Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/Sema/implicit-int-conversion-on-int.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

59 lines
1.3 KiB
C

// RUN: %clang_cc1 %s -verify=expected -Wimplicit-int-conversion
// RUN: %clang_cc1 %s -verify=none -Wimplicit-int-conversion -Wno-implicit-int-conversion-on-negation
// none-no-diagnostics
char test_char(char x) {
return -x; // expected-warning {{implicit conversion loses integer precision: 'int' to 'char' on negation}}
}
unsigned char test_unsigned_char(unsigned char x) {
return -x; // expected-warning {{implicit conversion loses integer precision: 'int' to 'unsigned char' on negation}}
}
short test_short(short x) {
return -x; // expected-warning {{implicit conversion loses integer precision: 'int' to 'short' on negation}}
}
unsigned short test_unsigned_short(unsigned short x) {
return -x; // expected-warning {{implicit conversion loses integer precision: 'int' to 'unsigned short' on negation}}
}
// --- int-width and wider (should NOT warn) ---
int test_i(int x) {
return -x;
}
unsigned int test_ui(unsigned int x) {
return -x;
}
long test_l(long x) {
return -x;
}
unsigned long test_ul(unsigned long x) {
return -x;
}
long long test_ll(long long x) {
return -x;
}
unsigned long long test_ull(unsigned long long x) {
return -x;
}
unsigned _BitInt(16) test_unsigned_bit_int(unsigned _BitInt(16) x) {
return -x;
}
unsigned test_shift_minus(int i) {
return -(1 << i);
}
unsigned test_shift_not(int i) {
return ~(1 << i);
}