Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGen/arm-cmse-call.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

78 lines
2.1 KiB
C

// RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -O1 -emit-llvm %s -o - 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK
// RUN: %clang_cc1 -triple thumbebv8m.base-none-eabi -mcmse -O1 -emit-llvm %s -o - 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK
typedef void fn_t(void);
fn_t s;
fn_t *p0 __attribute__((cmse_nonsecure_call));
typedef fn_t *pfn_t __attribute__((cmse_nonsecure_call));
pfn_t p1;
pfn_t a0[4];
extern pfn_t a1[];
typedef void (*pfn1_t)(int) __attribute__((cmse_nonsecure_call));
pfn1_t p2;
typedef fn_t *apfn_t[4] __attribute__((cmse_nonsecure_call));
apfn_t a2;
typedef pfn_t apfn1_t[4] __attribute__((cmse_nonsecure_call));
apfn1_t a3;
typedef void (*apfn2_t[4])(void) __attribute__((cmse_nonsecure_call));
apfn2_t a4;
void (*b[4])(int) __attribute__((cmse_nonsecure_call));
void f(int i) {
s();
// CHECK: call void @s() #[[#A1:]]
p0();
// CHECK: %[[#P0:]] = load {{.*}} @p0
// CHECK: call void %[[#P0]]() #[[#A2:]]
p1();
// CHECK: %[[#P1:]] = load {{.*}} @p1
// CHECK: call void %[[#P1]]() #[[#A2]]
p2(i);
// CHECK: %[[#P2:]] = load {{.*}} @p2
// CHECK: call void %[[#P2]](i32 noundef %i) #[[#A2]]
a0[i]();
// CHECK: %[[EP0:.*]] = getelementptr {{.*}} @a0
// CHECK: %[[#E0:]] = load {{.*}} %[[EP0]]
// CHECK: call void %[[#E0]]() #[[#A2]]
a1[i]();
// CHECK: %[[EP1:.*]] = getelementptr {{.*}} @a1
// CHECK: %[[#E1:]] = load {{.*}} %[[EP1]]
// CHECK: call void %[[#E1]]() #[[#A2]]
a2[i]();
// CHECK: %[[EP2:.*]] = getelementptr {{.*}} @a2
// CHECK: %[[#E2:]] = load {{.*}} %[[EP2]]
// CHECK: call void %[[#E2]]() #[[#A2]]
a3[i]();
// CHECK: %[[EP3:.*]] = getelementptr {{.*}} @a3
// CHECK: %[[#E3:]] = load {{.*}} %[[EP3]]
// CHECK: call void %[[#E3]]() #[[#A2]]
a4[i]();
// CHECK: %[[EP4:.*]] = getelementptr {{.*}} @a4
// CHECK: %[[#E4:]] = load {{.*}} %[[EP4]]
// CHECK: call void %[[#E4]]() #[[#A2]]
b[i](i);
// CHECK: %[[EP5:.*]] = getelementptr {{.*}} @b
// CHECK: %[[#E5:]] = load {{.*}} %[[EP5]]
// CHECK: call void %[[#E5]](i32 noundef %i) #[[#A2]]
}
// CHECK: attributes #[[#A1]] = { nounwind }
// CHECK: attributes #[[#A2]] = { nounwind "cmse_nonsecure_call"