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).
59 lines
1.9 KiB
C++
59 lines
1.9 KiB
C++
// REQUIRES: x86-registered-target
|
|
// RUN: %clang_cc1 -triple x86_64 %s -S -o /dev/null -Werror -verify
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
|
|
|
|
struct string_view {
|
|
int S;
|
|
const char* D;
|
|
constexpr string_view() : S(0), D(0){}
|
|
constexpr string_view(const char* Str) : S(__builtin_strlen(Str)), D(Str) {}
|
|
constexpr string_view(int Size, const char* Str) : S(Size), D(Str) {}
|
|
constexpr int size() const {
|
|
return S;
|
|
}
|
|
constexpr const char* data() const {
|
|
return D;
|
|
}
|
|
};
|
|
|
|
namespace GH143242 {
|
|
constexpr string_view code2 = R"(nop; nop; nop; nop)";
|
|
asm((code2));
|
|
// CHECK: module asm "nop; nop; nop; nop"
|
|
}
|
|
|
|
int func() {return 0;};
|
|
|
|
void f() {
|
|
|
|
asm((string_view("")) ::(string_view("r"))(func()));
|
|
// CHECK: %[[CALL:.*]] = call noundef i32 @_Z4funcv
|
|
// CHECK: call void asm sideeffect "", "r,~{dirflag},~{fpsr},~{flags}"
|
|
asm("" :::(string_view("memory")));
|
|
// CHECK: call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"
|
|
}
|
|
|
|
void foo(unsigned long long addr, unsigned long long a0) {
|
|
register unsigned long long result asm("rax");
|
|
register unsigned long long b0 asm("rdi");
|
|
|
|
b0 = a0;
|
|
|
|
asm((string_view("call *%1")) : (string_view("=r")) (result)
|
|
: (string_view("r"))(addr), (string_view("r")) (b0) : (string_view("memory")));
|
|
|
|
// CHECK:{{.*}} call i64 asm "call *$1", "={rax},r,{rdi},~{memory},~{dirflag},~{fpsr},~{flags}"
|
|
}
|
|
|
|
|
|
void test_srcloc() {
|
|
asm((string_view( // expected-error {{invalid instruction mnemonic 'nonsense'}} \
|
|
// expected-error {{invalid instruction mnemonic 'foobar'}} \
|
|
// expected-note@1 {{instantiated into assembly here}} \
|
|
// expected-note@2 {{instantiated into assembly here}}
|
|
R"o(nonsense
|
|
foobar)o")
|
|
|
|
) ::(string_view("r"))(func()));
|
|
}
|