Skip to content

Commit fb993cd

Browse files
authored
Add guard to for loop test clang/test/Sema/for.c (#133169)
Commit 20b7f59 includes a case that checks diagnostics for for loops using thread locals. This fails on platforms which do not support TLS. This change adds guards to run this part of the test iff the feature is supported.
1 parent 4480f26 commit fb993cd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/test/Sema/for.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ void b8 (void) { for (static struct { int i; } s;s.i;); } /* c11-warning {{decla
1919
void b9 (void) { for (struct { int i; } (*s)(struct { int j; } o) = 0;s;); }
2020
void b10(void) { for (typedef struct { int i; } (*s)(struct { int j; });;); } /* c11-warning {{non-variable declaration in 'for' loop is a C23 extension}}
2121
c23-warning {{non-variable declaration in 'for' loop is incompatible with C standards before C23}} */
22+
23+
#if __has_feature(c_thread_local)
2224
void b11 (void) { for (static _Thread_local struct { int i; } s;s.i;); } /* c11-warning {{declaration of non-local variable in 'for' loop is a C23 extension}}
2325
c23-warning {{declaration of non-local variable in 'for' loop is incompatible with C standards before C23}} */
26+
#endif

0 commit comments

Comments
 (0)