Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGen/ms-volatile.c
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
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).
2026-08-01 05:13:02 +03:00

88 lines
2.6 KiB
C

// RUN: %clang_cc1 -triple i386-pc-win32 -fms-extensions -emit-llvm -fms-volatile -o - < %s | FileCheck %s
struct foo {
volatile int x;
};
struct bar {
int x;
};
typedef _Complex float __declspec(align(8)) baz;
#pragma pack(push)
#pragma pack(1)
struct qux {
volatile int f;
};
#pragma pack(pop)
void test1(struct foo *p, struct foo *q) {
*p = *q;
// CHECK-LABEL: @test1
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
void test2(volatile int *p, volatile int *q) {
*p = *q;
// CHECK-LABEL: @test2
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
void test3(struct foo *p, struct foo *q) {
p->x = q->x;
// CHECK-LABEL: @test3
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
void test4(volatile struct foo *p, volatile struct foo *q) {
p->x = q->x;
// CHECK-LABEL: @test4
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
void test5(volatile struct foo *p, volatile struct foo *q) {
*p = *q;
// CHECK-LABEL: @test5
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
void test6(struct bar *p, struct bar *q) {
*p = *q;
// CHECK-LABEL: @test6
// CHECK-NOT: load atomic volatile {{.*}}
// CHECK-NOT: store atomic volatile {{.*}}, {{.*}}
}
void test7(volatile struct bar *p, volatile struct bar *q) {
*p = *q;
// CHECK-LABEL: @test7
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
void test8(volatile double *p, volatile double *q) {
*p = *q;
// CHECK-LABEL: @test8
// CHECK: load volatile {{.*}}, align 8
// CHECK: store volatile {{.*}}, {{.*}}, align 8
}
void test9(volatile baz *p, baz *q) {
*p = *q;
// CHECK-LABEL: @test9
// CHECK: store volatile {{.*}}, {{.*}}, align 8
// CHECK: store volatile {{.*}}, {{.*}}, align 4
}
void test10(volatile long long *p, volatile long long *q) {
*p = *q;
// CHECK-LABEL: @test10
// CHECK: load volatile {{.*}}, align 8
// CHECK: store volatile {{.*}}, {{.*}}, align 8
}
void test11(volatile float *p, volatile float *q) {
*p = *q;
// CHECK-LABEL: @test11
// CHECK: load atomic volatile {{.*}} acquire, align 4
// CHECK: store atomic volatile {{.*}}, {{.*}} release, align 4
}
int test12(struct qux *p) {
return p->f;
// CHECK-LABEL: @test12
// CHECK: load volatile {{.*}}, align 1
}