summaryrefslogtreecommitdiffstats
path: root/Templates
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-01-24 21:24:06 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-01-24 21:24:06 (GMT)
commiteb86b4cec14df4a51cca9f178e8e758b97be11b7 (patch)
tree285f1daa3846a50ef9f318938c15f21c3ff4584b /Templates
parent178c897374718c2b7cfa76f5c016f23658d5d2b2 (diff)
downloadCMake-eb86b4cec14df4a51cca9f178e8e758b97be11b7.zip
CMake-eb86b4cec14df4a51cca9f178e8e758b97be11b7.tar.gz
CMake-eb86b4cec14df4a51cca9f178e8e758b97be11b7.tar.bz2
TestDriver: fix/silence clang-tidy warnings
Diffstat (limited to 'Templates')
-rw-r--r--Templates/TestDriver.cxx.in27
1 files changed, 12 insertions, 15 deletions
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index 7340842..ecf6fa1 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -1,7 +1,7 @@
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ctype.h> /* NOLINT */
+#include <stdio.h> /* NOLINT */
+#include <stdlib.h> /* NOLINT */
+#include <string.h> /* NOLINT */
#if defined(_MSC_VER)
#pragma warning(disable : 4996) /* deprecation */
@@ -29,7 +29,7 @@ typedef struct
static functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
@CMAKE_FUNCTION_TABLE_ENTIRES@
- { 0, 0 }
+ { NULL, NULL } /* NOLINT */
};
static const int NumTests =
@@ -37,7 +37,6 @@ static const int NumTests =
/* Allocate and create a lowercased copy of string
(note that it has to be free'd manually) */
-
static char* lowercase(const char* string)
{
char *new_string, *p;
@@ -46,8 +45,8 @@ static char* lowercase(const char* string)
stringSize = CM_CAST(size_t, strlen(string) + 1);
new_string = CM_CAST(char*, malloc(sizeof(char) * stringSize));
- if (!new_string) {
- return 0;
+ if (new_string == NULL) { /* NOLINT */
+ return NULL; /* NOLINT */
}
strncpy(new_string, string, stringSize);
for (p = new_string; *p != 0; ++p) {
@@ -87,12 +86,12 @@ int main(int ac, char* av[])
av++;
}
partial_match = 0;
- arg = 0;
+ arg = NULL; /* NOLINT */
/* If partial match is requested. */
if (testToRun == -1 && ac > 1) {
partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
}
- if (partial_match && ac < 3) {
+ if (partial_match != 0 && ac < 3) {
printf("-R needs an additional parameter.\n");
return -1;
}
@@ -101,20 +100,18 @@ int main(int ac, char* av[])
}
for (i = 0; i < NumTests && testToRun == -1; ++i) {
test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
- if (partial_match && strstr(test_name, arg) != NULL) {
+ if (partial_match != 0 && strstr(test_name, arg) != NULL) { /* NOLINT */
testToRun = i;
ac -= 2;
av += 2;
- } else if (!partial_match && strcmp(test_name, arg) == 0) {
+ } else if (partial_match == 0 && strcmp(test_name, arg) == 0) {
testToRun = i;
ac--;
av++;
}
free(test_name);
}
- if (arg) {
- free(arg);
- }
+ free(arg);
if (testToRun != -1) {
int result;
@CMAKE_TESTDRIVER_BEFORE_TESTMAIN@