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).
199 lines
5.6 KiB
C
199 lines
5.6 KiB
C
// RUN: %clang_cc1 %s -verify -fopenacc
|
|
|
|
struct S {
|
|
int foo;
|
|
char Array[1];
|
|
};
|
|
char *getArrayPtr();
|
|
void func() {
|
|
char Array[10];
|
|
char *ArrayPtr = getArrayPtr();
|
|
int *readonly;
|
|
struct S s;
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{expected '('}}
|
|
#pragma acc cache
|
|
}
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+2{{expected '('}}
|
|
// expected-error@+1{{invalid OpenACC clause 'clause'}}
|
|
#pragma acc cache clause list
|
|
}
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{expected expression}}
|
|
#pragma acc cache()
|
|
}
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+2{{expected expression}}
|
|
// expected-error@+1{{invalid OpenACC clause 'clause'}}
|
|
#pragma acc cache() clause-list
|
|
}
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+2{{expected ')'}}
|
|
// expected-note@+1{{to match this '('}}
|
|
#pragma acc cache(
|
|
}
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+3{{use of undeclared identifier 'invalid'}}
|
|
// expected-error@+2{{expected ')'}}
|
|
// expected-note@+1{{to match this '('}}
|
|
#pragma acc cache(invalid
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+3{{expected ')'}}
|
|
// expected-note@+2{{to match this '('}}
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(ArrayPtr
|
|
}
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{use of undeclared identifier 'invalid'}}
|
|
#pragma acc cache(invalid)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(ArrayPtr)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+5{{expected expression}}
|
|
// expected-error@+4{{expected ']'}}
|
|
// expected-note@+3{{to match this '['}}
|
|
// expected-error@+2{{expected ')'}}
|
|
// expected-note@+1{{to match this '('}}
|
|
#pragma acc cache(ArrayPtr[
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+3{{expected expression}}
|
|
// expected-error@+2{{expected ']'}}
|
|
// expected-note@+1{{to match this '['}}
|
|
#pragma acc cache(ArrayPtr[, 5)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+3{{expected expression}}
|
|
// expected-error@+2{{expected ']'}}
|
|
// expected-note@+1{{to match this '['}}
|
|
#pragma acc cache(Array[)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
#pragma acc cache(Array[*readonly])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+5{{expected expression}}
|
|
// expected-error@+4{{expected ']'}}
|
|
// expected-note@+3{{to match this '['}}
|
|
// expected-error@+2{{expected ')'}}
|
|
// expected-note@+1{{to match this '('}}
|
|
#pragma acc cache(Array[*readonly:
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(readonly)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+2{{invalid tag 'devnum' on 'cache' directive}}
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(devnum:ArrayPtr)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+2{{invalid tag 'invalid' on 'cache' directive}}
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(invalid:ArrayPtr)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(readonly:ArrayPtr)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
#pragma acc cache(readonly:ArrayPtr[5:1])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
#pragma acc cache(readonly:ArrayPtr[5:*readonly])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(readonly:ArrayPtr[5:*readonly], Array)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
#pragma acc cache(readonly:ArrayPtr[5:*readonly], Array[*readonly:3])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
#pragma acc cache(readonly:ArrayPtr[5 + 0:*readonly], Array[*readonly + 0:3])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+3{{expected expression}}
|
|
// expected-error@+2{{expected ')'}}
|
|
// expected-note@+1{{to match this '('}}
|
|
#pragma acc cache(readonly:ArrayPtr[5:*readonly],
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{expected expression}}
|
|
#pragma acc cache(readonly:ArrayPtr[5:*readonly],)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-warning@+1{{left operand of comma operator has no effect}}
|
|
#pragma acc cache(readonly:ArrayPtr[5,6:*readonly])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-warning@+1{{left operand of comma operator has no effect}}
|
|
#pragma acc cache(readonly:ArrayPtr[5:3, *readonly], ArrayPtr[0])
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-error@+1{{OpenACC variable in 'cache' directive is not a valid sub-array or array element}}
|
|
#pragma acc cache(readonly:s.foo)
|
|
}
|
|
|
|
#pragma acc loop
|
|
for (int i = 0; i < 10; ++i) {
|
|
// expected-warning@+1{{left operand of comma operator has no effect}}
|
|
#pragma acc cache(readonly:s.Array[1,2])
|
|
}
|
|
}
|