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).
49 lines
1.7 KiB
C
49 lines
1.7 KiB
C
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s
|
|
|
|
// C guarantees that brace-init with fewer initializers than members in the
|
|
// aggregate will initialize the rest of the aggregate as-if it were static
|
|
// initialization. In turn static initialization guarantees that padding is
|
|
// initialized to zero bits.
|
|
|
|
// CHECK: @__const.partial_init.s = private unnamed_addr constant { i8, [7 x i8], i64 } { i8 42, [7 x i8] zeroinitializer, i64 0 }, align 8
|
|
|
|
// Technically, we could initialize this padding to non-zero because all of the
|
|
// struct's members have initializers.
|
|
|
|
// CHECK: @__const.init_all.s = private unnamed_addr constant { i8, [7 x i8], i64 } { i8 42, [7 x i8] zeroinitializer, i64 -2401053089374216531 }, align 8
|
|
|
|
struct S {
|
|
char c;
|
|
long long l;
|
|
};
|
|
|
|
void use(struct S*);
|
|
|
|
// CHECK-LABEL: @empty_braces(
|
|
// CHECK: %s = alloca
|
|
// CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align 8 %s, i8 0,
|
|
// CHECK-NEXT: call void @use(ptr noundef %s)
|
|
void empty_braces(void) {
|
|
struct S s = {};
|
|
return use(&s);
|
|
}
|
|
|
|
// CHECK-LABEL: @partial_init(
|
|
// CHECK: %s = alloca
|
|
// CHECK-NEXT: call void @llvm.memcpy{{.*}}(ptr align 8 %s, {{.*}}@__const.partial_init.s
|
|
// CHECK-NEXT: call void @use(ptr noundef %s)
|
|
void partial_init(void) {
|
|
struct S s = { .c = 42 };
|
|
return use(&s);
|
|
}
|
|
|
|
// CHECK-LABEL: @init_all(
|
|
// CHECK: %s = alloca
|
|
// CHECK-NEXT: call void @llvm.memcpy{{.*}}(ptr align 8 %s, {{.*}}@__const.init_all.s
|
|
// CHECK-NEXT: call void @use(ptr noundef %s)
|
|
void init_all(void) {
|
|
struct S s = { .c = 42, .l = 0xdeadbeefc0fedead };
|
|
return use(&s);
|
|
}
|