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).
73 lines
2.3 KiB
Plaintext
73 lines
2.3 KiB
Plaintext
// RUN: %clang_cc1 -fsyntax-only -verify=host,expected %s
|
|
// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify=dev,expected %s
|
|
|
|
#include "Inputs/cuda.h"
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 1: host method called from device function
|
|
|
|
struct S1 {
|
|
void method() {} // dev-note {{'method' declared here}}
|
|
};
|
|
|
|
__device__ void foo1(S1& s) {
|
|
s.method(); // dev-error {{reference to __host__ function 'method' in __device__ function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 2: host method called from device function, for overloaded method
|
|
|
|
struct S2 {
|
|
void method(int) {} // expected-note {{candidate function not viable: call to __host__ function from __device__ function}}
|
|
void method(float) {} // expected-note {{candidate function not viable: call to __host__ function from __device__ function}}
|
|
};
|
|
|
|
__device__ void foo2(S2& s, int i, float f) {
|
|
s.method(f); // expected-error {{no matching member function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 3: device method called from host function
|
|
|
|
struct S3 {
|
|
__device__ void method() {} // host-note {{'method' declared here}}
|
|
};
|
|
|
|
void foo3(S3& s) {
|
|
s.method(); // host-error {{reference to __device__ function 'method' in __host__ function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 4: device method called from host&device function
|
|
|
|
struct S4 {
|
|
__device__ void method() {} // host-note {{'method' declared here}}
|
|
};
|
|
|
|
__host__ __device__ void foo4(S4& s) {
|
|
s.method(); // host-error {{reference to __device__ function 'method' in __host__ __device__ function}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 5: overloaded operators
|
|
|
|
struct S5 {
|
|
S5() {}
|
|
S5& operator=(const S5&) {return *this;} // expected-note {{candidate function not viable}}
|
|
};
|
|
|
|
__device__ void foo5(S5& s, S5& t) {
|
|
s = t; // expected-error {{no viable overloaded '='}}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Test 6: call method through pointer
|
|
|
|
struct S6 {
|
|
void method() {} // dev-note {{'method' declared here}};
|
|
};
|
|
|
|
__device__ void foo6(S6* s) {
|
|
s->method(); // dev-error {{reference to __host__ function 'method' in __device__ function}}
|
|
}
|