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).
126 lines
4.0 KiB
C
126 lines
4.0 KiB
C
// RUN: %clang_cc1 -emit-llvm -Wno-strict-prototypes -Wno-incompatible-function-pointer-types -fcf-protection=branch -triple i386-linux-gnu %s -o - | FileCheck %s
|
|
|
|
// CHECK: @t5 = weak{{.*}} global i32 2
|
|
int t5 __attribute__((weak)) = 2;
|
|
|
|
// CHECK: @t13 ={{.*}} global %struct.s0 zeroinitializer, section "SECT"
|
|
struct s0 { int x; };
|
|
struct s0 t13 __attribute__((section("SECT"))) = { 0 };
|
|
|
|
// CHECK: @t14.x = internal global i32 0, section "SECT"
|
|
void t14(void) {
|
|
static int x __attribute__((section("SECT"))) = 0;
|
|
}
|
|
|
|
// CHECK: @t18 ={{.*}} global i32 1, align 4
|
|
extern int t18 __attribute__((weak_import));
|
|
int t18 = 1;
|
|
|
|
// CHECK: @t16 = extern_weak global i32
|
|
extern int t16 __attribute__((weak_import));
|
|
|
|
// CHECK: @t6 = protected global i32 0
|
|
int t6 __attribute__((visibility("protected")));
|
|
|
|
// CHECK: @t12 ={{.*}} global i32 0, section "SECT"
|
|
int t12 __attribute__((section("SECT")));
|
|
|
|
// CHECK: @t9 = weak{{.*}} alias void (...), ptr @__t8
|
|
void __t8() {}
|
|
void t9() __attribute__((weak, alias("__t8")));
|
|
|
|
// CHECK: declare extern_weak i32 @t15()
|
|
int __attribute__((weak_import)) t15(void);
|
|
int t17(void) {
|
|
return t15() + t16;
|
|
}
|
|
|
|
// CHECK: define{{.*}} void @t1() [[NR:#[0-9]+]] {
|
|
void t1(void) __attribute__((noreturn));
|
|
void t1(void) { while (1) {} }
|
|
|
|
// CHECK: define{{.*}} void @t2() [[NUW:#[0-9]+]] {
|
|
void t2(void) __attribute__((nothrow));
|
|
void t2(void) {}
|
|
|
|
// CHECK: define weak{{.*}} void @t3() [[NUW]] {
|
|
void t3(void) __attribute__((weak));
|
|
void t3(void) {}
|
|
|
|
// CHECK: define hidden void @t4() [[NUW]] {
|
|
void t4(void) __attribute__((visibility("hidden")));
|
|
void t4(void) {}
|
|
|
|
// CHECK: define{{.*}} void @t7() [[NR]] {
|
|
void t7(void) __attribute__((noreturn, nothrow));
|
|
void t7(void) { while (1) {} }
|
|
|
|
// CHECK: define{{.*}} void @t72() [[COLDDEF:#[0-9]+]] {
|
|
void t71(void) __attribute__((cold));
|
|
void t72(void) __attribute__((cold));
|
|
void t72(void) { t71(); }
|
|
// CHECK: call void @t71() [[COLDSITE:#[0-9]+]]
|
|
// CHECK: declare void @t71() [[COLDDECL:#[0-9]+]]
|
|
|
|
// CHECK: define{{.*}} void @t82() [[HOTDEF:#[0-9]+]] {
|
|
void t81(void) __attribute__((hot));
|
|
void t82(void) __attribute__((hot));
|
|
void t82(void) { t81(); }
|
|
// CHECK: call void @t81() [[HOTSITE:#[0-9]+]]
|
|
// CHECK: declare void @t81() [[HOTDECL:#[0-9]+]]
|
|
|
|
// CHECK: define{{.*}} void @t10() [[NUW]] section "xSECT" {
|
|
void t10(void) __attribute__((section("xSECT")));
|
|
void t10(void) {}
|
|
// CHECK: define{{.*}} void @t11() [[NUW]] section "xSECT" {
|
|
void __attribute__((section("xSECT"))) t11(void) {}
|
|
|
|
// CHECK: define{{.*}} i32 @t19() [[NUW]] {
|
|
extern int t19(void) __attribute__((weak_import));
|
|
int t19(void) {
|
|
return 10;
|
|
}
|
|
|
|
// CHECK:define{{.*}} void @t20() [[NUW]] {
|
|
// CHECK: call void @abort()
|
|
// CHECK-NEXT: unreachable
|
|
void t20(void) {
|
|
__builtin_abort();
|
|
}
|
|
|
|
void (__attribute__((fastcall)) *fptr)(int);
|
|
void t21(void) {
|
|
fptr(10);
|
|
}
|
|
// CHECK: [[FPTRVAR:%[a-z0-9]+]] = load ptr, ptr @fptr
|
|
// CHECK-NEXT: call x86_fastcallcc void [[FPTRVAR]](i32 inreg noundef 10)
|
|
|
|
|
|
// PR9356: We might want to err on this, but for now at least make sure we
|
|
// use the section in the definition.
|
|
void __attribute__((section(".foo"))) t22(void);
|
|
void __attribute__((section(".bar"))) t22(void) {}
|
|
|
|
// CHECK: define{{.*}} void @t22() [[NUW]] section ".bar"
|
|
|
|
// CHECK: define{{.*}} void @t23() [[NOCF_CHECK_FUNC:#[0-9]+]]
|
|
void __attribute__((nocf_check)) t23(void) {}
|
|
|
|
// CHECK: call void %{{[a-z0-9]+}}() [[NOCF_CHECK_CALL:#[0-9]+]]
|
|
typedef void (*f_t)(void);
|
|
void t24(f_t f1) {
|
|
__attribute__((nocf_check)) f_t p = f1;
|
|
(*p)();
|
|
}
|
|
|
|
// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
|
|
// CHECK: attributes [[NR]] = { noinline noreturn nounwind{{.*}} }
|
|
// CHECK: attributes [[COLDDEF]] = { cold {{.*}}}
|
|
// CHECK: attributes [[COLDDECL]] = { cold {{.*}}}
|
|
// CHECK: attributes [[HOTDEF]] = { hot {{.*}}}
|
|
// CHECK: attributes [[HOTDECL]] = { hot {{.*}}}
|
|
// CHECK: attributes [[NOCF_CHECK_FUNC]] = { nocf_check {{.*}}}
|
|
// CHECK: attributes [[COLDSITE]] = { cold {{.*}}}
|
|
// CHECK: attributes [[HOTSITE]] = { hot {{.*}}}
|
|
// CHECK: attributes [[NOCF_CHECK_CALL]] = { nocf_check }
|