This fixes the issue int main() { extern char *x; } void main1() { extern char *x; } t2.c:5: error: incompatible types for redefinition of 'x' (reported by Giovanni Mascellani 2019/07/16)
Showing the changes to tests (2 of 4 files). Show all
Unified · Split
| @@ -273,5 +273,27 @@ int main () · 272 unmodified lines | |||
| 273 | int xxx[1] = {1}; | 273 | int xxx[1] = {1}; |
| 274 | int bar() { P(3, xxx[0]); return 0; } | 274 | int bar() { P(3, xxx[0]); return 0; } |
| 275 | 275 | ||
| 276 | #elif defined test_var_4 | ||
| 277 | struct yyy { int y; }; | ||
| 278 | struct zzz; | ||
| 279 | void f1() { | ||
| 280 | extern char *x; | ||
| 281 | extern char **xx; | ||
| 282 | extern struct yyy y; | ||
| 283 | extern struct yyy *yy; | ||
| 284 | extern struct zzz z; | ||
| 285 | extern struct zzz *zz; | ||
| 286 | } | ||
| 287 | void f2() { | ||
| 288 | extern char *x; | ||
| 289 | extern char **xx; | ||
| 290 | extern struct yyy y; | ||
| 291 | extern struct yyy *yy; | ||
| 292 | extern struct zzz z; | ||
| 293 | extern struct zzz *zz; | ||
| 294 | } | ||
| 295 | struct yyy y, *yy; | ||
| 296 | struct zzz { int z; } z, *zz; | ||
| 297 | |||
| 276 | /******************************************************************/ | 298 | /******************************************************************/ |
| 277 | #endif | 299 | #endif |
| @@ -132,3 +132,5 @@ bar : 3 ; 3 · 131 unmodified lines | |||
| 132 | 132 | ||
| 133 | [test_var_3] | 133 | [test_var_3] |
| 134 | 60_errors_and_warnings.c:273: error: incompatible types for redefinition of 'xxx' | 134 | 60_errors_and_warnings.c:273: error: incompatible types for redefinition of 'xxx' |
| 135 | |||
| 136 | [test_var_4] | ||