summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-04-26 08:47:35 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-04-26 08:48:00 (GMT)
commitd77b3d342e133fe885d4ab6bb7b4285d3e5aaacc (patch)
tree89c3f1977a48b5ab279dddc8bf3837cd436ae1da
parent941113b0635789c0734a65d44203c7b484cd20ad (diff)
parentca2a84c3d731a5e1210ebe52a1d203478a2cadeb (diff)
downloadCMake-d77b3d342e133fe885d4ab6bb7b4285d3e5aaacc.zip
CMake-d77b3d342e133fe885d4ab6bb7b4285d3e5aaacc.tar.gz
CMake-d77b3d342e133fe885d4ab6bb7b4285d3e5aaacc.tar.bz2
Merge topic 'test-driver-use-anonymous-namespace'
ca2a84c3d7 TestDriver: Fix 'misc-use-anonymous-namespace' warning from clang-tidy 16 Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8413
-rw-r--r--Templates/TestDriver.cxx.in18
1 files changed, 14 insertions, 4 deletions
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index c47266a..3bb2fd6 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -20,11 +20,19 @@
# else
# define CM_NULL NULL
# endif
+# define CM_NAMESPACE_BEGIN namespace {
+# define CM_NAMESPACE_END }
+# define CM_LOCAL
#else
# define CM_CAST(TYPE, EXPR) (TYPE)(EXPR)
# define CM_NULL NULL
+# define CM_NAMESPACE_BEGIN
+# define CM_NAMESPACE_END
+# define CM_LOCAL static
#endif
+CM_NAMESPACE_BEGIN
+
/* Create map. */
typedef int (*MainFuncPointer)(int, char* []); /* NOLINT */
@@ -34,17 +42,17 @@ typedef struct /* NOLINT */
MainFuncPointer func;
} functionMapEntry;
-static functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
+CM_LOCAL const functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
@CMAKE_FUNCTION_TABLE_ENTRIES@
{ CM_NULL, CM_NULL } /* NOLINT */
};
-static const int NumTests = CM_CAST(int,
+CM_LOCAL const int NumTests = CM_CAST(int,
sizeof(cmakeGeneratedFunctionMapEntries) / sizeof(functionMapEntry)) - 1;
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
-static char* lowercase(const char* string)
+CM_LOCAL char* lowercase(const char* string)
{
char *new_string;
char *p;
@@ -63,7 +71,7 @@ static char* lowercase(const char* string)
return new_string;
}
-static int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
+CM_LOCAL int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
int i;
for (i = 0; i < n_skipped_tests; i++) {
if (strcmp(name, skipped_tests[i]) == 0) {
@@ -74,6 +82,8 @@ static int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_te
return 0;
}
+CM_NAMESPACE_END
+
int main(int ac, char* av[])
{
int i;