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).
89 lines
2.6 KiB
C++
89 lines
2.6 KiB
C++
// RUN: rm -rf %t
|
|
// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify
|
|
|
|
int &global(int);
|
|
int &global2(int);
|
|
|
|
namespace N6 {
|
|
char &f(char);
|
|
}
|
|
|
|
namespace N8 { }
|
|
|
|
namespace LookupBeforeImport {
|
|
int &f(int);
|
|
}
|
|
void testEarly() {
|
|
int &r = LookupBeforeImport::f(1);
|
|
}
|
|
|
|
@import namespaces_left;
|
|
@import namespaces_right;
|
|
|
|
void test() {
|
|
int &ir1 = N1::f(1);
|
|
int &ir2 = N2::f(1);
|
|
int &ir3 = N3::f(1);
|
|
int &ir4 = global(1);
|
|
int &ir5 = ::global2(1);
|
|
float &fr1 = N1::f(1.0f);
|
|
float &fr2 = N2::f(1.0f);
|
|
float &fr3 = global(1.0f);
|
|
float &fr4 = ::global2(1.0f);
|
|
float &fr5 = LookupBeforeImport::f(1.0f);
|
|
double &dr1 = N2::f(1.0);
|
|
double &dr2 = N3::f(1.0);
|
|
double &dr3 = global(1.0);
|
|
double &dr4 = ::global2(1.0);
|
|
double &dr5 = LookupBeforeImport::f(1.0);
|
|
|
|
struct AddAndReexportBeforeImport::S s;
|
|
int k = AddAndReexportBeforeImport::S;
|
|
}
|
|
|
|
// Test namespaces merged without a common first declaration.
|
|
namespace N5 {
|
|
char &f(char);
|
|
}
|
|
|
|
namespace N10 {
|
|
int &f(int);
|
|
}
|
|
|
|
void testMerged() {
|
|
int &ir1 = N5::f(17);
|
|
int &ir2 = N6::f(17);
|
|
int &ir3 = N7::f(17);
|
|
double &fr1 = N5::f(1.0);
|
|
double &fr2 = N6::f(1.0);
|
|
double &fr3 = N7::f(1.0);
|
|
char &cr1 = N5::f('a');
|
|
char &cr2 = N6::f('b');
|
|
}
|
|
|
|
// Test merging of declarations within namespaces that themselves were
|
|
// merged without a common first declaration.
|
|
void testMergedMerged() {
|
|
int &ir1 = N8::f(17);
|
|
int &ir2 = N9::f(17);
|
|
int &ir3 = N10::f(17);
|
|
}
|
|
|
|
// Test merging when using anonymous namespaces, which does not
|
|
// actually perform any merging.
|
|
void testAnonymousNotMerged() {
|
|
N11::consumeFoo(N11::getFoo()); // expected-error{{cannot initialize a parameter of type 'Foo *' with an rvalue of type 'Foo *'}}
|
|
N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'Foo *' with an rvalue of type 'Foo *'}}
|
|
}
|
|
|
|
// expected-note@Inputs/namespaces-right.h:60 {{passing argument to parameter here}}
|
|
// expected-note@Inputs/namespaces-right.h:67 {{passing argument to parameter here}}
|
|
// expected-note@Inputs/namespaces-left.h:63 {{'N11::(anonymous namespace)::Foo' is not defined, but forward declared here; conversion would be valid if it was derived from 'N11::(anonymous namespace)::Foo'}}
|
|
// expected-note@Inputs/namespaces-left.h:70 {{'N12::(anonymous namespace)::Foo' is not defined, but forward declared here; conversion would be valid if it was derived from 'N12::(anonymous namespace)::Foo'}}
|
|
// Test that bringing in one name from an overload set does not hide the rest.
|
|
void testPartialImportOfOverloadSet() {
|
|
void (*p)() = N13::p;
|
|
p();
|
|
N13::f(0);
|
|
}
|