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

54 lines
2.2 KiB
C

// Parse diagnostic arguments in the driver
// Exactly which arguments are warned about and which aren't differ based
// on what target is selected. -stdlib= and -fuse-ld= emit diagnostics when
// compiling C code, for e.g. *-linux-gnu. Linker inputs, like -lfoo, emit
// diagnostics when only compiling for all targets.
// This is normally a non-fatal warning:
// RUN: %clang --target=x86_64-apple-darwin11 \
// RUN: -fsyntax-only -lfoo %s 2>&1 | FileCheck %s
// Either with a specific -Werror=unused.. or a blanket -Werror, this
// causes the command to fail.
// RUN: not %clang --target=x86_64-apple-darwin11 \
// RUN: -fsyntax-only -lfoo \
// RUN: -Werror=unused-command-line-argument %s 2>&1 | FileCheck %s
// RUN: not %clang --target=x86_64-apple-darwin11 \
// RUN: -fsyntax-only -lfoo -Werror %s 2>&1 | FileCheck %s
// With a specific -Wno-..., no diagnostic should be printed.
// RUN: %clang --target=x86_64-apple-darwin11 \
// RUN: -fsyntax-only -lfoo -Werror \
// RUN: -Wno-unused-command-line-argument %s 2>&1 | count 0
// With -Qunused-arguments, no diagnostic should be printed.
// RUN: %clang --target=x86_64-apple-darwin11 \
// RUN: -fsyntax-only -lfoo -Werror \
// RUN: -Qunused-arguments %s 2>&1 | count 0
// With the argument enclosed in --{start,end}-no-unused-arguments,
// there's no diagnostic.
// RUN: %clang --target=x86_64-apple-darwin11 -fsyntax-only \
// RUN: --start-no-unused-arguments -lfoo --end-no-unused-arguments \
// RUN: -Werror %s 2>&1 | count 0
// With --{start,end}-no-unused-argument around a different argument, it
// still warns about the unused argument.
// RUN: not %clang --target=x86_64-apple-darwin11 \
// RUN: --start-no-unused-arguments -fsyntax-only --end-no-unused-arguments \
// RUN: -lfoo -Werror %s 2>&1 | FileCheck %s
// Test clang-cl warning about unused linker options.
// RUN: not %clang_cl -fsyntax-only /WX \
// RUN: -LD -- %s 2>&1 | FileCheck %s --check-prefix=CL-WARNING
// Test clang-cl ignoring the warning with --start-no-unused-arguments.
// RUN: %clang_cl -fsyntax-only /WX \
// RUN: --start-no-unused-arguments /LD --end-no-unused-arguments -- %s 2>&1 | count 0
// CHECK: -lfoo: 'linker' input unused
// CL-WARNING: argument unused during compilation: '-LD'