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

52 lines
2.4 KiB
C++

// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
/// Prevent use of all builtins.
void valid_attribute_all_1() __attribute__((no_builtin)) {}
void valid_attribute_all_2() __attribute__((no_builtin())) {}
/// Prevent use of specific builtins.
void valid_attribute_function() __attribute__((no_builtin("memcpy"))) {}
void valid_attribute_functions() __attribute__((no_builtin("memcpy"))) __attribute__((no_builtin("memcmp"))) {}
/// Many times the same builtin is fine.
void many_attribute_function_1() __attribute__((no_builtin)) __attribute__((no_builtin)) {}
void many_attribute_function_2() __attribute__((no_builtin("memcpy"))) __attribute__((no_builtin("memcpy"))) {}
void many_attribute_function_3() __attribute__((no_builtin("memcpy", "memcpy"))) {}
void many_attribute_function_4() __attribute__((no_builtin("memcpy", "memcpy"))) __attribute__((no_builtin("memcpy"))) {}
/// Invalid builtin name.
void invalid_builtin() __attribute__((no_builtin("not_a_builtin"))) {}
// expected-warning@-1 {{'not_a_builtin' is not a valid builtin name for 'no_builtin'}}
/// Can't use bare no_builtin with a named one.
void wildcard_and_functionname() __attribute__((no_builtin)) __attribute__((no_builtin("memcpy"))) {}
// expected-error@-1 {{empty 'no_builtin' cannot be composed with named ones}}
/// Can't attach attribute to a variable.
int __attribute__((no_builtin)) variable;
// expected-warning@-1 {{'no_builtin' attribute only applies to functions}}
/// Can't attach attribute to a declaration.
void nobuiltin_on_declaration() __attribute__((no_builtin));
// expected-error@-1 {{no_builtin attribute is permitted on definitions only}}
struct S {
/// Can't attach attribute to a defaulted function,
S()
__attribute__((no_builtin)) = default;
// expected-error@-1 {{no_builtin attribute has no effect on defaulted or deleted functions}}
/// Can't attach attribute to a deleted function,
S(const S &)
__attribute__((no_builtin)) = delete;
// expected-error@-1 {{no_builtin attribute has no effect on defaulted or deleted functions}}
void whatever() __attribute__((no_builtin("memcpy")));
// expected-error@-1 {{no_builtin attribute is permitted on definitions only}}
};
/// Can't attach attribute to an aliased function.
void alised_function() {}
void aliasing_function() __attribute__((no_builtin)) __attribute__((alias("alised_function")));
// expected-error@-1 {{no_builtin attribute is permitted on definitions only}}