You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/test/Sema/attr-cfi-salt.c
+20-36Lines changed: 20 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@
2
2
3
3
#define__cfi_salt(S) __attribute__((cfi_salt(S)))
4
4
5
-
intbad1() __cfi_salt();
6
-
// expected-error@-1{{'cfi_salt' attribute takes one argument}}
7
-
intbad2() __cfi_salt(42);
8
-
// expected-error@-1{{expected string literal as argument of 'cfi_salt' attribute}}
5
+
intbad1() __cfi_salt();// expected-error{{'cfi_salt' attribute takes one argument}}
6
+
intbad2() __cfi_salt(42); // expected-error{{expected string literal as argument of 'cfi_salt' attribute}}
7
+
intbad3() __attribute__((cfi_salt("a", "b", "c"))); // expected-error{{'cfi_salt' attribute takes one argument}}
8
+
9
9
10
10
intfoo(inta, intb) __cfi_salt("pepper"); // ok
11
11
intfoo(inta, intb) __cfi_salt("pepper"); // ok
@@ -17,51 +17,35 @@ typedef int (*bar_t)(void) __cfi_salt("pepper"); // ok
17
17
// int b(void) __cfi_salt("salt 'n") __cfi_salt("pepper");
18
18
// bar_t bar_fn __cfi_salt("salt 'n");
19
19
20
-
intbaz__cfi_salt("salt");
21
-
// expected-warning@-1{{'cfi_salt' only applies to function types}}
20
+
intbaz__cfi_salt("salt"); // expected-warning{{'cfi_salt' only applies to function types}}
22
21
23
-
intbaz_fn(inta, intb) __cfi_salt("salt 'n");
24
-
// expected-note@-1{{previous declaration is here}}
25
-
intbaz_fn(inta, intb) __cfi_salt("pepper");
26
-
// expected-error@-1{{conflicting types for 'baz_fn'}}
22
+
intbaz_fn(inta, intb) __cfi_salt("salt 'n"); // expected-note{{previous declaration is here}}
23
+
intbaz_fn(inta, intb) __cfi_salt("pepper"); // expected-error{{conflicting types for 'baz_fn'}}
27
24
28
-
intmux_fn(inta, intb) __cfi_salt("salt 'n");
29
-
// expected-note@-1{{previous declaration is here}}
30
-
intmux_fn(inta, intb) __cfi_salt("pepper") {
31
-
// expected-error@-1{{conflicting types for 'mux_fn'}}
25
+
intmux_fn(inta, intb) __cfi_salt("salt 'n"); // expected-note{{previous declaration is here}}
26
+
intmux_fn(inta, intb) __cfi_salt("pepper") { // expected-error{{conflicting types for 'mux_fn'}}
32
27
returna*b;
33
28
}
34
29
35
-
typedefintqux_t__cfi_salt("salt");
36
-
// expected-warning@-1{{'cfi_salt' only applies to function types}}
30
+
typedefintqux_t__cfi_salt("salt"); // expected-warning{{'cfi_salt' only applies to function types}}
37
31
38
-
typedefint (*quux_t)(void) __cfi_salt("salt 'n");
39
-
// expected-note@-1{{previous definition is here}}
40
-
typedefint (*quux_t)(void) __cfi_salt("pepper");
41
-
// expected-error@-1{{typedef redefinition with different type}}
32
+
typedefint (*quux_t)(void) __cfi_salt("salt 'n"); // expected-note{{previous definition is here}}
33
+
typedefint (*quux_t)(void) __cfi_salt("pepper"); // expected-error{{typedef redefinition with different type}}
42
34
43
-
voidfunc1(inta) __cfi_salt("pepper");
44
-
// expected-note@-1{{previous declaration is here}}
45
-
voidfunc1(inta) { }
46
-
// expected-error@-1{{conflicting types for 'func1'}}
47
-
void (*fp1)(int) =func1;
48
-
// expected-error@-1{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
35
+
voidfunc1(inta) __cfi_salt("pepper"); // expected-note{{previous declaration is here}}
36
+
voidfunc1(inta) { } // expected-error{{conflicting types for 'func1'}}
37
+
void (*fp1)(int) =func1; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
49
38
50
-
voidfunc2(int) [[clang::cfi_salt("test")]];
51
-
// expected-note@-1{{previous declaration is here}}
52
-
voidfunc2(inta) { }
53
-
// expected-error@-1{{conflicting types for 'func2'}}
54
-
void (*fp2)(int) =func2;
55
-
// expected-error@-1{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
39
+
voidfunc2(int) [[clang::cfi_salt("test")]]; // expected-note{{previous declaration is here}}
40
+
voidfunc2(inta) { } // expected-error{{conflicting types for 'func2'}}
41
+
void (*fp2)(int) =func2; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
56
42
57
43
voidfunc3(int) __cfi_salt("pepper"); // ok
58
44
voidfunc3(inta) __cfi_salt("pepper") { } // ok
59
45
void (*__cfi_salt("pepper") fp3)(int) =func3; // ok
60
-
void (*fp3_noattr)(int) =func3;
61
-
// expected-error@-1{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
46
+
void (*fp3_noattr)(int) =func3; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
62
47
63
48
voidfunc4(int) [[clang::cfi_salt("test")]]; // ok
64
49
voidfunc4(inta) [[clang::cfi_salt("test")]] { } // ok
65
50
void (* [[clang::cfi_salt("test")]] fp4)(int) =func4; // ok
66
-
void (*fp4_noattr)(int) =func4;
67
-
// expected-error@-1{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
51
+
void (*fp4_noattr)(int) =func4; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
0 commit comments