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).
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false -triple x86_64-pc-linux-gnu %s
|
|
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false -triple i386-pc-linux-gnu %s
|
|
|
|
int clang_analyzer_eval(int);
|
|
|
|
typedef struct {
|
|
int a : 1;
|
|
int b[2];
|
|
} BITFIELD_CAST;
|
|
|
|
void array_struct_bitfield_1() {
|
|
BITFIELD_CAST ff = {0};
|
|
BITFIELD_CAST *pff = &ff;
|
|
clang_analyzer_eval(*((int *)pff + 1) == 0); // expected-warning{{TRUE}}
|
|
ff.b[0] = 3;
|
|
clang_analyzer_eval(*((int *)pff + 1) == 3); // expected-warning{{TRUE}}
|
|
}
|
|
|
|
int array_struct_bitfield_2() {
|
|
BITFIELD_CAST ff = {0};
|
|
BITFIELD_CAST *pff = &ff;
|
|
int a = *((int *)pff + 2); // expected-warning{{Assigned value is uninitialized [core.uninitialized.Assign]}}
|
|
return a;
|
|
}
|
|
|
|
typedef struct {
|
|
unsigned int a : 1;
|
|
unsigned int x : 31;
|
|
unsigned int c : 1;
|
|
int b[2];
|
|
} mystruct;
|
|
|
|
void array_struct_bitfield_3() {
|
|
mystruct ff;
|
|
mystruct *pff = &ff;
|
|
ff.b[0] = 3;
|
|
clang_analyzer_eval(*((int *)pff + 2) == 3); // expected-warning{{TRUE}}
|
|
}
|