================
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fsyntax-only -fsanitize=kcfi -verify %s
+
+#define __cfi_salt(S) __attribute__((cfi_salt(S)))
+
+int bad1() __cfi_salt(); // expected-error{{'cfi_salt' attribute takes one 
argument}}
+int bad2() __cfi_salt(42); // expected-error{{expected string literal as 
argument of 'cfi_salt' attribute}}
+int bad3() __attribute__((cfi_salt("a", "b", "c"))); // 
expected-error{{'cfi_salt' attribute takes one argument}}
----------------
AaronBallman wrote:

```suggestion
int bad1(void) __cfi_salt(); // expected-error{{'cfi_salt' attribute takes one 
argument}}
int bad2(void) __cfi_salt(42); // expected-error{{expected string literal as 
argument of 'cfi_salt' attribute}}
int bad3(void) __attribute__((cfi_salt("a", "b", "c"))); // 
expected-error{{'cfi_salt' attribute takes one argument}}
```
This makes it more clear as to what's being tested (it's not the function 
prototype that matters for these tests, it's the attribute argument list).

https://github.com/llvm/llvm-project/pull/141846
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to