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

65 lines
1.7 KiB
C

// RUN: %clang_cc1 -fsyntax-only -Wused-but-marked-unused -Wunused-function -Wunneeded-internal-declaration -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-infinite-recursion %s
void foo(void) {}
static void f2(void) {}
static void f1(void) {f2();} // expected-warning{{unused}}
static int f0(void) { return 17; } // expected-warning{{not needed and will not be emitted}}
int x = sizeof(f0());
static void f3(void);
extern void f3(void) { } // expected-warning{{unused}}
inline static void f4(void);
void f4(void) { } // expected-warning{{unused}}
static void __attribute__((used)) f5(void) {}
static void f6(void);
static void __attribute__((used)) f6(void);
static void f6(void) {};
static void f7(void);
void f8(void(*a0)(void));
void f9(void) { f8(f7); }
static void f7(void) {}
__attribute__((unused)) static void bar(void);
void bar(void) { }
__attribute__((constructor)) static void bar2(void);
void bar2(void) { }
__attribute__((destructor)) static void bar3(void);
void bar3(void) { }
static void f10(void); // expected-warning{{unused}}
static void f10(void);
static void f11(void);
static void f11(void) { } // expected-warning{{unused}}
static void f12(void) { } // expected-warning{{unused}}
static void f12(void);
// PR7923
static void unused(void) { unused(); } // expected-warning{{not needed and will not be emitted}}
static void cleanupMalloc(char * const * const allocation) { }
void f13(void) {
char * const __attribute__((cleanup(cleanupMalloc))) a = 0;
(void)a;
}
extern void a(void) __attribute__((unused));
extern void b(void) __attribute__((unused));
void b(void)
{
}
void a(void)
{
b();
}