[clang] fb993cd - Add guard to for loop test clang/test/Sema/for.c (#133169)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 27 11:26:09 PDT 2025


Author: Ariel-Burton
Date: 2025-03-27T14:26:06-04:00
New Revision: fb993cd2290c0cf71a5192f350adf12424b55890

URL: https://github.com/llvm/llvm-project/commit/fb993cd2290c0cf71a5192f350adf12424b55890
DIFF: https://github.com/llvm/llvm-project/commit/fb993cd2290c0cf71a5192f350adf12424b55890.diff

LOG: Add guard to for loop test clang/test/Sema/for.c (#133169)

Commit 20b7f5982622f 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.

Added: 
    

Modified: 
    clang/test/Sema/for.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Sema/for.c b/clang/test/Sema/for.c
index 110f84ddda952..33aaf7a074ad3 100644
--- a/clang/test/Sema/for.c
+++ b/clang/test/Sema/for.c
@@ -19,5 +19,8 @@ void b8 (void) { for (static struct { int i; } s;s.i;); } /* c11-warning {{decla
 void b9 (void) { for (struct { int i; } (*s)(struct { int j; } o) = 0;s;); }
 void b10(void) { for (typedef struct { int i; } (*s)(struct { int j; });;); } /* c11-warning {{non-variable declaration in 'for' loop is a C23 extension}}
                                                                                  c23-warning {{non-variable declaration in 'for' loop is incompatible with C standards before C23}} */
+
+#if __has_feature(c_thread_local)
 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}}
                                                                             c23-warning {{declaration of non-local variable in 'for' loop is incompatible with C standards before C23}} */
+#endif


        


More information about the cfe-commits mailing list