Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/Sema/pragma-ms-alloc-text.cpp
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
2.0 KiB
C++

// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
#pragma alloc_text() // expected-warning {{expected a string literal for the section name in '#pragma alloc_text'}}
#pragma alloc_text(a // expected-warning {{expected ',' in '#pragma alloc_text'}}
#pragma alloc_text(a, a // expected-warning {{missing ')' after '#pragma alloc_text'}}
#pragma alloc_text(a, a) // expected-error {{use of undeclared a}}
#pragma alloc_text(L"a", a) // expected-warning {{expected a string literal for the section name}}
void foo();
#pragma alloc_text(a, foo) // expected-error {{'#pragma alloc_text' is applicable only to functions with C linkage}}
extern "C" void foo1();
#pragma alloc_text(a, foo1) // no-warning
#pragma alloc_text(a, foo1) asdf // expected-warning {{extra tokens at end of '#pragma alloc_text'}}
#pragma alloc_text(a, foo1 // expected-warning {{missing ')' after '#pragma alloc_text'}}
namespace N {
#pragma alloc_text(b, foo1) // no-warning
}
extern "C" {
void foo2();
#pragma alloc_text(a, foo2) // no-warning
}
void foo3() {
#pragma alloc_text(a, foo1) // expected-error {{'#pragma alloc_text' can only appear at file scope}}
}
extern "C" void foo4();
#pragma alloc_text(c, foo4) // no-warning
void foo4() {}
void foo5(); // expected-note {{previous declaration is here}}
#pragma alloc_text(c, foo5) // expected-error {{'#pragma alloc_text' is applicable only to functions with C linkage}}
extern "C" void foo5() {} // expected-error {{declaration of 'foo5' has a different language linkage}}
extern "C" {
static void foo6();
#pragma alloc_text(c, foo6) // no-warning
void foo6() {}
}
extern "C" {
static void foo7();
}
static void foo7();
#pragma alloc_text(c, foo7) // no-warning
void foo7() {}
static void foo8();
extern "C" {
static void foo8();
}
#pragma alloc_text(c, foo8) // expected-error {{'#pragma alloc_text' is applicable only to functions with C linkage}}
void foo8() {}
enum foo9 { A, B, C };
#pragma alloc_text(c, foo9) // expected-error {{'#pragma alloc_text' is applicable only to functions}}