summaryrefslogtreecommitdiff
path: root/Tests/Preprocess
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 10:34:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-16 16:05:19 -0400
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Tests/Preprocess
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadcmake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Tests/Preprocess')
-rw-r--r--Tests/Preprocess/preprocess.c215
-rw-r--r--Tests/Preprocess/preprocess.cxx235
2 files changed, 216 insertions, 234 deletions
diff --git a/Tests/Preprocess/preprocess.c b/Tests/Preprocess/preprocess.c
index af5eae6722..1b038b0c5d 100644
--- a/Tests/Preprocess/preprocess.c
+++ b/Tests/Preprocess/preprocess.c
@@ -9,189 +9,182 @@
int check_defines_C(void)
{
int result = 1;
- if(strcmp(FILE_STRING, STRING_VALUE) != 0)
- {
- fprintf(stderr,
- "FILE_STRING has wrong value in C [%s]\n", FILE_STRING);
+ if (strcmp(FILE_STRING, STRING_VALUE) != 0) {
+ fprintf(stderr, "FILE_STRING has wrong value in C [%s]\n", FILE_STRING);
result = 0;
- }
- if(strcmp(TARGET_STRING, STRING_VALUE) != 0)
- {
- fprintf(stderr,
- "TARGET_STRING has wrong value in C [%s]\n", TARGET_STRING);
+ }
+ if (strcmp(TARGET_STRING, STRING_VALUE) != 0) {
+ fprintf(stderr, "TARGET_STRING has wrong value in C [%s]\n",
+ TARGET_STRING);
result = 0;
- }
+ }
{
- int x = 2;
- int y = 3;
- if((FILE_EXPR) != (EXPR))
- {
- fprintf(stderr, "FILE_EXPR did not work in C [%s]\n",
- TO_STRING(FILE_EXPR));
- result = 0;
+ int x = 2;
+ int y = 3;
+ if ((FILE_EXPR) != (EXPR)) {
+ fprintf(stderr, "FILE_EXPR did not work in C [%s]\n",
+ TO_STRING(FILE_EXPR));
+ result = 0;
}
- if((TARGET_EXPR) != (EXPR))
- {
- fprintf(stderr, "TARGET_EXPR did not work in C [%s]\n",
- TO_STRING(FILE_EXPR));
- result = 0;
+ if ((TARGET_EXPR) != (EXPR)) {
+ fprintf(stderr, "TARGET_EXPR did not work in C [%s]\n",
+ TO_STRING(FILE_EXPR));
+ result = 0;
}
}
#ifdef NDEBUG
-# ifdef FILE_DEF_DEBUG
+#ifdef FILE_DEF_DEBUG
{
- fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n");
+ result = 0;
}
-# endif
-# ifdef TARGET_DEF_DEBUG
+#endif
+#ifdef TARGET_DEF_DEBUG
{
- fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in C\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in C\n");
+ result = 0;
}
-# endif
-# ifdef DIRECTORY_DEF_DEBUG
+#endif
+#ifdef DIRECTORY_DEF_DEBUG
{
- fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in C\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in C\n");
+ result = 0;
}
-# endif
-# ifndef FILE_DEF_RELEASE
-# ifndef PREPROCESS_XCODE
+#endif
+#ifndef FILE_DEF_RELEASE
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr, "FILE_DEF_RELEASE should be defined in C\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_RELEASE should be defined in C\n");
+ result = 0;
}
-# endif
-# endif
-# ifndef TARGET_DEF_RELEASE
+#endif
+#endif
+#ifndef TARGET_DEF_RELEASE
{
- fprintf(stderr, "TARGET_DEF_RELEASE should be defined in C\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_RELEASE should be defined in C\n");
+ result = 0;
}
-# endif
-# ifndef DIRECTORY_DEF_RELEASE
+#endif
+#ifndef DIRECTORY_DEF_RELEASE
{
- fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in C\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in C\n");
+ result = 0;
}
-# endif
+#endif
#endif
#ifdef PREPROCESS_DEBUG
-# ifndef FILE_DEF_DEBUG
-# ifndef PREPROCESS_XCODE
+#ifndef FILE_DEF_DEBUG
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr, "FILE_DEF_DEBUG should be defined in C\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_DEBUG should be defined in C\n");
+ result = 0;
}
-# endif
-# endif
-# ifndef TARGET_DEF_DEBUG
+#endif
+#endif
+#ifndef TARGET_DEF_DEBUG
{
- fprintf(stderr, "TARGET_DEF_DEBUG should be defined in C\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_DEBUG should be defined in C\n");
+ result = 0;
}
-# endif
-# ifndef DIRECTORY_DEF_DEBUG
+#endif
+#ifndef DIRECTORY_DEF_DEBUG
{
- fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in C\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in C\n");
+ result = 0;
}
-# endif
-# ifdef FILE_DEF_RELEASE
+#endif
+#ifdef FILE_DEF_RELEASE
{
- fprintf(stderr, "FILE_DEF_RELEASE should not be defined in C\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_RELEASE should not be defined in C\n");
+ result = 0;
}
-# endif
-# ifdef TARGET_DEF_RELEASE
+#endif
+#ifdef TARGET_DEF_RELEASE
{
- fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in C\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in C\n");
+ result = 0;
}
-# endif
-# ifdef DIRECTORY_DEF_RELEASE
+#endif
+#ifdef DIRECTORY_DEF_RELEASE
{
- fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in C\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in C\n");
+ result = 0;
}
-# endif
+#endif
#endif
#if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
-# if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
-# ifndef PREPROCESS_XCODE
+#if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr,
- "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in C\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in C\n");
+ result = 0;
}
-# endif
-# endif
-# if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
+#endif
+#endif
+#if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
{
- fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in C\n");
- result = 0;
+ fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in C\n");
+ result = 0;
}
-# endif
+#endif
#endif
#if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
-# if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
-# ifndef PREPROCESS_XCODE
+#if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr,
- "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in C\n");
- result = 0;
+ fprintf(stderr,
+ "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in C\n");
+ result = 0;
}
-# endif
-# endif
-# if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
+#endif
+#endif
+#if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
{
- fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in C\n");
- result = 0;
+ fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in C\n");
+ result = 0;
}
-# endif
+#endif
#endif
#ifndef FILE_PATH_DEF
{
- fprintf(stderr, "FILE_PATH_DEF not defined in C\n");
- result = 0;
+ fprintf(stderr, "FILE_PATH_DEF not defined in C\n");
+ result = 0;
}
#endif
#ifndef TARGET_PATH_DEF
{
- fprintf(stderr, "TARGET_PATH_DEF not defined in C\n");
- result = 0;
+ fprintf(stderr, "TARGET_PATH_DEF not defined in C\n");
+ result = 0;
}
#endif
#ifndef FILE_DEF
{
- fprintf(stderr, "FILE_DEF not defined in C\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF not defined in C\n");
+ result = 0;
}
#endif
#ifndef TARGET_DEF
{
- fprintf(stderr, "TARGET_DEF not defined in C\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF not defined in C\n");
+ result = 0;
}
#endif
#ifndef DIRECTORY_DEF
{
- fprintf(stderr, "DIRECTORY_DEF not defined in C\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF not defined in C\n");
+ result = 0;
}
#endif
#ifndef OLD_DEF
{
- fprintf(stderr, "OLD_DEF not defined in C\n");
- result = 0;
+ fprintf(stderr, "OLD_DEF not defined in C\n");
+ result = 0;
}
#endif
#if !defined(OLD_EXPR) || OLD_EXPR != 2
{
- fprintf(stderr, "OLD_EXPR id not work in C [%s]\n",
- TO_STRING(OLD_EXPR));
- result = 0;
+ fprintf(stderr, "OLD_EXPR id not work in C [%s]\n", TO_STRING(OLD_EXPR));
+ result = 0;
}
#endif
return result;
diff --git a/Tests/Preprocess/preprocess.cxx b/Tests/Preprocess/preprocess.cxx
index d1681036f0..0fab785254 100644
--- a/Tests/Preprocess/preprocess.cxx
+++ b/Tests/Preprocess/preprocess.cxx
@@ -11,189 +11,183 @@ extern "C" int check_defines_C(void);
int check_defines_CXX()
{
int result = 1;
- if(strcmp(FILE_STRING, STRING_VALUE) != 0)
- {
- fprintf(stderr,
- "FILE_STRING has wrong value in CXX [%s]\n", FILE_STRING);
+ if (strcmp(FILE_STRING, STRING_VALUE) != 0) {
+ fprintf(stderr, "FILE_STRING has wrong value in CXX [%s]\n", FILE_STRING);
result = 0;
- }
- if(strcmp(TARGET_STRING, STRING_VALUE) != 0)
- {
- fprintf(stderr,
- "TARGET_STRING has wrong value in CXX [%s]\n", TARGET_STRING);
+ }
+ if (strcmp(TARGET_STRING, STRING_VALUE) != 0) {
+ fprintf(stderr, "TARGET_STRING has wrong value in CXX [%s]\n",
+ TARGET_STRING);
result = 0;
- }
+ }
{
- int x = 2;
- int y = 3;
- if((FILE_EXPR) != (EXPR))
- {
- fprintf(stderr, "FILE_EXPR did not work in CXX [%s]\n",
- TO_STRING(FILE_EXPR));
- result = 0;
+ int x = 2;
+ int y = 3;
+ if ((FILE_EXPR) != (EXPR)) {
+ fprintf(stderr, "FILE_EXPR did not work in CXX [%s]\n",
+ TO_STRING(FILE_EXPR));
+ result = 0;
}
- if((TARGET_EXPR) != (EXPR))
- {
- fprintf(stderr, "TARGET_EXPR did not work in CXX [%s]\n",
- TO_STRING(FILE_EXPR));
- result = 0;
+ if ((TARGET_EXPR) != (EXPR)) {
+ fprintf(stderr, "TARGET_EXPR did not work in CXX [%s]\n",
+ TO_STRING(FILE_EXPR));
+ result = 0;
}
}
#ifdef NDEBUG
-# ifdef FILE_DEF_DEBUG
+#ifdef FILE_DEF_DEBUG
{
- fprintf(stderr, "FILE_DEF_DEBUG should not be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_DEBUG should not be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifdef TARGET_DEF_DEBUG
+#endif
+#ifdef TARGET_DEF_DEBUG
{
- fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifdef DIRECTORY_DEF_DEBUG
+#endif
+#ifdef DIRECTORY_DEF_DEBUG
{
- fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifndef FILE_DEF_RELEASE
-# ifndef PREPROCESS_XCODE
+#endif
+#ifndef FILE_DEF_RELEASE
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr, "FILE_DEF_RELEASE should be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_RELEASE should be defined in CXX\n");
+ result = 0;
}
-# endif
-# endif
-# ifndef TARGET_DEF_RELEASE
+#endif
+#endif
+#ifndef TARGET_DEF_RELEASE
{
- fprintf(stderr, "TARGET_DEF_RELEASE should be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_RELEASE should be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifndef DIRECTORY_DEF_RELEASE
+#endif
+#ifndef DIRECTORY_DEF_RELEASE
{
- fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in CXX\n");
+ result = 0;
}
-# endif
+#endif
#endif
#ifdef PREPROCESS_DEBUG
-# ifndef FILE_DEF_DEBUG
-# ifndef PREPROCESS_XCODE
+#ifndef FILE_DEF_DEBUG
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr, "FILE_DEF_DEBUG should be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_DEBUG should be defined in CXX\n");
+ result = 0;
}
-# endif
-# endif
-# ifndef TARGET_DEF_DEBUG
+#endif
+#endif
+#ifndef TARGET_DEF_DEBUG
{
- fprintf(stderr, "TARGET_DEF_DEBUG should be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_DEBUG should be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifndef DIRECTORY_DEF_DEBUG
+#endif
+#ifndef DIRECTORY_DEF_DEBUG
{
- fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifdef FILE_DEF_RELEASE
+#endif
+#ifdef FILE_DEF_RELEASE
{
- fprintf(stderr, "FILE_DEF_RELEASE should not be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF_RELEASE should not be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifdef TARGET_DEF_RELEASE
+#endif
+#ifdef TARGET_DEF_RELEASE
{
- fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in CXX\n");
+ result = 0;
}
-# endif
-# ifdef DIRECTORY_DEF_RELEASE
+#endif
+#ifdef DIRECTORY_DEF_RELEASE
{
- fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in CXX\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in CXX\n");
+ result = 0;
}
-# endif
+#endif
#endif
#if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
-# if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
-# ifndef PREPROCESS_XCODE
+#if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr,
- "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in CXX\n");
- result = 0;
+ fprintf(stderr,
+ "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in CXX\n");
+ result = 0;
}
-# endif
-# endif
-# if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
+#endif
+#endif
+#if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
{
- fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in CXX\n");
- result = 0;
+ fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in CXX\n");
+ result = 0;
}
-# endif
+#endif
#endif
#if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
-# if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
-# ifndef PREPROCESS_XCODE
+#if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
+#ifndef PREPROCESS_XCODE
{
- fprintf(stderr,
- "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in CXX\n");
- result = 0;
+ fprintf(stderr,
+ "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in CXX\n");
+ result = 0;
}
-# endif
-# endif
-# if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
+#endif
+#endif
+#if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
{
- fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in CXX\n");
- result = 0;
+ fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in CXX\n");
+ result = 0;
}
-# endif
+#endif
#endif
#ifndef FILE_PATH_DEF
{
- fprintf(stderr, "FILE_PATH_DEF not defined in CXX\n");
- result = 0;
+ fprintf(stderr, "FILE_PATH_DEF not defined in CXX\n");
+ result = 0;
}
#endif
#ifndef TARGET_PATH_DEF
{
- fprintf(stderr, "TARGET_PATH_DEF not defined in CXX\n");
- result = 0;
+ fprintf(stderr, "TARGET_PATH_DEF not defined in CXX\n");
+ result = 0;
}
#endif
#ifndef FILE_DEF
{
- fprintf(stderr, "FILE_DEF not defined in CXX\n");
- result = 0;
+ fprintf(stderr, "FILE_DEF not defined in CXX\n");
+ result = 0;
}
#endif
#ifndef TARGET_DEF
{
- fprintf(stderr, "TARGET_DEF not defined in CXX\n");
- result = 0;
+ fprintf(stderr, "TARGET_DEF not defined in CXX\n");
+ result = 0;
}
#endif
#ifndef DIRECTORY_DEF
{
- fprintf(stderr, "DIRECTORY_DEF not defined in CXX\n");
- result = 0;
+ fprintf(stderr, "DIRECTORY_DEF not defined in CXX\n");
+ result = 0;
}
#endif
#ifndef OLD_DEF
{
- fprintf(stderr, "OLD_DEF not defined in CXX\n");
- result = 0;
+ fprintf(stderr, "OLD_DEF not defined in CXX\n");
+ result = 0;
}
#endif
#if !defined(OLD_EXPR) || OLD_EXPR != 2
{
- fprintf(stderr, "OLD_EXPR id not work in C [%s]\n",
- TO_STRING(OLD_EXPR));
- result = 0;
+ fprintf(stderr, "OLD_EXPR id not work in C [%s]\n", TO_STRING(OLD_EXPR));
+ result = 0;
}
#endif
return result;
@@ -203,23 +197,18 @@ int main()
{
int result = 1;
- if(!check_defines_C())
- {
+ if (!check_defines_C()) {
result = 0;
- }
+ }
- if(!check_defines_CXX())
- {
+ if (!check_defines_CXX()) {
result = 0;
- }
+ }
- if(result)
- {
+ if (result) {
printf("All preprocessor definitions are correct.\n");
return 0;
- }
- else
- {
+ } else {
return 1;
- }
+ }
}