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).
84 lines
2.3 KiB
C++
84 lines
2.3 KiB
C++
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=unreachable | FileCheck %s
|
|
|
|
void abort() __attribute__((noreturn));
|
|
|
|
// CHECK-LABEL: define{{.*}} void @_Z14calls_noreturnv()
|
|
void calls_noreturn() {
|
|
// Check absence (ptr) of call site attributes (including noreturn)
|
|
// CHECK: call void @_Z5abortv(){{[^#]*}}
|
|
abort();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
struct A {
|
|
// CHECK: declare void @_Z5abortv() [[EXTERN_FN_ATTR:#[0-9]+]]
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A5call1Ev
|
|
void call1() {
|
|
// CHECK: call void @_ZN1A16does_not_return2Ev({{.*}}){{[^#]*}}
|
|
does_not_return2();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
// Test static members. Checks are below after `struct A` scope ends.
|
|
static void does_not_return1() __attribute__((noreturn)) {
|
|
abort();
|
|
}
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A5call2Ev
|
|
void call2() {
|
|
// CHECK: call void @_ZN1A16does_not_return1Ev(){{[^#]*}}
|
|
does_not_return1();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
// Test calls through pointers to non-static member functions.
|
|
typedef void (A::*MemFn)() __attribute__((noreturn));
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A5call3Ev
|
|
void call3() {
|
|
MemFn MF = &A::does_not_return2;
|
|
// CHECK: call void %{{[0-9]+\(.*}}){{[^#]*}}
|
|
(this->*MF)();
|
|
|
|
// CHECK: __ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
|
|
// Test regular members.
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A16does_not_return2Ev({{.*}})
|
|
// CHECK-SAME: [[USER_FN_ATTR:#[0-9]+]]
|
|
void does_not_return2() __attribute__((noreturn)) {
|
|
// CHECK: call void @_Z5abortv(){{[^#]*}}
|
|
abort();
|
|
|
|
// CHECK: call void @__ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
|
|
// CHECK: call void @__ubsan_handle_builtin_unreachable
|
|
// CHECK: unreachable
|
|
}
|
|
};
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1A16does_not_return1Ev()
|
|
// CHECK-SAME: [[USER_FN_ATTR]]
|
|
// CHECK: call void @_Z5abortv(){{[^#]*}}
|
|
|
|
void force_irgen() {
|
|
A a;
|
|
a.call1();
|
|
a.call2();
|
|
a.call3();
|
|
}
|
|
|
|
// `noreturn` should be removed from functions and call sites
|
|
// CHECK-LABEL: attributes
|
|
// CHECK-NOT: [[USER_FN_ATTR]] = { {{.*noreturn.*}} }
|
|
// CHECK-NOT: [[EXTERN_FN_ATTR]] = { {{.*noreturn.*}} }
|