History

improve _Static_assert

Fix static assert to support literal string instead of just printing the sring of the current token as it use to be so we can now use _Static_assert(0, "0" "1") which will print __FILE__ __LINE__ error: 01

matthias committed 6 years ago

Commit cb041f11 parent e050ae83 files · +21 −12Browse files

Showing the changes to tests (2 of 3 files). Show all

Unified · Split

2 files
  1. tests/tests2/60_errors_and_warnings.c +4 −0
  2. tests/tests2/60_errors_and_warnings.expect +13 −10
tests/tests2/60_errors_and_warnings.c+4−0
@@ -186,6 +186,10 @@ void * _Alignas(16) p1; · 185 unmodified lines
186 _Static_assert(ONE == 0, "don't show me this");186 _Static_assert(ONE == 0, "don't show me this");
187 _Static_assert(ONE == 1, "ONE is not 1");187 _Static_assert(ONE == 1, "ONE is not 1");
188 188
189#elif defined test_static_assert_2
190 _Static_assert(1, "1"" is 1");
191 _Static_assert(0, "0"" is 0");
192
189#elif defined test_void_array193#elif defined test_void_array
190 void t[3];194 void t[3];
191 195
tests/tests2/60_errors_and_warnings.expect+13−10
@@ -89,24 +89,27 @@ · 88 unmodified lines
8960_errors_and_warnings.c:181: error: identifier expected8960_errors_and_warnings.c:181: error: identifier expected
90 90
91[test_static_assert]91[test_static_assert]
9260_errors_and_warnings.c:187: error: "ONE is not 1"9260_errors_and_warnings.c:187: error: ONE is not 1
93
94[test_static_assert_2]
9560_errors_and_warnings.c:191: error: 0 is 0
93 96
94[test_void_array]97[test_void_array]
9560_errors_and_warnings.c:190: error: declaration of an array of incomplete type elements9860_errors_and_warnings.c:194: error: declaration of an array of incomplete type elements
96 99
97[test_incomplete_enum_array]100[test_incomplete_enum_array]
9860_errors_and_warnings.c:193: error: declaration of an array of incomplete type elements10160_errors_and_warnings.c:197: error: declaration of an array of incomplete type elements
99 102
100[test_incomplete_struct_array]103[test_incomplete_struct_array]
10160_errors_and_warnings.c:196: error: declaration of an array of incomplete type elements10460_errors_and_warnings.c:200: error: declaration of an array of incomplete type elements
102 105
103[test_const_fun_array]106[test_const_fun_array]
10460_errors_and_warnings.c:200: error: declaration of an array of functions10760_errors_and_warnings.c:204: error: declaration of an array of functions
105 108
106[test_incomplete_array_array]109[test_incomplete_array_array]
107 110
108[test_extern_array]111[test_extern_array]
10960_errors_and_warnings.c:216: error: incompatible types for redefinition of 'x'11260_errors_and_warnings.c:220: error: incompatible types for redefinition of 'x'
110 113
111[test_func_1]114[test_func_1]
112hello: a = 123115hello: a = 123
@@ -115,17 +118,17 @@ hello: a = 123 · 2 unmodified lines
115hello: a = 123118hello: a = 123
116 119
117[test_func_3]120[test_func_3]
11860_errors_and_warnings.c:246: warning: static storage ignored for redefinition of 'hello'12160_errors_and_warnings.c:250: warning: static storage ignored for redefinition of 'hello'
119hello: a = 123122hello: a = 123
120 123
121[test_func_4]124[test_func_4]
122hello: a = 123125hello: a = 123
123 126
124[test_func_5]127[test_func_5]
12560_errors_and_warnings.c:246: error: incompatible types for redefinition of 'hello'12860_errors_and_warnings.c:250: error: incompatible types for redefinition of 'hello'
126 129
127[test_func_6]130[test_func_6]
12860_errors_and_warnings.c:234: error: function without file scope cannot be static13160_errors_and_warnings.c:238: error: function without file scope cannot be static
129 132
130[test_var_1]133[test_var_1]
131main : 1 ; 1134main : 1 ; 1
@@ -138,6 +141,6 @@ main : 2 ; 2 · 6 unmodified lines
138bar : 3 ; 3141bar : 3 ; 3
139 142
140[test_var_3]143[test_var_3]
14160_errors_and_warnings.c:278: error: incompatible types for redefinition of 'xxx'14460_errors_and_warnings.c:282: error: incompatible types for redefinition of 'xxx'
142 145
143[test_var_4]146[test_var_4]

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t