cb424d7448
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).
137 lines
5.4 KiB
C++
137 lines
5.4 KiB
C++
// RUN: rm -rf %t
|
|
// RUN: cd %S
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -v \
|
|
// RUN: -iquote Inputs/macro-ambiguity/a/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/a/system \
|
|
// RUN: -fno-implicit-modules \
|
|
// RUN: -fmodule-map-file-home-is-cwd \
|
|
// RUN: -emit-module -fmodule-name=a -o %t/a.pcm \
|
|
// RUN: Inputs/macro-ambiguity/module.modulemap
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -v \
|
|
// RUN: -iquote Inputs/macro-ambiguity/b/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/b/system \
|
|
// RUN: -fno-implicit-modules \
|
|
// RUN: -fmodule-map-file-home-is-cwd \
|
|
// RUN: -emit-module -fmodule-name=b -o %t/b.pcm \
|
|
// RUN: Inputs/macro-ambiguity/module.modulemap
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -v \
|
|
// RUN: -iquote Inputs/macro-ambiguity/c/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/c/system \
|
|
// RUN: -fno-implicit-modules \
|
|
// RUN: -fmodule-map-file-home-is-cwd \
|
|
// RUN: -emit-module -fmodule-name=c -o %t/c.pcm \
|
|
// RUN: Inputs/macro-ambiguity/module.modulemap
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -v \
|
|
// RUN: -iquote Inputs/macro-ambiguity/d/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/d/system \
|
|
// RUN: -fno-implicit-modules \
|
|
// RUN: -fmodule-map-file-home-is-cwd \
|
|
// RUN: -emit-module -fmodule-name=d -o %t/d.pcm \
|
|
// RUN: Inputs/macro-ambiguity/module.modulemap
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -v \
|
|
// RUN: -iquote Inputs/macro-ambiguity/a/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/a/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/b/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/b/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/c/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/c/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/d/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/d/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/e/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/e/system \
|
|
// RUN: -fno-implicit-modules \
|
|
// RUN: -fmodule-map-file-home-is-cwd \
|
|
// RUN: -fmodule-map-file=Inputs/macro-ambiguity/module.modulemap \
|
|
// RUN: -fmodule-file=%t/a.pcm \
|
|
// RUN: -fmodule-file=%t/b.pcm \
|
|
// RUN: -fmodule-file=%t/c.pcm \
|
|
// RUN: -fmodule-file=%t/d.pcm \
|
|
// RUN: -Wambiguous-macro -verify macro-ambiguity.cpp
|
|
//
|
|
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
|
|
// RUN: -v -fmodules-local-submodule-visibility \
|
|
// RUN: -iquote Inputs/macro-ambiguity/a/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/a/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/b/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/b/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/c/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/c/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/d/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/d/system \
|
|
// RUN: -iquote Inputs/macro-ambiguity/e/quote \
|
|
// RUN: -isystem Inputs/macro-ambiguity/e/system \
|
|
// RUN: -fno-implicit-modules \
|
|
// RUN: -fmodule-map-file-home-is-cwd \
|
|
// RUN: -fmodule-map-file=Inputs/macro-ambiguity/module.modulemap \
|
|
// RUN: -fmodule-file=%t/a.pcm \
|
|
// RUN: -fmodule-file=%t/b.pcm \
|
|
// RUN: -fmodule-file=%t/c.pcm \
|
|
// RUN: -fmodule-file=%t/d.pcm \
|
|
// RUN: -Wambiguous-macro -verify macro-ambiguity.cpp
|
|
|
|
// Include the textual headers first to maximize the ways in which things can
|
|
// become ambiguous.
|
|
#include "e_quote.h"
|
|
#include <e_system.h>
|
|
|
|
#include "a_quote.h"
|
|
#include <a_system.h>
|
|
#include "b_quote.h"
|
|
#include <b_system.h>
|
|
#include "c_quote.h"
|
|
#include <c_system.h>
|
|
#include "d_quote.h"
|
|
#include <d_system.h>
|
|
|
|
int test(int x) {
|
|
// We expect to get warnings for all of the quoted includes but none of the
|
|
// system includes here because the first module is a non-system module and
|
|
// the quote macros come from non-system-headers.
|
|
x = FOO1_QUOTE(x); // expected-warning {{ambiguous expansion of macro}}
|
|
// expected-note@Inputs/macro-ambiguity/c/quote/c_quote.h:4 {{expanding this definition}}
|
|
// expected-note@Inputs/macro-ambiguity/a/quote/a_quote.h:4 {{other definition}}
|
|
|
|
x = FOO1_SYSTEM(x);
|
|
|
|
x = BAR1_QUOTE(x); // expected-warning {{ambiguous expansion of macro}}
|
|
// expected-note@Inputs/macro-ambiguity/d/quote/d_quote.h:4 {{expanding this definition}}
|
|
// expected-note@Inputs/macro-ambiguity/a/quote/a_quote.h:5 {{other definition}}
|
|
|
|
x = BAR1_SYSTEM(x);
|
|
|
|
x = BAZ1_QUOTE(x); // expected-warning {{ambiguous expansion of macro}}
|
|
// expected-note@Inputs/macro-ambiguity/a/quote/a_quote.h:6 {{expanding this definition}}
|
|
// expected-note@Inputs/macro-ambiguity/e/quote/e_quote.h:4 {{other definition}}
|
|
|
|
x = BAZ1_SYSTEM(x);
|
|
|
|
// Here, we don't even warn on bar because in that cas both b and d are
|
|
// system modules and so the use of non-system headers is irrelevant.
|
|
x = FOO2_QUOTE(x); // expected-warning {{ambiguous expansion of macro}}
|
|
// expected-note@Inputs/macro-ambiguity/c/quote/c_quote.h:5 {{expanding this definition}}
|
|
// expected-note@Inputs/macro-ambiguity/b/quote/b_quote.h:4 {{other definition}}
|
|
|
|
x = FOO2_SYSTEM(x);
|
|
|
|
x = BAR2_QUOTE(x);
|
|
|
|
x = BAR2_SYSTEM(x);
|
|
|
|
x = BAZ2_QUOTE(x); // expected-warning {{ambiguous expansion of macro}}
|
|
// expected-note@Inputs/macro-ambiguity/b/quote/b_quote.h:6 {{expanding this definition}}
|
|
// expected-note@Inputs/macro-ambiguity/e/quote/e_quote.h:5 {{other definition}}
|
|
|
|
x = BAZ2_SYSTEM(x);
|
|
return x;
|
|
}
|