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).
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
|
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s -fexperimental-new-constant-interpreter | FileCheck %s
|
|
|
|
// Don't crash if the argument to __builtin_constant_p isn't scalar.
|
|
template <typename T>
|
|
constexpr bool is_constant(const T v) {
|
|
return __builtin_constant_p(v);
|
|
}
|
|
|
|
template <typename T>
|
|
class numeric {
|
|
public:
|
|
using type = T;
|
|
|
|
template <typename S>
|
|
constexpr numeric(S value)
|
|
: value_(static_cast<T>(value)) {}
|
|
|
|
private:
|
|
const T value_;
|
|
};
|
|
|
|
bool bcp() {
|
|
return is_constant(numeric<int>(1));
|
|
}
|
|
|
|
// PR45535
|
|
struct with_dtor {
|
|
~with_dtor();
|
|
};
|
|
// CHECK: define {{.*}}bcp_stmt_expr_1
|
|
bool bcp_stmt_expr_1() {
|
|
// CHECK-NOT: call {{.*}}with_dtorD
|
|
return __builtin_constant_p(({with_dtor wd; 123;}));
|
|
}
|
|
|
|
int do_not_call();
|
|
// CHECK: define {{.*}}bcp_stmt_expr_2
|
|
bool bcp_stmt_expr_2(int n) {
|
|
// CHECK-NOT: call {{.*}}do_not_call
|
|
return __builtin_constant_p(({
|
|
// This has a side-effect due to the VLA bound, so CodeGen should fold it
|
|
// to false.
|
|
typedef int arr[do_not_call()];
|
|
n;
|
|
}));
|
|
// CHECK-NOT: }
|
|
// CHECK: ret i1 false
|
|
}
|