diff --git a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept.cpp b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept.cpp index 9990594266bf..a4402866075e 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept.cpp @@ -1,8 +1,9 @@ // RUN: %check_clang_tidy %s android-cloexec-accept %t +#include + struct sockaddr {}; typedef int socklen_t; -#define NULL 0 extern "C" int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); diff --git a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept4.cpp b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept4.cpp index 448d4a9f6404..c7d8b641ff87 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept4.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-accept4.cpp @@ -1,5 +1,7 @@ // RUN: %check_clang_tidy %s android-cloexec-accept4 %t +#include + typedef int socklen_t; struct sockaddr {}; @@ -13,7 +15,6 @@ struct sockaddr {}; _rc = (exp); \ } while (_rc == -1); \ }) -#define NULL 0 extern "C" int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags); diff --git a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-memfd-create.cpp b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-memfd-create.cpp index d1d77d35392c..ca1a7706d879 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-memfd-create.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-memfd-create.cpp @@ -1,5 +1,7 @@ // RUN: %check_clang_tidy %s android-cloexec-memfd-create %t +#include + #define MFD_ALLOW_SEALING 1 #define __O_CLOEXEC 3 #define MFD_CLOEXEC __O_CLOEXEC @@ -10,7 +12,6 @@ _rc = (exp); \ } while (_rc == -1); \ }) -#define NULL 0 extern "C" int memfd_create(const char *name, unsigned int flags); diff --git a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-pipe2.cpp b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-pipe2.cpp index 4bda70fa77cc..4efe7d92c4cd 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-pipe2.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/android/cloexec-pipe2.cpp @@ -10,7 +10,6 @@ _rc = (exp); \ } while (_rc == -1); \ }) -#define NULL 0 extern "C" int pipe2(int pipefd[2], int flags); diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/posix-return.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/posix-return.cpp index d0dfd978b7c3..e9ac55462fcd 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/posix-return.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/posix-return.cpp @@ -1,6 +1,7 @@ // RUN: %check_clang_tidy %s bugprone-posix-return %t -#define NULL nullptr +#include + #define ZERO 0 #define NEGATIVE_ONE -1 diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c index 36b121597860..acb4cca0f94f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c @@ -1,5 +1,6 @@ // RUN: %check_clang_tidy %s bugprone-spuriously-wake-up-functions %t -- -- -#define NULL 0 + +#include struct Node1 { void *Node1; diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp index d7508009e19a..4e265b64ae52 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp @@ -1,5 +1,5 @@ // RUN: %check_clang_tidy %s bugprone-spuriously-wake-up-functions %t -- -- -#define NULL 0 +#include namespace std { using intmax_t = int; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.c b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.c index 8eb874a33c10..bf84aa327fae 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.c +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.c @@ -3,7 +3,7 @@ // RUN: clang-tidy %s -checks=-*,modernize-redundant-void-arg -- -std=c17 -Wno-strict-prototypes | count 0 // RUN: %check_clang_tidy -std=c23-or-later -check-suffixes=C23 %s modernize-redundant-void-arg %t -#define NULL 0 +#include extern int i; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp index 09dc2bb5c177..a029cd997bdc 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/redundant-void-arg.cpp @@ -1,6 +1,6 @@ // RUN: %check_clang_tidy %s modernize-redundant-void-arg %t -#define NULL 0 +#include int foo(); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-basic.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-basic.cpp index b9ffeecf2baf..7b92cbd9b760 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-basic.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-basic.cpp @@ -1,7 +1,7 @@ // RUN: %check_clang_tidy %s modernize-use-nullptr %t -- -- -fno-delayed-template-parsing const unsigned int g_null = 0; -#define NULL 0 +#include void test_assignment() { int *p1 = 0; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-c23.c b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-c23.c index d9b7ec2f7d19..9097b93232dc 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-c23.c +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr-c23.c @@ -1,6 +1,6 @@ // RUN: %check_clang_tidy -std=c23-or-later %s modernize-use-nullptr %t -#define NULL 0 +#include void test_assignment() { int *p1 = 0; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.c b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.c index 1218b837199c..5f659319f354 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.c +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.c @@ -3,7 +3,7 @@ // Note: this test expects no diagnostics, but FileCheck cannot handle that, // hence the use of | count 0. -#define NULL 0 +#include void f(void) { char *str = NULL; // ok (void)str; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.cpp index 27a96297c411..0092a5cc9a47 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-nullptr.cpp @@ -1,7 +1,7 @@ // RUN: %check_clang_tidy %s modernize-use-nullptr %t -- \ // RUN: -config="{CheckOptions: {modernize-use-nullptr.NullMacros: 'MY_NULL,NULL'}}" -#define NULL 0 +#include namespace std { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/delete-null-pointer.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/delete-null-pointer.cpp index 1a37c2bbf113..b8221c1e296d 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/delete-null-pointer.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/delete-null-pointer.cpp @@ -1,6 +1,6 @@ // RUN: %check_clang_tidy %s readability-delete-null-pointer %t -- -- -fno-delayed-template-parsing -#define NULL 0 +#include template struct Templ { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c index e6f8eb451f67..f9326a185b3a 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c @@ -1,11 +1,10 @@ -// RUN: %check_clang_tidy -std=c23-or-later %s readability-implicit-bool-conversion %t -// RUN: %check_clang_tidy -std=c23-or-later -check-suffix=UPPER-CASE %s readability-implicit-bool-conversion %t -- \ +// RUN: %check_clang_tidy -std=c23-or-later %s readability-implicit-bool-conversion %t --system-headers +// RUN: %check_clang_tidy -std=c23-or-later -check-suffix=UPPER-CASE %s readability-implicit-bool-conversion %t -- --system-headers \ // RUN: -config='{CheckOptions: { \ // RUN: readability-implicit-bool-conversion.UseUpperCaseLiteralSuffix: true \ // RUN: }}' -#undef NULL -#define NULL 0L +#include void functionTakingBool(bool); void functionTakingInt(int); diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration.cpp index ce3a0da79655..94b6f7f1a5d9 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/isolate-declaration.cpp @@ -1,5 +1,7 @@ // RUN: %check_clang_tidy %s readability-isolate-declaration %t -- -- -fexceptions +#include + void f() { int i; } @@ -190,7 +192,6 @@ void forbidden_transformations() { ; } -#define NULL 0 #define MY_NICE_TYPE int ** #define VAR_NAME(name) name##__LINE__ #define A_BUNCH_OF_VARIABLES int m1 = 42, m2 = 43, m3 = 44; diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get-msvc.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get-msvc.cpp index b360ccbadfa5..bccb1a228550 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get-msvc.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get-msvc.cpp @@ -1,6 +1,6 @@ // RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t -#define NULL __null +#include namespace std { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get.cpp index b74d28f4873b..77497594fa21 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-smartptr-get.cpp @@ -2,7 +2,7 @@ #include #include -#define NULL __null +#include struct Bar { void Do();