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).
98 lines
2.8 KiB
C++
98 lines
2.8 KiB
C++
// RUN: %clang_cc1 -fexperimental-strict-floating-point \
|
|
// RUN: -triple x86_64-linux-gnu -emit-llvm -o - -verify %s
|
|
//
|
|
// RUN: %clang_cc1 -fexperimental-strict-floating-point \
|
|
// RUN: -triple x86_64-linux-gnu -emit-llvm -o - -verify %s \
|
|
// RUN: -ffp-eval-method=source
|
|
//
|
|
// RUN: %clang_cc1 -fexperimental-strict-floating-point \
|
|
// RUN: -triple x86_64-linux-gnu -emit-llvm -o - -verify %s \
|
|
// RUN: -ffp-eval-method=double
|
|
|
|
extern "C" int printf(const char *, ...);
|
|
|
|
void foo1() {
|
|
printf("FP: %d\n", __FLT_EVAL_METHOD__);
|
|
}
|
|
|
|
void apply_pragma() {
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
printf("FP: %d\n", __FLT_EVAL_METHOD__);
|
|
}
|
|
|
|
int foo2() {
|
|
apply_pragma();
|
|
return 0;
|
|
}
|
|
|
|
void apply_pragma_with_wrong_value() {
|
|
// expected-error@+1{{unexpected argument 'value' to '#pragma clang fp eval_method'; expected 'source', 'double' or 'extended'}}
|
|
#pragma clang fp eval_method(value)
|
|
}
|
|
|
|
int foo3() {
|
|
apply_pragma_with_wrong_value();
|
|
return 0;
|
|
}
|
|
|
|
void foo() {
|
|
auto a = __FLT_EVAL_METHOD__;
|
|
{
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
auto b = __FLT_EVAL_METHOD__;
|
|
}
|
|
auto c = __FLT_EVAL_METHOD__;
|
|
}
|
|
|
|
void func() {
|
|
{
|
|
{
|
|
#pragma clang fp eval_method(source)
|
|
}
|
|
int i = __FLT_EVAL_METHOD__; // ok, not in a scope changed by the pragma
|
|
}
|
|
{
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(source)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
int i = __FLT_EVAL_METHOD__;
|
|
}
|
|
}
|
|
|
|
float G;
|
|
|
|
int f(float x, float y, float z) {
|
|
G = x * y + z;
|
|
return __FLT_EVAL_METHOD__;
|
|
}
|
|
|
|
int foo(int flag, float x, float y, float z) {
|
|
if (flag) {
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
G = x + y + z;
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
return __FLT_EVAL_METHOD__;
|
|
} else {
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(extended)
|
|
G = x + y + z;
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
return __FLT_EVAL_METHOD__;
|
|
}
|
|
}
|
|
|
|
#if __FLT_EVAL_METHOD__ == 1
|
|
#endif
|
|
#pragma clang fp eval_method(source)
|
|
|
|
// expected-note@+1{{#pragma entered here}}
|
|
#pragma clang fp eval_method(double)
|
|
// expected-error@+1{{'__FLT_EVAL_METHOD__' cannot be expanded inside a scope containing '#pragma clang fp eval_method'}}
|
|
#if __FLT_EVAL_METHOD__ == 1
|
|
#endif
|