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

37 lines
1.5 KiB
C

// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value
// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only %s -Wabsolute-value -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
int abs(int);
// Wrong signature
int fabsf(int);
// expected-warning@-1{{incompatible redeclaration of library function 'fabsf'}}
// expected-note@-2{{'fabsf' is a builtin with type 'float (float)'}}
void test_int(int i, unsigned u, long long ll, float f, double d) {
(void)abs(i);
// Remove abs call
(void)abs(u);
// expected-warning@-1{{taking the absolute value of unsigned type 'unsigned int' has no effect}}
// expected-note@-2{{remove the call to 'abs' since unsigned values cannot be negative}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
int llabs;
(void)llabs;
// Conflict in names, no notes
(void)abs(ll);
// expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
// Conflict in names, no notes
(void)abs(f);
// expected-warning@-1{{using integer absolute value function 'abs' when argument is of floating point type}}
// Suggest header.
(void)abs(d);
// expected-warning@-1{{using integer absolute value function 'abs' when argument is of floating point type}}
// expected-note@-2{{use function 'fabs' instead}}
// expected-note@-3{{include the header <math.h> or explicitly provide a declaration for 'fabs'}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:12}:"fabs"
}