Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/ParserOpenACC/parse-cache-construct.cpp
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

116 lines
3.1 KiB
C++

// RUN: %clang_cc1 %s -verify -fopenacc
namespace NS {
static char* NSArray; // expected-note {{'NS::NSArray' declared here}}
static int NSInt; // expected-note 2 {{'NS::NSInt' declared here}}
}
char *getArrayPtr();
template<typename T, int I>
void func() {
char *ArrayPtr = getArrayPtr();
#pragma acc loop
for (int i = 0; i < 10; ++i) {
// expected-warning@+1{{left operand of comma operator has no effect}}
#pragma acc cache(ArrayPtr[T::value + I:I + 3], T::array[(T::value, 2): 2])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
#pragma acc cache(NS::NSArray[NS::NSInt])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
#pragma acc cache(NS::NSArray[NS::NSInt : NS::NSInt])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{use of undeclared identifier 'NSArray'}}
#pragma acc cache(NSArray[NS::NSInt : NS::NSInt])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{use of undeclared identifier 'NSInt'}}
#pragma acc cache(NS::NSArray[NSInt : NS::NSInt])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{use of undeclared identifier 'NSInt'}}
#pragma acc cache(NS::NSArray[NS::NSInt : NSInt])
}
}
struct S {
static constexpr int value = 5;
static constexpr char array[] ={1,2,3,4,5};
};
struct Members {
int value = 5;
char array[5] ={1,2,3,4,5};
};
struct HasMembersArray {
Members MemArr[4];
};
void use() {
Members s;
#pragma acc loop
for (int i = 0; i < 10; ++i) {
#pragma acc cache(s.array[s.value])
}
HasMembersArray Arrs;
#pragma acc loop
for (int i = 0; i < 10; ++i) {
#pragma acc cache(Arrs.MemArr[3].array[4])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
#pragma acc cache(Arrs.MemArr[3].array[1:4])
}
#pragma acc loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{OpenACC sub-array is not allowed here}}
#pragma acc cache(Arrs.MemArr[2:1].array[1:4])
}
#pragma acc parallel loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{OpenACC sub-array is not allowed here}}
#pragma acc cache(Arrs.MemArr[2:1].array[4])
}
#pragma acc parallel loop
for (int i = 0; i < 10; ++i) {
// expected-error@+2{{expected ']'}}
// expected-note@+1{{to match this '['}}
#pragma acc cache(Arrs.MemArr[3:4:].array[4])
}
#pragma acc parallel loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{OpenACC sub-array is not allowed here}}
#pragma acc cache(Arrs.MemArr[:].array[4])
}
#pragma acc parallel loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{expected unqualified-id}}
#pragma acc cache(Arrs.MemArr[::].array[4])
}
#pragma acc parallel 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(Arrs.MemArr[: :].array[4])
}
#pragma acc parallel loop
for (int i = 0; i < 10; ++i) {
// expected-error@+1{{OpenACC sub-array is not allowed here}}
#pragma acc cache(Arrs.MemArr[3:].array[4])
}
func<S, 5>(); // expected-note{{in instantiation of function template specialization}}
}