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

60 lines
1.6 KiB
C

// RUN: %clang_cc1 -x c %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -x c %s -triple x86_64-linux-gnu -emit-llvm -fno-builtin -o - | FileCheck %s
// RUN: %clang_cc1 -x c++ %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s
#ifdef __cplusplus
extern "C" {
#endif
struct __jmp_buf_tag { int n; };
struct __ucontext_t_tag { int n; };
int setjmp(struct __jmp_buf_tag*);
int sigsetjmp(struct __jmp_buf_tag*, int);
int _setjmp(struct __jmp_buf_tag*);
int __sigsetjmp(struct __jmp_buf_tag*, int);
int _setjmpex(struct __jmp_buf_tag* env);
int getcontext(struct __ucontext_t_tag*);
typedef struct __jmp_buf_tag jmp_buf[1];
typedef struct __jmp_buf_tag sigjmp_buf[1];
typedef struct __ucontext_t_tag ucontext_t[1];
#ifdef __cplusplus
}
#endif
void f(void) {
jmp_buf jb;
ucontext_t ut;
// CHECK: call {{.*}}@setjmp(
setjmp(jb);
// CHECK: call {{.*}}@sigsetjmp(
sigsetjmp(jb, 0);
// CHECK: call {{.*}}@_setjmp(
_setjmp(jb);
// CHECK: call {{.*}}@__sigsetjmp(
__sigsetjmp(jb, 0);
// CHECK: call {{.*}}@_setjmpex(
_setjmpex(jb);
// CHECK: call {{.*}}@getcontext(
getcontext(ut);
}
// CHECK: ; Function Attrs: returns_twice
// CHECK-NEXT: declare {{.*}} @setjmp(
// CHECK: ; Function Attrs: returns_twice
// CHECK-NEXT: declare {{.*}} @sigsetjmp(
// CHECK: ; Function Attrs: returns_twice
// CHECK-NEXT: declare {{.*}} @_setjmp(
// CHECK: ; Function Attrs: returns_twice
// CHECK-NEXT: declare {{.*}} @__sigsetjmp(
// CHECK: ; Function Attrs: returns_twice
// CHECK-NEXT: declare {{.*}} @_setjmpex(
// CHECK: ; Function Attrs: returns_twice
// CHECK-NEXT: declare {{.*}} @getcontext(