diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Tests/CompileDefinitions | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
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/CompileDefinitions')
-rw-r--r-- | Tests/CompileDefinitions/compiletest.cpp | 64 | ||||
-rw-r--r-- | Tests/CompileDefinitions/compiletest_mixed_c.c | 1 | ||||
-rw-r--r-- | Tests/CompileDefinitions/compiletest_mixed_cxx.cpp | 2 | ||||
-rw-r--r-- | Tests/CompileDefinitions/runtest.c | 27 | ||||
-rw-r--r-- | Tests/CompileDefinitions/target_prop/usetgt.c | 11 |
5 files changed, 55 insertions, 50 deletions
diff --git a/Tests/CompileDefinitions/compiletest.cpp b/Tests/CompileDefinitions/compiletest.cpp index 7df09df..640e7cf 100644 --- a/Tests/CompileDefinitions/compiletest.cpp +++ b/Tests/CompileDefinitions/compiletest.cpp @@ -7,29 +7,38 @@ #error Expect CMAKE_IS=Fun definition #endif - -template<bool test> +template <bool test> struct CMakeStaticAssert; -template<> -struct CMakeStaticAssert<true> {}; +template <> +struct CMakeStaticAssert<true> +{ +}; static const char fun_string[] = CMAKE_IS_; #ifndef NO_SPACES_IN_DEFINE_VALUES static const char very_fun_string[] = CMAKE_IS_REALLY; #endif -enum { - StringLiteralTest1 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_) == sizeof("Fun")>), +enum +{ + StringLiteralTest1 = + sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_) == sizeof("Fun")>), #ifndef NO_SPACES_IN_DEFINE_VALUES - StringLiteralTest2 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_REALLY) == sizeof("Very Fun")>), + StringLiteralTest2 = + sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_REALLY) == sizeof("Very Fun")>), #endif #ifdef TEST_GENERATOR_EXPRESSIONS - StringLiteralTest3 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST1) == sizeof("A,B,C,D")>), - StringLiteralTest4 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST2) == sizeof("A,,B,,C,,D")>), - StringLiteralTest5 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST3) == sizeof("A,-B,-C,-D")>), - StringLiteralTest6 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST4) == sizeof("A-,-B-,-C-,-D")>), - StringLiteralTest7 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST5) == sizeof("A-,B-,C-,D")>) + StringLiteralTest3 = + sizeof(CMakeStaticAssert<sizeof(LETTER_LIST1) == sizeof("A,B,C,D")>), + StringLiteralTest4 = + sizeof(CMakeStaticAssert<sizeof(LETTER_LIST2) == sizeof("A,,B,,C,,D")>), + StringLiteralTest5 = + sizeof(CMakeStaticAssert<sizeof(LETTER_LIST3) == sizeof("A,-B,-C,-D")>), + StringLiteralTest6 = + sizeof(CMakeStaticAssert<sizeof(LETTER_LIST4) == sizeof("A-,-B-,-C-,-D")>), + StringLiteralTest7 = + sizeof(CMakeStaticAssert<sizeof(LETTER_LIST5) == sizeof("A-,B-,C-,D")>) #endif }; @@ -70,35 +79,34 @@ enum { #error Unexpected LINK_LANGUAGE_IS_C #endif - // TEST_GENERATOR_EXPRESSIONS #endif #ifndef BUILD_IS_DEBUG -# error "BUILD_IS_DEBUG not defined!" +#error "BUILD_IS_DEBUG not defined!" #endif #ifndef BUILD_IS_NOT_DEBUG -# error "BUILD_IS_NOT_DEBUG not defined!" +#error "BUILD_IS_NOT_DEBUG not defined!" #endif // Check per-config definitions. #ifdef TEST_CONFIG_DEBUG -# if !BUILD_IS_DEBUG -# error "BUILD_IS_DEBUG false with TEST_CONFIG_DEBUG!" -# endif -# if BUILD_IS_NOT_DEBUG -# error "BUILD_IS_NOT_DEBUG true with TEST_CONFIG_DEBUG!" -# endif +#if !BUILD_IS_DEBUG +#error "BUILD_IS_DEBUG false with TEST_CONFIG_DEBUG!" +#endif +#if BUILD_IS_NOT_DEBUG +#error "BUILD_IS_NOT_DEBUG true with TEST_CONFIG_DEBUG!" +#endif #else -# if BUILD_IS_DEBUG -# error "BUILD_IS_DEBUG true without TEST_CONFIG_DEBUG!" -# endif -# if !BUILD_IS_NOT_DEBUG -# error "BUILD_IS_NOT_DEBUG false without TEST_CONFIG_DEBUG!" -# endif +#if BUILD_IS_DEBUG +#error "BUILD_IS_DEBUG true without TEST_CONFIG_DEBUG!" +#endif +#if !BUILD_IS_NOT_DEBUG +#error "BUILD_IS_NOT_DEBUG false without TEST_CONFIG_DEBUG!" +#endif #endif -int main(int argc, char **argv) +int main(int argc, char** argv) { return 0; } diff --git a/Tests/CompileDefinitions/compiletest_mixed_c.c b/Tests/CompileDefinitions/compiletest_mixed_c.c index a270b2b..5fbe45f 100644 --- a/Tests/CompileDefinitions/compiletest_mixed_c.c +++ b/Tests/CompileDefinitions/compiletest_mixed_c.c @@ -19,5 +19,4 @@ void someFunc(void) { - } diff --git a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp index ae6befc..4eab099 100644 --- a/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp +++ b/Tests/CompileDefinitions/compiletest_mixed_cxx.cpp @@ -17,7 +17,7 @@ #error Expected C_EXECUTABLE_LINK_LANGUAGE_IS_C define #endif -int main(int argc, char **argv) +int main(int argc, char** argv) { return 0; } diff --git a/Tests/CompileDefinitions/runtest.c b/Tests/CompileDefinitions/runtest.c index c2d51aa..7c28ab9 100644 --- a/Tests/CompileDefinitions/runtest.c +++ b/Tests/CompileDefinitions/runtest.c @@ -3,45 +3,40 @@ #include <string.h> #ifndef BUILD_CONFIG_NAME -# error "BUILD_CONFIG_NAME not defined!" +#error "BUILD_CONFIG_NAME not defined!" #endif int main() { char build_config_name[] = BUILD_CONFIG_NAME; char* c; - for(c = build_config_name; *c; ++c) - { + for (c = build_config_name; *c; ++c) { *c = (char)tolower((int)*c); - } + } fprintf(stderr, "build_config_name=\"%s\"\n", build_config_name); #ifdef TEST_CONFIG_DEBUG - if(strcmp(build_config_name, "debug") != 0) - { + if (strcmp(build_config_name, "debug") != 0) { fprintf(stderr, "build_config_name is not \"debug\"\n"); return 1; - } + } #endif #ifdef TEST_CONFIG_RELEASE - if(strcmp(build_config_name, "release") != 0) - { + if (strcmp(build_config_name, "release") != 0) { fprintf(stderr, "build_config_name is not \"release\"\n"); return 1; - } + } #endif #ifdef TEST_CONFIG_MINSIZEREL - if(strcmp(build_config_name, "minsizerel") != 0) - { + if (strcmp(build_config_name, "minsizerel") != 0) { fprintf(stderr, "build_config_name is not \"minsizerel\"\n"); return 1; - } + } #endif #ifdef TEST_CONFIG_RELWITHDEBINFO - if(strcmp(build_config_name, "relwithdebinfo") != 0) - { + if (strcmp(build_config_name, "relwithdebinfo") != 0) { fprintf(stderr, "build_config_name is not \"relwithdebinfo\"\n"); return 1; - } + } #endif return 0; } diff --git a/Tests/CompileDefinitions/target_prop/usetgt.c b/Tests/CompileDefinitions/target_prop/usetgt.c index 6672a3e..8408a90 100644 --- a/Tests/CompileDefinitions/target_prop/usetgt.c +++ b/Tests/CompileDefinitions/target_prop/usetgt.c @@ -1,10 +1,13 @@ #ifndef TGT_DEF -# error TGT_DEF incorrectly not defined +#error TGT_DEF incorrectly not defined #endif #ifndef TGT_TYPE_STATIC_LIBRARY -# error TGT_TYPE_STATIC_LIBRARY incorrectly not defined +#error TGT_TYPE_STATIC_LIBRARY incorrectly not defined #endif #ifdef TGT_TYPE_EXECUTABLE -# error TGT_TYPE_EXECUTABLE incorrectly defined +#error TGT_TYPE_EXECUTABLE incorrectly defined #endif -int main(void) { return 0; } +int main(void) +{ + return 0; +} |