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
186186 _Static_assert(ONE == 0, "don't show me this");
187187 _Static_assert(ONE == 1, "ONE is not 1");
188188
189+#elif defined test_static_assert_2
190+ _Static_assert(1, "1"" is 1");
191+ _Static_assert(0, "0"" is 0");
192+
189193 #elif defined test_void_array
190194 void t[3];
191195
tests/tests2/60_errors_and_warnings.expect+13−10
@@ -89,24 +89,27 @@ · 88 unmodified lines
8989 60_errors_and_warnings.c:181: error: identifier expected
9090
9191 [test_static_assert]
92−60_errors_and_warnings.c:187: error: "ONE is not 1"
92+60_errors_and_warnings.c:187: error: ONE is not 1
93+
94+[test_static_assert_2]
95+60_errors_and_warnings.c:191: error: 0 is 0
9396
9497 [test_void_array]
95−60_errors_and_warnings.c:190: error: declaration of an array of incomplete type elements
98+60_errors_and_warnings.c:194: error: declaration of an array of incomplete type elements
9699
97100 [test_incomplete_enum_array]
98−60_errors_and_warnings.c:193: error: declaration of an array of incomplete type elements
101+60_errors_and_warnings.c:197: error: declaration of an array of incomplete type elements
99102
100103 [test_incomplete_struct_array]
101−60_errors_and_warnings.c:196: error: declaration of an array of incomplete type elements
104+60_errors_and_warnings.c:200: error: declaration of an array of incomplete type elements
102105
103106 [test_const_fun_array]
104−60_errors_and_warnings.c:200: error: declaration of an array of functions
107+60_errors_and_warnings.c:204: error: declaration of an array of functions
105108
106109 [test_incomplete_array_array]
107110
108111 [test_extern_array]
109−60_errors_and_warnings.c:216: error: incompatible types for redefinition of 'x'
112+60_errors_and_warnings.c:220: error: incompatible types for redefinition of 'x'
110113
111114 [test_func_1]
112115 hello: a = 123
@@ -115,17 +118,17 @@ hello: a = 123 · 2 unmodified lines
115118 hello: a = 123
116119
117120 [test_func_3]
118−60_errors_and_warnings.c:246: warning: static storage ignored for redefinition of 'hello'
121+60_errors_and_warnings.c:250: warning: static storage ignored for redefinition of 'hello'
119122 hello: a = 123
120123
121124 [test_func_4]
122125 hello: a = 123
123126
124127 [test_func_5]
125−60_errors_and_warnings.c:246: error: incompatible types for redefinition of 'hello'
128+60_errors_and_warnings.c:250: error: incompatible types for redefinition of 'hello'
126129
127130 [test_func_6]
128−60_errors_and_warnings.c:234: error: function without file scope cannot be static
131+60_errors_and_warnings.c:238: error: function without file scope cannot be static
129132
130133 [test_var_1]
131134 main : 1 ; 1
@@ -138,6 +141,6 @@ main : 2 ; 2 · 6 unmodified lines
138141 bar : 3 ; 3
139142
140143 [test_var_3]
141−60_errors_and_warnings.c:278: error: incompatible types for redefinition of 'xxx'
144+60_errors_and_warnings.c:282: error: incompatible types for redefinition of 'xxx'
142145
143146 [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