https://github.com/Ariel-Burton created 
https://github.com/llvm/llvm-project/pull/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.

>From 57b0c1fbe258dd02ced18f51affbad066344501e Mon Sep 17 00:00:00 2001
From: Ariel Burton <ariel.bur...@ibm.com>
Date: Wed, 26 Mar 2025 21:59:59 +0000
Subject: [PATCH] Add guard to for loop test clang/test/Sema/for.c

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.
---
 clang/test/Sema/for.c | 3 +++
 1 file changed, 3 insertions(+)

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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to