Skip to content

Commit

Permalink
[clang][NFC] Adjust tests to not un/define predefined macros
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
john-brawn-arm committed Feb 14, 2023
1 parent 7a49d50 commit 463fa25
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
9 changes: 2 additions & 7 deletions clang/test/Sema/thread-specifier.c
Expand Up @@ -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}}
Expand All @@ -19,7 +14,7 @@ __thread static int t3; // thread-local-warning {{'_Thread_local' is a C11 exten
// expected-warning@-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@-2 {{'{{__thread|_Thread_local|thread_local}}' is only allowed on variable declarations}}
Expand Down Expand Up @@ -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}}
Expand Down
1 change: 0 additions & 1 deletion clang/test/SemaObjC/method-attributes.m
Expand Up @@ -37,7 +37,6 @@ - (void) dep __attribute__((deprecated)) { } // OK private methodn


// rdar://10529259
#define IBAction void)__attribute__((ibaction)

@interface Foo
- (void)doSomething1:(id)sender;
Expand Down
1 change: 0 additions & 1 deletion clang/test/SemaObjC/super-dealloc-attribute.m
Expand Up @@ -87,7 +87,6 @@ + (void)registerClass:(id)name {
@end

// rdar://14251387
#define IBAction void)__attribute__((ibaction)

@interface UIViewController @end

Expand Down

0 comments on commit 463fa25

Please sign in to comment.