cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
69 lines
2.1 KiB
C
69 lines
2.1 KiB
C
// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm < %s | FileCheck %s
|
|
|
|
_Static_assert(sizeof(void *) == 8, "sizeof(void *) has unexpected value. Expected 8.");
|
|
|
|
int foo(void) {
|
|
// CHECK: define dso_local i32 @foo
|
|
// CHECK: %a = alloca ptr addrspace(270), align 4
|
|
// CHECK: ret i32 4
|
|
int (*__ptr32 a)(int);
|
|
return sizeof(a);
|
|
}
|
|
|
|
int bar(void) {
|
|
// CHECK: define dso_local i32 @bar
|
|
// CHECK: %p = alloca ptr addrspace(270), align 4
|
|
// CHECK: ret i32 4
|
|
int *__ptr32 p;
|
|
return sizeof(p);
|
|
}
|
|
|
|
|
|
int baz(void) {
|
|
// CHECK: define dso_local i32 @baz
|
|
// CHECK: %p = alloca ptr addrspace(270), align 4
|
|
// CHECK: ret i32 4
|
|
typedef int *__ptr32 IP32_PTR;
|
|
|
|
IP32_PTR p;
|
|
return sizeof(p);
|
|
}
|
|
|
|
int fugu(void) {
|
|
// CHECK: define dso_local i32 @fugu
|
|
// CHECK: %p = alloca ptr addrspace(270), align 4
|
|
// CHECK: ret i32 4
|
|
typedef int *int_star;
|
|
|
|
int_star __ptr32 p;
|
|
return sizeof(p);
|
|
}
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
|
size_t strlen(const char *);
|
|
|
|
size_t test_calling_strlen_with_32_bit_pointer ( char *__ptr32 s ) {
|
|
// CHECK-LABEL: define dso_local i64 @test_calling_strlen_with_32_bit_pointer(ptr addrspace(270) noundef %s)
|
|
// CHECK-NEXT: entry:
|
|
// CHECK-NEXT: %s.addr = alloca ptr addrspace(270), align 4
|
|
// CHECK-NEXT: store ptr addrspace(270) %s, ptr %s.addr, align 4
|
|
// CHECK-NEXT: %0 = load ptr addrspace(270), ptr %s.addr, align 4
|
|
// CHECK-NEXT: %1 = addrspacecast ptr addrspace(270) %0 to ptr
|
|
// CHECK-NEXT: %call = call i64 @strlen(ptr noundef %1)
|
|
// CHECK-NEXT: ret i64 %call
|
|
return strlen ( s );
|
|
}
|
|
|
|
// CHECK-LABEL: declare dso_local i64 @strlen(ptr noundef)
|
|
|
|
size_t test_calling_strlen_with_64_bit_pointer ( char *s ) {
|
|
// CHECK-LABEL: define dso_local i64 @test_calling_strlen_with_64_bit_pointer(ptr noundef %s)
|
|
// CHECK-NEXT: entry:
|
|
// CHECK-NEXT: %s.addr = alloca ptr, align 8
|
|
// CHECK-NEXT: store ptr %s, ptr %s.addr, align 8
|
|
// CHECK-NEXT: %0 = load ptr, ptr %s.addr, align 8
|
|
// CHECK-NEXT: %call = call i64 @strlen(ptr noundef %0)
|
|
// CHECK-NEXT: ret i64 %call
|
|
return strlen ( s );
|
|
}
|