22
33#define __cfi_salt (S ) __attribute__((cfi_salt(S)))
44
5+ int bad1 () __cfi_salt ();
6+ // expected-error@-1{{'cfi_salt' attribute takes one argument}}
7+ int bad2 () __cfi_salt (42 );
8+ // expected-error@-1{{expected string literal as argument of 'cfi_salt' attribute}}
9+
510int foo (int a , int b ) __cfi_salt ("pepper "); // ok
611int foo (int a , int b ) __cfi_salt ("pepper "); // ok
712
813typedef int (* bar_t )(void ) __cfi_salt ("pepper "); // ok
914typedef int (* bar_t )(void ) __cfi_salt ("pepper "); // ok
1015
11- #if 0
12- // FIXME: These should fail.
13- int b (void ) __cfi_salt ("salt 'n") __cfi_salt("pepper");
14- bar_t bar_fn __cfi_salt ("salt 'n ");
15- #endif
16+ // FIXME: Should we allow this?
17+ // int b(void) __cfi_salt("salt 'n") __cfi_salt("pepper");
18+ // bar_t bar_fn __cfi_salt("salt 'n");
1619
1720int baz __cfi_salt ("salt ");
1821 // expected-warning@-1{{'cfi_salt' only applies to function types}}
@@ -36,3 +39,12 @@ typedef int (*quux_t)(void) __cfi_salt("salt 'n");
3639 // expected-note@-1{{previous definition is here}}
3740typedef int (* quux_t )(void ) __cfi_salt ("pepper ");
3841 // expected-error@-1{{typedef redefinition with different type}}
42+
43+ void func (int a ) __cfi_salt ("pepper ");
44+ // expected-note@-1{{previous declaration is here}}
45+ void func (int a ) { }
46+ // expected-error@-1{{conflicting types for 'func'}}
47+
48+ void func2 (int ) [[clang ::cfi_salt ("test ")]];
49+ void func2 (int a ) { }
50+ void (* fp )(int ) = func2 ;
0 commit comments