[clang] 463fa25 - [clang][NFC] Adjust tests to not un/define predefined macros

John Brawn via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 06:03:41 PST 2023


Author: John Brawn
Date: 2023-02-14T13:55:03Z
New Revision: 463fa25c34d6e569862a9b74b24db3aa5522d84b

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

LOG: [clang][NFC] Adjust tests to not un/define predefined macros

An upcoming patch will be making all defining or undefining of
predefined macros to be warning (currently only some give a warning).
In preparation for this adjust some tests that would emit a warning:
 * In thread-specifier.c the undefine is done to avoid a different
   warning, but we get that warning just because __thread and
   __private_extern__ are the wrong way around so we can just swap
   them.
 * There are a couple of objective-c tests that redefine IBAction to
   what it's already defined as, so we can just remove the define.

Added: 
    

Modified: 
    clang/test/Sema/thread-specifier.c
    clang/test/SemaObjC/method-attributes.m
    clang/test/SemaObjC/super-dealloc-attribute.m

Removed: 
    


################################################################################
diff  --git a/clang/test/Sema/thread-specifier.c b/clang/test/Sema/thread-specifier.c
index af6dcd9cb8d90..66f1d0f26697a 100644
--- a/clang/test/Sema/thread-specifier.c
+++ b/clang/test/Sema/thread-specifier.c
@@ -6,11 +6,6 @@
 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify=expected,thread-local -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11 -Wno-deprecated
 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify=expected,thread-local -pedantic %s -std=c99 -D__thread=_Thread_local -DC99
 
-#ifdef __cplusplus
-// In C++, we define __private_extern__ to extern.
-#undef __private_extern__
-#endif
-
 __thread int t1; // thread-local-warning {{'_Thread_local' is a C11 extension}}
 __thread extern int t2; // thread-local-warning {{'_Thread_local' is a C11 extension}}
 __thread static int t3; // thread-local-warning {{'_Thread_local' is a C11 extension}}
@@ -19,7 +14,7 @@ __thread static int t3; // thread-local-warning {{'_Thread_local' is a C11 exten
 // expected-warning at -3 {{'__thread' before 'static'}}
 #endif
 
-__thread __private_extern__ int t4; // thread-local-warning {{'_Thread_local' is a C11 extension}}
+__private_extern__ __thread int t4; // thread-local-warning {{'_Thread_local' is a C11 extension}}
 struct t5 { __thread int x; }; // thread-local-warning {{'_Thread_local' is a C11 extension}}
 #ifdef __cplusplus
 // expected-error-re at -2 {{'{{__thread|_Thread_local|thread_local}}' is only allowed on variable declarations}}
@@ -47,7 +42,7 @@ int f(__thread int t7) { // expected-error {{' is only allowed on variable decla
 #endif
   extern __thread int t9; // thread-local-warning {{'_Thread_local' is a C11 extension}}
   static __thread int t10; // thread-local-warning {{'_Thread_local' is a C11 extension}}
-  __thread __private_extern__ int t11; // thread-local-warning {{'_Thread_local' is a C11 extension}}
+  __private_extern__ __thread int t11; // thread-local-warning {{'_Thread_local' is a C11 extension}}
 #if __cplusplus < 201103L
   __thread auto int t12a; // expected-error-re {{cannot combine with previous '{{__thread|_Thread_local}}' declaration specifier}} \
                           // thread-local-warning {{'_Thread_local' is a C11 extension}}

diff  --git a/clang/test/SemaObjC/method-attributes.m b/clang/test/SemaObjC/method-attributes.m
index 110e6811e0f8a..14e192637855d 100644
--- a/clang/test/SemaObjC/method-attributes.m
+++ b/clang/test/SemaObjC/method-attributes.m
@@ -37,7 +37,6 @@ - (void) dep __attribute__((deprecated)) { } // OK private methodn
 
 
 // rdar://10529259
-#define IBAction void)__attribute__((ibaction)
 
 @interface Foo 
 - (void)doSomething1:(id)sender;

diff  --git a/clang/test/SemaObjC/super-dealloc-attribute.m b/clang/test/SemaObjC/super-dealloc-attribute.m
index ecab109d3089e..37429cde0543e 100644
--- a/clang/test/SemaObjC/super-dealloc-attribute.m
+++ b/clang/test/SemaObjC/super-dealloc-attribute.m
@@ -87,7 +87,6 @@ + (void)registerClass:(id)name {
 @end
 
 // rdar://14251387
-#define IBAction void)__attribute__((ibaction)
 
 @interface UIViewController @end
 


        


More information about the cfe-commits mailing list