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 | |
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')
668 files changed, 5326 insertions, 5444 deletions
diff --git a/Tests/AliasTarget/bat.cpp b/Tests/AliasTarget/bat.cpp index 1063c21..cb76bfe 100644 --- a/Tests/AliasTarget/bat.cpp +++ b/Tests/AliasTarget/bat.cpp @@ -22,7 +22,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int bar() + int bar() { return 0; } diff --git a/Tests/AliasTarget/commandgenerator.cpp b/Tests/AliasTarget/commandgenerator.cpp index 23560a4..aaab014 100644 --- a/Tests/AliasTarget/commandgenerator.cpp +++ b/Tests/AliasTarget/commandgenerator.cpp @@ -3,7 +3,7 @@ #include "object.h" -int main(int argc, char **argv) +int main(int argc, char** argv) { std::fstream fout; fout.open("commandoutput.h", std::ios::out); diff --git a/Tests/AliasTarget/empty.cpp b/Tests/AliasTarget/empty.cpp index b19427a..15f9ff5 100644 --- a/Tests/AliasTarget/empty.cpp +++ b/Tests/AliasTarget/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int main(void) + int main(void) { return 0; } diff --git a/Tests/AliasTarget/object.h b/Tests/AliasTarget/object.h index e935f14..d33551c 100644 --- a/Tests/AliasTarget/object.h +++ b/Tests/AliasTarget/object.h @@ -1,4 +1,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int object(void); + int object(void); diff --git a/Tests/AliasTarget/subdir/empty.cpp b/Tests/AliasTarget/subdir/empty.cpp index b19427a..15f9ff5 100644 --- a/Tests/AliasTarget/subdir/empty.cpp +++ b/Tests/AliasTarget/subdir/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int main(void) + int main(void) { return 0; } diff --git a/Tests/AliasTarget/targetgenerator.cpp b/Tests/AliasTarget/targetgenerator.cpp index 3362414..b3e6ee2 100644 --- a/Tests/AliasTarget/targetgenerator.cpp +++ b/Tests/AliasTarget/targetgenerator.cpp @@ -1,7 +1,7 @@ #include <fstream> -int main(int argc, char **argv) +int main(int argc, char** argv) { std::fstream fout; fout.open("targetoutput.h", std::ios::out); diff --git a/Tests/Architecture/bar.c b/Tests/Architecture/bar.c index 923c89c..37946c7 100644 --- a/Tests/Architecture/bar.c +++ b/Tests/Architecture/bar.c @@ -1,2 +1,5 @@ extern int foo(void); -int main() { return foo(); } +int main() +{ + return foo(); +} diff --git a/Tests/Architecture/foo.c b/Tests/Architecture/foo.c index e35694b..c83d856 100644 --- a/Tests/Architecture/foo.c +++ b/Tests/Architecture/foo.c @@ -1 +1,4 @@ -int foo(void) { return 0; } +int foo(void) +{ + return 0; +} diff --git a/Tests/Assembler/main.c b/Tests/Assembler/main.c index 95de0b5..84a54d6 100644 --- a/Tests/Assembler/main.c +++ b/Tests/Assembler/main.c @@ -1,11 +1,13 @@ #include <stdio.h> #ifdef __CLASSIC_C__ -int main(){ +int main() +{ int argc; - char*argv[]; + char* argv[]; #else -int main(int argc, char*argv[]){ +int main(int argc, char* argv[]) +{ #endif printf("hello assembler world, %d arguments given\n", argc); return 0; diff --git a/Tests/BuildDepends/Project/bar.cxx b/Tests/BuildDepends/Project/bar.cxx index c4adbf8..ec7aa65 100644 --- a/Tests/BuildDepends/Project/bar.cxx +++ b/Tests/BuildDepends/Project/bar.cxx @@ -6,11 +6,10 @@ int main(int argc, char** argv) { /* Make sure the noregen header was not regenerated. */ - if(strcmp("foo", noregen_string) != 0) - { + if (strcmp("foo", noregen_string) != 0) { printf("FAILED: noregen.h was regenerated!\n"); return 1; - } + } /* Print out the string that should have been regenerated. */ printf("%s\n", regen_string); diff --git a/Tests/BuildDepends/Project/generator.cxx b/Tests/BuildDepends/Project/generator.cxx index 92a122d..5a83a7f 100644 --- a/Tests/BuildDepends/Project/generator.cxx +++ b/Tests/BuildDepends/Project/generator.cxx @@ -4,21 +4,16 @@ extern const char* foo(); int main(int argc, const char* argv[]) { - if(argc < 3) - { + if (argc < 3) { fprintf(stderr, "Must specify output file and symbol prefix!"); return 1; - } - if(FILE* fout = fopen(argv[1], "w")) - { - fprintf(fout, "static const char* %s_string = \"%s\";\n", argv[2], - foo()); + } + if (FILE* fout = fopen(argv[1], "w")) { + fprintf(fout, "static const char* %s_string = \"%s\";\n", argv[2], foo()); fclose(fout); - } - else - { + } else { fprintf(stderr, "Could not open output file \"%s\"", argv[1]); return 1; - } + } return 0; } diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c index e9113a2..cfaf051 100644 --- a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c +++ b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c @@ -2,7 +2,7 @@ #ifdef _WIN32 __declspec(dllimport) #endif -int link_depends_no_shared_lib(void); + int link_depends_no_shared_lib(void); int main() { return link_depends_no_shared_lib() + link_depends_no_shared_exe_value; diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_lib.c b/Tests/BuildDepends/Project/link_depends_no_shared_lib.c index d226289..d66c636 100644 --- a/Tests/BuildDepends/Project/link_depends_no_shared_lib.c +++ b/Tests/BuildDepends/Project/link_depends_no_shared_lib.c @@ -2,7 +2,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int link_depends_no_shared_lib(void) + int link_depends_no_shared_lib(void) { return link_depends_no_shared_lib_value; } diff --git a/Tests/BuildDepends/Project/ninjadep.cpp b/Tests/BuildDepends/Project/ninjadep.cpp index 5498b17..e794448 100644 --- a/Tests/BuildDepends/Project/ninjadep.cpp +++ b/Tests/BuildDepends/Project/ninjadep.cpp @@ -1,6 +1,7 @@ #include "dir/header.h" #include <stdio.h> -int main() { +int main() +{ printf("HEADER_STRING: %s\n", HEADER_STRING); } diff --git a/Tests/BuildDepends/Project/object_depends.cxx b/Tests/BuildDepends/Project/object_depends.cxx index 76e8197..f8b643a 100644 --- a/Tests/BuildDepends/Project/object_depends.cxx +++ b/Tests/BuildDepends/Project/object_depends.cxx @@ -1 +1,4 @@ -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/BuildDepends/Project/zot.cxx b/Tests/BuildDepends/Project/zot.cxx index 186554b..faee7d3 100644 --- a/Tests/BuildDepends/Project/zot.cxx +++ b/Tests/BuildDepends/Project/zot.cxx @@ -7,8 +7,8 @@ const char* zot_macro_tgt_f(); int main() { - printf("[%s] [%s] [%s] [%s]\n", zot, zot_custom, - zot_macro_dir_f(), zot_macro_tgt_f()); + printf("[%s] [%s] [%s] [%s]\n", zot, zot_custom, zot_macro_dir_f(), + zot_macro_tgt_f()); fflush(stdout); return 0; } diff --git a/Tests/BundleGeneratorTest/Executable.cxx b/Tests/BundleGeneratorTest/Executable.cxx index 8107f78..3d7e0d7 100644 --- a/Tests/BundleGeneratorTest/Executable.cxx +++ b/Tests/BundleGeneratorTest/Executable.cxx @@ -5,4 +5,3 @@ int main(int argc, char* argv[]) print_message("Howdy, World!\n"); return 0; } - diff --git a/Tests/BundleGeneratorTest/Library.cxx b/Tests/BundleGeneratorTest/Library.cxx index 1403c68..c4f40c4 100644 --- a/Tests/BundleGeneratorTest/Library.cxx +++ b/Tests/BundleGeneratorTest/Library.cxx @@ -4,4 +4,3 @@ void print_message(const char* const Message) { std::cout << Message; } - diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx index 54f9534..9ae802f 100644 --- a/Tests/BundleTest/BundleLib.cxx +++ b/Tests/BundleTest/BundleLib.cxx @@ -8,13 +8,12 @@ int fileExists(char* filename) { #ifndef R_OK -# define R_OK 04 +#define R_OK 04 #endif - if ( access(filename, R_OK) != 0 ) - { + if (access(filename, R_OK) != 0) { printf("Cannot find file: %s\n", filename); return 0; - } + } return 1; } @@ -28,18 +27,15 @@ int findBundleFile(char* exec, const char* file) printf("Process executable name: %s\n", exec); // Remove the executable name and directory name - for ( cc = strlen(nexec)-1; cc > 0; cc -- ) - { - if ( nexec[cc] == '/' ) - { + for (cc = strlen(nexec) - 1; cc > 0; cc--) { + if (nexec[cc] == '/') { nexec[cc] = 0; - if ( cnt == 1 ) - { + if (cnt == 1) { break; - } - cnt ++; } + cnt++; } + } printf("Process executable path: %s\n", nexec); sprintf(fpath, "%s/%s", nexec, file); printf("Check for file: %s\n", fpath); @@ -49,22 +45,19 @@ int findBundleFile(char* exec, const char* file) return res; } -int foo(char *exec) +int foo(char* exec) { // Call a CoreFoundation function... // CFBundleRef br = CFBundleGetMainBundle(); - (void) br; + (void)br; int res1 = findBundleFile(exec, "Resources/randomResourceFile.plist"); int res2 = findBundleFile(exec, "MacOS/SomeRandomFile.txt"); int res3 = findBundleFile(exec, "MacOS/README.rst"); - if ( !res1 || - !res2 || - !res3 ) - { + if (!res1 || !res2 || !res3) { return 1; - } + } return 0; } diff --git a/Tests/BundleTest/BundleTest.cxx b/Tests/BundleTest/BundleTest.cxx index a66d601..a5e8f59 100644 --- a/Tests/BundleTest/BundleTest.cxx +++ b/Tests/BundleTest/BundleTest.cxx @@ -8,13 +8,15 @@ int main(int argc, char* argv[]) { printf("Started with: %d arguments\n", argc); - // Call a CoreFoundation function... but pull in the link dependency on "-framework - // CoreFoundation" via CMake's dependency chaining mechanism. This code exists to + // Call a CoreFoundation function... but pull in the link dependency on + // "-framework + // CoreFoundation" via CMake's dependency chaining mechanism. This code + // exists to // verify that the chaining mechanism works with "-framework blah" style // link dependencies. // CFBundleRef br = CFBundleGetMainBundle(); - (void) br; + (void)br; return foo(argv[0]); } diff --git a/Tests/BundleUtilities/framework.h b/Tests/BundleUtilities/framework.h index bdd10f0..343317c 100644 --- a/Tests/BundleUtilities/framework.h +++ b/Tests/BundleUtilities/framework.h @@ -3,13 +3,13 @@ #define framework_h #ifdef WIN32 -# ifdef framework_EXPORTS -# define FRAMEWORK_EXPORT __declspec(dllexport) -# else -# define FRAMEWORK_EXPORT __declspec(dllimport) -# endif +#ifdef framework_EXPORTS +#define FRAMEWORK_EXPORT __declspec(dllexport) #else -# define FRAMEWORK_EXPORT +#define FRAMEWORK_EXPORT __declspec(dllimport) +#endif +#else +#define FRAMEWORK_EXPORT #endif void FRAMEWORK_EXPORT framework(); diff --git a/Tests/BundleUtilities/shared.h b/Tests/BundleUtilities/shared.h index 3588fb8..28904fd 100644 --- a/Tests/BundleUtilities/shared.h +++ b/Tests/BundleUtilities/shared.h @@ -3,13 +3,13 @@ #define shared_h #ifdef WIN32 -# ifdef shared_EXPORTS -# define SHARED_EXPORT __declspec(dllexport) -# else -# define SHARED_EXPORT __declspec(dllimport) -# endif +#ifdef shared_EXPORTS +#define SHARED_EXPORT __declspec(dllexport) #else -# define SHARED_EXPORT +#define SHARED_EXPORT __declspec(dllimport) +#endif +#else +#define SHARED_EXPORT #endif void SHARED_EXPORT shared(); diff --git a/Tests/BundleUtilities/shared2.h b/Tests/BundleUtilities/shared2.h index d53546c..3f0015c 100644 --- a/Tests/BundleUtilities/shared2.h +++ b/Tests/BundleUtilities/shared2.h @@ -3,13 +3,13 @@ #define shared2_h #ifdef WIN32 -# ifdef shared2_EXPORTS -# define SHARED2_EXPORT __declspec(dllexport) -# else -# define SHARED2_EXPORT __declspec(dllimport) -# endif +#ifdef shared2_EXPORTS +#define SHARED2_EXPORT __declspec(dllexport) #else -# define SHARED2_EXPORT +#define SHARED2_EXPORT __declspec(dllimport) +#endif +#else +#define SHARED2_EXPORT #endif void SHARED2_EXPORT shared2(); diff --git a/Tests/BundleUtilities/testbundleutils1.cpp b/Tests/BundleUtilities/testbundleutils1.cpp index 23d3cbd..3eb6a44 100644 --- a/Tests/BundleUtilities/testbundleutils1.cpp +++ b/Tests/BundleUtilities/testbundleutils1.cpp @@ -16,18 +16,15 @@ int main(int, char**) #if defined(WIN32) HANDLE lib = LoadLibraryA("module1.dll"); - if(!lib) - { + if (!lib) { printf("Failed to open module1\n"); } #else void* lib = dlopen("module1.so", RTLD_LAZY); - if(!lib) - { + if (!lib) { printf("Failed to open module1\n%s\n", dlerror()); } #endif - return lib == 0 ? 1 : 0; } diff --git a/Tests/BundleUtilities/testbundleutils2.cpp b/Tests/BundleUtilities/testbundleutils2.cpp index 319be89..c39eb52 100644 --- a/Tests/BundleUtilities/testbundleutils2.cpp +++ b/Tests/BundleUtilities/testbundleutils2.cpp @@ -16,18 +16,15 @@ int main(int, char**) #if defined(WIN32) HANDLE lib = LoadLibraryA("module2.dll"); - if(!lib) - { + if (!lib) { printf("Failed to open module2\n"); } #else void* lib = dlopen("module2.so", RTLD_LAZY); - if(!lib) - { + if (!lib) { printf("Failed to open module2\n%s\n", dlerror()); } #endif - return lib == 0 ? 1 : 0; } diff --git a/Tests/BundleUtilities/testbundleutils3.cpp b/Tests/BundleUtilities/testbundleutils3.cpp index 9df13e9..3bc8a83 100644 --- a/Tests/BundleUtilities/testbundleutils3.cpp +++ b/Tests/BundleUtilities/testbundleutils3.cpp @@ -16,18 +16,15 @@ int main(int, char**) #if defined(WIN32) HANDLE lib = LoadLibraryA("module3.dll"); - if(!lib) - { + if (!lib) { printf("Failed to open module3\n"); } #else void* lib = dlopen("module3.so", RTLD_LAZY); - if(!lib) - { + if (!lib) { printf("Failed to open module3\n%s\n", dlerror()); } #endif - return lib == 0 ? 1 : 0; } diff --git a/Tests/CFBundleTest/np_macmain.cpp b/Tests/CFBundleTest/np_macmain.cpp index 78004d0..b5a4226 100644 --- a/Tests/CFBundleTest/np_macmain.cpp +++ b/Tests/CFBundleTest/np_macmain.cpp @@ -8,7 +8,6 @@ doing anything useful. \***********************************************************/ - #include <stdio.h> typedef void (*NPP_ShutdownProcPtr)(void); @@ -20,9 +19,9 @@ struct NPNetscapeFuncs; struct NPPluginFuncs; extern "C" { - NPError NP_Initialize(NPNetscapeFuncs *browserFuncs); - NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs); - NPError NP_Shutdown(void); +NPError NP_Initialize(NPNetscapeFuncs* browserFuncs); +NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs); +NPError NP_Shutdown(void); } #pragma GCC visibility pop @@ -33,17 +32,17 @@ void initPluginModule() NPError NP_GetEntryPoints(NPPluginFuncs* pFuncs) { - printf("NP_GetEntryPoints()\n"); - return 0; + printf("NP_GetEntryPoints()\n"); + return 0; } NPError NP_Initialize(NPNetscapeFuncs* pFuncs) { - printf("NP_Initialize()\n"); - return 0; + printf("NP_Initialize()\n"); + return 0; } NPError NP_Shutdown() { - return 0; + return 0; } diff --git a/Tests/CMakeCommands/add_compile_options/main.cpp b/Tests/CMakeCommands/add_compile_options/main.cpp index 2bb20ac..1d57021 100644 --- a/Tests/CMakeCommands/add_compile_options/main.cpp +++ b/Tests/CMakeCommands/add_compile_options/main.cpp @@ -1,8 +1,8 @@ #ifdef DO_GNU_TESTS -# ifndef TEST_OPTION -# error Expected TEST_OPTION -# endif +#ifndef TEST_OPTION +#error Expected TEST_OPTION +#endif #endif int main(void) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c index 5796d96..7931a6f 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.c +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -1,23 +1,22 @@ #ifdef TEST_LANG_DEFINES - #ifdef CONSUMER_LANG_CXX - #error Unexpected CONSUMER_LANG_CXX - #endif +#ifdef CONSUMER_LANG_CXX +#error Unexpected CONSUMER_LANG_CXX +#endif - #ifndef CONSUMER_LANG_C - #error Expected CONSUMER_LANG_C - #endif +#ifndef CONSUMER_LANG_C +#error Expected CONSUMER_LANG_C +#endif - #if !LANG_IS_C - #error Expected LANG_IS_C - #endif +#if !LANG_IS_C +#error Expected LANG_IS_C +#endif - #if LANG_IS_CXX - #error Unexpected LANG_IS_CXX - #endif +#if LANG_IS_CXX +#error Unexpected LANG_IS_CXX +#endif #endif void consumer_c() { - } diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp index 778f57e..0202c17 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -16,21 +16,24 @@ #endif #ifdef TEST_LANG_DEFINES - #ifndef CONSUMER_LANG_CXX - #error Expected CONSUMER_LANG_CXX - #endif +#ifndef CONSUMER_LANG_CXX +#error Expected CONSUMER_LANG_CXX +#endif - #ifdef CONSUMER_LANG_C - #error Unexpected CONSUMER_LANG_C - #endif +#ifdef CONSUMER_LANG_C +#error Unexpected CONSUMER_LANG_C +#endif - #if !LANG_IS_CXX - #error Expected LANG_IS_CXX - #endif +#if !LANG_IS_CXX +#error Expected LANG_IS_CXX +#endif - #if LANG_IS_C - #error Unexpected LANG_IS_C - #endif +#if LANG_IS_C +#error Unexpected LANG_IS_C +#endif #endif -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_compile_definitions/main.cpp b/Tests/CMakeCommands/target_compile_definitions/main.cpp index addb33c..bf08b45 100644 --- a/Tests/CMakeCommands/target_compile_definitions/main.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/main.cpp @@ -11,4 +11,7 @@ #error Unexpected MY_INTERFACE_DEFINE #endif -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_compile_features/dummy.cpp b/Tests/CMakeCommands/target_compile_features/dummy.cpp index 341aaaf..e9ad257 100644 --- a/Tests/CMakeCommands/target_compile_features/dummy.cpp +++ b/Tests/CMakeCommands/target_compile_features/dummy.cpp @@ -1,5 +1,5 @@ -int main(int, char **) +int main(int, char**) { return 0; } diff --git a/Tests/CMakeCommands/target_compile_features/lib_restrict.c b/Tests/CMakeCommands/target_compile_features/lib_restrict.c index 049c1b0..2ceec97 100644 --- a/Tests/CMakeCommands/target_compile_features/lib_restrict.c +++ b/Tests/CMakeCommands/target_compile_features/lib_restrict.c @@ -1,7 +1,7 @@ #include "lib_restrict.h" -int foo(int * restrict a, int * restrict b) +int foo(int* restrict a, int* restrict b) { (void)a; (void)b; diff --git a/Tests/CMakeCommands/target_compile_features/lib_restrict.h b/Tests/CMakeCommands/target_compile_features/lib_restrict.h index eca22be..2e528b6 100644 --- a/Tests/CMakeCommands/target_compile_features/lib_restrict.h +++ b/Tests/CMakeCommands/target_compile_features/lib_restrict.h @@ -2,6 +2,6 @@ #ifndef LIB_RESTRICT_H #define LIB_RESTRICT_H -int foo(int * restrict a, int * restrict b); +int foo(int* restrict a, int* restrict b); #endif diff --git a/Tests/CMakeCommands/target_compile_features/lib_user.cpp b/Tests/CMakeCommands/target_compile_features/lib_user.cpp index 976068a..541e528 100644 --- a/Tests/CMakeCommands/target_compile_features/lib_user.cpp +++ b/Tests/CMakeCommands/target_compile_features/lib_user.cpp @@ -1,7 +1,7 @@ #include "lib_auto_type.h" -int main(int argc, char **argv) +int main(int argc, char** argv) { return getAutoType(); } diff --git a/Tests/CMakeCommands/target_compile_features/main.c b/Tests/CMakeCommands/target_compile_features/main.c index 831c5eb2..76e98c4 100644 --- a/Tests/CMakeCommands/target_compile_features/main.c +++ b/Tests/CMakeCommands/target_compile_features/main.c @@ -1,5 +1,5 @@ -int foo(int * restrict a, int * restrict b) +int foo(int* restrict a, int* restrict b) { (void)a; (void)b; diff --git a/Tests/CMakeCommands/target_compile_features/main.cpp b/Tests/CMakeCommands/target_compile_features/main.cpp index fe29b04..6f5daee 100644 --- a/Tests/CMakeCommands/target_compile_features/main.cpp +++ b/Tests/CMakeCommands/target_compile_features/main.cpp @@ -1,5 +1,5 @@ -int main(int, char **) +int main(int, char**) { auto i = 0; return i; diff --git a/Tests/CMakeCommands/target_compile_features/restrict_user.c b/Tests/CMakeCommands/target_compile_features/restrict_user.c index d47b847..76c956f 100644 --- a/Tests/CMakeCommands/target_compile_features/restrict_user.c +++ b/Tests/CMakeCommands/target_compile_features/restrict_user.c @@ -1,7 +1,7 @@ #include "lib_restrict.h" -int bar(int * restrict a, int * restrict b) +int bar(int* restrict a, int* restrict b) { (void)a; (void)b; diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c index 5796d96..7931a6f 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.c +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -1,23 +1,22 @@ #ifdef TEST_LANG_DEFINES - #ifdef CONSUMER_LANG_CXX - #error Unexpected CONSUMER_LANG_CXX - #endif +#ifdef CONSUMER_LANG_CXX +#error Unexpected CONSUMER_LANG_CXX +#endif - #ifndef CONSUMER_LANG_C - #error Expected CONSUMER_LANG_C - #endif +#ifndef CONSUMER_LANG_C +#error Expected CONSUMER_LANG_C +#endif - #if !LANG_IS_C - #error Expected LANG_IS_C - #endif +#if !LANG_IS_C +#error Expected LANG_IS_C +#endif - #if LANG_IS_CXX - #error Unexpected LANG_IS_CXX - #endif +#if LANG_IS_CXX +#error Unexpected LANG_IS_CXX +#endif #endif void consumer_c() { - } diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index c5882a5..71a6098 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -1,36 +1,39 @@ #ifdef DO_GNU_TESTS -# ifdef MY_PRIVATE_DEFINE -# error Unexpected MY_PRIVATE_DEFINE -# endif +#ifdef MY_PRIVATE_DEFINE +#error Unexpected MY_PRIVATE_DEFINE +#endif -# ifndef MY_PUBLIC_DEFINE -# error Expected MY_PUBLIC_DEFINE -# endif +#ifndef MY_PUBLIC_DEFINE +#error Expected MY_PUBLIC_DEFINE +#endif -# ifndef MY_INTERFACE_DEFINE -# error Expected MY_INTERFACE_DEFINE -# endif +#ifndef MY_INTERFACE_DEFINE +#error Expected MY_INTERFACE_DEFINE +#endif #endif #ifdef TEST_LANG_DEFINES - #ifndef CONSUMER_LANG_CXX - #error Expected CONSUMER_LANG_CXX - #endif +#ifndef CONSUMER_LANG_CXX +#error Expected CONSUMER_LANG_CXX +#endif - #ifdef CONSUMER_LANG_C - #error Unexpected CONSUMER_LANG_C - #endif +#ifdef CONSUMER_LANG_C +#error Unexpected CONSUMER_LANG_C +#endif - #if !LANG_IS_CXX - #error Expected LANG_IS_CXX - #endif +#if !LANG_IS_CXX +#error Expected LANG_IS_CXX +#endif - #if LANG_IS_C - #error Unexpected LANG_IS_C - #endif +#if LANG_IS_C +#error Unexpected LANG_IS_C +#endif #endif -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_compile_options/main.cpp b/Tests/CMakeCommands/target_compile_options/main.cpp index 961c06d..ac472ae 100644 --- a/Tests/CMakeCommands/target_compile_options/main.cpp +++ b/Tests/CMakeCommands/target_compile_options/main.cpp @@ -1,18 +1,21 @@ #ifdef DO_GNU_TESTS -# ifndef MY_PRIVATE_DEFINE -# error Expected MY_PRIVATE_DEFINE -# endif +#ifndef MY_PRIVATE_DEFINE +#error Expected MY_PRIVATE_DEFINE +#endif -# ifndef MY_PUBLIC_DEFINE -# error Expected MY_PUBLIC_DEFINE -# endif +#ifndef MY_PUBLIC_DEFINE +#error Expected MY_PUBLIC_DEFINE +#endif -# ifdef MY_INTERFACE_DEFINE -# error Unexpected MY_INTERFACE_DEFINE -# endif +#ifdef MY_INTERFACE_DEFINE +#error Unexpected MY_INTERFACE_DEFINE +#endif #endif -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c index 8821f5b..ae88f92 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.c +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -1,10 +1,13 @@ #ifdef TEST_LANG_DEFINES - #include "c_only.h" +#include "c_only.h" - #ifndef C_ONLY_DEFINE - #error Expected C_ONLY_DEFINE - #endif +#ifndef C_ONLY_DEFINE +#error Expected C_ONLY_DEFINE +#endif #endif -int consumer_c() { return 0; } +int consumer_c() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 9e1656a..0f8153b 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -5,7 +5,7 @@ #include "publicinclude.h" #include "relative_dir.h" #ifdef TEST_LANG_DEFINES - #include "cxx_only.h" +#include "cxx_only.h" #endif #ifdef PRIVATEINCLUDE_DEFINE @@ -33,9 +33,12 @@ #endif #ifdef TEST_LANG_DEFINES - #ifndef CXX_ONLY_DEFINE - #error Expected CXX_ONLY_DEFINE - #endif +#ifndef CXX_ONLY_DEFINE +#error Expected CXX_ONLY_DEFINE +#endif #endif -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_include_directories/main.cpp b/Tests/CMakeCommands/target_include_directories/main.cpp index 8434b97..71298ce 100644 --- a/Tests/CMakeCommands/target_include_directories/main.cpp +++ b/Tests/CMakeCommands/target_include_directories/main.cpp @@ -19,4 +19,7 @@ #error Expected CURE_DEFINE #endif -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp index 41dc3ce..80b3c08 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.cpp @@ -4,7 +4,6 @@ OnlyPlainLib1::OnlyPlainLib1() : result(0) { - } int OnlyPlainLib1::GetResult() diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h index c0373ce..2bc04ee 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h @@ -1,9 +1,9 @@ struct #ifdef _WIN32 -__declspec(dllexport) + __declspec(dllexport) #endif -OnlyPlainLib1 + OnlyPlainLib1 { OnlyPlainLib1(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h index 74b18a0..6f18d20 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h @@ -4,4 +4,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -OnlyPlainLib1 onlyPlainLib2(); + OnlyPlainLib1 onlyPlainLib2(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp index 0fb7b0a..02e9415 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib_user.cpp @@ -1,7 +1,7 @@ #include "onlyplainlib2.h" -int main(int argc, char **argv) +int main(int argc, char** argv) { return onlyPlainLib2().GetResult(); } diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp index a253c46..d6b3986 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.cpp @@ -1,2 +1,5 @@ -int staticlib1() { return 0; } +int staticlib1() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h index 4bbf23f..7d58b10 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib1.h @@ -1,4 +1,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int staticlib1(); + int staticlib1(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp index 4e38063..bd1a901 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.cpp @@ -1,2 +1,5 @@ -int staticlib2() { return 0; } +int staticlib2() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h index a4e07b6..bbfdaa3 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/staticlib2.h @@ -1,4 +1,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int staticlib2(); + int staticlib2(); diff --git a/Tests/CMakeCommands/target_link_libraries/depC.h b/Tests/CMakeCommands/target_link_libraries/depC.h index 4d65c9e..01c9e06 100644 --- a/Tests/CMakeCommands/target_link_libraries/depC.h +++ b/Tests/CMakeCommands/target_link_libraries/depC.h @@ -8,5 +8,4 @@ struct DEPC_EXPORT DepC int foo(); DepA getA(); - }; diff --git a/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp b/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp index d1321a1..1caa516 100644 --- a/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp +++ b/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp @@ -5,7 +5,7 @@ #include "subdirlib.h" -int main(int, char **) +int main(int, char**) { DepA a; DepB b; diff --git a/Tests/CMakeCommands/target_link_libraries/targetA.cpp b/Tests/CMakeCommands/target_link_libraries/targetA.cpp index d1321a1..1caa516 100644 --- a/Tests/CMakeCommands/target_link_libraries/targetA.cpp +++ b/Tests/CMakeCommands/target_link_libraries/targetA.cpp @@ -5,7 +5,7 @@ #include "subdirlib.h" -int main(int, char **) +int main(int, char**) { DepA a; DepB b; diff --git a/Tests/CMakeCommands/target_link_libraries/targetB.cpp b/Tests/CMakeCommands/target_link_libraries/targetB.cpp index 0913a57..a08c79a 100644 --- a/Tests/CMakeCommands/target_link_libraries/targetB.cpp +++ b/Tests/CMakeCommands/target_link_libraries/targetB.cpp @@ -1,7 +1,7 @@ #include "depD.h" -int main(int, char **) +int main(int, char**) { DepD d; DepA a = d.getA(); diff --git a/Tests/CMakeCommands/target_link_libraries/targetC.cpp b/Tests/CMakeCommands/target_link_libraries/targetC.cpp index 3542660..7c5c9e4 100644 --- a/Tests/CMakeCommands/target_link_libraries/targetC.cpp +++ b/Tests/CMakeCommands/target_link_libraries/targetC.cpp @@ -8,7 +8,7 @@ #error Expected TEST_DEF definition #endif -int main(int, char **) +int main(int, char**) { DepG g; diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index 26ab223..1cfd381 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -1,24 +1,24 @@ #include "cmSystemTools.h" -class CompileCommandParser { +class CompileCommandParser +{ public: - class CommandType: public std::map<std::string, std::string> + class CommandType : public std::map<std::string, std::string> { public: std::string const& at(std::string const& k) const - { + { const_iterator i = this->find(k); - if(i != this->end()) { return i->second; } + if (i != this->end()) { + return i->second; + } static std::string emptyString; return emptyString; - } + } }; typedef std::vector<CommandType> TranslationUnitsType; - CompileCommandParser(std::ifstream *input) - { - this->Input = input; - } + CompileCommandParser(std::ifstream* input) { this->Input = input; } void Parse() { @@ -36,54 +36,53 @@ private: { this->TranslationUnits = TranslationUnitsType(); ExpectOrDie('[', "at start of compile command file\n"); - do - { + do { ParseTranslationUnit(); this->TranslationUnits.push_back(this->Command); - } while(Expect(',')); + } while (Expect(',')); ExpectOrDie(']', "at end of array"); } void ParseTranslationUnit() { this->Command = CommandType(); - if(!Expect('{')) return; - if(Expect('}')) return; - do - { + if (!Expect('{')) + return; + if (Expect('}')) + return; + do { ParseString(); std::string name = this->String; ExpectOrDie(':', "between name and value"); ParseString(); std::string value = this->String; this->Command[name] = value; - } while(Expect(',')); + } while (Expect(',')); ExpectOrDie('}', "at end of object"); } void ParseString() { this->String = ""; - if(!Expect('"')) return; - while (!Expect('"')) - { + if (!Expect('"')) + return; + while (!Expect('"')) { Expect('\\'); - this->String.append(1,C); + this->String.append(1, C); Next(); - } + } } bool Expect(char c) { - if(this->C == c) - { + if (this->C == c) { NextNonWhitespace(); return true; - } + } return false; } - void ExpectOrDie(char c, const std::string & message) + void ExpectOrDie(char c, const std::string& message) { if (!Expect(c)) ErrorExit(std::string("'") + c + "' expected " + message + "."); @@ -91,51 +90,54 @@ private: void NextNonWhitespace() { - do { Next(); } while (IsWhitespace()); + do { + Next(); + } while (IsWhitespace()); } void Next() { this->C = char(Input->get()); - if (this->Input->bad()) ErrorExit("Unexpected end of file."); + if (this->Input->bad()) + ErrorExit("Unexpected end of file."); } - void ErrorExit(const std::string &message) { + void ErrorExit(const std::string& message) + { std::cout << "ERROR: " << message; exit(1); } bool IsWhitespace() { - return (this->C == ' ' || this->C == '\t' || - this->C == '\n' || this->C == '\r'); + return (this->C == ' ' || this->C == '\t' || this->C == '\n' || + this->C == '\r'); } char C; TranslationUnitsType TranslationUnits; CommandType Command; std::string String; - std::ifstream *Input; + std::ifstream* Input; }; -int main () +int main() { std::ifstream file("compile_commands.json"); CompileCommandParser parser(&file); parser.Parse(); - for(CompileCommandParser::TranslationUnitsType::const_iterator - it = parser.GetTranslationUnits().begin(), - end = parser.GetTranslationUnits().end(); it != end; ++it) - { + for (CompileCommandParser::TranslationUnitsType::const_iterator + it = parser.GetTranslationUnits().begin(), + end = parser.GetTranslationUnits().end(); + it != end; ++it) { std::vector<std::string> command; cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command); - if (!cmSystemTools::RunSingleCommand( - command, 0, 0, 0, it->at("directory").c_str())) - { - std::cout << "ERROR: Failed to run command \"" - << command[0] << "\"" << std::endl; + if (!cmSystemTools::RunSingleCommand(command, 0, 0, 0, + it->at("directory").c_str())) { + std::cout << "ERROR: Failed to run command \"" << command[0] << "\"" + << std::endl; exit(1); - } } + } return 0; } diff --git a/Tests/CMakeLib/testGeneratedFileStream.cxx b/Tests/CMakeLib/testGeneratedFileStream.cxx index f8ca4af..128cab4 100644 --- a/Tests/CMakeLib/testGeneratedFileStream.cxx +++ b/Tests/CMakeLib/testGeneratedFileStream.cxx @@ -12,10 +12,11 @@ #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" -#define cmFailed(m1, m2) \ - std::cout << "FAILED: " << m1 << m2 << "\n"; failed=1 +#define cmFailed(m1, m2) \ + std::cout << "FAILED: " << m1 << m2 << "\n"; \ + failed = 1 -int testGeneratedFileStream(int, char*[]) +int testGeneratedFileStream(int, char* []) { int failed = 0; cmGeneratedFileStream gm; @@ -39,54 +40,47 @@ int testGeneratedFileStream(int, char*[]) gm.Open(file4.c_str()); gm << "This is generated file 4"; gm.Close(); - if ( cmSystemTools::FileExists(file1.c_str()) ) - { - if ( cmSystemTools::FileExists(file2.c_str()) ) - { - if ( cmSystemTools::FileExists(file3.c_str()) ) - { - if ( cmSystemTools::FileExists(file4.c_str()) ) - { - if ( cmSystemTools::FileExists(file1tmp.c_str()) ) - { - cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file1tmp.c_str()); - } - else if ( cmSystemTools::FileExists(file2tmp.c_str()) ) - { - cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file2tmp.c_str()); - } - else if ( cmSystemTools::FileExists(file3tmp.c_str()) ) - { - cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file3tmp.c_str()); - } - else if ( cmSystemTools::FileExists(file4tmp.c_str()) ) - { - cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file4tmp.c_str()); - } - else - { + if (cmSystemTools::FileExists(file1.c_str())) { + if (cmSystemTools::FileExists(file2.c_str())) { + if (cmSystemTools::FileExists(file3.c_str())) { + if (cmSystemTools::FileExists(file4.c_str())) { + if (cmSystemTools::FileExists(file1tmp.c_str())) { + cmFailed("Something wrong with cmGeneratedFileStream. Temporary " + "file is still here: ", + file1tmp.c_str()); + } else if (cmSystemTools::FileExists(file2tmp.c_str())) { + cmFailed("Something wrong with cmGeneratedFileStream. Temporary " + "file is still here: ", + file2tmp.c_str()); + } else if (cmSystemTools::FileExists(file3tmp.c_str())) { + cmFailed("Something wrong with cmGeneratedFileStream. Temporary " + "file is still here: ", + file3tmp.c_str()); + } else if (cmSystemTools::FileExists(file4tmp.c_str())) { + cmFailed("Something wrong with cmGeneratedFileStream. Temporary " + "file is still here: ", + file4tmp.c_str()); + } else { std::cout << "cmGeneratedFileStream works\n"; - } } - else - { - cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", file4.c_str()); - } - } - else - { - cmFailed("Something wrong with cmGeneratedFileStream. Found file: ", file3.c_str()); + } else { + cmFailed( + "Something wrong with cmGeneratedFileStream. Cannot find file: ", + file4.c_str()); } + } else { + cmFailed("Something wrong with cmGeneratedFileStream. Found file: ", + file3.c_str()); } - else - { - cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", file2.c_str()); - } - } - else - { - cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", file1.c_str()); + } else { + cmFailed( + "Something wrong with cmGeneratedFileStream. Cannot find file: ", + file2.c_str()); } + } else { + cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", + file1.c_str()); + } cmSystemTools::RemoveFile(file1.c_str()); cmSystemTools::RemoveFile(file2.c_str()); cmSystemTools::RemoveFile(file3.c_str()); diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx index 37cb3fa..a575d0d 100644 --- a/Tests/CMakeLib/testRST.cxx +++ b/Tests/CMakeLib/testRST.cxx @@ -15,67 +15,57 @@ void reportLine(std::ostream& os, bool ret, std::string line, bool eol) { - if(ret) - { - os << "\"" << line << "\" (" << (eol?"with EOL":"without EOL") << ")"; - } - else - { + if (ret) { + os << "\"" << line << "\" (" << (eol ? "with EOL" : "without EOL") << ")"; + } else { os << "EOF"; - } + } } int testRST(int argc, char* argv[]) { - if(argc != 2) - { + if (argc != 2) { std::cerr << "Usage: testRST <dir>" << std::endl; return 1; - } + } std::string dir = argv[1]; - if(dir.empty()) - { + if (dir.empty()) { dir = "."; - } + } std::string a_name = "testRST.actual"; std::string e_name = dir + "/testRST.expect"; // Process the test RST file. { - std::string fname = dir + "/testRST.rst"; - std::ofstream fout(a_name.c_str()); - if(!fout) - { - std::cerr << "Could not open output " << a_name << std::endl; - return 1; + std::string fname = dir + "/testRST.rst"; + std::ofstream fout(a_name.c_str()); + if (!fout) { + std::cerr << "Could not open output " << a_name << std::endl; + return 1; } - cmRST r(fout, dir); - if(!r.ProcessFile(fname)) - { - std::cerr << "Could not open input " << fname << std::endl; - return 1; + cmRST r(fout, dir); + if (!r.ProcessFile(fname)) { + std::cerr << "Could not open input " << fname << std::endl; + return 1; } } // Compare expected and actual outputs. std::ifstream e_fin(e_name.c_str()); std::ifstream a_fin(a_name.c_str()); - if(!e_fin) - { + if (!e_fin) { std::cerr << "Could not open input " << e_name << std::endl; return 1; - } - if(!a_fin) - { + } + if (!a_fin) { std::cerr << "Could not open input " << a_name << std::endl; return 1; - } + } int lineno = 0; bool e_ret; bool a_ret; - do - { + do { std::string e_line; std::string a_line; bool e_eol; @@ -83,11 +73,11 @@ int testRST(int argc, char* argv[]) e_ret = cmSystemTools::GetLineFromStream(e_fin, e_line, &e_eol); a_ret = cmSystemTools::GetLineFromStream(a_fin, a_line, &a_eol); ++lineno; - if(e_ret != a_ret || e_line != a_line || e_eol != a_eol) - { + if (e_ret != a_ret || e_line != a_line || e_eol != a_eol) { a_fin.seekg(0, std::ios::beg); std::cerr << "Actual output does not match that expected on line " - << lineno << "." << std::endl << "Expected "; + << lineno << "." << std::endl + << "Expected "; reportLine(std::cerr, e_ret, e_line, e_eol); std::cerr << " but got "; reportLine(std::cerr, a_ret, a_line, a_eol); @@ -95,7 +85,7 @@ int testRST(int argc, char* argv[]) << "Actual output:" << std::endl << a_fin.rdbuf(); return 1; - } - } while(e_ret && a_ret); + } + } while (e_ret && a_ret); return 0; } diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index 9309ae3..a3846c0 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -12,22 +12,21 @@ #include "cmSystemTools.h" #define cmPassed(m) std::cout << "Passed: " << m << "\n" -#define cmFailed(m) std::cout << "FAILED: " << m << "\n"; failed=1 +#define cmFailed(m) \ + std::cout << "FAILED: " << m << "\n"; \ + failed = 1 -int testSystemTools(int, char*[]) +int testSystemTools(int, char* []) { int failed = 0; // ---------------------------------------------------------------------- // Test cmSystemTools::UpperCase std::string str = "abc"; std::string strupper = "ABC"; - if(cmSystemTools::UpperCase(str) == strupper) - { + if (cmSystemTools::UpperCase(str) == strupper) { cmPassed("cmSystemTools::UpperCase is working"); - } - else - { + } else { cmFailed("cmSystemTools::UpperCase is working"); - } + } return failed; } diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx index 204a717..1da23fe 100644 --- a/Tests/CMakeLib/testUTF8.cxx +++ b/Tests/CMakeLib/testUTF8.cxx @@ -19,8 +19,8 @@ typedef char test_utf8_char[5]; static void test_utf8_char_print(test_utf8_char const c) { unsigned char const* d = reinterpret_cast<unsigned char const*>(c); - printf("[0x%02X,0x%02X,0x%02X,0x%02X]", - (int)d[0], (int)d[1], (int)d[2], (int)d[3]); + printf("[0x%02X,0x%02X,0x%02X,0x%02X]", (int)d[0], (int)d[1], (int)d[2], + (int)d[3]); } struct test_utf8_entry @@ -31,33 +31,29 @@ struct test_utf8_entry }; static test_utf8_entry const good_entry[] = { - {1, "\x20\x00\x00\x00", 0x0020}, /* Space. */ - {2, "\xC2\xA9\x00\x00", 0x00A9}, /* Copyright. */ - {3, "\xE2\x80\x98\x00", 0x2018}, /* Open-single-quote. */ - {3, "\xE2\x80\x99\x00", 0x2019}, /* Close-single-quote. */ - {4, "\xF0\xA3\x8E\xB4", 0x233B4}, /* Example from RFC 3629. */ - {0, {0,0,0,0,0}, 0} + { 1, "\x20\x00\x00\x00", 0x0020 }, /* Space. */ + { 2, "\xC2\xA9\x00\x00", 0x00A9 }, /* Copyright. */ + { 3, "\xE2\x80\x98\x00", 0x2018 }, /* Open-single-quote. */ + { 3, "\xE2\x80\x99\x00", 0x2019 }, /* Close-single-quote. */ + { 4, "\xF0\xA3\x8E\xB4", 0x233B4 }, /* Example from RFC 3629. */ + { 0, { 0, 0, 0, 0, 0 }, 0 } }; static test_utf8_char const bad_chars[] = { - "\x80\x00\x00\x00", - "\xC0\x00\x00\x00", - "\xE0\x00\x00\x00", - "\xE0\x80\x80\x00", - "\xF0\x80\x80\x80", - {0,0,0,0,0} + "\x80\x00\x00\x00", "\xC0\x00\x00\x00", "\xE0\x00\x00\x00", + "\xE0\x80\x80\x00", "\xF0\x80\x80\x80", { 0, 0, 0, 0, 0 } }; static void report_good(bool passed, test_utf8_char const c) { - printf("%s: decoding good ", passed?"pass":"FAIL"); + printf("%s: decoding good ", passed ? "pass" : "FAIL"); test_utf8_char_print(c); printf(" (%s) ", c); } static void report_bad(bool passed, test_utf8_char const c) { - printf("%s: decoding bad ", passed?"pass":"FAIL"); + printf("%s: decoding bad ", passed ? "pass" : "FAIL"); test_utf8_char_print(c); printf(" "); } @@ -65,25 +61,23 @@ static void report_bad(bool passed, test_utf8_char const c) static bool decode_good(test_utf8_entry const entry) { unsigned int uc; - if(const char* e = cm_utf8_decode_character(entry.str, entry.str+4, &uc)) - { - int used = static_cast<int>(e-entry.str); - if(uc != entry.chr) - { + if (const char* e = + cm_utf8_decode_character(entry.str, entry.str + 4, &uc)) { + int used = static_cast<int>(e - entry.str); + if (uc != entry.chr) { report_good(false, entry.str); printf("expected 0x%04X, got 0x%04X\n", entry.chr, uc); return false; - } - if(used != entry.n) - { + } + if (used != entry.n) { report_good(false, entry.str); printf("had %d bytes, used %d\n", entry.n, used); return false; - } + } report_good(true, entry.str); printf("got 0x%04X\n", uc); return true; - } + } report_good(false, entry.str); printf("failed\n"); return false; @@ -92,34 +86,29 @@ static bool decode_good(test_utf8_entry const entry) static bool decode_bad(test_utf8_char const s) { unsigned int uc = 0xFFFFu; - const char* e = cm_utf8_decode_character(s, s+4, &uc); - if(e) - { + const char* e = cm_utf8_decode_character(s, s + 4, &uc); + if (e) { report_bad(false, s); printf("expected failure, got 0x%04X\n", uc); return false; - } + } report_bad(true, s); printf("failed as expected\n"); return true; } -int testUTF8(int, char*[]) +int testUTF8(int, char* []) { int result = 0; - for(test_utf8_entry const* e = good_entry; e->n; ++e) - { - if(!decode_good(*e)) - { + for (test_utf8_entry const* e = good_entry; e->n; ++e) { + if (!decode_good(*e)) { result = 1; - } } - for(test_utf8_char const* c = bad_chars; (*c)[0]; ++c) - { - if(!decode_bad(*c)) - { + } + for (test_utf8_char const* c = bad_chars; (*c)[0]; ++c) { + if (!decode_bad(*c)) { result = 1; - } } + } return result; } diff --git a/Tests/CMakeLib/testVisualStudioSlnParser.cxx b/Tests/CMakeLib/testVisualStudioSlnParser.cxx index b31cc47..f8bcfae 100644 --- a/Tests/CMakeLib/testVisualStudioSlnParser.cxx +++ b/Tests/CMakeLib/testVisualStudioSlnParser.cxx @@ -8,177 +8,149 @@ static bool parsedRight(cmVisualStudioSlnParser& parser, const std::string& file, cmSlnData& data, cmVisualStudioSlnParser::ParseResult expected = - cmVisualStudioSlnParser::ResultOK) + cmVisualStudioSlnParser::ResultOK) { - if (parser.ParseFile(SOURCE_DIR "/testVisualStudioSlnParser_data/" + file - + "." SLN_EXTENSION, - data, cmVisualStudioSlnParser::DataGroupProjects)) - { - if (expected == cmVisualStudioSlnParser::ResultOK) - { + if (parser.ParseFile(SOURCE_DIR "/testVisualStudioSlnParser_data/" + file + + "." SLN_EXTENSION, + data, cmVisualStudioSlnParser::DataGroupProjects)) { + if (expected == cmVisualStudioSlnParser::ResultOK) { return true; - } } - else - { - if (parser.GetParseResult() == expected) - { + } else { + if (parser.GetParseResult() == expected) { return true; - } } + } std::cerr << "cmVisualStudioSlnParser mis-parsed " << file << "." SLN_EXTENSION << "; expected result " << expected - << ", got " << parser.GetParseResult() - << std::endl; + << ", got " << parser.GetParseResult() << std::endl; return false; } -int testVisualStudioSlnParser(int, char*[]) +int testVisualStudioSlnParser(int, char* []) { cmVisualStudioSlnParser parser; // Test clean parser - if (parser.GetParseResult() != cmVisualStudioSlnParser::ResultOK) - { - std::cerr << "cmVisualStudioSlnParser initialisation failed" - << std::endl; + if (parser.GetParseResult() != cmVisualStudioSlnParser::ResultOK) { + std::cerr << "cmVisualStudioSlnParser initialisation failed" << std::endl; return 1; - } + } // Test parsing valid sln { - cmSlnData data; - if (!parsedRight(parser, "valid", data)) - { - return 1; + cmSlnData data; + if (!parsedRight(parser, "valid", data)) { + return 1; } - const std::vector<cmSlnProjectEntry>& projects = data.GetProjects(); - const char * const names[] = - { - "3rdParty", "ALL_BUILD", "CMakeLib", "CMakeLibTests", - "CMakePredefinedTargets", "CPackLib", "CTestDashboardTargets", "CTestLib", - "Continuous", "Documentation", - "Experimental", "INSTALL", "KWSys", "LIBCURL", "Nightly", - "NightlyMemoryCheck", "PACKAGE", "RUN_TESTS", "Tests", "Utilities", - "Win9xCompat", "ZERO_CHECK", "cmIML_test", "cmake", "cmbzip2", "cmcldeps", - "cmcompress", "cmcurl", "cmexpat", "cmlibarchive", "cmsys", - "cmsysEncodeExecutable", "cmsysProcessFwd9x", "cmsysTestDynload", - "cmsysTestProcess", "cmsysTestSharedForward", "cmsysTestsC", - "cmsysTestsCxx", "cmsys_c", "cmw9xcom", "cmzlib", "cpack", "ctest", - "documentation", "memcheck_fail", "pseudo_BC", "pseudo_purify", - "pseudo_valgrind", "test_clean", "uninstall" - /* clang-format needs this comment to break after the opening brace */ + const std::vector<cmSlnProjectEntry>& projects = data.GetProjects(); + const char* const names[] = { + "3rdParty", "ALL_BUILD", "CMakeLib", "CMakeLibTests", + "CMakePredefinedTargets", "CPackLib", "CTestDashboardTargets", + "CTestLib", "Continuous", "Documentation", "Experimental", "INSTALL", + "KWSys", "LIBCURL", "Nightly", "NightlyMemoryCheck", "PACKAGE", + "RUN_TESTS", "Tests", "Utilities", "Win9xCompat", "ZERO_CHECK", + "cmIML_test", "cmake", "cmbzip2", "cmcldeps", "cmcompress", "cmcurl", + "cmexpat", "cmlibarchive", "cmsys", "cmsysEncodeExecutable", + "cmsysProcessFwd9x", "cmsysTestDynload", "cmsysTestProcess", + "cmsysTestSharedForward", "cmsysTestsC", "cmsysTestsCxx", "cmsys_c", + "cmw9xcom", "cmzlib", "cpack", "ctest", "documentation", "memcheck_fail", + "pseudo_BC", "pseudo_purify", "pseudo_valgrind", "test_clean", + "uninstall" + /* clang-format needs this comment to break after the opening brace */ }; - const size_t expectedProjectCount = sizeof(names) / sizeof(*names); - if (projects.size() != expectedProjectCount) - { - std::cerr << "cmVisualStudioSlnParser returned bad number of " - << "projects (" << projects.size() << " instead of " - << expectedProjectCount << ')' - << std::endl; - return 1; - } - for (size_t idx = 0; idx < expectedProjectCount; ++idx) - { - if (projects[idx].GetName() != names[idx]) - { - std::cerr << "cmVisualStudioSlnParser returned bad project #" - << idx << "; expected \"" << names[idx] << "\", got \"" - << projects[idx].GetName() << '"' - << std::endl; + const size_t expectedProjectCount = sizeof(names) / sizeof(*names); + if (projects.size() != expectedProjectCount) { + std::cerr << "cmVisualStudioSlnParser returned bad number of " + << "projects (" << projects.size() << " instead of " + << expectedProjectCount << ')' << std::endl; return 1; + } + for (size_t idx = 0; idx < expectedProjectCount; ++idx) { + if (projects[idx].GetName() != names[idx]) { + std::cerr << "cmVisualStudioSlnParser returned bad project #" << idx + << "; expected \"" << names[idx] << "\", got \"" + << projects[idx].GetName() << '"' << std::endl; + return 1; } } - if (projects[0].GetRelativePath() != "Utilities\\3rdParty") - { - std::cerr << "cmVisualStudioSlnParser returned bad relative path of " - << "project 3rdParty; expected \"Utilities\\3rdParty\", " - << "got \"" << projects[0].GetRelativePath() << '"' - << std::endl; - return 1; + if (projects[0].GetRelativePath() != "Utilities\\3rdParty") { + std::cerr << "cmVisualStudioSlnParser returned bad relative path of " + << "project 3rdParty; expected \"Utilities\\3rdParty\", " + << "got \"" << projects[0].GetRelativePath() << '"' + << std::endl; + return 1; } - if (projects[2].GetGUID() != "{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}") - { - std::cerr << "cmVisualStudioSlnParser returned bad relative path of " - << "project CMakeLib; expected " - << "\"{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}\", " - << "got \"" << projects[2].GetGUID() << '"' - << std::endl; - return 1; + if (projects[2].GetGUID() != "{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}") { + std::cerr << "cmVisualStudioSlnParser returned bad relative path of " + << "project CMakeLib; expected " + << "\"{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}\", " + << "got \"" << projects[2].GetGUID() << '"' << std::endl; + return 1; } } // Test BOM parsing { - cmSlnData data; + cmSlnData data; - if (!parsedRight(parser, "bom", data)) - { - return 1; + if (!parsedRight(parser, "bom", data)) { + return 1; } - if (!parser.GetParseHadBOM()) - { - std::cerr << "cmVisualStudioSlnParser didn't find BOM in bom." - << SLN_EXTENSION - << std::endl; - return 1; + if (!parser.GetParseHadBOM()) { + std::cerr << "cmVisualStudioSlnParser didn't find BOM in bom." + << SLN_EXTENSION << std::endl; + return 1; } - if (!parsedRight(parser, "nobom", data)) - { - return 1; + if (!parsedRight(parser, "nobom", data)) { + return 1; } - if (parser.GetParseHadBOM()) - { - std::cerr << "cmVisualStudioSlnParser found BOM in nobom." - << SLN_EXTENSION - << std::endl; - return 1; + if (parser.GetParseHadBOM()) { + std::cerr << "cmVisualStudioSlnParser found BOM in nobom." + << SLN_EXTENSION << std::endl; + return 1; } } // Test invalid sln { - { - cmSlnData data; - if (!parsedRight(parser, "err-nonexistent", data, - cmVisualStudioSlnParser::ResultErrorOpeningInput)) { - return 1; + cmSlnData data; + if (!parsedRight(parser, "err-nonexistent", data, + cmVisualStudioSlnParser::ResultErrorOpeningInput)) { + return 1; + } } - } - { - cmSlnData data; - if (!parsedRight(parser, "err-empty", data, - cmVisualStudioSlnParser::ResultErrorReadingInput)) { - return 1; + cmSlnData data; + if (!parsedRight(parser, "err-empty", data, + cmVisualStudioSlnParser::ResultErrorReadingInput)) { + return 1; + } } - } - const char * const files[] = - { - "header", "projectArgs", "topLevel", "projectContents", "projectSection", - "global", "unclosed", "strayQuote", "strayParen", "strayQuote2" - /* clang-format needs this comment to break after the opening brace */ + const char* const files[] = { + "header", "projectArgs", "topLevel", "projectContents", + "projectSection", "global", "unclosed", "strayQuote", + "strayParen", "strayQuote2" + /* clang-format needs this comment to break after the opening brace */ }; - for (size_t idx = 0; idx < sizeof(files) / sizeof(files[0]); ++idx) - { - cmSlnData data; - if (!parsedRight(parser, std::string("err-structure-") + files[idx], data, - cmVisualStudioSlnParser::ResultErrorInputStructure)) - { - return 1; + for (size_t idx = 0; idx < sizeof(files) / sizeof(files[0]); ++idx) { + cmSlnData data; + if (!parsedRight(parser, std::string("err-structure-") + files[idx], + data, + cmVisualStudioSlnParser::ResultErrorInputStructure)) { + return 1; } } - { - cmSlnData data; - if (!parsedRight(parser, "err-data", data, - cmVisualStudioSlnParser::ResultErrorInputData)) { - return 1; + cmSlnData data; + if (!parsedRight(parser, "err-data", data, + cmVisualStudioSlnParser::ResultErrorInputData)) { + return 1; + } } } - } // All is well return 0; diff --git a/Tests/CMakeLib/testXMLParser.cxx b/Tests/CMakeLib/testXMLParser.cxx index b5219e2..1fd5113 100644 --- a/Tests/CMakeLib/testXMLParser.cxx +++ b/Tests/CMakeLib/testXMLParser.cxx @@ -4,14 +4,13 @@ #include <iostream> -int testXMLParser(int, char*[]) +int testXMLParser(int, char* []) { // TODO: Derive from parser and check attributes. cmXMLParser parser; - if(!parser.ParseFile(SOURCE_DIR "/testXMLParser.xml")) - { + if (!parser.ParseFile(SOURCE_DIR "/testXMLParser.xml")) { std::cerr << "cmXMLParser failed!" << std::endl; return 1; - } + } return 0; } diff --git a/Tests/CMakeLib/testXMLSafe.cxx b/Tests/CMakeLib/testXMLSafe.cxx index 9e4960c..34c38fb 100644 --- a/Tests/CMakeLib/testXMLSafe.cxx +++ b/Tests/CMakeLib/testXMLSafe.cxx @@ -20,28 +20,26 @@ struct test_pair }; static test_pair const pairs[] = { - {"copyright \xC2\xA9", "copyright \xC2\xA9"}, - {"form-feed \f", "form-feed [NON-XML-CHAR-0xC]"}, - {"angles <>", "angles <>"}, - {"ampersand &", "ampersand &"}, - {"bad-byte \x80", "bad-byte [NON-UTF-8-BYTE-0x80]"}, - {0,0} + { "copyright \xC2\xA9", "copyright \xC2\xA9" }, + { "form-feed \f", "form-feed [NON-XML-CHAR-0xC]" }, + { "angles <>", "angles <>" }, + { "ampersand &", "ampersand &" }, + { "bad-byte \x80", "bad-byte [NON-UTF-8-BYTE-0x80]" }, + { 0, 0 } }; -int testXMLSafe(int, char*[]) +int testXMLSafe(int, char* []) { int result = 0; - for(test_pair const* p = pairs; p->in; ++p) - { + for (test_pair const* p = pairs; p->in; ++p) { cmXMLSafe xs(p->in); std::ostringstream oss; oss << xs; std::string out = oss.str(); - if(out != p->out) - { + if (out != p->out) { printf("expected [%s], got [%s]\n", p->out, out.c_str()); result = 1; - } } + } return result; } diff --git a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h index 82bb049..ad21c13 100644 --- a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h +++ b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h @@ -2,8 +2,9 @@ #define _CSHM_DUMMY_H struct non_existent_struct; -struct struct_with_member{ - int member; +struct struct_with_member +{ + int member; }; #endif diff --git a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx index 458a99b..f3e9326 100644 --- a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx +++ b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx @@ -4,13 +4,14 @@ namespace ns { class non_existent_class; -class class_with_non_existent_members { +class class_with_non_existent_members +{ }; -class class_with_member { +class class_with_member +{ public: - int foo; + int foo; }; - } #endif diff --git a/Tests/CMakeOnly/LinkInterfaceLoop/lib.c b/Tests/CMakeOnly/LinkInterfaceLoop/lib.c index fede1d6..abe3b78 100644 --- a/Tests/CMakeOnly/LinkInterfaceLoop/lib.c +++ b/Tests/CMakeOnly/LinkInterfaceLoop/lib.c @@ -1 +1,4 @@ -int lib(void) { return 0; } +int lib(void) +{ + return 0; +} diff --git a/Tests/CMakeOnly/LinkInterfaceLoop/main.c b/Tests/CMakeOnly/LinkInterfaceLoop/main.c index 78f2de1..8488f4e 100644 --- a/Tests/CMakeOnly/LinkInterfaceLoop/main.c +++ b/Tests/CMakeOnly/LinkInterfaceLoop/main.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/COnly/conly.c b/Tests/COnly/conly.c index 7214fe1..7bd8e8e 100644 --- a/Tests/COnly/conly.c +++ b/Tests/COnly/conly.c @@ -5,19 +5,17 @@ #include <stdio.h> -int main () +int main() { int class = 0; - if ( LibC1Func() != 2.0 ) - { + if (LibC1Func() != 2.0) { printf("Problem with libc1\n"); return 1; - } - if ( LibC2Func() != 1.0 ) - { + } + if (LibC2Func() != 1.0) { printf("Problem with libc2\n"); return 1; - } + } printf("Foo: %s %d\n", foo, class); return 0; } diff --git a/Tests/COnly/libc2.h b/Tests/COnly/libc2.h index 2713d71..7bc4fb1 100644 --- a/Tests/COnly/libc2.h +++ b/Tests/COnly/libc2.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef testc2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef testc2_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float LibC2Func(); diff --git a/Tests/COnly/testCModule.c b/Tests/COnly/testCModule.c index 1a89292..4381bd7 100644 --- a/Tests/COnly/testCModule.c +++ b/Tests/COnly/testCModule.c @@ -1,6 +1,9 @@ #ifdef _WIN32 -# define TEST_EXPORT __declspec(dllexport) +#define TEST_EXPORT __declspec(dllexport) #else -# define TEST_EXPORT +#define TEST_EXPORT #endif -TEST_EXPORT int testCModule(void) { return 0; } +TEST_EXPORT int testCModule(void) +{ + return 0; +} diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/CPackWiXGenerator/myotherapp.cpp index c272dab..0eefc1c 100644 --- a/Tests/CPackWiXGenerator/myotherapp.cpp +++ b/Tests/CPackWiXGenerator/myotherapp.cpp @@ -1 +1,3 @@ -int main() {}
\ No newline at end of file +int main() +{ +}
\ No newline at end of file diff --git a/Tests/CTestConfig/CTestConfig.cxx b/Tests/CTestConfig/CTestConfig.cxx index 49c5324..45c6c06 100644 --- a/Tests/CTestConfig/CTestConfig.cxx +++ b/Tests/CTestConfig/CTestConfig.cxx @@ -3,8 +3,7 @@ int main(int argc, const char* argv[]) { int i = 0; - for (; i<argc; ++i) - { + for (; i < argc; ++i) { fprintf(stdout, "%s\n", argv[i]); } diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp index 85e6cd8..3695dc9 100644 --- a/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp +++ b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp @@ -1 +1,3 @@ -void foo() {} +void foo() +{ +} diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp index c3a2c12..89c1a66 100644 --- a/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp +++ b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp @@ -1 +1,3 @@ -void extra() {} +void extra() +{ +} diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp index 237c8ce..5047a34 100644 --- a/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp +++ b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp @@ -1 +1,3 @@ -int main() {} +int main() +{ +} diff --git a/Tests/CTestTest/SmallAndFast/echoargs.c b/Tests/CTestTest/SmallAndFast/echoargs.c index 6e17464..19063b4 100644 --- a/Tests/CTestTest/SmallAndFast/echoargs.c +++ b/Tests/CTestTest/SmallAndFast/echoargs.c @@ -3,8 +3,7 @@ int main(int argc, const char* argv[]) { int i = 0; - for (; i<argc; ++i) - { + for (; i < argc; ++i) { fprintf(stdout, "%s\n", argv[i]); } return 0; diff --git a/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx index 8ea5e40..d2396b7 100644 --- a/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx +++ b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx @@ -2,9 +2,9 @@ int main(int argc, const char* argv[]) { - unsigned int i = 0; // "i<argc" should produce a "signed/unsigned comparison" warning - for (; i<argc; ++i) - { + unsigned int i = + 0; // "i<argc" should produce a "signed/unsigned comparison" warning + for (; i < argc; ++i) { fprintf(stdout, "%s\n", argv[i]); } return 0; diff --git a/Tests/CTestTestCostSerial/sleep.c b/Tests/CTestTestCostSerial/sleep.c index cb9f87a..b7abe94 100644 --- a/Tests/CTestTestCostSerial/sleep.c +++ b/Tests/CTestTestCostSerial/sleep.c @@ -1,7 +1,7 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif /* sleeps for 1 second */ diff --git a/Tests/CTestTestCrash/crash.cxx b/Tests/CTestTestCrash/crash.cxx index bc9e096..370c3fb 100644 --- a/Tests/CTestTestCrash/crash.cxx +++ b/Tests/CTestTestCrash/crash.cxx @@ -1,4 +1,4 @@ -//causes a segfault +// causes a segfault int main() { int* ptr = 0; diff --git a/Tests/CTestTestFailure/badCode.cxx b/Tests/CTestTestFailure/badCode.cxx index b410f0a..8102883 100644 --- a/Tests/CTestTestFailure/badCode.cxx +++ b/Tests/CTestTestFailure/badCode.cxx @@ -1,4 +1,4 @@ int main() { -this code will not compile + this code will not compile } diff --git a/Tests/CTestTestFdSetSize/sleep.c b/Tests/CTestTestFdSetSize/sleep.c index b2e6a87..6676488 100644 --- a/Tests/CTestTestFdSetSize/sleep.c +++ b/Tests/CTestTestFdSetSize/sleep.c @@ -1,7 +1,7 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif /* sleeps for 0.1 second */ diff --git a/Tests/CTestTestParallel/lockFile.c b/Tests/CTestTestParallel/lockFile.c index 6a6a889..a515107 100644 --- a/Tests/CTestTestParallel/lockFile.c +++ b/Tests/CTestTestParallel/lockFile.c @@ -10,11 +10,10 @@ int main(void) const char* fname = "lockedFile.txt"; file = fopen(fname, "w"); - for(i = 0; i < 10000; i++) - { + for (i = 0; i < 10000; i++) { fprintf(file, "%s", "x"); fflush(file); - } + } fclose(file); return remove(fname); } diff --git a/Tests/CTestTestResourceLock/lockFile.c b/Tests/CTestTestResourceLock/lockFile.c index a6a4dc0..8c023ef 100644 --- a/Tests/CTestTestResourceLock/lockFile.c +++ b/Tests/CTestTestResourceLock/lockFile.c @@ -1,7 +1,7 @@ #include <stdio.h> /* Disable deprecation warning for fopen */ -#pragma warning(disable: 4996) +#pragma warning(disable : 4996) /*if run serially, works fine. If run in parallel, someone will attempt to delete @@ -11,21 +11,17 @@ int main(int argc, char** argv) FILE* file; int i; const char* fname; - if(argc >= 2) - { + if (argc >= 2) { fname = argv[1]; - } - else - { + } else { fname = "lockedFile.txt"; - } + } file = fopen(fname, "w"); - for(i = 0; i < 10000; i++) - { + for (i = 0; i < 10000; i++) { fprintf(file, "%s", "x"); fflush(file); - } + } fclose(file); return remove(fname); } diff --git a/Tests/CTestTestScheduler/sleep.c b/Tests/CTestTestScheduler/sleep.c index 9631a68..41a5d45 100644 --- a/Tests/CTestTestScheduler/sleep.c +++ b/Tests/CTestTestScheduler/sleep.c @@ -1,17 +1,16 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif /* sleeps for 4n seconds, where n is the argument to the program */ int main(int argc, char** argv) { int time; - if(argc > 1) - { + if (argc > 1) { time = 4 * atoi(argv[1]); - } + } #if defined(_WIN32) Sleep(time * 1000); #else diff --git a/Tests/CTestTestStopTime/sleep.c b/Tests/CTestTestStopTime/sleep.c index b589647..3baad9e 100644 --- a/Tests/CTestTestStopTime/sleep.c +++ b/Tests/CTestTestStopTime/sleep.c @@ -1,17 +1,16 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif /* sleeps for n seconds, where n is the argument to the program */ int main(int argc, char** argv) { int time; - if(argc > 1) - { + if (argc > 1) { time = atoi(argv[1]); - } + } #if defined(_WIN32) Sleep(time * 1000); #else diff --git a/Tests/CTestTestTimeout/sleep.c b/Tests/CTestTestTimeout/sleep.c index 33ce307..a4872b5 100644 --- a/Tests/CTestTestTimeout/sleep.c +++ b/Tests/CTestTestTimeout/sleep.c @@ -1,7 +1,7 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif #include <stdio.h> @@ -11,9 +11,9 @@ int main(void) fprintf(stderr, "before sleep\n"); fflush(stderr); /* should not be needed, but just in case */ #if defined(_WIN32) - Sleep((TIMEOUT+4)*1000); + Sleep((TIMEOUT + 4) * 1000); #else - sleep((TIMEOUT+4)); + sleep((TIMEOUT + 4)); #endif fprintf(stderr, "after sleep\n"); fflush(stderr); /* should not be needed, but just in case */ diff --git a/Tests/CTestTestUpload/sleep.c b/Tests/CTestTestUpload/sleep.c index b589647..3baad9e 100644 --- a/Tests/CTestTestUpload/sleep.c +++ b/Tests/CTestTestUpload/sleep.c @@ -1,17 +1,16 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif /* sleeps for n seconds, where n is the argument to the program */ int main(int argc, char** argv) { int time; - if(argc > 1) - { + if (argc > 1) { time = atoi(argv[1]); - } + } #if defined(_WIN32) Sleep(time * 1000); #else diff --git a/Tests/CTestTestZeroTimeout/sleep.c b/Tests/CTestTestZeroTimeout/sleep.c index d40d59d..0be7bbc 100644 --- a/Tests/CTestTestZeroTimeout/sleep.c +++ b/Tests/CTestTestZeroTimeout/sleep.c @@ -1,7 +1,7 @@ #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #else -# include <unistd.h> +#include <unistd.h> #endif /* sleeps for 5 seconds */ diff --git a/Tests/CompatibleInterface/bar.cpp b/Tests/CompatibleInterface/bar.cpp index 2e09900..69b16c3 100644 --- a/Tests/CompatibleInterface/bar.cpp +++ b/Tests/CompatibleInterface/bar.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int bar() + int bar() { return 0; } diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index d20b64b..93723af 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -23,13 +23,16 @@ #error Expected STRING_PROP3 #endif -template<bool test> +template <bool test> struct CMakeStaticAssert; -template<> -struct CMakeStaticAssert<true> {}; +template <> +struct CMakeStaticAssert<true> +{ +}; -enum { +enum +{ NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>), NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>), NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>), @@ -44,9 +47,9 @@ int foo(); #ifdef _WIN32 __declspec(dllimport) #endif -int bar(); + int bar(); -int main(int argc, char **argv) +int main(int argc, char** argv) { Iface2 if2; return if2.foo() + foo() + bar(); diff --git a/Tests/CompileCommandOutput/compile_command_output.cxx b/Tests/CompileCommandOutput/compile_command_output.cxx index 145a064..25795a0 100644 --- a/Tests/CompileCommandOutput/compile_command_output.cxx +++ b/Tests/CompileCommandOutput/compile_command_output.cxx @@ -1,7 +1,7 @@ #include "file_with_underscores.h" #include "relative.h" -int main (int argc, char** argv) +int main(int argc, char** argv) { file_with_underscores(); relative(); diff --git a/Tests/CompileCommandOutput/file_with_underscores.cxx b/Tests/CompileCommandOutput/file_with_underscores.cxx index 4f42ccf..d45c3e0 100644 --- a/Tests/CompileCommandOutput/file_with_underscores.cxx +++ b/Tests/CompileCommandOutput/file_with_underscores.cxx @@ -1,3 +1,5 @@ #include "file_with_underscores.h" -void file_with_underscores() {} +void file_with_underscores() +{ +} diff --git a/Tests/CompileCommandOutput/relative.cxx b/Tests/CompileCommandOutput/relative.cxx index eae11e2..cd1d9b6 100644 --- a/Tests/CompileCommandOutput/relative.cxx +++ b/Tests/CompileCommandOutput/relative.cxx @@ -1,3 +1,5 @@ #include "relative.h" -void relative() {} +void relative() +{ +} diff --git a/Tests/CompileCommandOutput/relative.h b/Tests/CompileCommandOutput/relative.h index ddfe551..221e354 100644 --- a/Tests/CompileCommandOutput/relative.h +++ b/Tests/CompileCommandOutput/relative.h @@ -1,11 +1,11 @@ #if defined(_WIN32) -# ifdef test2_EXPORTS -# define TEST2_EXPORT __declspec(dllexport) -# else -# define TEST2_EXPORT __declspec(dllimport) -# endif +#ifdef test2_EXPORTS +#define TEST2_EXPORT __declspec(dllexport) #else -# define TEST2_EXPORT +#define TEST2_EXPORT __declspec(dllimport) +#endif +#else +#define TEST2_EXPORT #endif TEST2_EXPORT void relative(); 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; +} diff --git a/Tests/CompileFeatures/c_restrict.c b/Tests/CompileFeatures/c_restrict.c index 7bc7566..5082da8 100644 --- a/Tests/CompileFeatures/c_restrict.c +++ b/Tests/CompileFeatures/c_restrict.c @@ -1,5 +1,5 @@ -int f (int * restrict a, int * restrict b) +int f(int* restrict a, int* restrict b) { (void)a; (void)b; diff --git a/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp b/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp index 63a3713..3d1076f 100644 --- a/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp +++ b/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp @@ -1,5 +1,8 @@ -struct X { int i, j, k = 42; }; +struct X +{ + int i, j, k = 42; +}; int someFunc() { diff --git a/Tests/CompileFeatures/cxx_alias_templates.cpp b/Tests/CompileFeatures/cxx_alias_templates.cpp index a47e27d..0859692 100644 --- a/Tests/CompileFeatures/cxx_alias_templates.cpp +++ b/Tests/CompileFeatures/cxx_alias_templates.cpp @@ -7,5 +7,5 @@ struct A }; using B = A<int, char>; -template<typename T> +template <typename T> using C = A<int, T>; diff --git a/Tests/CompileFeatures/cxx_alignas.cpp b/Tests/CompileFeatures/cxx_alignas.cpp index 35b7c82..9fc2c2a 100644 --- a/Tests/CompileFeatures/cxx_alignas.cpp +++ b/Tests/CompileFeatures/cxx_alignas.cpp @@ -1,4 +1,5 @@ -struct S1 { +struct S1 +{ alignas(8) int n; }; diff --git a/Tests/CompileFeatures/cxx_attribute_deprecated.cpp b/Tests/CompileFeatures/cxx_attribute_deprecated.cpp index b6f307d..5482db8 100644 --- a/Tests/CompileFeatures/cxx_attribute_deprecated.cpp +++ b/Tests/CompileFeatures/cxx_attribute_deprecated.cpp @@ -1,6 +1,5 @@ -[[deprecated]] -int foo() +[[deprecated]] int foo() { return 0; } diff --git a/Tests/CompileFeatures/cxx_attributes.cpp b/Tests/CompileFeatures/cxx_attributes.cpp index a3c89ea..1434317 100644 --- a/Tests/CompileFeatures/cxx_attributes.cpp +++ b/Tests/CompileFeatures/cxx_attributes.cpp @@ -1,2 +1,5 @@ -void unusedFunc [[noreturn]] () { throw 1; } +void unusedFunc[[noreturn]]() +{ + throw 1; +} diff --git a/Tests/CompileFeatures/cxx_contextual_conversions.cpp b/Tests/CompileFeatures/cxx_contextual_conversions.cpp index 3438624..cbc7304 100644 --- a/Tests/CompileFeatures/cxx_contextual_conversions.cpp +++ b/Tests/CompileFeatures/cxx_contextual_conversions.cpp @@ -1,33 +1,42 @@ -#define assert(E) if(!(E)) return 1; +#define assert(E) \ + if (!(E)) \ + return 1; -template<class T> +template <class T> class zero_init { public: - zero_init( ) - : val( static_cast<T>(0) ) { } - zero_init( T val ) : val( val ) - { } - operator T & ( ) { return val; } - operator T ( ) const { return val; } + zero_init() + : val(static_cast<T>(0)) + { + } + zero_init(T val) + : val(val) + { + } + operator T&() { return val; } + operator T() const { return val; } private: T val; }; int someFunc() { - zero_init<int*> p; assert( p == 0 ); + zero_init<int*> p; + assert(p == 0); p = new int(7); - assert( *p == 7 ); + assert(*p == 7); delete p; - zero_init<int> i; assert( i == 0 ); + zero_init<int> i; + assert(i == 0); i = 7; - assert( i == 7 ); - switch( i ) { } + assert(i == 7); + switch (i) { + } - int *vp = new int[i]; + int* vp = new int[i]; return 0; } diff --git a/Tests/CompileFeatures/cxx_decltype_incomplete_return_types.cpp b/Tests/CompileFeatures/cxx_decltype_incomplete_return_types.cpp index 109d038..74bcbe1 100644 --- a/Tests/CompileFeatures/cxx_decltype_incomplete_return_types.cpp +++ b/Tests/CompileFeatures/cxx_decltype_incomplete_return_types.cpp @@ -1,14 +1,19 @@ -template<class T> +template <class T> struct A { ~A() = delete; }; -template<class T> auto h() -> A<T>; -template<class T> auto i(T) -> T; -template<class T> auto f(T) -> decltype(i(h<T>())); -template<class T> auto f(T) -> void; -auto g() -> void { +template <class T> +auto h() -> A<T>; +template <class T> +auto i(T) -> T; +template <class T> +auto f(T) -> decltype(i(h<T>())); +template <class T> +auto f(T) -> void; +auto g() -> void +{ f(42); } diff --git a/Tests/CompileFeatures/cxx_default_function_template_args.cpp b/Tests/CompileFeatures/cxx_default_function_template_args.cpp index 3d14c52..bcca6aa 100644 --- a/Tests/CompileFeatures/cxx_default_function_template_args.cpp +++ b/Tests/CompileFeatures/cxx_default_function_template_args.cpp @@ -1,5 +1,5 @@ -template<typename T = int> +template <typename T = int> int someFunc() { T t = 0; diff --git a/Tests/CompileFeatures/cxx_defaulted_functions.cpp b/Tests/CompileFeatures/cxx_defaulted_functions.cpp index b679a92..3b15adc 100644 --- a/Tests/CompileFeatures/cxx_defaulted_functions.cpp +++ b/Tests/CompileFeatures/cxx_defaulted_functions.cpp @@ -1,5 +1,6 @@ -struct A { +struct A +{ A() = default; }; diff --git a/Tests/CompileFeatures/cxx_delegating_constructors.cpp b/Tests/CompileFeatures/cxx_delegating_constructors.cpp index 4b41615..7e04939 100644 --- a/Tests/CompileFeatures/cxx_delegating_constructors.cpp +++ b/Tests/CompileFeatures/cxx_delegating_constructors.cpp @@ -7,7 +7,6 @@ public: Foo(double d) : Foo(static_cast<int>(d)) { - } private: diff --git a/Tests/CompileFeatures/cxx_digit_separators.cpp b/Tests/CompileFeatures/cxx_digit_separators.cpp index abcd1c8..a40ac0a 100644 --- a/Tests/CompileFeatures/cxx_digit_separators.cpp +++ b/Tests/CompileFeatures/cxx_digit_separators.cpp @@ -1,6 +1,5 @@ int someFunc() { - int one_thousand = 1'000; - return one_thousand - 1000; + int one_thousand = 1'000; return one_thousand - 1000; } diff --git a/Tests/CompileFeatures/cxx_explicit_conversions.cpp b/Tests/CompileFeatures/cxx_explicit_conversions.cpp index 0decdcd..a34128f 100644 --- a/Tests/CompileFeatures/cxx_explicit_conversions.cpp +++ b/Tests/CompileFeatures/cxx_explicit_conversions.cpp @@ -2,9 +2,7 @@ class A { int m_i; + public: - explicit operator bool() - { - return m_i != 0; - } + explicit operator bool() { return m_i != 0; } }; diff --git a/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp b/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp index 631c699..bde94d2 100644 --- a/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp +++ b/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp @@ -2,7 +2,11 @@ template <typename T> struct B { - B() : m_i(42) {} + B() + : m_i(42) + { + } + private: int m_i; friend T; @@ -10,7 +14,7 @@ private: struct A { - template<typename T> + template <typename T> int getBValue(B<T> b) { return b.m_i; diff --git a/Tests/CompileFeatures/cxx_extern_templates.cpp b/Tests/CompileFeatures/cxx_extern_templates.cpp index 9fa4aa4..01f300a 100644 --- a/Tests/CompileFeatures/cxx_extern_templates.cpp +++ b/Tests/CompileFeatures/cxx_extern_templates.cpp @@ -1,5 +1,5 @@ -template<typename T> +template <typename T> void someFunc() { } diff --git a/Tests/CompileFeatures/cxx_final.cpp b/Tests/CompileFeatures/cxx_final.cpp index 598cb94..9d5d5c4 100644 --- a/Tests/CompileFeatures/cxx_final.cpp +++ b/Tests/CompileFeatures/cxx_final.cpp @@ -1,2 +1,4 @@ -struct A final {}; +struct A final +{ +}; diff --git a/Tests/CompileFeatures/cxx_generalized_initializers.cpp b/Tests/CompileFeatures/cxx_generalized_initializers.cpp index ad05f12..cfe9d98 100644 --- a/Tests/CompileFeatures/cxx_generalized_initializers.cpp +++ b/Tests/CompileFeatures/cxx_generalized_initializers.cpp @@ -1,19 +1,22 @@ #if defined(_MSC_VER) && _MSC_VER == 1800 && _MSC_FULL_VER < 180030723 -# error "VS 2013 safely supports this only with Update 3 or greater" +#error "VS 2013 safely supports this only with Update 3 or greater" #endif // Dummy implementation. Test only the compiler feature. namespace std { - typedef decltype(sizeof(int)) size_t; - template <class _E> - class initializer_list +typedef decltype(sizeof(int)) size_t; +template <class _E> +class initializer_list +{ + const _E* __begin_; + size_t __size_; + +public: + template <typename T1, typename T2> + initializer_list(T1, T2) { - const _E* __begin_; - size_t __size_; - public: - template <typename T1, typename T2> - initializer_list(T1, T2) {} - }; + } +}; } template <typename T> diff --git a/Tests/CompileFeatures/cxx_inheriting_constructors.cpp b/Tests/CompileFeatures/cxx_inheriting_constructors.cpp index cfce880..51400ce 100644 --- a/Tests/CompileFeatures/cxx_inheriting_constructors.cpp +++ b/Tests/CompileFeatures/cxx_inheriting_constructors.cpp @@ -3,7 +3,10 @@ struct A { int m_i; - A(int i) : m_i(i) {} + A(int i) + : m_i(i) + { + } }; struct B : public A diff --git a/Tests/CompileFeatures/cxx_inline_namespaces.cpp b/Tests/CompileFeatures/cxx_inline_namespaces.cpp index 59fa9c8..77f99e8 100644 --- a/Tests/CompileFeatures/cxx_inline_namespaces.cpp +++ b/Tests/CompileFeatures/cxx_inline_namespaces.cpp @@ -1,26 +1,25 @@ -namespace Lib -{ -inline namespace Lib_1 -{ - template <typename T> class A; +namespace Lib { +inline namespace Lib_1 { +template <typename T> +class A; } -template <typename T> void g(T); +template <typename T> +void g(T); } -struct MyClass { - +struct MyClass +{ }; -namespace Lib +namespace Lib { +template <> +class A<MyClass> { -template<> -class A<MyClass> { - }; } void someFunc() { Lib::A<MyClass> a; - g(a); // ok, Lib is an associated namespace of A + g(a); // ok, Lib is an associated namespace of A } diff --git a/Tests/CompileFeatures/cxx_lambda_init_captures.cpp b/Tests/CompileFeatures/cxx_lambda_init_captures.cpp index 7e337fa..46f22cb 100644 --- a/Tests/CompileFeatures/cxx_lambda_init_captures.cpp +++ b/Tests/CompileFeatures/cxx_lambda_init_captures.cpp @@ -2,5 +2,6 @@ int someFunc() { int a = 0; - return [b = static_cast<int&&>(a)]() { return b; }(); + return [b = static_cast<int&&>(a)]() { return b; } + (); } diff --git a/Tests/CompileFeatures/cxx_lambdas.cpp b/Tests/CompileFeatures/cxx_lambdas.cpp index eecaa23..7cd1fab 100644 --- a/Tests/CompileFeatures/cxx_lambdas.cpp +++ b/Tests/CompileFeatures/cxx_lambdas.cpp @@ -1,5 +1,5 @@ void someFunc() { - [](){}(); + []() {}(); } diff --git a/Tests/CompileFeatures/cxx_local_type_template_args.cpp b/Tests/CompileFeatures/cxx_local_type_template_args.cpp index 802ea7a..00565e6 100644 --- a/Tests/CompileFeatures/cxx_local_type_template_args.cpp +++ b/Tests/CompileFeatures/cxx_local_type_template_args.cpp @@ -1,13 +1,27 @@ template <typename T> -class X { }; +class X +{ +}; template <typename T> -void f(T t) { } -struct {} unnamed_obj; -void f() { - struct A { }; - enum { e1 }; - typedef struct {} B; +void f(T t) +{ +} +struct +{ +} unnamed_obj; +void f() +{ + struct A + { + }; + enum + { + e1 + }; + typedef struct + { + } B; B b; X<A> x1; X<A*> x2; diff --git a/Tests/CompileFeatures/cxx_noexcept.cpp b/Tests/CompileFeatures/cxx_noexcept.cpp index a3c05b8..535e5db 100644 --- a/Tests/CompileFeatures/cxx_noexcept.cpp +++ b/Tests/CompileFeatures/cxx_noexcept.cpp @@ -1,5 +1,4 @@ void someFunc() noexcept { - } diff --git a/Tests/CompileFeatures/cxx_nullptr.cpp b/Tests/CompileFeatures/cxx_nullptr.cpp index 96307df..a31422d 100644 --- a/Tests/CompileFeatures/cxx_nullptr.cpp +++ b/Tests/CompileFeatures/cxx_nullptr.cpp @@ -1,7 +1,6 @@ void someFunc(int*) { - } void otherFunc() diff --git a/Tests/CompileFeatures/cxx_override.cpp b/Tests/CompileFeatures/cxx_override.cpp index 55bec13..3283f2f 100644 --- a/Tests/CompileFeatures/cxx_override.cpp +++ b/Tests/CompileFeatures/cxx_override.cpp @@ -1,7 +1,9 @@ -struct A { +struct A +{ virtual void doNothing() {} }; -struct B : A { +struct B : A +{ void doNothing() override {} }; diff --git a/Tests/CompileFeatures/cxx_range_for.cpp b/Tests/CompileFeatures/cxx_range_for.cpp index 892109e..e3b5724 100644 --- a/Tests/CompileFeatures/cxx_range_for.cpp +++ b/Tests/CompileFeatures/cxx_range_for.cpp @@ -3,8 +3,7 @@ void someFunc() { int accumulated = 0; int numbers[] = { 1, 2, 5 }; - for (int i : numbers) - { + for (int i : numbers) { accumulated += i; - } + } } diff --git a/Tests/CompileFeatures/cxx_reference_qualified_functions.cpp b/Tests/CompileFeatures/cxx_reference_qualified_functions.cpp index 83a2361..2fd36e0 100644 --- a/Tests/CompileFeatures/cxx_reference_qualified_functions.cpp +++ b/Tests/CompileFeatures/cxx_reference_qualified_functions.cpp @@ -1,11 +1,13 @@ -struct test{ - void f() & { } - void f() && { } +struct test +{ + void f() & {} + void f() && {} }; -void someFunc(){ +void someFunc() +{ test t; - t.f(); // lvalue + t.f(); // lvalue test().f(); // rvalue } diff --git a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp index bce82e3..7b3602c 100644 --- a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp +++ b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp @@ -1,12 +1,16 @@ -struct X { - constexpr X() : n(5) { +struct X +{ + constexpr X() + : n(5) + { n *= 2; } int n; }; -constexpr int g(const int (&is)[4]) { +constexpr int g(const int (&is)[4]) +{ X x; int r = x.n; for (int i = 0; i < 5; ++i) diff --git a/Tests/CompileFeatures/cxx_return_type_deduction.cpp b/Tests/CompileFeatures/cxx_return_type_deduction.cpp index 009e919..a3108df 100644 --- a/Tests/CompileFeatures/cxx_return_type_deduction.cpp +++ b/Tests/CompileFeatures/cxx_return_type_deduction.cpp @@ -1,7 +1,7 @@ auto sum(int a, int b) { - return a+b; + return a + b; } int someFunc() diff --git a/Tests/CompileFeatures/cxx_right_angle_brackets.cpp b/Tests/CompileFeatures/cxx_right_angle_brackets.cpp index 2713fd8..8f1b0ee 100644 --- a/Tests/CompileFeatures/cxx_right_angle_brackets.cpp +++ b/Tests/CompileFeatures/cxx_right_angle_brackets.cpp @@ -1,5 +1,5 @@ -template<typename T> +template <typename T> struct A { typedef T Result; @@ -7,6 +7,6 @@ struct A void someFunc() { - A<A<int>> object; + A<A<int> > object; (void)object; } diff --git a/Tests/CompileFeatures/cxx_rvalue_references.cpp b/Tests/CompileFeatures/cxx_rvalue_references.cpp index 787026a..3b85ab6 100644 --- a/Tests/CompileFeatures/cxx_rvalue_references.cpp +++ b/Tests/CompileFeatures/cxx_rvalue_references.cpp @@ -1,5 +1,4 @@ void someFunc(int&&) { - } diff --git a/Tests/CompileFeatures/cxx_template_template_parameters.cpp b/Tests/CompileFeatures/cxx_template_template_parameters.cpp index 0fdd18d..d57dd36 100644 --- a/Tests/CompileFeatures/cxx_template_template_parameters.cpp +++ b/Tests/CompileFeatures/cxx_template_template_parameters.cpp @@ -1,14 +1,12 @@ -template<template <typename> class T, typename U> +template <template <typename> class T, typename U> void someFunc(T<U>) { - } -template<typename T> +template <typename T> struct A { - }; void otherFunc() diff --git a/Tests/CompileFeatures/cxx_uniform_initialization.cpp b/Tests/CompileFeatures/cxx_uniform_initialization.cpp index 82c76e2..e5048d1 100644 --- a/Tests/CompileFeatures/cxx_uniform_initialization.cpp +++ b/Tests/CompileFeatures/cxx_uniform_initialization.cpp @@ -1,9 +1,12 @@ -struct A {}; -struct B { +struct A +{ +}; +struct B +{ B(A) {} }; void Func() { - B b{A{}}; + B b{ A{} }; } diff --git a/Tests/CompileFeatures/cxx_unrestricted_unions.cpp b/Tests/CompileFeatures/cxx_unrestricted_unions.cpp index 698fd61..f6d64f6 100644 --- a/Tests/CompileFeatures/cxx_unrestricted_unions.cpp +++ b/Tests/CompileFeatures/cxx_unrestricted_unions.cpp @@ -1,10 +1,16 @@ -struct point { +struct point +{ point() {} - point(int x, int y) : x_(x), y_(y) {} + point(int x, int y) + : x_(x) + , y_(y) + { + } int x_, y_; }; -union u { +union u +{ point p_; int i_; const char* s_; diff --git a/Tests/CompileFeatures/cxx_user_literals.cpp b/Tests/CompileFeatures/cxx_user_literals.cpp index 9e5a588..5144204 100644 --- a/Tests/CompileFeatures/cxx_user_literals.cpp +++ b/Tests/CompileFeatures/cxx_user_literals.cpp @@ -1,5 +1,5 @@ -long double operator "" _meters(long double); +long double operator"" _meters(long double); void someFunc() { diff --git a/Tests/CompileFeatures/cxx_variable_templates.cpp b/Tests/CompileFeatures/cxx_variable_templates.cpp index 5d4bdbc..8e6fc99 100644 --- a/Tests/CompileFeatures/cxx_variable_templates.cpp +++ b/Tests/CompileFeatures/cxx_variable_templates.cpp @@ -1,5 +1,5 @@ -template<typename T> +template <typename T> constexpr T pi = T(3.1415926535897932385); int someFunc() diff --git a/Tests/CompileFeatures/cxx_variadic_templates.cpp b/Tests/CompileFeatures/cxx_variadic_templates.cpp index e1f641b..3dc2570 100644 --- a/Tests/CompileFeatures/cxx_variadic_templates.cpp +++ b/Tests/CompileFeatures/cxx_variadic_templates.cpp @@ -3,63 +3,61 @@ #endif #ifdef OLD_GNU -template<int... Is> +template <int... Is> struct Interface; #endif -template<int I, int... Is> +template <int I, int... Is> struct Interface #ifdef OLD_GNU - <I, Is...> + <I, Is...> #endif { - static int accumulate() - { - return I + Interface<Is...>::accumulate(); - } + static int accumulate() { return I + Interface<Is...>::accumulate(); } }; -template<int I> +template <int I> struct Interface<I> { - static int accumulate() - { - return I; - } + static int accumulate() { return I; } }; // Note: split this into a separate test if a // cxx_variadic_template_template_parameters feature is added. -template<typename T> -struct eval { - enum { +template <typename T> +struct eval +{ + enum + { Matched = 0 }; }; -template<template<typename...> class T, typename... U> -struct eval<T<U...> > { - enum { +template <template <typename...> class T, typename... U> +struct eval<T<U...> > +{ + enum + { Matched = 1 }; }; -template<typename...> -struct A { - +template <typename...> +struct A +{ }; -template<typename T> -struct B { - +template <typename T> +struct B +{ }; -template<typename T, typename U> -struct C { - +template <typename T, typename U> +struct C +{ }; -template<typename T, typename U, typename...> -struct D { - +template <typename T, typename U, typename...> +struct D +{ }; // Note: This test assumes that a compiler supporting this feature diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c index 1b39dec..0e67095 100644 --- a/Tests/CompileFeatures/default_dialect.c +++ b/Tests/CompileFeatures/default_dialect.c @@ -1,19 +1,19 @@ #if DEFAULT_C11 -# if __STDC_VERSION__ != 201112L -# error Unexpected value for __STDC_VERSION__. -# endif +#if __STDC_VERSION__ != 201112L +#error Unexpected value for __STDC_VERSION__. +#endif #elif DEFAULT_C99 -# if __STDC_VERSION__ != 199901L -# error Unexpected value for __STDC_VERSION__. -# endif +#if __STDC_VERSION__ != 199901L +#error Unexpected value for __STDC_VERSION__. +#endif #else -# if !DEFAULT_C90 -# error Buildsystem error -# endif -# if defined(__STDC_VERSION__) -# error Unexpected __STDC_VERSION__ definition -# endif +#if !DEFAULT_C90 +#error Buildsystem error +#endif +#if defined(__STDC_VERSION__) +#error Unexpected __STDC_VERSION__ definition +#endif #endif int main() diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp index a2ca268..0efaefa 100644 --- a/Tests/CompileFeatures/default_dialect.cpp +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -1,22 +1,23 @@ -template<long l> +template <long l> struct Outputter; #if DEFAULT_CXX14 -# if __cplusplus != 201402L +#if __cplusplus != 201402L Outputter<__cplusplus> o; -# endif +#endif #elif DEFAULT_CXX11 -# if __cplusplus != 201103L +#if __cplusplus != 201103L Outputter<__cplusplus> o; -# endif +#endif #else -# if !DEFAULT_CXX98 -# error Buildsystem error -# endif -# if __cplusplus != 199711L && __cplusplus != 1 && !defined(__GXX_EXPERIMENTAL_CXX0X__) +#if !DEFAULT_CXX98 +#error Buildsystem error +#endif +#if __cplusplus != 199711L && __cplusplus != 1 && \ + !defined(__GXX_EXPERIMENTAL_CXX0X__) Outputter<__cplusplus> o; -# endif +#endif #endif int main() diff --git a/Tests/CompileFeatures/genex_test.c b/Tests/CompileFeatures/genex_test.c index b1215bd..1d54840 100644 --- a/Tests/CompileFeatures/genex_test.c +++ b/Tests/CompileFeatures/genex_test.c @@ -1,11 +1,11 @@ #ifndef EXPECT_C_STATIC_ASSERT -# error EXPECT_C_STATIC_ASSERT not defined +#error EXPECT_C_STATIC_ASSERT not defined #endif #ifndef EXPECT_C_FUNCTION_PROTOTYPES -# error EXPECT_C_FUNCTION_PROTOTYPES not defined +#error EXPECT_C_FUNCTION_PROTOTYPES not defined #endif #ifndef EXPECT_C_RESTRICT -# error EXPECT_C_RESTRICT not defined +#error EXPECT_C_RESTRICT not defined #endif #if !EXPECT_C_STATIC_ASSERT @@ -19,20 +19,19 @@ #endif #if !EXPECT_C_FUNCTION_PROTOTYPES -# error Expect c_function_prototypes support +#error Expect c_function_prototypes support #endif #if !EXPECT_C_RESTRICT -# if EXPECT_C_RESTRICT -# error Expect c_restrict support -# endif +#if EXPECT_C_RESTRICT +#error Expect c_restrict support +#endif #else -# if !EXPECT_C_RESTRICT -# error Expect no c_restrict support -# endif +#if !EXPECT_C_RESTRICT +#error Expect no c_restrict support +#endif #endif int main() { - } diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 2161bca..5ae8a78 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -1,14 +1,14 @@ #ifndef EXPECT_FINAL -# error EXPECT_FINAL not defined +#error EXPECT_FINAL not defined #endif #ifndef EXPECT_INHERITING_CONSTRUCTORS -# error EXPECT_INHERITING_CONSTRUCTORS not defined +#error EXPECT_INHERITING_CONSTRUCTORS not defined #endif #ifndef EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL -# error EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL not defined +#error EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL not defined #endif #ifndef EXPECT_OVERRIDE_CONTROL -# error EXPECT_OVERRIDE_CONTROL not defined +#error EXPECT_OVERRIDE_CONTROL not defined #endif #if !HAVE_OVERRIDE_CONTROL @@ -33,40 +33,39 @@ struct B final : A #endif #if !HAVE_AUTO_TYPE -# error Expect cxx_auto_type support +#error Expect cxx_auto_type support #endif #if !HAVE_INHERITING_CONSTRUCTORS -# if EXPECT_INHERITING_CONSTRUCTORS -# error Expect cxx_inheriting_constructors support -# endif +#if EXPECT_INHERITING_CONSTRUCTORS +#error Expect cxx_inheriting_constructors support +#endif #else -# if !EXPECT_INHERITING_CONSTRUCTORS -# error Expect no cxx_inheriting_constructors support -# endif +#if !EXPECT_INHERITING_CONSTRUCTORS +#error Expect no cxx_inheriting_constructors support +#endif #endif #if !HAVE_FINAL -# if EXPECT_FINAL -# error Expect cxx_final support -# endif +#if EXPECT_FINAL +#error Expect cxx_final support +#endif #else -# if !EXPECT_FINAL -# error Expect no cxx_final support -# endif +#if !EXPECT_FINAL +#error Expect no cxx_final support +#endif #endif #if !HAVE_INHERITING_CONSTRUCTORS_AND_FINAL -# if EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL -# error Expect cxx_inheriting_constructors and cxx_final support -# endif +#if EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL +#error Expect cxx_inheriting_constructors and cxx_final support +#endif #else -# if !EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL -# error Expect no combined cxx_inheriting_constructors and cxx_final support -# endif +#if !EXPECT_INHERITING_CONSTRUCTORS_AND_FINAL +#error Expect no combined cxx_inheriting_constructors and cxx_final support +#endif #endif int main() { - } diff --git a/Tests/CompileFeatures/main.cpp b/Tests/CompileFeatures/main.cpp index 3a8e0fc..c5a7a46 100644 --- a/Tests/CompileFeatures/main.cpp +++ b/Tests/CompileFeatures/main.cpp @@ -1,5 +1,5 @@ -int main(int,char**) +int main(int, char**) { auto value = 0; return value; diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index f3c1355..63a0480 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -1,15 +1,15 @@ #ifndef TEST_DEFINE -# error Expected definition TEST_DEFINE +#error Expected definition TEST_DEFINE #endif #ifndef NEEDS_ESCAPE -# error Expected definition NEEDS_ESCAPE +#error Expected definition NEEDS_ESCAPE #endif #ifdef DO_GNU_TESTS -# ifndef TEST_DEFINE_GNU -# error Expected definition TEST_DEFINE_GNU -# endif +#ifndef TEST_DEFINE_GNU +#error Expected definition TEST_DEFINE_GNU +#endif #endif #include <string.h> @@ -18,10 +18,14 @@ int main() { return (strcmp(NEEDS_ESCAPE, "E$CAPE") == 0 #ifdef TEST_OCTOTHORPE - && strcmp(TEST_OCTOTHORPE, "#") == 0 + && strcmp(TEST_OCTOTHORPE, "#") == 0 #endif - && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 - && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 - && TEST_C_COMPILER_VERSION_EQUALITY == 1 - && TEST_CXX_COMPILER_VERSION_EQUALITY == 1) ? 0 : 1; + && + strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && + strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == + 0 && + TEST_C_COMPILER_VERSION_EQUALITY == 1 && + TEST_CXX_COMPILER_VERSION_EQUALITY == 1) + ? 0 + : 1; } diff --git a/Tests/CompileOptions/other.cpp b/Tests/CompileOptions/other.cpp index 0e34375..7d75e37 100644 --- a/Tests/CompileOptions/other.cpp +++ b/Tests/CompileOptions/other.cpp @@ -1,5 +1,4 @@ void foo(void) { - } diff --git a/Tests/Complex/Executable/A.h b/Tests/Complex/Executable/A.h index 25c45fc..3503719 100644 --- a/Tests/Complex/Executable/A.h +++ b/Tests/Complex/Executable/A.h @@ -1,4 +1,7 @@ // This header should not be compiled directly but through inclusion // in A.cxx through A.hh. extern int A(); -int A() { return 10; } +int A() +{ + return 10; +} diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 8d538db..5f79ac0 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -17,13 +17,12 @@ extern "C" { #include <stdio.h> #include <sys/stat.h> #if !defined(S_ISDIR) -# define S_ISDIR(mode) ((mode) & _S_IFDIR) +#define S_ISDIR(mode) ((mode)&_S_IFDIR) #endif #ifdef COMPLEX_TEST_LINK_STATIC -extern "C" -{ - int TestLinkGetType(); +extern "C" { +int TestLinkGetType(); } #endif @@ -31,7 +30,7 @@ int cm_passed = 0; int cm_failed = 0; // ====================================================================== -void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") +void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "") { std::cout << "FAILED: " << Message << m2 << m3 << "\n"; cm_failed++; @@ -39,30 +38,30 @@ void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") // ====================================================================== -void cmPassed(const char* Message, const char* m2="") +void cmPassed(const char* Message, const char* m2 = "") { std::cout << "Passed: " << Message << m2 << "\n"; cm_passed++; } #ifndef COMPLEX_DEFINED_PRE -# error "COMPLEX_DEFINED_PRE not defined!" +#error "COMPLEX_DEFINED_PRE not defined!" #endif #ifdef COMPLEX_DEFINED -# error "COMPLEX_DEFINED is defined but it should not!" +#error "COMPLEX_DEFINED is defined but it should not!" #endif #ifndef COMPLEX_DEFINED_POST -# error "COMPLEX_DEFINED_POST not defined!" +#error "COMPLEX_DEFINED_POST not defined!" #endif #ifndef CMAKE_IS_REALLY_FUN -# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work +#error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif #if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE) -# error Per-configuration directory-level definition not inherited. +#error Per-configuration directory-level definition not inherited. #endif // ====================================================================== @@ -70,21 +69,18 @@ void cmPassed(const char* Message, const char* m2="") void TestAndRemoveFile(const char* filename) { struct stat st; - if(stat(filename, &st) < 0) - { + if (stat(filename, &st) < 0) { cmFailed("Could not find file: ", filename); - } - else - { - if (remove(filename) < 0) - { - cmFailed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); - } - else - { + } else { + if (remove(filename) < 0) { + cmFailed("Unable to remove file. It does not imply that this test " + "failed, but it *will* be corrupted thereafter if this file is " + "not removed: ", + filename); + } else { cmPassed("Find and remove file: ", filename); - } } + } } // ====================================================================== @@ -92,14 +88,11 @@ void TestAndRemoveFile(const char* filename) void TestDir(const char* filename) { struct stat st; - if(stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) - { + if (stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) { cmFailed("Could not find dir: ", filename); - } - else - { + } else { cmPassed("Find dir: ", filename); - } + } } // Here is a stupid function that tries to use std::string methods @@ -113,7 +106,7 @@ void ForceStringUse() std::string cachetest = CACHE_TEST_VAR_INTERNAL; v.push_back(cachetest); v2 = v; - std::string x(5,'x'); + std::string x(5, 'x'); char buff[5]; x.copy(buff, 1, 0); x[0] = 'a'; @@ -126,7 +119,6 @@ void ForceStringUse() copy = cachetest.substr(0, cachetest.size()); } - // defined in testcflags.c extern "C" int TestCFlags(char* m); extern "C" int TestTargetCompileFlags(char* m); @@ -152,14 +144,11 @@ int main() cmFailed("Sub dir with same named source fails"); } #endif - if(file1() != 1) - { + if (file1() != 1) { cmFailed("Call to file1 function from library failed."); - } - else - { + } else { cmPassed("Call to file1 function returned 1."); - } + } #ifndef COMPLEX_TARGET_FLAG cmFailed("COMPILE_FLAGS did not work with SET_TARGET_PROPERTIES"); #else @@ -178,14 +167,11 @@ int main() cmFailed("CONDITIONAL_PARENTHESES did not work"); #endif - if(file2() != 1) - { + if (file2() != 1) { cmFailed("Call to file2 function from library failed."); - } - else - { + } else { cmPassed("Call to file2 function returned 1."); - } + } #ifndef TEST_CXX_FLAGS cmFailed("CMake CMAKE_CXX_FLAGS is not being passed to the compiler!"); #else @@ -194,34 +180,28 @@ int main() std::string gen = CMAKE_GENERATOR; // visual studio is currently broken for c flags char msg[1024]; - if(gen.find("Visual") == gen.npos) - { + if (gen.find("Visual") == gen.npos) { #ifdef TEST_C_FLAGS - cmFailed("CMake CMAKE_C_FLAGS are being passed to c++ files the compiler!"); + cmFailed( + "CMake CMAKE_C_FLAGS are being passed to c++ files the compiler!"); #else cmPassed("CMake CMAKE_C_FLAGS are not being passed to c++ files."); #endif - if(TestCFlags(msg)) - { - cmPassed( - "CMake CMAKE_C_FLAGS are being passed to c files and CXX flags are not."); - } - else - { + if (TestCFlags(msg)) { + cmPassed("CMake CMAKE_C_FLAGS are being passed to c files and CXX flags " + "are not."); + } else { cmFailed(msg); - } } - if(TestTargetCompileFlags(msg)) - { + } + if (TestTargetCompileFlags(msg)) { cmPassed(msg); - } - else - { + } else { cmFailed(msg); - } + } - // ---------------------------------------------------------------------- - // Test ADD_DEFINITIONS +// ---------------------------------------------------------------------- +// Test ADD_DEFINITIONS #ifndef CMAKE_IS_FUN cmFailed("CMake is not fun, so it is broken and should be fixed."); @@ -229,38 +209,39 @@ int main() cmPassed("CMAKE_IS_FUN is defined."); #endif -#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4) +#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && \ + defined(CMAKE_ARGV4) cmPassed("Variable args for MACROs are working."); #else cmFailed("Variable args for MACROs are failing."); #endif - // ---------------------------------------------------------------------- - // Test GET_SOURCE_FILE_PROPERTY for location +// ---------------------------------------------------------------------- +// Test GET_SOURCE_FILE_PROPERTY for location #ifndef CMAKE_FOUND_ACXX cmFailed("CMake did not get the location of A.cxx correctly"); #else cmPassed("CMake found A.cxx properly"); #endif - // ---------------------------------------------------------------------- - // Test GET_DIRECTORY_PROPERTY for parent +// ---------------------------------------------------------------------- +// Test GET_DIRECTORY_PROPERTY for parent #ifndef CMAKE_FOUND_PARENT cmFailed("CMake did not get the location of the parent directory properly"); #else cmPassed("CMake found the parent directory properly"); #endif - // ---------------------------------------------------------------------- - // Test GET_DIRECTORY_PROPERTY for listfiles +// ---------------------------------------------------------------------- +// Test GET_DIRECTORY_PROPERTY for listfiles #ifndef CMAKE_FOUND_LISTFILE_STACK cmFailed("CMake did not get the listfile stack properly"); #else cmPassed("CMake found the listfile stack properly"); #endif - // ---------------------------------------------------------------------- - // Test SET, VARIABLE_REQUIRES +// ---------------------------------------------------------------------- +// Test SET, VARIABLE_REQUIRES #ifdef SHOULD_NOT_BE_DEFINED cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); @@ -282,7 +263,7 @@ int main() #ifndef ONE_VAR_IS_DEFINED cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " - "ONE_VAR_IS_DEFINED is not defined."); + "ONE_VAR_IS_DEFINED is not defined."); #else cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif @@ -296,19 +277,16 @@ int main() #ifndef STRING_VAR cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else - if(strcmp(STRING_VAR, "CMake is great") != 0) - { + if (strcmp(STRING_VAR, "CMake is great") != 0) { cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", - STRING_VAR); - } - else - { + STRING_VAR); + } else { cmPassed("STRING_VAR == ", STRING_VAR); - } + } #endif - // ---------------------------------------------------------------------- - // Test various IF/ELSE combinations +// ---------------------------------------------------------------------- +// Test various IF/ELSE combinations #ifdef SHOULD_NOT_BE_DEFINED_NOT cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined."); @@ -401,7 +379,8 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_MATCHES2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); #endif @@ -425,7 +404,8 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_COMMAND2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); #endif @@ -455,13 +435,15 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined."); #endif #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined."); #endif @@ -521,7 +503,8 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_GREATER2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); #endif @@ -545,164 +528,153 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_STRLESS2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined."); #endif #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER - cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined."); + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER is not defined."); #endif #ifndef SHOULD_BE_DEFINED_STRGREATER - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined."); #endif #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER2 - cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined."); + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER2 is not defined."); #endif #ifndef SHOULD_BE_DEFINED_STRGREATER2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined."); #endif - // ---------------------------------------------------------------------- - // Test FOREACH +// ---------------------------------------------------------------------- +// Test FOREACH #ifndef FOREACH_VAR1 cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR1 is not defined."); + "FOREACH_VAR1 is not defined."); #else - if(strcmp(FOREACH_VAR1, "VALUE1") != 0) - { + if (strcmp(FOREACH_VAR1, "VALUE1") != 0) { cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR1 == ", FOREACH_VAR1); - } - else - { + "FOREACH_VAR1 == ", + FOREACH_VAR1); + } else { cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1); - } + } #endif #ifndef FOREACH_VAR2 cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR2 is not defined."); + "FOREACH_VAR2 is not defined."); #else - if(strcmp(FOREACH_VAR2, "VALUE2") != 0) - { + if (strcmp(FOREACH_VAR2, "VALUE2") != 0) { cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR2 == ", FOREACH_VAR2); - } - else - { + "FOREACH_VAR2 == ", + FOREACH_VAR2); + } else { cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2); - } + } #endif #ifndef FOREACH_CONCAT cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_CONCAT is not defined."); + "FOREACH_CONCAT is not defined."); #else - if(strcmp(FOREACH_CONCAT, "abcdefg") != 0) - { + if (strcmp(FOREACH_CONCAT, "abcdefg") != 0) { cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_CONCAT == ", FOREACH_CONCAT); - } - else - { + "FOREACH_CONCAT == ", + FOREACH_CONCAT); + } else { cmPassed("FOREACH_CONCAT == ", FOREACH_CONCAT); - } + } #endif // ---------------------------------------------------------------------- // Test WHILE - if(WHILE_VALUE != 1000) - { + if (WHILE_VALUE != 1000) { cmFailed("WHILE command is not working"); - } - else - { + } else { cmPassed("WHILE command is working"); - } + } - // ---------------------------------------------------------------------- - // Test LOAD_CACHE +// ---------------------------------------------------------------------- +// Test LOAD_CACHE #ifndef CACHE_TEST_VAR1 cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR1 is not defined."); + "CACHE_TEST_VAR1 is not defined."); #else - if(strcmp(CACHE_TEST_VAR1, "foo") != 0) - { + if (strcmp(CACHE_TEST_VAR1, "foo") != 0) { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); - } - else - { + "CACHE_TEST_VAR1 == ", + CACHE_TEST_VAR1); + } else { cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); - } + } #endif #ifndef CACHE_TEST_VAR2 cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR2 is not defined."); + "CACHE_TEST_VAR2 is not defined."); #else - if(strcmp(CACHE_TEST_VAR2, "bar") != 0) - { + if (strcmp(CACHE_TEST_VAR2, "bar") != 0) { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); - } - else - { + "CACHE_TEST_VAR2 == ", + CACHE_TEST_VAR2); + } else { cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); - } + } #endif #ifndef CACHE_TEST_VAR3 cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR3 is not defined."); + "CACHE_TEST_VAR3 is not defined."); #else - if(strcmp(CACHE_TEST_VAR3, "1") != 0) - { + if (strcmp(CACHE_TEST_VAR3, "1") != 0) { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); - } - else - { + "CACHE_TEST_VAR3 == ", + CACHE_TEST_VAR3); + } else { cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); - } + } #endif #ifdef CACHE_TEST_VAR_EXCLUDED - cmFailed("the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " - "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); + cmFailed( + "the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " + "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); #else cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined."); #endif #ifndef CACHE_TEST_VAR_INTERNAL cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR_INTERNAL is not defined."); + "CACHE_TEST_VAR_INTERNAL is not defined."); #else std::string cachetest = CACHE_TEST_VAR_INTERNAL; - if(cachetest != "bar") - { + if (cachetest != "bar") { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); - } - else - { + "CACHE_TEST_VAR_INTERNAL == ", + CACHE_TEST_VAR_INTERNAL); + } else { cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); - } + } #endif // ---------------------------------------------------------------------- @@ -751,34 +723,34 @@ int main() TestAndRemoveFile("Executable/Temp/complex-required.txt"); - // ---------------------------------------------------------------------- - // Test FIND_LIBRARY +// ---------------------------------------------------------------------- +// Test FIND_LIBRARY #ifndef FIND_DUMMY_LIB cmFailed("the CONFIGURE_FILE command is broken, " - "FIND_DUMMY_LIB is not defined."); + "FIND_DUMMY_LIB is not defined."); #else - if(strstr(FIND_DUMMY_LIB, "dummylib") == NULL) - { + if (strstr(FIND_DUMMY_LIB, "dummylib") == NULL) { cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, " - "FIND_DUMMY_LIB == ", FIND_DUMMY_LIB); - } - else - { + "FIND_DUMMY_LIB == ", + FIND_DUMMY_LIB); + } else { cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB); - } + } #endif - // ---------------------------------------------------------------------- - // Test SET_SOURCE_FILES_PROPERTIES +// ---------------------------------------------------------------------- +// Test SET_SOURCE_FILES_PROPERTIES #ifndef FILE_HAS_EXTRA_COMPILE_FLAGS - cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_HAS_EXTRA_COMPILE_FLAGS flag"); + cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting " + "FILE_HAS_EXTRA_COMPILE_FLAGS flag"); #else - cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_HAS_EXTRA_COMPILE_FLAGS flag"); + cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting " + "FILE_HAS_EXTRA_COMPILE_FLAGS flag"); #endif -#if 0 // Disable until implemented everywhere. +#if 0 // Disable until implemented everywhere. #ifndef FILE_DEFINE_STRING cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_DEFINE_STRING flag"); #else @@ -806,84 +778,72 @@ int main() #endif #ifndef FILE_COMPILE_FLAGS - cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not " + "defined."); #else - if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) - { - cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ", + if (strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) { + cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is " + "broken. FILE_COMPILE_FLAGS == ", FILE_COMPILE_FLAGS); - } - else - { - cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ", FILE_COMPILE_FLAGS); - } + } else { + cmPassed( + "SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ", + FILE_COMPILE_FLAGS); + } #endif - // ---------------------------------------------------------------------- - // Test registry (win32) +// ---------------------------------------------------------------------- +// Test registry (win32) #if defined(_WIN32) && !defined(__CYGWIN__) #ifndef REGISTRY_TEST_PATH - cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not " + "defined."); #else std::cout << "REGISTRY_TEST_PATH == " << REGISTRY_TEST_PATH << "\n"; - if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) - { - cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ", + if (stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) { + cmFailed("the 'read registry value' function or CONFIGURE_FILE command is " + "broken. REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH, " is not " BINARY_DIR "/registry_dir"); - } - else - { + } else { cmPassed("REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH); - } + } #endif #endif // defined(_WIN32) && !defined(__CYGWIN__) - if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) - { + if (strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) { cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4"); - } - else - { + } else { cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4"); - } + } // ---------------------------------------------------------------------- // Test REMOVE command - if (strcmp("a;b;d",REMOVE_STRING) == 0) - { + if (strcmp("a;b;d", REMOVE_STRING) == 0) { cmPassed("REMOVE is working"); - } - else - { + } else { cmFailed("REMOVE is not working"); - } + } // ---------------------------------------------------------------------- // Test SEPARATE_ARGUMENTS - if(strcmp("a;b;c", TEST_SEP) == 0) - { + if (strcmp("a;b;c", TEST_SEP) == 0) { cmPassed("SEPARATE_ARGUMENTS is working"); - } - else - { + } else { cmFailed("SEPARATE_ARGUMENTS is not working"); - } + } // ---------------------------------------------------------------------- // Test Escape Quotes - if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) - { + if (strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) { cmPassed("ESCAPE_QUOTES is working"); - } - else - { + } else { cmFailed("ESCAPE_QUOTES is not working"); - } + } - - // ---------------------------------------------------------------------- - // Test if IF command inside a FOREACH works. -#if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) +// ---------------------------------------------------------------------- +// Test if IF command inside a FOREACH works. +#if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && \ + !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) cmPassed("IF inside a FOREACH block works"); #else cmFailed("IF inside a FOREACH block is broken"); @@ -894,22 +854,16 @@ int main() #else cmFailed("Generated header included by non-generated source failed."); #endif - if(SHOULD_BE_ZERO == 0) - { + if (SHOULD_BE_ZERO == 0) { cmPassed("cmakedefine01 is working for 0"); - } - else - { + } else { cmFailed("cmakedefine01 is not working for 0"); - } - if(SHOULD_BE_ONE == 1) - { + } + if (SHOULD_BE_ONE == 1) { cmPassed("cmakedefine01 is working for 1"); - } - else - { + } else { cmFailed("cmakedefine01 is not working for 1"); - } + } #ifdef FORCE_TEST cmFailed("CMake SET CACHE FORCE"); #else @@ -917,14 +871,11 @@ int main() #endif #ifdef COMPLEX_TEST_LINK_STATIC - if(TestLinkGetType()) - { + if (TestLinkGetType()) { cmPassed("Link to static over shared worked."); - } - else - { + } else { cmFailed("Link to static over shared failed."); - } + } #endif #if defined(A_VALUE) && A_VALUE == 10 @@ -937,10 +888,9 @@ int main() // Summary std::cout << "Passed: " << cm_passed << "\n"; - if(cm_failed) - { + if (cm_failed) { std::cout << "Failed: " << cm_failed << "\n"; return cm_failed; - } + } return 0; } diff --git a/Tests/Complex/Executable/complex.file.cxx b/Tests/Complex/Executable/complex.file.cxx index e873fa6..cfba9ed 100644 --- a/Tests/Complex/Executable/complex.file.cxx +++ b/Tests/Complex/Executable/complex.file.cxx @@ -2,7 +2,7 @@ #include "cmMissingHeader.h" #endif -int main(int , char**) +int main(int, char**) { return 0; } diff --git a/Tests/Complex/Executable/notInAllExe.cxx b/Tests/Complex/Executable/notInAllExe.cxx index 70275cd..2685073 100644 --- a/Tests/Complex/Executable/notInAllExe.cxx +++ b/Tests/Complex/Executable/notInAllExe.cxx @@ -6,5 +6,5 @@ int main() } #if 1 -# error "This target should not be compiled by ALL." +#error "This target should not be compiled by ALL." #endif diff --git a/Tests/Complex/Executable/testSystemDir.cxx b/Tests/Complex/Executable/testSystemDir.cxx index e4815c6..4bb2db4 100644 --- a/Tests/Complex/Executable/testSystemDir.cxx +++ b/Tests/Complex/Executable/testSystemDir.cxx @@ -1,3 +1,6 @@ #include <testSystemDir.h> -int main() { return foo(); } +int main() +{ + return foo(); +} diff --git a/Tests/Complex/Executable/testcflags.c b/Tests/Complex/Executable/testcflags.c index 6c2dd5d..e452b06 100644 --- a/Tests/Complex/Executable/testcflags.c +++ b/Tests/Complex/Executable/testcflags.c @@ -12,12 +12,12 @@ int TestTargetCompileFlags(char* m) int TestCFlags(char* m) { - /* TEST_CXX_FLAGS should not be defined in a c file */ +/* TEST_CXX_FLAGS should not be defined in a c file */ #ifdef TEST_CXX_FLAGS strcpy(m, "CMake CMAKE_CXX_FLAGS (TEST_CXX_FLAGS) found in c file."); return 0; #endif - /* TEST_C_FLAGS should be defined in a c file */ +/* TEST_C_FLAGS should be defined in a c file */ #ifndef TEST_C_FLAGS strcpy(m, "CMake CMAKE_C_FLAGS (TEST_C_FLAGS) not found in c file."); return 0; diff --git a/Tests/Complex/Library/SystemDir/testSystemDir.h b/Tests/Complex/Library/SystemDir/testSystemDir.h index 73be353..074ff75 100644 --- a/Tests/Complex/Library/SystemDir/testSystemDir.h +++ b/Tests/Complex/Library/SystemDir/testSystemDir.h @@ -1,2 +1,5 @@ // Purposely leave off the return type to create a warning. -foo() { return 0; } +foo() +{ + return 0; +} diff --git a/Tests/Complex/Library/create_file.cxx b/Tests/Complex/Library/create_file.cxx index 050ed0b..62a1975 100644 --- a/Tests/Complex/Library/create_file.cxx +++ b/Tests/Complex/Library/create_file.cxx @@ -1,26 +1,23 @@ #include <stdio.h> #include <stdlib.h> -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { + if (argc < 2) { fprintf(stderr, "Missing name of file to create.\n"); return EXIT_FAILURE; - } + } - FILE *stream = fopen(argv[1], "w"); - if(stream == NULL) - { + FILE* stream = fopen(argv[1], "w"); + if (stream == NULL) { fprintf(stderr, "Unable to open %s for writing!\n", argv[1]); return EXIT_FAILURE; - } + } - if(fclose(stream)) - { + if (fclose(stream)) { fprintf(stderr, "Unable to close %s!\n", argv[1]); return EXIT_FAILURE; - } + } fprintf(stdout, ">> Creating %s!\n", argv[1]); diff --git a/Tests/Complex/Library/notInAllLib.cxx b/Tests/Complex/Library/notInAllLib.cxx index 5d928f4..e66ea05 100644 --- a/Tests/Complex/Library/notInAllLib.cxx +++ b/Tests/Complex/Library/notInAllLib.cxx @@ -1,5 +1,8 @@ -int notInAllLibFunc() { return 0; } +int notInAllLibFunc() +{ + return 0; +} #if 1 -# error "This target should not be compiled by ALL." +#error "This target should not be compiled by ALL." #endif diff --git a/Tests/Complex/Library/sharedFile.h b/Tests/Complex/Library/sharedFile.h index 65ac2e2..e32fcb7 100644 --- a/Tests/Complex/Library/sharedFile.h +++ b/Tests/Complex/Library/sharedFile.h @@ -1,8 +1,8 @@ #if defined(_WIN32) || defined(WIN32) /* Win32 version */ #ifdef CMakeTestLibraryShared_EXPORTS -# define CMakeTest_EXPORT __declspec(dllexport) +#define CMakeTest_EXPORT __declspec(dllexport) #else -# define CMakeTest_EXPORT __declspec(dllimport) +#define CMakeTest_EXPORT __declspec(dllimport) #endif #else /* unix needs nothing */ diff --git a/Tests/Complex/Library/testConly.h b/Tests/Complex/Library/testConly.h index ba84589..9b0fb73 100644 --- a/Tests/Complex/Library/testConly.h +++ b/Tests/Complex/Library/testConly.h @@ -1,8 +1,8 @@ #if defined(_WIN32) || defined(WIN32) /* Win32 version */ #ifdef CMakeTestCLibraryShared_EXPORTS -# define CMakeTest_EXPORT __declspec(dllexport) +#define CMakeTest_EXPORT __declspec(dllexport) #else -# define CMakeTest_EXPORT __declspec(dllimport) +#define CMakeTest_EXPORT __declspec(dllimport) #endif #else /* unix needs nothing */ @@ -10,4 +10,3 @@ #endif CMakeTest_EXPORT int CsharedFunction(); - diff --git a/Tests/ComplexOneConfig/Executable/A.h b/Tests/ComplexOneConfig/Executable/A.h index 25c45fc..3503719 100644 --- a/Tests/ComplexOneConfig/Executable/A.h +++ b/Tests/ComplexOneConfig/Executable/A.h @@ -1,4 +1,7 @@ // This header should not be compiled directly but through inclusion // in A.cxx through A.hh. extern int A(); -int A() { return 10; } +int A() +{ + return 10; +} diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 8d538db..5f79ac0 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -17,13 +17,12 @@ extern "C" { #include <stdio.h> #include <sys/stat.h> #if !defined(S_ISDIR) -# define S_ISDIR(mode) ((mode) & _S_IFDIR) +#define S_ISDIR(mode) ((mode)&_S_IFDIR) #endif #ifdef COMPLEX_TEST_LINK_STATIC -extern "C" -{ - int TestLinkGetType(); +extern "C" { +int TestLinkGetType(); } #endif @@ -31,7 +30,7 @@ int cm_passed = 0; int cm_failed = 0; // ====================================================================== -void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") +void cmFailed(const char* Message, const char* m2 = "", const char* m3 = "") { std::cout << "FAILED: " << Message << m2 << m3 << "\n"; cm_failed++; @@ -39,30 +38,30 @@ void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") // ====================================================================== -void cmPassed(const char* Message, const char* m2="") +void cmPassed(const char* Message, const char* m2 = "") { std::cout << "Passed: " << Message << m2 << "\n"; cm_passed++; } #ifndef COMPLEX_DEFINED_PRE -# error "COMPLEX_DEFINED_PRE not defined!" +#error "COMPLEX_DEFINED_PRE not defined!" #endif #ifdef COMPLEX_DEFINED -# error "COMPLEX_DEFINED is defined but it should not!" +#error "COMPLEX_DEFINED is defined but it should not!" #endif #ifndef COMPLEX_DEFINED_POST -# error "COMPLEX_DEFINED_POST not defined!" +#error "COMPLEX_DEFINED_POST not defined!" #endif #ifndef CMAKE_IS_REALLY_FUN -# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work +#error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif #if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE) -# error Per-configuration directory-level definition not inherited. +#error Per-configuration directory-level definition not inherited. #endif // ====================================================================== @@ -70,21 +69,18 @@ void cmPassed(const char* Message, const char* m2="") void TestAndRemoveFile(const char* filename) { struct stat st; - if(stat(filename, &st) < 0) - { + if (stat(filename, &st) < 0) { cmFailed("Could not find file: ", filename); - } - else - { - if (remove(filename) < 0) - { - cmFailed("Unable to remove file. It does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed: ", filename); - } - else - { + } else { + if (remove(filename) < 0) { + cmFailed("Unable to remove file. It does not imply that this test " + "failed, but it *will* be corrupted thereafter if this file is " + "not removed: ", + filename); + } else { cmPassed("Find and remove file: ", filename); - } } + } } // ====================================================================== @@ -92,14 +88,11 @@ void TestAndRemoveFile(const char* filename) void TestDir(const char* filename) { struct stat st; - if(stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) - { + if (stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) { cmFailed("Could not find dir: ", filename); - } - else - { + } else { cmPassed("Find dir: ", filename); - } + } } // Here is a stupid function that tries to use std::string methods @@ -113,7 +106,7 @@ void ForceStringUse() std::string cachetest = CACHE_TEST_VAR_INTERNAL; v.push_back(cachetest); v2 = v; - std::string x(5,'x'); + std::string x(5, 'x'); char buff[5]; x.copy(buff, 1, 0); x[0] = 'a'; @@ -126,7 +119,6 @@ void ForceStringUse() copy = cachetest.substr(0, cachetest.size()); } - // defined in testcflags.c extern "C" int TestCFlags(char* m); extern "C" int TestTargetCompileFlags(char* m); @@ -152,14 +144,11 @@ int main() cmFailed("Sub dir with same named source fails"); } #endif - if(file1() != 1) - { + if (file1() != 1) { cmFailed("Call to file1 function from library failed."); - } - else - { + } else { cmPassed("Call to file1 function returned 1."); - } + } #ifndef COMPLEX_TARGET_FLAG cmFailed("COMPILE_FLAGS did not work with SET_TARGET_PROPERTIES"); #else @@ -178,14 +167,11 @@ int main() cmFailed("CONDITIONAL_PARENTHESES did not work"); #endif - if(file2() != 1) - { + if (file2() != 1) { cmFailed("Call to file2 function from library failed."); - } - else - { + } else { cmPassed("Call to file2 function returned 1."); - } + } #ifndef TEST_CXX_FLAGS cmFailed("CMake CMAKE_CXX_FLAGS is not being passed to the compiler!"); #else @@ -194,34 +180,28 @@ int main() std::string gen = CMAKE_GENERATOR; // visual studio is currently broken for c flags char msg[1024]; - if(gen.find("Visual") == gen.npos) - { + if (gen.find("Visual") == gen.npos) { #ifdef TEST_C_FLAGS - cmFailed("CMake CMAKE_C_FLAGS are being passed to c++ files the compiler!"); + cmFailed( + "CMake CMAKE_C_FLAGS are being passed to c++ files the compiler!"); #else cmPassed("CMake CMAKE_C_FLAGS are not being passed to c++ files."); #endif - if(TestCFlags(msg)) - { - cmPassed( - "CMake CMAKE_C_FLAGS are being passed to c files and CXX flags are not."); - } - else - { + if (TestCFlags(msg)) { + cmPassed("CMake CMAKE_C_FLAGS are being passed to c files and CXX flags " + "are not."); + } else { cmFailed(msg); - } } - if(TestTargetCompileFlags(msg)) - { + } + if (TestTargetCompileFlags(msg)) { cmPassed(msg); - } - else - { + } else { cmFailed(msg); - } + } - // ---------------------------------------------------------------------- - // Test ADD_DEFINITIONS +// ---------------------------------------------------------------------- +// Test ADD_DEFINITIONS #ifndef CMAKE_IS_FUN cmFailed("CMake is not fun, so it is broken and should be fixed."); @@ -229,38 +209,39 @@ int main() cmPassed("CMAKE_IS_FUN is defined."); #endif -#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4) +#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && \ + defined(CMAKE_ARGV4) cmPassed("Variable args for MACROs are working."); #else cmFailed("Variable args for MACROs are failing."); #endif - // ---------------------------------------------------------------------- - // Test GET_SOURCE_FILE_PROPERTY for location +// ---------------------------------------------------------------------- +// Test GET_SOURCE_FILE_PROPERTY for location #ifndef CMAKE_FOUND_ACXX cmFailed("CMake did not get the location of A.cxx correctly"); #else cmPassed("CMake found A.cxx properly"); #endif - // ---------------------------------------------------------------------- - // Test GET_DIRECTORY_PROPERTY for parent +// ---------------------------------------------------------------------- +// Test GET_DIRECTORY_PROPERTY for parent #ifndef CMAKE_FOUND_PARENT cmFailed("CMake did not get the location of the parent directory properly"); #else cmPassed("CMake found the parent directory properly"); #endif - // ---------------------------------------------------------------------- - // Test GET_DIRECTORY_PROPERTY for listfiles +// ---------------------------------------------------------------------- +// Test GET_DIRECTORY_PROPERTY for listfiles #ifndef CMAKE_FOUND_LISTFILE_STACK cmFailed("CMake did not get the listfile stack properly"); #else cmPassed("CMake found the listfile stack properly"); #endif - // ---------------------------------------------------------------------- - // Test SET, VARIABLE_REQUIRES +// ---------------------------------------------------------------------- +// Test SET, VARIABLE_REQUIRES #ifdef SHOULD_NOT_BE_DEFINED cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); @@ -282,7 +263,7 @@ int main() #ifndef ONE_VAR_IS_DEFINED cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " - "ONE_VAR_IS_DEFINED is not defined."); + "ONE_VAR_IS_DEFINED is not defined."); #else cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif @@ -296,19 +277,16 @@ int main() #ifndef STRING_VAR cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else - if(strcmp(STRING_VAR, "CMake is great") != 0) - { + if (strcmp(STRING_VAR, "CMake is great") != 0) { cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", - STRING_VAR); - } - else - { + STRING_VAR); + } else { cmPassed("STRING_VAR == ", STRING_VAR); - } + } #endif - // ---------------------------------------------------------------------- - // Test various IF/ELSE combinations +// ---------------------------------------------------------------------- +// Test various IF/ELSE combinations #ifdef SHOULD_NOT_BE_DEFINED_NOT cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined."); @@ -401,7 +379,8 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_MATCHES2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); #endif @@ -425,7 +404,8 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_COMMAND2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); #endif @@ -455,13 +435,15 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY is defined."); #endif #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_IS_DIRECTORY2 is defined."); #endif @@ -521,7 +503,8 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_GREATER2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); #endif @@ -545,164 +528,153 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_STRLESS2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined."); #endif #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER - cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined."); + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER is not defined."); #endif #ifndef SHOULD_BE_DEFINED_STRGREATER - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined."); #endif #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER2 - cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined."); + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER2 is not defined."); #endif #ifndef SHOULD_BE_DEFINED_STRGREATER2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined."); #endif - // ---------------------------------------------------------------------- - // Test FOREACH +// ---------------------------------------------------------------------- +// Test FOREACH #ifndef FOREACH_VAR1 cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR1 is not defined."); + "FOREACH_VAR1 is not defined."); #else - if(strcmp(FOREACH_VAR1, "VALUE1") != 0) - { + if (strcmp(FOREACH_VAR1, "VALUE1") != 0) { cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR1 == ", FOREACH_VAR1); - } - else - { + "FOREACH_VAR1 == ", + FOREACH_VAR1); + } else { cmPassed("FOREACH_VAR1 == ", FOREACH_VAR1); - } + } #endif #ifndef FOREACH_VAR2 cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR2 is not defined."); + "FOREACH_VAR2 is not defined."); #else - if(strcmp(FOREACH_VAR2, "VALUE2") != 0) - { + if (strcmp(FOREACH_VAR2, "VALUE2") != 0) { cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_VAR2 == ", FOREACH_VAR2); - } - else - { + "FOREACH_VAR2 == ", + FOREACH_VAR2); + } else { cmPassed("FOREACH_VAR2 == ", FOREACH_VAR2); - } + } #endif #ifndef FOREACH_CONCAT cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_CONCAT is not defined."); + "FOREACH_CONCAT is not defined."); #else - if(strcmp(FOREACH_CONCAT, "abcdefg") != 0) - { + if (strcmp(FOREACH_CONCAT, "abcdefg") != 0) { cmFailed("the FOREACH, SET or CONFIGURE_FILE command is broken, " - "FOREACH_CONCAT == ", FOREACH_CONCAT); - } - else - { + "FOREACH_CONCAT == ", + FOREACH_CONCAT); + } else { cmPassed("FOREACH_CONCAT == ", FOREACH_CONCAT); - } + } #endif // ---------------------------------------------------------------------- // Test WHILE - if(WHILE_VALUE != 1000) - { + if (WHILE_VALUE != 1000) { cmFailed("WHILE command is not working"); - } - else - { + } else { cmPassed("WHILE command is working"); - } + } - // ---------------------------------------------------------------------- - // Test LOAD_CACHE +// ---------------------------------------------------------------------- +// Test LOAD_CACHE #ifndef CACHE_TEST_VAR1 cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR1 is not defined."); + "CACHE_TEST_VAR1 is not defined."); #else - if(strcmp(CACHE_TEST_VAR1, "foo") != 0) - { + if (strcmp(CACHE_TEST_VAR1, "foo") != 0) { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); - } - else - { + "CACHE_TEST_VAR1 == ", + CACHE_TEST_VAR1); + } else { cmPassed("CACHE_TEST_VAR1 == ", CACHE_TEST_VAR1); - } + } #endif #ifndef CACHE_TEST_VAR2 cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR2 is not defined."); + "CACHE_TEST_VAR2 is not defined."); #else - if(strcmp(CACHE_TEST_VAR2, "bar") != 0) - { + if (strcmp(CACHE_TEST_VAR2, "bar") != 0) { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); - } - else - { + "CACHE_TEST_VAR2 == ", + CACHE_TEST_VAR2); + } else { cmPassed("CACHE_TEST_VAR2 == ", CACHE_TEST_VAR2); - } + } #endif #ifndef CACHE_TEST_VAR3 cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR3 is not defined."); + "CACHE_TEST_VAR3 is not defined."); #else - if(strcmp(CACHE_TEST_VAR3, "1") != 0) - { + if (strcmp(CACHE_TEST_VAR3, "1") != 0) { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); - } - else - { + "CACHE_TEST_VAR3 == ", + CACHE_TEST_VAR3); + } else { cmPassed("CACHE_TEST_VAR3 == ", CACHE_TEST_VAR3); - } + } #endif #ifdef CACHE_TEST_VAR_EXCLUDED - cmFailed("the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " - "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); + cmFailed( + "the LOAD_CACHE or CONFIGURE_FILE command or cmakedefine is broken, " + "CACHE_TEST_VAR_EXCLUDED is defined (should not have been loaded)."); #else cmPassed("CACHE_TEST_VAR_EXCLUDED is not defined."); #endif #ifndef CACHE_TEST_VAR_INTERNAL cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR_INTERNAL is not defined."); + "CACHE_TEST_VAR_INTERNAL is not defined."); #else std::string cachetest = CACHE_TEST_VAR_INTERNAL; - if(cachetest != "bar") - { + if (cachetest != "bar") { cmFailed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " - "CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); - } - else - { + "CACHE_TEST_VAR_INTERNAL == ", + CACHE_TEST_VAR_INTERNAL); + } else { cmPassed("CACHE_TEST_VAR_INTERNAL == ", CACHE_TEST_VAR_INTERNAL); - } + } #endif // ---------------------------------------------------------------------- @@ -751,34 +723,34 @@ int main() TestAndRemoveFile("Executable/Temp/complex-required.txt"); - // ---------------------------------------------------------------------- - // Test FIND_LIBRARY +// ---------------------------------------------------------------------- +// Test FIND_LIBRARY #ifndef FIND_DUMMY_LIB cmFailed("the CONFIGURE_FILE command is broken, " - "FIND_DUMMY_LIB is not defined."); + "FIND_DUMMY_LIB is not defined."); #else - if(strstr(FIND_DUMMY_LIB, "dummylib") == NULL) - { + if (strstr(FIND_DUMMY_LIB, "dummylib") == NULL) { cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, " - "FIND_DUMMY_LIB == ", FIND_DUMMY_LIB); - } - else - { + "FIND_DUMMY_LIB == ", + FIND_DUMMY_LIB); + } else { cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB); - } + } #endif - // ---------------------------------------------------------------------- - // Test SET_SOURCE_FILES_PROPERTIES +// ---------------------------------------------------------------------- +// Test SET_SOURCE_FILES_PROPERTIES #ifndef FILE_HAS_EXTRA_COMPILE_FLAGS - cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_HAS_EXTRA_COMPILE_FLAGS flag"); + cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting " + "FILE_HAS_EXTRA_COMPILE_FLAGS flag"); #else - cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_HAS_EXTRA_COMPILE_FLAGS flag"); + cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting " + "FILE_HAS_EXTRA_COMPILE_FLAGS flag"); #endif -#if 0 // Disable until implemented everywhere. +#if 0 // Disable until implemented everywhere. #ifndef FILE_DEFINE_STRING cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_DEFINE_STRING flag"); #else @@ -806,84 +778,72 @@ int main() #endif #ifndef FILE_COMPILE_FLAGS - cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not " + "defined."); #else - if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) - { - cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ", + if (strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) { + cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is " + "broken. FILE_COMPILE_FLAGS == ", FILE_COMPILE_FLAGS); - } - else - { - cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ", FILE_COMPILE_FLAGS); - } + } else { + cmPassed( + "SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ", + FILE_COMPILE_FLAGS); + } #endif - // ---------------------------------------------------------------------- - // Test registry (win32) +// ---------------------------------------------------------------------- +// Test registry (win32) #if defined(_WIN32) && !defined(__CYGWIN__) #ifndef REGISTRY_TEST_PATH - cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined."); + cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not " + "defined."); #else std::cout << "REGISTRY_TEST_PATH == " << REGISTRY_TEST_PATH << "\n"; - if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) - { - cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ", + if (stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) { + cmFailed("the 'read registry value' function or CONFIGURE_FILE command is " + "broken. REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH, " is not " BINARY_DIR "/registry_dir"); - } - else - { + } else { cmPassed("REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH); - } + } #endif #endif // defined(_WIN32) && !defined(__CYGWIN__) - if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) - { + if (strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) { cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4"); - } - else - { + } else { cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4"); - } + } // ---------------------------------------------------------------------- // Test REMOVE command - if (strcmp("a;b;d",REMOVE_STRING) == 0) - { + if (strcmp("a;b;d", REMOVE_STRING) == 0) { cmPassed("REMOVE is working"); - } - else - { + } else { cmFailed("REMOVE is not working"); - } + } // ---------------------------------------------------------------------- // Test SEPARATE_ARGUMENTS - if(strcmp("a;b;c", TEST_SEP) == 0) - { + if (strcmp("a;b;c", TEST_SEP) == 0) { cmPassed("SEPARATE_ARGUMENTS is working"); - } - else - { + } else { cmFailed("SEPARATE_ARGUMENTS is not working"); - } + } // ---------------------------------------------------------------------- // Test Escape Quotes - if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) - { + if (strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) { cmPassed("ESCAPE_QUOTES is working"); - } - else - { + } else { cmFailed("ESCAPE_QUOTES is not working"); - } + } - - // ---------------------------------------------------------------------- - // Test if IF command inside a FOREACH works. -#if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) +// ---------------------------------------------------------------------- +// Test if IF command inside a FOREACH works. +#if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && \ + !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) cmPassed("IF inside a FOREACH block works"); #else cmFailed("IF inside a FOREACH block is broken"); @@ -894,22 +854,16 @@ int main() #else cmFailed("Generated header included by non-generated source failed."); #endif - if(SHOULD_BE_ZERO == 0) - { + if (SHOULD_BE_ZERO == 0) { cmPassed("cmakedefine01 is working for 0"); - } - else - { + } else { cmFailed("cmakedefine01 is not working for 0"); - } - if(SHOULD_BE_ONE == 1) - { + } + if (SHOULD_BE_ONE == 1) { cmPassed("cmakedefine01 is working for 1"); - } - else - { + } else { cmFailed("cmakedefine01 is not working for 1"); - } + } #ifdef FORCE_TEST cmFailed("CMake SET CACHE FORCE"); #else @@ -917,14 +871,11 @@ int main() #endif #ifdef COMPLEX_TEST_LINK_STATIC - if(TestLinkGetType()) - { + if (TestLinkGetType()) { cmPassed("Link to static over shared worked."); - } - else - { + } else { cmFailed("Link to static over shared failed."); - } + } #endif #if defined(A_VALUE) && A_VALUE == 10 @@ -937,10 +888,9 @@ int main() // Summary std::cout << "Passed: " << cm_passed << "\n"; - if(cm_failed) - { + if (cm_failed) { std::cout << "Failed: " << cm_failed << "\n"; return cm_failed; - } + } return 0; } diff --git a/Tests/ComplexOneConfig/Executable/complex.file.cxx b/Tests/ComplexOneConfig/Executable/complex.file.cxx index e873fa6..cfba9ed 100644 --- a/Tests/ComplexOneConfig/Executable/complex.file.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.file.cxx @@ -2,7 +2,7 @@ #include "cmMissingHeader.h" #endif -int main(int , char**) +int main(int, char**) { return 0; } diff --git a/Tests/ComplexOneConfig/Executable/notInAllExe.cxx b/Tests/ComplexOneConfig/Executable/notInAllExe.cxx index 70275cd..2685073 100644 --- a/Tests/ComplexOneConfig/Executable/notInAllExe.cxx +++ b/Tests/ComplexOneConfig/Executable/notInAllExe.cxx @@ -6,5 +6,5 @@ int main() } #if 1 -# error "This target should not be compiled by ALL." +#error "This target should not be compiled by ALL." #endif diff --git a/Tests/ComplexOneConfig/Executable/testSystemDir.cxx b/Tests/ComplexOneConfig/Executable/testSystemDir.cxx index e4815c6..4bb2db4 100644 --- a/Tests/ComplexOneConfig/Executable/testSystemDir.cxx +++ b/Tests/ComplexOneConfig/Executable/testSystemDir.cxx @@ -1,3 +1,6 @@ #include <testSystemDir.h> -int main() { return foo(); } +int main() +{ + return foo(); +} diff --git a/Tests/ComplexOneConfig/Executable/testcflags.c b/Tests/ComplexOneConfig/Executable/testcflags.c index 6c2dd5d..e452b06 100644 --- a/Tests/ComplexOneConfig/Executable/testcflags.c +++ b/Tests/ComplexOneConfig/Executable/testcflags.c @@ -12,12 +12,12 @@ int TestTargetCompileFlags(char* m) int TestCFlags(char* m) { - /* TEST_CXX_FLAGS should not be defined in a c file */ +/* TEST_CXX_FLAGS should not be defined in a c file */ #ifdef TEST_CXX_FLAGS strcpy(m, "CMake CMAKE_CXX_FLAGS (TEST_CXX_FLAGS) found in c file."); return 0; #endif - /* TEST_C_FLAGS should be defined in a c file */ +/* TEST_C_FLAGS should be defined in a c file */ #ifndef TEST_C_FLAGS strcpy(m, "CMake CMAKE_C_FLAGS (TEST_C_FLAGS) not found in c file."); return 0; diff --git a/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h b/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h index 73be353..074ff75 100644 --- a/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h +++ b/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h @@ -1,2 +1,5 @@ // Purposely leave off the return type to create a warning. -foo() { return 0; } +foo() +{ + return 0; +} diff --git a/Tests/ComplexOneConfig/Library/create_file.cxx b/Tests/ComplexOneConfig/Library/create_file.cxx index 050ed0b..62a1975 100644 --- a/Tests/ComplexOneConfig/Library/create_file.cxx +++ b/Tests/ComplexOneConfig/Library/create_file.cxx @@ -1,26 +1,23 @@ #include <stdio.h> #include <stdlib.h> -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { + if (argc < 2) { fprintf(stderr, "Missing name of file to create.\n"); return EXIT_FAILURE; - } + } - FILE *stream = fopen(argv[1], "w"); - if(stream == NULL) - { + FILE* stream = fopen(argv[1], "w"); + if (stream == NULL) { fprintf(stderr, "Unable to open %s for writing!\n", argv[1]); return EXIT_FAILURE; - } + } - if(fclose(stream)) - { + if (fclose(stream)) { fprintf(stderr, "Unable to close %s!\n", argv[1]); return EXIT_FAILURE; - } + } fprintf(stdout, ">> Creating %s!\n", argv[1]); diff --git a/Tests/ComplexOneConfig/Library/notInAllLib.cxx b/Tests/ComplexOneConfig/Library/notInAllLib.cxx index 5d928f4..e66ea05 100644 --- a/Tests/ComplexOneConfig/Library/notInAllLib.cxx +++ b/Tests/ComplexOneConfig/Library/notInAllLib.cxx @@ -1,5 +1,8 @@ -int notInAllLibFunc() { return 0; } +int notInAllLibFunc() +{ + return 0; +} #if 1 -# error "This target should not be compiled by ALL." +#error "This target should not be compiled by ALL." #endif diff --git a/Tests/ComplexOneConfig/Library/sharedFile.h b/Tests/ComplexOneConfig/Library/sharedFile.h index 65ac2e2..e32fcb7 100644 --- a/Tests/ComplexOneConfig/Library/sharedFile.h +++ b/Tests/ComplexOneConfig/Library/sharedFile.h @@ -1,8 +1,8 @@ #if defined(_WIN32) || defined(WIN32) /* Win32 version */ #ifdef CMakeTestLibraryShared_EXPORTS -# define CMakeTest_EXPORT __declspec(dllexport) +#define CMakeTest_EXPORT __declspec(dllexport) #else -# define CMakeTest_EXPORT __declspec(dllimport) +#define CMakeTest_EXPORT __declspec(dllimport) #endif #else /* unix needs nothing */ diff --git a/Tests/ComplexOneConfig/Library/testConly.h b/Tests/ComplexOneConfig/Library/testConly.h index ba84589..9b0fb73 100644 --- a/Tests/ComplexOneConfig/Library/testConly.h +++ b/Tests/ComplexOneConfig/Library/testConly.h @@ -1,8 +1,8 @@ #if defined(_WIN32) || defined(WIN32) /* Win32 version */ #ifdef CMakeTestCLibraryShared_EXPORTS -# define CMakeTest_EXPORT __declspec(dllexport) +#define CMakeTest_EXPORT __declspec(dllexport) #else -# define CMakeTest_EXPORT __declspec(dllimport) +#define CMakeTest_EXPORT __declspec(dllimport) #endif #else /* unix needs nothing */ @@ -10,4 +10,3 @@ #endif CMakeTest_EXPORT int CsharedFunction(); - diff --git a/Tests/CustComDepend/bar.h b/Tests/CustComDepend/bar.h index d179464..c072b81 100644 --- a/Tests/CustComDepend/bar.h +++ b/Tests/CustComDepend/bar.h @@ -1,9 +1,9 @@ #ifdef _WIN32 -# ifdef bar_EXPORTS -# define BAR_EXPORT __declspec( dllexport ) -# else -# define BAR_EXPORT __declspec( dllimport ) -# endif +#ifdef bar_EXPORTS +#define BAR_EXPORT __declspec(dllexport) #else -# define BAR_EXPORT +#define BAR_EXPORT __declspec(dllimport) +#endif +#else +#define BAR_EXPORT #endif diff --git a/Tests/CustComDepend/foo.cxx b/Tests/CustComDepend/foo.cxx index 19dfcb1..2705b66 100644 --- a/Tests/CustComDepend/foo.cxx +++ b/Tests/CustComDepend/foo.cxx @@ -4,12 +4,10 @@ int main(int ac, char** av) { FILE* fout = fopen(av[1], "w"); printf("create %s\n", av[1]); - if(!fout) - { + if (!fout) { return -1; - } + } fprintf(fout, "#include <bar.h>\nBAR_EXPORT int bar(){ return 10;}\n"); fclose(fout); return 0; } - diff --git a/Tests/CustomCommand/gen_redirect_in.c b/Tests/CustomCommand/gen_redirect_in.c index 8dd8f43..6af364b 100644 --- a/Tests/CustomCommand/gen_redirect_in.c +++ b/Tests/CustomCommand/gen_redirect_in.c @@ -1,5 +1,8 @@ #if 1 -int gen_redirect() { return 3; } +int gen_redirect() +{ + return 3; +} /* endif should be concatenated to generated file */ diff --git a/Tests/CustomCommand/generator.cxx b/Tests/CustomCommand/generator.cxx index cceac07..8281713 100644 --- a/Tests/CustomCommand/generator.cxx +++ b/Tests/CustomCommand/generator.cxx @@ -1,18 +1,17 @@ #include <stdio.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - if ( argc < 2 ) - { + if (argc < 2) { fprintf(stderr, "Usage: %s <file>\n", argv[0]); return 1; - } - FILE *fp = fopen(argv[1],"w"); + } + FILE* fp = fopen(argv[1], "w"); #ifdef GENERATOR_EXTERN - fprintf(fp,"int generated() { return 3; }\n"); + fprintf(fp, "int generated() { return 3; }\n"); #else - fprintf(fp,"extern int gen_redirect(void);\n"); - fprintf(fp,"int generated() { return gen_redirect(); }\n"); + fprintf(fp, "extern int gen_redirect(void);\n"); + fprintf(fp, "int generated() { return gen_redirect(); }\n"); #endif fclose(fp); return 0; diff --git a/Tests/CustomCommand/tcat.cxx b/Tests/CustomCommand/tcat.cxx index 89e3cb0..d010d14 100644 --- a/Tests/CustomCommand/tcat.cxx +++ b/Tests/CustomCommand/tcat.cxx @@ -3,9 +3,8 @@ int main() { int c; - while((c = getc(stdin), c != EOF)) - { + while ((c = getc(stdin), c != EOF)) { putc(c, stdout); - } + } return 0; } diff --git a/Tests/CustomCommand/wrapper.cxx b/Tests/CustomCommand/wrapper.cxx index 97912de..c380938 100644 --- a/Tests/CustomCommand/wrapper.cxx +++ b/Tests/CustomCommand/wrapper.cxx @@ -1,30 +1,28 @@ #include <stdio.h> #include <string.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - if ( argc < 3 ) - { + if (argc < 3) { fprintf(stderr, "Usage: %s <file1> <file2>\n", argv[0]); return 1; - } - FILE *fp = fopen(argv[1],"w"); - fprintf(fp,"extern int wrapped_help();\n"); - fprintf(fp,"int wrapped() { return wrapped_help(); }\n"); + } + FILE* fp = fopen(argv[1], "w"); + fprintf(fp, "extern int wrapped_help();\n"); + fprintf(fp, "int wrapped() { return wrapped_help(); }\n"); fclose(fp); - fp = fopen(argv[2],"w"); - fprintf(fp,"int wrapped_help() { return 5; }\n"); + fp = fopen(argv[2], "w"); + fprintf(fp, "int wrapped_help() { return 5; }\n"); fclose(fp); #ifdef CMAKE_INTDIR - const char* cfg = (argc >= 4)? argv[3] : ""; - if(strcmp(cfg, CMAKE_INTDIR) != 0) - { - fprintf(stderr, - "Did not receive expected configuration argument:\n" - " expected [" CMAKE_INTDIR "]\n" - " received [%s]\n", cfg); + const char* cfg = (argc >= 4) ? argv[3] : ""; + if (strcmp(cfg, CMAKE_INTDIR) != 0) { + fprintf(stderr, "Did not receive expected configuration argument:\n" + " expected [" CMAKE_INTDIR "]\n" + " received [%s]\n", + cfg); return 1; - } + } #endif return 0; } diff --git a/Tests/CustomCommandByproducts/CustomCommandByproducts.c b/Tests/CustomCommandByproducts/CustomCommandByproducts.c index 1916427..02ad7ea 100644 --- a/Tests/CustomCommandByproducts/CustomCommandByproducts.c +++ b/Tests/CustomCommandByproducts/CustomCommandByproducts.c @@ -9,15 +9,7 @@ extern int byproduct8(void); extern int ExternalLibrary(void); int main(void) { - return ( - byproduct1() + - byproduct2() + - byproduct3() + - byproduct4() + - byproduct5() + - byproduct6() + - byproduct7() + - byproduct8() + - ExternalLibrary() + - 0); + return (byproduct1() + byproduct2() + byproduct3() + byproduct4() + + byproduct5() + byproduct6() + byproduct7() + byproduct8() + + ExternalLibrary() + 0); } diff --git a/Tests/CustomCommandByproducts/External/ExternalLibrary.c b/Tests/CustomCommandByproducts/External/ExternalLibrary.c index a1dacf0..554f611 100644 --- a/Tests/CustomCommandByproducts/External/ExternalLibrary.c +++ b/Tests/CustomCommandByproducts/External/ExternalLibrary.c @@ -1 +1,4 @@ -int ExternalLibrary(void) { return 0; } +int ExternalLibrary(void) +{ + return 0; +} diff --git a/Tests/CustomCommandByproducts/ProducerExe.c b/Tests/CustomCommandByproducts/ProducerExe.c index 78f2de1..8488f4e 100644 --- a/Tests/CustomCommandByproducts/ProducerExe.c +++ b/Tests/CustomCommandByproducts/ProducerExe.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/CxxOnly/cxxonly.cxx b/Tests/CxxOnly/cxxonly.cxx index 9cf6f2d..0911a07 100644 --- a/Tests/CxxOnly/cxxonly.cxx +++ b/Tests/CxxOnly/cxxonly.cxx @@ -6,20 +6,18 @@ extern int testCPP; #include <stdio.h> -int main () +int main() { #ifdef _MSC_VER testCPP = 1; #endif - if ( LibCxx1Class::Method() != 2.0 ) - { + if (LibCxx1Class::Method() != 2.0) { printf("Problem with libcxx1\n"); return 1; - } - if ( LibCxx2Class::Method() != 1.0 ) - { + } + if (LibCxx2Class::Method() != 1.0) { printf("Problem with libcxx2\n"); return 1; - } + } return 0; } diff --git a/Tests/CxxOnly/libcxx2.h b/Tests/CxxOnly/libcxx2.h index 5dd84f6..1d97fa0 100644 --- a/Tests/CxxOnly/libcxx2.h +++ b/Tests/CxxOnly/libcxx2.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef testcxx2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef testcxx2_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif class CM_TEST_LIB_EXPORT LibCxx2Class diff --git a/Tests/CxxOnly/testCxxModule.cxx b/Tests/CxxOnly/testCxxModule.cxx index dd16d2b..039e8bb 100644 --- a/Tests/CxxOnly/testCxxModule.cxx +++ b/Tests/CxxOnly/testCxxModule.cxx @@ -1,6 +1,9 @@ #ifdef _WIN32 -# define TEST_EXPORT __declspec(dllexport) +#define TEST_EXPORT __declspec(dllexport) #else -# define TEST_EXPORT +#define TEST_EXPORT #endif -TEST_EXPORT int testCxxModule(void) { return 0; } +TEST_EXPORT int testCxxModule(void) +{ + return 0; +} diff --git a/Tests/CxxSubdirC/Cdir/Cobj.c b/Tests/CxxSubdirC/Cdir/Cobj.c index 75a0045..a593e07 100644 --- a/Tests/CxxSubdirC/Cdir/Cobj.c +++ b/Tests/CxxSubdirC/Cdir/Cobj.c @@ -1 +1,4 @@ -int Cobj(void) { return 0; } +int Cobj(void) +{ + return 0; +} diff --git a/Tests/CxxSubdirC/main.cxx b/Tests/CxxSubdirC/main.cxx index 049220f..c4cebc4 100644 --- a/Tests/CxxSubdirC/main.cxx +++ b/Tests/CxxSubdirC/main.cxx @@ -1,2 +1,5 @@ extern "C" int Cobj(void); -int main() { return Cobj(); } +int main() +{ + return Cobj(); +} diff --git a/Tests/Dependency/Case1/a.c b/Tests/Dependency/Case1/a.c index d702db1..262f523 100644 --- a/Tests/Dependency/Case1/a.c +++ b/Tests/Dependency/Case1/a.c @@ -1,5 +1,4 @@ int a() { - return 5; + return 5; } - diff --git a/Tests/Dependency/Case1/b.c b/Tests/Dependency/Case1/b.c index 6bdfafa..deda685 100644 --- a/Tests/Dependency/Case1/b.c +++ b/Tests/Dependency/Case1/b.c @@ -2,5 +2,5 @@ extern int a(); int b() { - return a()+17; + return a() + 17; } diff --git a/Tests/Dependency/Case1/b2.c b/Tests/Dependency/Case1/b2.c index f37e1bb..f341da7 100644 --- a/Tests/Dependency/Case1/b2.c +++ b/Tests/Dependency/Case1/b2.c @@ -1,4 +1,4 @@ int b2() { - return 3; + return 3; } diff --git a/Tests/Dependency/Case1/c.c b/Tests/Dependency/Case1/c.c index c180a59..a3ec162 100644 --- a/Tests/Dependency/Case1/c.c +++ b/Tests/Dependency/Case1/c.c @@ -2,5 +2,5 @@ extern int b(); int c() { - return b()+42; + return b() + 42; } diff --git a/Tests/Dependency/Case1/c2.c b/Tests/Dependency/Case1/c2.c index 4cf4426..317bb0f 100644 --- a/Tests/Dependency/Case1/c2.c +++ b/Tests/Dependency/Case1/c2.c @@ -2,5 +2,5 @@ extern int b2(); int c2() { - return b2()+1; + return b2() + 1; } diff --git a/Tests/Dependency/Case1/d.c b/Tests/Dependency/Case1/d.c index ea5457d..f67aef7 100644 --- a/Tests/Dependency/Case1/d.c +++ b/Tests/Dependency/Case1/d.c @@ -2,6 +2,5 @@ extern int c2(); int d() { - return c2()+2; + return c2() + 2; } - diff --git a/Tests/Dependency/Case1/main.c b/Tests/Dependency/Case1/main.c index 1e5f6d4..07191cc 100644 --- a/Tests/Dependency/Case1/main.c +++ b/Tests/Dependency/Case1/main.c @@ -4,7 +4,7 @@ extern int d(); int main() { - c(); - b(); - d(); + c(); + b(); + d(); } diff --git a/Tests/Dependency/Case2/bar1.c b/Tests/Dependency/Case2/bar1.c index 6108fba..6da9077 100644 --- a/Tests/Dependency/Case2/bar1.c +++ b/Tests/Dependency/Case2/bar1.c @@ -1,4 +1,10 @@ extern int foo1(); extern int bar2(void); -int bar1(void) { return bar2(); } -int bar1_from_bar3(void) { return foo1(); } +int bar1(void) +{ + return bar2(); +} +int bar1_from_bar3(void) +{ + return foo1(); +} diff --git a/Tests/Dependency/Case2/bar2.c b/Tests/Dependency/Case2/bar2.c index b9a2360..00ed483 100644 --- a/Tests/Dependency/Case2/bar2.c +++ b/Tests/Dependency/Case2/bar2.c @@ -1,2 +1,5 @@ extern int bar3(void); -int bar2(void) { return bar3(); } +int bar2(void) +{ + return bar3(); +} diff --git a/Tests/Dependency/Case2/bar3.c b/Tests/Dependency/Case2/bar3.c index 73e8556..a950899 100644 --- a/Tests/Dependency/Case2/bar3.c +++ b/Tests/Dependency/Case2/bar3.c @@ -1,2 +1,5 @@ extern int bar1_from_bar3(void); -int bar3(void) { return bar1_from_bar3(); } +int bar3(void) +{ + return bar1_from_bar3(); +} diff --git a/Tests/Dependency/Case2/foo1.c b/Tests/Dependency/Case2/foo1.c index 5f1f8ac..d476f2c 100644 --- a/Tests/Dependency/Case2/foo1.c +++ b/Tests/Dependency/Case2/foo1.c @@ -1,2 +1,5 @@ extern int foo2(void); -int foo1(void) { return foo2(); } +int foo1(void) +{ + return foo2(); +} diff --git a/Tests/Dependency/Case2/foo1b.c b/Tests/Dependency/Case2/foo1b.c index e2b6dc3..e437014 100644 --- a/Tests/Dependency/Case2/foo1b.c +++ b/Tests/Dependency/Case2/foo1b.c @@ -1,2 +1,5 @@ extern int foo2b(void); -int foo1b(void) { return foo2b(); } +int foo1b(void) +{ + return foo2b(); +} diff --git a/Tests/Dependency/Case2/foo1c.c b/Tests/Dependency/Case2/foo1c.c index 1dcca58..af03dec 100644 --- a/Tests/Dependency/Case2/foo1c.c +++ b/Tests/Dependency/Case2/foo1c.c @@ -1,2 +1,5 @@ extern int foo2c(void); -int foo1c(void) { return foo2c(); } +int foo1c(void) +{ + return foo2c(); +} diff --git a/Tests/Dependency/Case2/foo2.c b/Tests/Dependency/Case2/foo2.c index 6019236..587c77a 100644 --- a/Tests/Dependency/Case2/foo2.c +++ b/Tests/Dependency/Case2/foo2.c @@ -1,2 +1,5 @@ extern int foo3(void); -int foo2(void) { return foo3(); } +int foo2(void) +{ + return foo3(); +} diff --git a/Tests/Dependency/Case2/foo2b.c b/Tests/Dependency/Case2/foo2b.c index 34d6944..6959e63 100644 --- a/Tests/Dependency/Case2/foo2b.c +++ b/Tests/Dependency/Case2/foo2b.c @@ -1,2 +1,5 @@ extern int foo3b(void); -int foo2b(void) { return foo3b(); } +int foo2b(void) +{ + return foo3b(); +} diff --git a/Tests/Dependency/Case2/foo2c.c b/Tests/Dependency/Case2/foo2c.c index dbc54de..aedb61c 100644 --- a/Tests/Dependency/Case2/foo2c.c +++ b/Tests/Dependency/Case2/foo2c.c @@ -1,2 +1,5 @@ extern int foo3c(void); -int foo2c(void) { return foo3c(); } +int foo2c(void) +{ + return foo3c(); +} diff --git a/Tests/Dependency/Case2/foo3.c b/Tests/Dependency/Case2/foo3.c index dacef6a..cab9535 100644 --- a/Tests/Dependency/Case2/foo3.c +++ b/Tests/Dependency/Case2/foo3.c @@ -1,2 +1,5 @@ extern int foo1b(void); -int foo3(void) { return foo1b(); } +int foo3(void) +{ + return foo1b(); +} diff --git a/Tests/Dependency/Case2/foo3b.c b/Tests/Dependency/Case2/foo3b.c index ca25fd8..69d2c8c 100644 --- a/Tests/Dependency/Case2/foo3b.c +++ b/Tests/Dependency/Case2/foo3b.c @@ -1,2 +1,5 @@ extern int foo1c(void); -int foo3b(void) { return foo1c(); } +int foo3b(void) +{ + return foo1c(); +} diff --git a/Tests/Dependency/Case2/foo3c.c b/Tests/Dependency/Case2/foo3c.c index 0ad65fe..e774495 100644 --- a/Tests/Dependency/Case2/foo3c.c +++ b/Tests/Dependency/Case2/foo3c.c @@ -1 +1,4 @@ -int foo3c(void) { return 0; } +int foo3c(void) +{ + return 0; +} diff --git a/Tests/Dependency/Case3/foo1.c b/Tests/Dependency/Case3/foo1.c index 5f1f8ac..d476f2c 100644 --- a/Tests/Dependency/Case3/foo1.c +++ b/Tests/Dependency/Case3/foo1.c @@ -1,2 +1,5 @@ extern int foo2(void); -int foo1(void) { return foo2(); } +int foo1(void) +{ + return foo2(); +} diff --git a/Tests/Dependency/Case3/foo1b.c b/Tests/Dependency/Case3/foo1b.c index 6ae3bab..84933af 100644 --- a/Tests/Dependency/Case3/foo1b.c +++ b/Tests/Dependency/Case3/foo1b.c @@ -1 +1,4 @@ -int foo1b(void) { return 0; } +int foo1b(void) +{ + return 0; +} diff --git a/Tests/Dependency/Case3/foo2.c b/Tests/Dependency/Case3/foo2.c index 33dbbfc..9bbb5d7 100644 --- a/Tests/Dependency/Case3/foo2.c +++ b/Tests/Dependency/Case3/foo2.c @@ -1,2 +1,5 @@ extern int foo1b(void); -int foo2(void) { return foo1b(); } +int foo2(void) +{ + return foo1b(); +} diff --git a/Tests/Dependency/Case4/bar.c b/Tests/Dependency/Case4/bar.c index d0bb0c4..08092f9 100644 --- a/Tests/Dependency/Case4/bar.c +++ b/Tests/Dependency/Case4/bar.c @@ -1,2 +1,5 @@ extern int foo(); -int main() { return foo(); } +int main() +{ + return foo(); +} diff --git a/Tests/Dependency/Case4/foo.c b/Tests/Dependency/Case4/foo.c index 9fe07f8..e05eb7e 100644 --- a/Tests/Dependency/Case4/foo.c +++ b/Tests/Dependency/Case4/foo.c @@ -1 +1,4 @@ -int foo() { return 0; } +int foo() +{ + return 0; +} diff --git a/Tests/Dependency/Case5/bar.c b/Tests/Dependency/Case5/bar.c index 4cb1b1b..fcbd135 100644 --- a/Tests/Dependency/Case5/bar.c +++ b/Tests/Dependency/Case5/bar.c @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllimport) #endif -void foo(void); + void foo(void); #include <stdio.h> diff --git a/Tests/Dependency/Case5/foo.c b/Tests/Dependency/Case5/foo.c index 794833d..b82b7c2 100644 --- a/Tests/Dependency/Case5/foo.c +++ b/Tests/Dependency/Case5/foo.c @@ -3,7 +3,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -void foo(void) + void foo(void) { printf("foo()\n"); } diff --git a/Tests/Dependency/Case5/main.c b/Tests/Dependency/Case5/main.c index ae3dc95..a967944 100644 --- a/Tests/Dependency/Case5/main.c +++ b/Tests/Dependency/Case5/main.c @@ -1,6 +1,6 @@ void bar(void); -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { bar(); return 0; diff --git a/Tests/Dependency/Exec/ExecMain.c b/Tests/Dependency/Exec/ExecMain.c index d2f551c..9572afd 100644 --- a/Tests/Dependency/Exec/ExecMain.c +++ b/Tests/Dependency/Exec/ExecMain.c @@ -5,7 +5,7 @@ void NoDepCFunction(); void SixAFunction(); void SixBFunction(); -int main( ) +int main() { SixAFunction(); SixBFunction(); diff --git a/Tests/Dependency/Exec2/ExecMain.c b/Tests/Dependency/Exec2/ExecMain.c index d08a796..385cce1 100644 --- a/Tests/Dependency/Exec2/ExecMain.c +++ b/Tests/Dependency/Exec2/ExecMain.c @@ -3,7 +3,7 @@ void FiveFunction(); void EightFunction(); -int main( ) +int main() { FiveFunction(); EightFunction(); diff --git a/Tests/Dependency/Exec3/ExecMain.c b/Tests/Dependency/Exec3/ExecMain.c index d08a796..385cce1 100644 --- a/Tests/Dependency/Exec3/ExecMain.c +++ b/Tests/Dependency/Exec3/ExecMain.c @@ -3,7 +3,7 @@ void FiveFunction(); void EightFunction(); -int main( ) +int main() { FiveFunction(); EightFunction(); diff --git a/Tests/Dependency/Exec4/ExecMain.c b/Tests/Dependency/Exec4/ExecMain.c index 3f53573..0cfcce9 100644 --- a/Tests/Dependency/Exec4/ExecMain.c +++ b/Tests/Dependency/Exec4/ExecMain.c @@ -3,7 +3,7 @@ void FiveFunction(); void TwoFunction(); -int main( ) +int main() { FiveFunction(); TwoFunction(); diff --git a/Tests/Dependency/Four/FourSrc.c b/Tests/Dependency/Four/FourSrc.c index 23a66a4..4ea996d 100644 --- a/Tests/Dependency/Four/FourSrc.c +++ b/Tests/Dependency/Four/FourSrc.c @@ -6,7 +6,7 @@ void TwoFunction(); void FourFunction() { static int count = 0; - if( count == 0 ) { + if (count == 0) { ++count; TwoFunction(); } diff --git a/Tests/Dependency/Three/ThreeSrc.c b/Tests/Dependency/Three/ThreeSrc.c index 9c77f17..3e814f3 100644 --- a/Tests/Dependency/Three/ThreeSrc.c +++ b/Tests/Dependency/Three/ThreeSrc.c @@ -4,7 +4,7 @@ void FourFunction(); void ThreeFunction() { static int count = 0; - if( count == 0 ) { + if (count == 0) { ++count; FourFunction(); } diff --git a/Tests/Dependency/Two/TwoSrc.c b/Tests/Dependency/Two/TwoSrc.c index 0b3366b..dbdf524 100644 --- a/Tests/Dependency/Two/TwoSrc.c +++ b/Tests/Dependency/Two/TwoSrc.c @@ -3,7 +3,7 @@ void TwoFunction() { static int count = 0; - if( count == 0 ) { + if (count == 0) { ++count; ThreeFunction(); } diff --git a/Tests/EmptyProperty/EmptyProperty.cxx b/Tests/EmptyProperty/EmptyProperty.cxx index 78f2de1..8488f4e 100644 --- a/Tests/EmptyProperty/EmptyProperty.cxx +++ b/Tests/EmptyProperty/EmptyProperty.cxx @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/Environment/main.cxx b/Tests/Environment/main.cxx index 2e1bf4c..55bc77f 100644 --- a/Tests/Environment/main.cxx +++ b/Tests/Environment/main.cxx @@ -1,13 +1,12 @@ #include <stdio.h> #include <stdlib.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { char* var = getenv("CMAKE_ENVIRONMENT_TEST_VAR"); - if (!var) - { + if (!var) { var = "(null)"; - } + } fprintf(stdout, "Environment:\n"); fprintf(stdout, " CMAKE_ENVIRONMENT_TEST_VAR='%s'\n", var); diff --git a/Tests/ExportImport/Export/Interface/headeronly/headeronly.h b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h index 3673c21..92bfecd 100644 --- a/Tests/ExportImport/Export/Interface/headeronly/headeronly.h +++ b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h @@ -1,5 +1,8 @@ -enum { one }; +enum +{ + one +}; struct HeaderOnly { diff --git a/Tests/ExportImport/Export/empty.cpp b/Tests/ExportImport/Export/empty.cpp index 1787013..11ec041 100644 --- a/Tests/ExportImport/Export/empty.cpp +++ b/Tests/ExportImport/Export/empty.cpp @@ -1,4 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() { return 0; } + int empty() +{ + return 0; +} diff --git a/Tests/ExportImport/Export/systemlib.cpp b/Tests/ExportImport/Export/systemlib.cpp index ec45148..a9e6179 100644 --- a/Tests/ExportImport/Export/systemlib.cpp +++ b/Tests/ExportImport/Export/systemlib.cpp @@ -3,5 +3,4 @@ SystemStruct::SystemStruct() { - } diff --git a/Tests/ExportImport/Export/systemlib.h b/Tests/ExportImport/Export/systemlib.h index f7900c0..6fd00d5 100644 --- a/Tests/ExportImport/Export/systemlib.h +++ b/Tests/ExportImport/Export/systemlib.h @@ -3,9 +3,9 @@ #define SYSTEMLIB_H #if defined(_WIN32) || defined(__CYGWIN__) -# define systemlib_EXPORT __declspec(dllexport) +#define systemlib_EXPORT __declspec(dllexport) #else -# define systemlib_EXPORT +#define systemlib_EXPORT #endif struct systemlib_EXPORT SystemStruct diff --git a/Tests/ExportImport/Export/testExe1.c b/Tests/ExportImport/Export/testExe1.c index e00fac7..5fbb892 100644 --- a/Tests/ExportImport/Export/testExe1.c +++ b/Tests/ExportImport/Export/testExe1.c @@ -4,22 +4,18 @@ extern int testExe1lib(void); int main(int argc, const char* argv[]) { - if(argc < 2) - { + if (argc < 2) { fprintf(stderr, "Must specify output file.\n"); return 1; - } + } { - FILE* f = fopen(argv[1], "w"); - if(f) - { - fprintf(f, "int generated_by_testExe1() { return 0; }\n"); - fclose(f); - } - else - { - fprintf(stderr, "Error writing to %s\n", argv[1]); - return 1; + FILE* f = fopen(argv[1], "w"); + if (f) { + fprintf(f, "int generated_by_testExe1() { return 0; }\n"); + fclose(f); + } else { + fprintf(stderr, "Error writing to %s\n", argv[1]); + return 1; } } return testExe1lib(); diff --git a/Tests/ExportImport/Export/testExe1lib.c b/Tests/ExportImport/Export/testExe1lib.c index 7ad48a3..4bb3325 100644 --- a/Tests/ExportImport/Export/testExe1lib.c +++ b/Tests/ExportImport/Export/testExe1lib.c @@ -1 +1,4 @@ -int testExe1lib(void) { return 0; } +int testExe1lib(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testExe2.c b/Tests/ExportImport/Export/testExe2.c index f7d9345..f8976c4 100644 --- a/Tests/ExportImport/Export/testExe2.c +++ b/Tests/ExportImport/Export/testExe2.c @@ -1,10 +1,13 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testExe2_EXPORT __declspec(dllexport) +#define testExe2_EXPORT __declspec(dllexport) #else -# define testExe2_EXPORT +#define testExe2_EXPORT #endif -testExe2_EXPORT int testExe2Func(void) { return 123; } +testExe2_EXPORT int testExe2Func(void) +{ + return 123; +} int main() { diff --git a/Tests/ExportImport/Export/testExe2lib.c b/Tests/ExportImport/Export/testExe2lib.c index 1991439..2a5a77b 100644 --- a/Tests/ExportImport/Export/testExe2lib.c +++ b/Tests/ExportImport/Export/testExe2lib.c @@ -1,10 +1,13 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testExe2lib_EXPORT __declspec(dllexport) -# define testExe2libImp_IMPORT __declspec(dllimport) +#define testExe2lib_EXPORT __declspec(dllexport) +#define testExe2libImp_IMPORT __declspec(dllimport) #else -# define testExe2lib_EXPORT -# define testExe2libImp_IMPORT +#define testExe2lib_EXPORT +#define testExe2libImp_IMPORT #endif testExe2libImp_IMPORT int testExe2libImp(void); -testExe2lib_EXPORT int testExe2lib(void) { return testExe2libImp(); } +testExe2lib_EXPORT int testExe2lib(void) +{ + return testExe2libImp(); +} diff --git a/Tests/ExportImport/Export/testExe2libImp.c b/Tests/ExportImport/Export/testExe2libImp.c index f5a23af..aba914b 100644 --- a/Tests/ExportImport/Export/testExe2libImp.c +++ b/Tests/ExportImport/Export/testExe2libImp.c @@ -1,7 +1,10 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testExe2libImp_EXPORT __declspec(dllexport) +#define testExe2libImp_EXPORT __declspec(dllexport) #else -# define testExe2libImp_EXPORT +#define testExe2libImp_EXPORT #endif -testExe2libImp_EXPORT int testExe2libImp(void) { return 0; } +testExe2libImp_EXPORT int testExe2libImp(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testExe3.c b/Tests/ExportImport/Export/testExe3.c index 895e2fc..2b07576 100644 --- a/Tests/ExportImport/Export/testExe3.c +++ b/Tests/ExportImport/Export/testExe3.c @@ -2,22 +2,18 @@ int main(int argc, const char* argv[]) { - if(argc < 2) - { + if (argc < 2) { fprintf(stderr, "Must specify output file.\n"); return 1; - } + } { - FILE* f = fopen(argv[1], "w"); - if(f) - { - fprintf(f, "int generated_by_testExe3() { return 0; }\n"); - fclose(f); - } - else - { - fprintf(stderr, "Error writing to %s\n", argv[1]); - return 1; + FILE* f = fopen(argv[1], "w"); + if (f) { + fprintf(f, "int generated_by_testExe3() { return 0; }\n"); + fclose(f); + } else { + fprintf(stderr, "Error writing to %s\n", argv[1]); + return 1; } } return 0; diff --git a/Tests/ExportImport/Export/testExe4.c b/Tests/ExportImport/Export/testExe4.c index 731057e..422ab3d 100644 --- a/Tests/ExportImport/Export/testExe4.c +++ b/Tests/ExportImport/Export/testExe4.c @@ -2,22 +2,18 @@ int main(int argc, const char* argv[]) { - if(argc < 2) - { + if (argc < 2) { fprintf(stderr, "Must specify output file.\n"); return 1; - } + } { - FILE* f = fopen(argv[1], "w"); - if(f) - { - fprintf(f, "int generated_by_testExe4() { return 0; }\n"); - fclose(f); - } - else - { - fprintf(stderr, "Error writing to %s\n", argv[1]); - return 1; + FILE* f = fopen(argv[1], "w"); + if (f) { + fprintf(f, "int generated_by_testExe4() { return 0; }\n"); + fclose(f); + } else { + fprintf(stderr, "Error writing to %s\n", argv[1]); + return 1; } } return 0; diff --git a/Tests/ExportImport/Export/testLib1.c b/Tests/ExportImport/Export/testLib1.c index 35bb1e5..5002963 100644 --- a/Tests/ExportImport/Export/testLib1.c +++ b/Tests/ExportImport/Export/testLib1.c @@ -1 +1,4 @@ -int testLib1(void) { return 0; } +int testLib1(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib2.c b/Tests/ExportImport/Export/testLib2.c index aabc0d3..7a5206f 100644 --- a/Tests/ExportImport/Export/testLib2.c +++ b/Tests/ExportImport/Export/testLib2.c @@ -1,4 +1,7 @@ extern int testLib1(void); -int testLib2(void) { return testLib1(); } +int testLib2(void) +{ + return testLib1(); +} diff --git a/Tests/ExportImport/Export/testLib3.c b/Tests/ExportImport/Export/testLib3.c index 31cec94..cacac81 100644 --- a/Tests/ExportImport/Export/testLib3.c +++ b/Tests/ExportImport/Export/testLib3.c @@ -1,10 +1,13 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testLib3_EXPORT __declspec(dllexport) -# define testLib3Imp_IMPORT __declspec(dllimport) +#define testLib3_EXPORT __declspec(dllexport) +#define testLib3Imp_IMPORT __declspec(dllimport) #else -# define testLib3_EXPORT -# define testLib3Imp_IMPORT +#define testLib3_EXPORT +#define testLib3Imp_IMPORT #endif testLib3Imp_IMPORT int testLib3Imp(void); -testLib3_EXPORT int testLib3(void) { return testLib3Imp(); } +testLib3_EXPORT int testLib3(void) +{ + return testLib3Imp(); +} diff --git a/Tests/ExportImport/Export/testLib3Imp.c b/Tests/ExportImport/Export/testLib3Imp.c index c27bccd..3d836da 100644 --- a/Tests/ExportImport/Export/testLib3Imp.c +++ b/Tests/ExportImport/Export/testLib3Imp.c @@ -1,10 +1,13 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testLib3Imp_EXPORT __declspec(dllexport) -# define testLib3ImpDep_IMPORT __declspec(dllimport) +#define testLib3Imp_EXPORT __declspec(dllexport) +#define testLib3ImpDep_IMPORT __declspec(dllimport) #else -# define testLib3Imp_EXPORT -# define testLib3ImpDep_IMPORT +#define testLib3Imp_EXPORT +#define testLib3ImpDep_IMPORT #endif testLib3ImpDep_IMPORT int testLib3ImpDep(void); -testLib3Imp_EXPORT int testLib3Imp(void) { return testLib3ImpDep(); } +testLib3Imp_EXPORT int testLib3Imp(void) +{ + return testLib3ImpDep(); +} diff --git a/Tests/ExportImport/Export/testLib3ImpDep.c b/Tests/ExportImport/Export/testLib3ImpDep.c index 578ac30..b824e03 100644 --- a/Tests/ExportImport/Export/testLib3ImpDep.c +++ b/Tests/ExportImport/Export/testLib3ImpDep.c @@ -1,7 +1,10 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testLib3ImpDep_EXPORT __declspec(dllexport) +#define testLib3ImpDep_EXPORT __declspec(dllexport) #else -# define testLib3ImpDep_EXPORT +#define testLib3ImpDep_EXPORT #endif -testLib3ImpDep_EXPORT int testLib3ImpDep(void) { return 0; } +testLib3ImpDep_EXPORT int testLib3ImpDep(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib4.c b/Tests/ExportImport/Export/testLib4.c index 846b438..0e583b1 100644 --- a/Tests/ExportImport/Export/testLib4.c +++ b/Tests/ExportImport/Export/testLib4.c @@ -1,7 +1,10 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testLib4_EXPORT __declspec(dllexport) +#define testLib4_EXPORT __declspec(dllexport) #else -# define testLib4_EXPORT +#define testLib4_EXPORT #endif -testLib4_EXPORT int testLib4(void) { return 0; } +testLib4_EXPORT int testLib4(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib5.c b/Tests/ExportImport/Export/testLib5.c index 20a8215..7c61fc0 100644 --- a/Tests/ExportImport/Export/testLib5.c +++ b/Tests/ExportImport/Export/testLib5.c @@ -1,7 +1,10 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testLib5_EXPORT __declspec(dllexport) +#define testLib5_EXPORT __declspec(dllexport) #else -# define testLib5_EXPORT +#define testLib5_EXPORT #endif -testLib5_EXPORT int testLib5(void) { return 0; } +testLib5_EXPORT int testLib5(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib7.c b/Tests/ExportImport/Export/testLib7.c index 7acae9e..de85c1a 100644 --- a/Tests/ExportImport/Export/testLib7.c +++ b/Tests/ExportImport/Export/testLib7.c @@ -1 +1,4 @@ -int testLib7(void) { return 0; } +int testLib7(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLibAbs1.c b/Tests/ExportImport/Export/testLibAbs1.c index 34aec75..c214b62 100644 --- a/Tests/ExportImport/Export/testLibAbs1.c +++ b/Tests/ExportImport/Export/testLibAbs1.c @@ -1 +1,4 @@ -int testLibAbs1(void) { return 0; } +int testLibAbs1(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLibCycleA1.c b/Tests/ExportImport/Export/testLibCycleA1.c index 3db9e53..cfbf0e1 100644 --- a/Tests/ExportImport/Export/testLibCycleA1.c +++ b/Tests/ExportImport/Export/testLibCycleA1.c @@ -1,2 +1,5 @@ extern int testLibCycleB1(void); -int testLibCycleA1(void) { return testLibCycleB1(); } +int testLibCycleA1(void) +{ + return testLibCycleB1(); +} diff --git a/Tests/ExportImport/Export/testLibCycleA2.c b/Tests/ExportImport/Export/testLibCycleA2.c index 29ad46d..93c9fb6 100644 --- a/Tests/ExportImport/Export/testLibCycleA2.c +++ b/Tests/ExportImport/Export/testLibCycleA2.c @@ -1,2 +1,5 @@ extern int testLibCycleB2(void); -int testLibCycleA2(void) { return testLibCycleB2(); } +int testLibCycleA2(void) +{ + return testLibCycleB2(); +} diff --git a/Tests/ExportImport/Export/testLibCycleA3.c b/Tests/ExportImport/Export/testLibCycleA3.c index 565447b..468c044 100644 --- a/Tests/ExportImport/Export/testLibCycleA3.c +++ b/Tests/ExportImport/Export/testLibCycleA3.c @@ -1,2 +1,5 @@ extern int testLibCycleB3(void); -int testLibCycleA3(void) { return testLibCycleB3(); } +int testLibCycleA3(void) +{ + return testLibCycleB3(); +} diff --git a/Tests/ExportImport/Export/testLibCycleB1.c b/Tests/ExportImport/Export/testLibCycleB1.c index 36cb7b0..d152857 100644 --- a/Tests/ExportImport/Export/testLibCycleB1.c +++ b/Tests/ExportImport/Export/testLibCycleB1.c @@ -1,2 +1,5 @@ extern int testLibCycleA2(void); -int testLibCycleB1(void) { return testLibCycleA2(); } +int testLibCycleB1(void) +{ + return testLibCycleA2(); +} diff --git a/Tests/ExportImport/Export/testLibCycleB2.c b/Tests/ExportImport/Export/testLibCycleB2.c index ff12093..18cd4f6 100644 --- a/Tests/ExportImport/Export/testLibCycleB2.c +++ b/Tests/ExportImport/Export/testLibCycleB2.c @@ -1,2 +1,5 @@ extern int testLibCycleA3(void); -int testLibCycleB2(void) { return testLibCycleA3(); } +int testLibCycleB2(void) +{ + return testLibCycleA3(); +} diff --git a/Tests/ExportImport/Export/testLibCycleB3.c b/Tests/ExportImport/Export/testLibCycleB3.c index ca8d470..a281c69 100644 --- a/Tests/ExportImport/Export/testLibCycleB3.c +++ b/Tests/ExportImport/Export/testLibCycleB3.c @@ -1 +1,4 @@ -int testLibCycleB3(void) { return 0; } +int testLibCycleB3(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLibDepends.c b/Tests/ExportImport/Export/testLibDepends.c index 3c7774ee..c896c10 100644 --- a/Tests/ExportImport/Export/testLibDepends.c +++ b/Tests/ExportImport/Export/testLibDepends.c @@ -18,8 +18,7 @@ extern int testLibRequired(void); extern int testStaticLibRequiredPrivate(void); -int testLibDepends(void) { - return testLibRequired() - + testStaticLibRequiredPrivate() - ; +int testLibDepends(void) +{ + return testLibRequired() + testStaticLibRequiredPrivate(); } diff --git a/Tests/ExportImport/Export/testLibNoSONAME.c b/Tests/ExportImport/Export/testLibNoSONAME.c index 2193e1f..30acc83 100644 --- a/Tests/ExportImport/Export/testLibNoSONAME.c +++ b/Tests/ExportImport/Export/testLibNoSONAME.c @@ -1,7 +1,10 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testLibNoSONAME_EXPORT __declspec(dllexport) +#define testLibNoSONAME_EXPORT __declspec(dllexport) #else -# define testLibNoSONAME_EXPORT +#define testLibNoSONAME_EXPORT #endif -testLibNoSONAME_EXPORT int testLibNoSONAME(void) { return 0; } +testLibNoSONAME_EXPORT int testLibNoSONAME(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLibPerConfigDest.c b/Tests/ExportImport/Export/testLibPerConfigDest.c index c7113fc..903e040 100644 --- a/Tests/ExportImport/Export/testLibPerConfigDest.c +++ b/Tests/ExportImport/Export/testLibPerConfigDest.c @@ -1 +1,4 @@ -int testLibPerConfigDest(void) { return 0; } +int testLibPerConfigDest(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLibRequired.c b/Tests/ExportImport/Export/testLibRequired.c index e126d44..24f320c 100644 --- a/Tests/ExportImport/Export/testLibRequired.c +++ b/Tests/ExportImport/Export/testLibRequired.c @@ -1 +1,4 @@ -int testLibRequired(void) { return 0; } +int testLibRequired(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c b/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c index 28a2675..5597fb4 100644 --- a/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c +++ b/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c @@ -1 +1,4 @@ -int testStaticLibRequiredPrivate(void) { return 0; } +int testStaticLibRequiredPrivate(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c index 953d0ad..1539bcb 100644 --- a/Tests/ExportImport/Import/A/deps_iface.c +++ b/Tests/ExportImport/Import/A/deps_iface.c @@ -27,7 +27,6 @@ extern int testLibDepends(void); - int main() { return testLibDepends(); diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp index 0c5cb7f..3658ab5 100644 --- a/Tests/ExportImport/Import/A/deps_shared_iface.cpp +++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp @@ -31,7 +31,7 @@ #endif #endif -int main(int,char **) +int main(int, char**) { TestSharedLibDepends dep; TestSharedLibRequired req; @@ -43,7 +43,7 @@ int main(int,char **) return dep.foo() + req.foo() #ifdef TEST_SUBDIR_LIB - + sdo.foo() + ren.foo() + + sdo.foo() + ren.foo() #endif - ; + ; } diff --git a/Tests/ExportImport/Import/A/imp_mod1.c b/Tests/ExportImport/Import/A/imp_mod1.c index 579d949..89d7545 100644 --- a/Tests/ExportImport/Import/A/imp_mod1.c +++ b/Tests/ExportImport/Import/A/imp_mod1.c @@ -1,7 +1,7 @@ #if defined(_WIN32) || defined(__CYGWIN__) -# define testExe2_IMPORT __declspec(dllimport) +#define testExe2_IMPORT __declspec(dllimport) #else -# define testExe2_IMPORT +#define testExe2_IMPORT #endif testExe2_IMPORT int testExe2Func(void); diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index 0a74309..83a9bb5 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -14,16 +14,16 @@ extern int testLibPerConfigDest(); /* Switch a symbol between debug and optimized builds to make sure the proper library is found from the testLib4 link interface. */ #ifdef EXE_DBG -# define testLib4libcfg testLib4libdbg +#define testLib4libcfg testLib4libdbg #else -# define testLib4libcfg testLib4libopt +#define testLib4libcfg testLib4libopt #endif extern testLib4libcfg(void); int main() { - return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() - + testLib5() + testLib6() + testLib7() + testLibCycleA1() - + testLibPerConfigDest() - + generated_by_testExe3() + generated_by_testExe4() + testLib4lib() + testLib4libcfg()); + return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() + + testLib5() + testLib6() + testLib7() + testLibCycleA1() + + testLibPerConfigDest() + generated_by_testExe3() + + generated_by_testExe4() + testLib4lib() + testLib4libcfg()); } diff --git a/Tests/ExportImport/Import/A/imp_testExeAbs1.c b/Tests/ExportImport/Import/A/imp_testExeAbs1.c index 069c3f0..629b891 100644 --- a/Tests/ExportImport/Import/A/imp_testExeAbs1.c +++ b/Tests/ExportImport/Import/A/imp_testExeAbs1.c @@ -2,14 +2,12 @@ #include "testLibAbs1a.h" #include "testLibAbs1b.h" #ifndef testLibAbs1a -# error "testLibAbs1a not defined" +#error "testLibAbs1a not defined" #endif #ifndef testLibAbs1b -# error "testLibAbs1b not defined" +#error "testLibAbs1b not defined" #endif int main() { - return 0 - + testLibAbs1() - ; + return 0 + testLibAbs1(); } diff --git a/Tests/ExportImport/Import/A/renamed_test.cpp b/Tests/ExportImport/Import/A/renamed_test.cpp index e2ee126..60d6cf9 100644 --- a/Tests/ExportImport/Import/A/renamed_test.cpp +++ b/Tests/ExportImport/Import/A/renamed_test.cpp @@ -1,7 +1,7 @@ #include "renamed.h" -int main(int, char **) +int main(int, char**) { Renamed ren; return ren.foo(); diff --git a/Tests/ExportImport/Import/Interface/headeronlytest.cpp b/Tests/ExportImport/Import/Interface/headeronlytest.cpp index 20674a7..0e754e9 100644 --- a/Tests/ExportImport/Import/Interface/headeronlytest.cpp +++ b/Tests/ExportImport/Import/Interface/headeronlytest.cpp @@ -9,8 +9,7 @@ #error Unexpected SHAREDLIB_DEFINE #endif - -int main(int,char**) +int main(int, char**) { HeaderOnly ho; return ho.foo(); diff --git a/Tests/ExportImport/Import/Interface/interfacetest.cpp b/Tests/ExportImport/Import/Interface/interfacetest.cpp index 786458d..7be8162 100644 --- a/Tests/ExportImport/Import/Interface/interfacetest.cpp +++ b/Tests/ExportImport/Import/Interface/interfacetest.cpp @@ -13,7 +13,7 @@ #error Expected DEFINE_IFACE_DEFINE #endif -int main(int,char**) +int main(int, char**) { SharedLibObject slo; return slo.foo(); diff --git a/Tests/FindBoost/Test/main.cxx b/Tests/FindBoost/Test/main.cxx index 0f44f30..6e8b5da 100644 --- a/Tests/FindBoost/Test/main.cxx +++ b/Tests/FindBoost/Test/main.cxx @@ -1,24 +1,22 @@ #include <boost/filesystem.hpp> #include <boost/thread.hpp> -namespace -{ - - boost::mutex m1; - boost::recursive_mutex m2; +namespace { - void - threadmain() - { - boost::lock_guard<boost::mutex> lock1(m1); - boost::lock_guard<boost::recursive_mutex> lock2(m2); +boost::mutex m1; +boost::recursive_mutex m2; - boost::filesystem::path p(boost::filesystem::current_path()); - } +void threadmain() +{ + boost::lock_guard<boost::mutex> lock1(m1); + boost::lock_guard<boost::recursive_mutex> lock2(m2); + boost::filesystem::path p(boost::filesystem::current_path()); +} } -int main() { +int main() +{ boost::thread foo(threadmain); foo.join(); diff --git a/Tests/FindBoost/TestHeaders/main.cxx b/Tests/FindBoost/TestHeaders/main.cxx index 0400d6d..7844de4 100644 --- a/Tests/FindBoost/TestHeaders/main.cxx +++ b/Tests/FindBoost/TestHeaders/main.cxx @@ -1,6 +1,7 @@ #include <boost/any.hpp> -int main() { +int main() +{ boost::any a; a = 5; a = std::string("A string"); diff --git a/Tests/FindGSL/rng/main.cc b/Tests/FindGSL/rng/main.cc index e1e0a47..af13125 100644 --- a/Tests/FindGSL/rng/main.cc +++ b/Tests/FindGSL/rng/main.cc @@ -7,15 +7,15 @@ int main() int retval = 1; // create a generator - gsl_rng *generator; + gsl_rng* generator; generator = gsl_rng_alloc(gsl_rng_mt19937); // Read a value. double const Result = gsl_rng_uniform(generator); // Check value - double const expectedResult( 0.999741748906672 ); - if( fabs( expectedResult - Result ) < 1.0e-6 ) + double const expectedResult(0.999741748906672); + if (fabs(expectedResult - Result) < 1.0e-6) retval = 0; // free allocated memory diff --git a/Tests/FindGTK2/atk/main.c b/Tests/FindGTK2/atk/main.c index e25030e..4dc8d4d 100644 --- a/Tests/FindGTK2/atk/main.c +++ b/Tests/FindGTK2/atk/main.c @@ -1,7 +1,7 @@ #include <atk/atk.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - const gchar *name = atk_get_toolkit_name(); - return 0; + const gchar* name = atk_get_toolkit_name(); + return 0; } diff --git a/Tests/FindGTK2/atkmm/main.cpp b/Tests/FindGTK2/atkmm/main.cpp index f455c7a..89a97f7 100644 --- a/Tests/FindGTK2/atkmm/main.cpp +++ b/Tests/FindGTK2/atkmm/main.cpp @@ -1,8 +1,8 @@ #include <atkmm.h> #include <atkmm/init.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - Atk::init(); - return 0; + Atk::init(); + return 0; } diff --git a/Tests/FindGTK2/cairo/main.c b/Tests/FindGTK2/cairo/main.c index 1b61001..e2be60c 100644 --- a/Tests/FindGTK2/cairo/main.c +++ b/Tests/FindGTK2/cairo/main.c @@ -1,52 +1,50 @@ /* Taken from http://cairographics.org/samples/ */ - #include <cairo.h> #include <math.h> #include <stdio.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - char *filename; - if (argc != 2) - { - fprintf (stderr, "Usage: %s OUTPUT_FILENAME\n", argv[0]); - return 1; - } - filename = argv[1]; - double xc = 128.0; - double yc = 128.0; - double radius = 100.0; - double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */ - double angle2 = 180.0 * (M_PI/180.0); /* in radians */ - - cairo_surface_t *im = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xc * 2, yc * 2); - cairo_t *cr = cairo_create(im); - - - cairo_set_line_width (cr, 10.0); - cairo_arc (cr, xc, yc, radius, angle1, angle2); - cairo_stroke (cr); - - /* draw helping lines */ - cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6); - cairo_set_line_width (cr, 6.0); - - cairo_arc (cr, xc, yc, 10.0, 0, 2*M_PI); - cairo_fill (cr); - - cairo_arc (cr, xc, yc, radius, angle1, angle1); - cairo_line_to (cr, xc, yc); - cairo_arc (cr, xc, yc, radius, angle2, angle2); - cairo_line_to (cr, xc, yc); - cairo_stroke (cr); - - cairo_status_t status = cairo_surface_write_to_png (im, filename); - cairo_surface_destroy (im); - if (status != CAIRO_STATUS_SUCCESS) { - fprintf(stderr, "Could not save png to '%s'\n", filename); - } - - cairo_destroy(cr); - return 0; + char* filename; + if (argc != 2) { + fprintf(stderr, "Usage: %s OUTPUT_FILENAME\n", argv[0]); + return 1; + } + filename = argv[1]; + double xc = 128.0; + double yc = 128.0; + double radius = 100.0; + double angle1 = 45.0 * (M_PI / 180.0); /* angles are specified */ + double angle2 = 180.0 * (M_PI / 180.0); /* in radians */ + + cairo_surface_t* im = + cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xc * 2, yc * 2); + cairo_t* cr = cairo_create(im); + + cairo_set_line_width(cr, 10.0); + cairo_arc(cr, xc, yc, radius, angle1, angle2); + cairo_stroke(cr); + + /* draw helping lines */ + cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.6); + cairo_set_line_width(cr, 6.0); + + cairo_arc(cr, xc, yc, 10.0, 0, 2 * M_PI); + cairo_fill(cr); + + cairo_arc(cr, xc, yc, radius, angle1, angle1); + cairo_line_to(cr, xc, yc); + cairo_arc(cr, xc, yc, radius, angle2, angle2); + cairo_line_to(cr, xc, yc); + cairo_stroke(cr); + + cairo_status_t status = cairo_surface_write_to_png(im, filename); + cairo_surface_destroy(im); + if (status != CAIRO_STATUS_SUCCESS) { + fprintf(stderr, "Could not save png to '%s'\n", filename); + } + + cairo_destroy(cr); + return 0; } diff --git a/Tests/FindGTK2/cairomm/main.cpp b/Tests/FindGTK2/cairomm/main.cpp index 0db3a04..1a669c3 100644 --- a/Tests/FindGTK2/cairomm/main.cpp +++ b/Tests/FindGTK2/cairomm/main.cpp @@ -1,5 +1,5 @@ -// Taken from http://cgit.freedesktop.org/cairomm/plain/examples/surfaces/image-surface.cc - +// Taken from +// http://cgit.freedesktop.org/cairomm/plain/examples/surfaces/image-surface.cc /* M_PI is defined in math.h in the case of Microsoft Visual C++, Solaris, * et. al. @@ -18,45 +18,47 @@ int main() { - Cairo::RefPtr<Cairo::ImageSurface> surface = - Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400); - - Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface); - - cr->save(); // save the state of the context - cr->set_source_rgb(0.86, 0.85, 0.47); - cr->paint(); // fill image with the color - cr->restore(); // color is back to black now - - cr->save(); - // draw a border around the image - cr->set_line_width(20.0); // make the line wider - cr->rectangle(0.0, 0.0, surface->get_width(), surface->get_height()); - cr->stroke(); - - cr->set_source_rgba(0.0, 0.0, 0.0, 0.7); - // draw a circle in the center of the image - cr->arc(surface->get_width() / 2.0, surface->get_height() / 2.0, - surface->get_height() / 4.0, 0.0, 2.0 * M_PI); - cr->stroke(); - - // draw a diagonal line - cr->move_to(surface->get_width() / 4.0, surface->get_height() / 4.0); - cr->line_to(surface->get_width() * 3.0 / 4.0, surface->get_height() * 3.0 / 4.0); - cr->stroke(); - cr->restore(); + Cairo::RefPtr<Cairo::ImageSurface> surface = + Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400); + + Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface); + + cr->save(); // save the state of the context + cr->set_source_rgb(0.86, 0.85, 0.47); + cr->paint(); // fill image with the color + cr->restore(); // color is back to black now + + cr->save(); + // draw a border around the image + cr->set_line_width(20.0); // make the line wider + cr->rectangle(0.0, 0.0, surface->get_width(), surface->get_height()); + cr->stroke(); + + cr->set_source_rgba(0.0, 0.0, 0.0, 0.7); + // draw a circle in the center of the image + cr->arc(surface->get_width() / 2.0, surface->get_height() / 2.0, + surface->get_height() / 4.0, 0.0, 2.0 * M_PI); + cr->stroke(); + + // draw a diagonal line + cr->move_to(surface->get_width() / 4.0, surface->get_height() / 4.0); + cr->line_to(surface->get_width() * 3.0 / 4.0, + surface->get_height() * 3.0 / 4.0); + cr->stroke(); + cr->restore(); #ifdef CAIRO_HAS_PNG_FUNCTIONS - std::string filename = "image.png"; - surface->write_to_png(filename); + std::string filename = "image.png"; + surface->write_to_png(filename); - std::cout << "Wrote png file \"" << filename << "\"" << std::endl; + std::cout << "Wrote png file \"" << filename << "\"" << std::endl; #else - std::cout << "You must compile cairo with PNG support for this example to work." - << std::endl; + std::cout + << "You must compile cairo with PNG support for this example to work." + << std::endl; #endif } diff --git a/Tests/FindGTK2/gdk/main.c b/Tests/FindGTK2/gdk/main.c index ac1bd4b..71f523b 100644 --- a/Tests/FindGTK2/gdk/main.c +++ b/Tests/FindGTK2/gdk/main.c @@ -1,7 +1,7 @@ #include <gdk/gdk.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - gdk_init(argc, argv); - return 0; + gdk_init(argc, argv); + return 0; } diff --git a/Tests/FindGTK2/gdk_pixbuf/main.c b/Tests/FindGTK2/gdk_pixbuf/main.c index e42b83e..ed9f564 100644 --- a/Tests/FindGTK2/gdk_pixbuf/main.c +++ b/Tests/FindGTK2/gdk_pixbuf/main.c @@ -1,10 +1,10 @@ #include <gdk-pixbuf/gdk-pixbuf.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - const char *version = gdk_pixbuf_version; - const guint major = gdk_pixbuf_major_version; - const guint minor = gdk_pixbuf_minor_version; - const guint micro = gdk_pixbuf_micro_version; - return 0; + const char* version = gdk_pixbuf_version; + const guint major = gdk_pixbuf_major_version; + const guint minor = gdk_pixbuf_minor_version; + const guint micro = gdk_pixbuf_micro_version; + return 0; } diff --git a/Tests/FindGTK2/gdkmm/main.cpp b/Tests/FindGTK2/gdkmm/main.cpp index 935bcc4..639e261 100644 --- a/Tests/FindGTK2/gdkmm/main.cpp +++ b/Tests/FindGTK2/gdkmm/main.cpp @@ -1,7 +1,7 @@ #include <gdkmm.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - Gdk::Color red = Gdk::Color("red"); - return 0; + Gdk::Color red = Gdk::Color("red"); + return 0; } diff --git a/Tests/FindGTK2/gio/main.c b/Tests/FindGTK2/gio/main.c index 13f4304..ebed1fc 100644 --- a/Tests/FindGTK2/gio/main.c +++ b/Tests/FindGTK2/gio/main.c @@ -1,8 +1,8 @@ #include <gio/gio.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - GFile *file = g_file_new_for_path("path"); - g_object_unref(file); - return 0; + GFile* file = g_file_new_for_path("path"); + g_object_unref(file); + return 0; } diff --git a/Tests/FindGTK2/giomm/main.cpp b/Tests/FindGTK2/giomm/main.cpp index 8303ba9..c0d5975 100644 --- a/Tests/FindGTK2/giomm/main.cpp +++ b/Tests/FindGTK2/giomm/main.cpp @@ -1,7 +1,7 @@ #include <giomm.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - Glib::RefPtr<Gio::File> f = Gio::File::create_for_path("path"); - return 0; + Glib::RefPtr<Gio::File> f = Gio::File::create_for_path("path"); + return 0; } diff --git a/Tests/FindGTK2/glib/main.c b/Tests/FindGTK2/glib/main.c index 80d0554..cf5e458 100644 --- a/Tests/FindGTK2/glib/main.c +++ b/Tests/FindGTK2/glib/main.c @@ -1,11 +1,11 @@ #include <glib.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (!g_file_test("file", G_FILE_TEST_EXISTS)) { - g_print("File not found. \n"); - } else { - g_print("File found. \n"); - } - return 0; + if (!g_file_test("file", G_FILE_TEST_EXISTS)) { + g_print("File not found. \n"); + } else { + g_print("File found. \n"); + } + return 0; } diff --git a/Tests/FindGTK2/glibmm/main.cpp b/Tests/FindGTK2/glibmm/main.cpp index 0e8cdae..3cdc0bd 100644 --- a/Tests/FindGTK2/glibmm/main.cpp +++ b/Tests/FindGTK2/glibmm/main.cpp @@ -2,6 +2,6 @@ int main(int, char**) { - Glib::init(); - return 0; + Glib::init(); + return 0; } diff --git a/Tests/FindGTK2/gmodule/main.c b/Tests/FindGTK2/gmodule/main.c index 5c85a6f..1ac5c1d 100644 --- a/Tests/FindGTK2/gmodule/main.c +++ b/Tests/FindGTK2/gmodule/main.c @@ -1,7 +1,7 @@ #include <gmodule.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - gboolean b = g_module_supported(); - return 0; + gboolean b = g_module_supported(); + return 0; } diff --git a/Tests/FindGTK2/gobject/main.c b/Tests/FindGTK2/gobject/main.c index d3e13f9..46e2127 100644 --- a/Tests/FindGTK2/gobject/main.c +++ b/Tests/FindGTK2/gobject/main.c @@ -1,18 +1,21 @@ -/* Taken from https://developer.gnome.org/gobject/stable/chapter-gobject.html */ - +/* Taken from https://developer.gnome.org/gobject/stable/chapter-gobject.html + */ #include <glib-object.h> +#define MAMAN_TYPE_BAR (maman_bar_get_type()) +#define MAMAN_BAR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), MAMAN_TYPE_BAR, MamanBar)) +#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAMAN_TYPE_BAR)) +#define MAMAN_BAR_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), MAMAN_TYPE_BAR, MamanBarClass)) +#define MAMAN_IS_BAR_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), MAMAN_TYPE_BAR)) +#define MAMAN_BAR_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), MAMAN_TYPE_BAR, MamanBarClass)) -#define MAMAN_TYPE_BAR (maman_bar_get_type ()) -#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar)) -#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR)) -#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass)) -#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR)) -#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass)) - -typedef struct _MamanBar MamanBar; -typedef struct _MamanBarClass MamanBarClass; +typedef struct _MamanBar MamanBar; +typedef struct _MamanBarClass MamanBarClass; struct _MamanBar { @@ -29,18 +32,17 @@ struct _MamanBarClass }; /* will create maman_bar_get_type and set maman_bar_parent_class */ -G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT); +G_DEFINE_TYPE(MamanBar, maman_bar, G_TYPE_OBJECT); -static GObject * -maman_bar_constructor (GType gtype, - guint n_properties, - GObjectConstructParam *properties) +static GObject* maman_bar_constructor(GType gtype, guint n_properties, + GObjectConstructParam* properties) { - GObject *obj; + GObject* obj; { /* Always chain up to the parent constructor */ - obj = G_OBJECT_CLASS (maman_bar_parent_class)->constructor (gtype, n_properties, properties); + obj = G_OBJECT_CLASS(maman_bar_parent_class) + ->constructor(gtype, n_properties, properties); } /* update the object state depending on constructor properties */ @@ -48,25 +50,21 @@ maman_bar_constructor (GType gtype, return obj; } -static void -maman_bar_class_init (MamanBarClass *klass) +static void maman_bar_class_init(MamanBarClass* klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GObjectClass* gobject_class = G_OBJECT_CLASS(klass); gobject_class->constructor = maman_bar_constructor; } -static void -maman_bar_init (MamanBar *self) +static void maman_bar_init(MamanBar* self) { /* initialize the object */ } - -int -main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - MamanBar *bar = g_object_new (MAMAN_TYPE_BAR, NULL); - g_object_unref(bar); - return 0; + MamanBar* bar = g_object_new(MAMAN_TYPE_BAR, NULL); + g_object_unref(bar); + return 0; } diff --git a/Tests/FindGTK2/gthread/main.c b/Tests/FindGTK2/gthread/main.c index ce68cbd..9606401 100644 --- a/Tests/FindGTK2/gthread/main.c +++ b/Tests/FindGTK2/gthread/main.c @@ -1,7 +1,7 @@ #include <glib.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - g_thread_init(NULL); - return 0; + g_thread_init(NULL); + return 0; } diff --git a/Tests/FindGTK2/gtk/main.c b/Tests/FindGTK2/gtk/main.c index 309c328..010830a 100644 --- a/Tests/FindGTK2/gtk/main.c +++ b/Tests/FindGTK2/gtk/main.c @@ -1,15 +1,15 @@ #include <gtk/gtk.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - GtkWidget *window; + GtkWidget* window; - gtk_init (&argc, &argv); + gtk_init(&argc, &argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_show (window); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_show(window); - gtk_main (); + gtk_main(); - return 0; + return 0; } diff --git a/Tests/FindGTK2/gtkmm/helloworld.cpp b/Tests/FindGTK2/gtkmm/helloworld.cpp index 535f44a..5f4e0ae 100644 --- a/Tests/FindGTK2/gtkmm/helloworld.cpp +++ b/Tests/FindGTK2/gtkmm/helloworld.cpp @@ -2,21 +2,21 @@ #include <iostream> HelloWorld::HelloWorld() - : m_button("Hello World") // creates a new button with label "Hello World". + : m_button("Hello World") // creates a new button with label "Hello World". { - // Sets the border width of the window. - set_border_width(10); + // Sets the border width of the window. + set_border_width(10); - // When the button receives the "clicked" signal, it will call the - // on_button_clicked() method defined below. - m_button.signal_clicked().connect(sigc::mem_fun(*this, - &HelloWorld::on_button_clicked)); + // When the button receives the "clicked" signal, it will call the + // on_button_clicked() method defined below. + m_button.signal_clicked().connect( + sigc::mem_fun(*this, &HelloWorld::on_button_clicked)); - // This packs the button into the Window (a container). - add(m_button); + // This packs the button into the Window (a container). + add(m_button); - // The final step is to display this newly created widget... - m_button.show(); + // The final step is to display this newly created widget... + m_button.show(); } HelloWorld::~HelloWorld() @@ -25,5 +25,5 @@ HelloWorld::~HelloWorld() void HelloWorld::on_button_clicked() { - std::cout << "Hello World" << std::endl; + std::cout << "Hello World" << std::endl; } diff --git a/Tests/FindGTK2/gtkmm/helloworld.h b/Tests/FindGTK2/gtkmm/helloworld.h index ab9a076..ae9af17 100644 --- a/Tests/FindGTK2/gtkmm/helloworld.h +++ b/Tests/FindGTK2/gtkmm/helloworld.h @@ -6,15 +6,15 @@ class HelloWorld : public Gtk::Window { public: - HelloWorld(); - virtual ~HelloWorld(); + HelloWorld(); + virtual ~HelloWorld(); protected: - //Signal handlers: - void on_button_clicked(); + // Signal handlers: + void on_button_clicked(); - //Member widgets: - Gtk::Button m_button; + // Member widgets: + Gtk::Button m_button; }; #endif // GTKMM_EXAMPLE_HELLOWORLD_H diff --git a/Tests/FindGTK2/gtkmm/main.cpp b/Tests/FindGTK2/gtkmm/main.cpp index 566a4bd..1637da2 100644 --- a/Tests/FindGTK2/gtkmm/main.cpp +++ b/Tests/FindGTK2/gtkmm/main.cpp @@ -1,13 +1,13 @@ #include "helloworld.h" #include <gtkmm.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - Gtk::Main kit(argc, argv); + Gtk::Main kit(argc, argv); - HelloWorld helloworld; - //Shows the window and returns when it is closed. - Gtk::Main::run(helloworld); + HelloWorld helloworld; + // Shows the window and returns when it is closed. + Gtk::Main::run(helloworld); - return 0; + return 0; } diff --git a/Tests/FindGTK2/pango/main.c b/Tests/FindGTK2/pango/main.c index ef87ce4..aa6ea92 100644 --- a/Tests/FindGTK2/pango/main.c +++ b/Tests/FindGTK2/pango/main.c @@ -1,7 +1,7 @@ #include <pango/pango.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - gboolean ret = pango_color_parse(NULL, "#ffffff"); - return 0; + gboolean ret = pango_color_parse(NULL, "#ffffff"); + return 0; } diff --git a/Tests/FindGTK2/pangocairo/main.c b/Tests/FindGTK2/pangocairo/main.c index 78268d6..15db513 100644 --- a/Tests/FindGTK2/pangocairo/main.c +++ b/Tests/FindGTK2/pangocairo/main.c @@ -1,72 +1,68 @@ -/* Taken from https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html */ - +/* Taken from + * https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html */ #include <math.h> #include <pango/pangocairo.h> -static void -draw_text (cairo_t *cr) +static void draw_text(cairo_t* cr) { #define RADIUS 150 #define N_WORDS 10 #define FONT "Sans Bold 27" - PangoLayout *layout; - PangoFontDescription *desc; + PangoLayout* layout; + PangoFontDescription* desc; int i; /* Center coordinates on the middle of the region we are drawing */ - cairo_translate (cr, RADIUS, RADIUS); + cairo_translate(cr, RADIUS, RADIUS); /* Create a PangoLayout, set the font and text */ - layout = pango_cairo_create_layout (cr); - pango_layout_set_text (layout, "Text", -1); - desc = pango_font_description_from_string (FONT); - pango_layout_set_font_description (layout, desc); - pango_font_description_free (desc); + layout = pango_cairo_create_layout(cr); + pango_layout_set_text(layout, "Text", -1); + desc = pango_font_description_from_string(FONT); + pango_layout_set_font_description(layout, desc); + pango_font_description_free(desc); /* Draw the layout N_WORDS times in a circle */ - for (i = 0; i < N_WORDS; i++) - { - int width, height; - double angle = (360. * i) / N_WORDS; - double red; - cairo_save (cr); - /* Gradient from red at angle == 60 to blue at angle == 240 */ - red = (1 + cos ((angle - 60) * G_PI / 180.)) / 2; - cairo_set_source_rgb (cr, red, 0, 1.0 - red); - cairo_rotate (cr, angle * G_PI / 180.); - /* Inform Pango to re-layout the text with the new transformation */ - pango_cairo_update_layout (cr, layout); - pango_layout_get_size (layout, &width, &height); - cairo_move_to (cr, - ((double)width / PANGO_SCALE) / 2, - RADIUS); - pango_cairo_show_layout (cr, layout); - cairo_restore (cr); - } + for (i = 0; i < N_WORDS; i++) { + int width, height; + double angle = (360. * i) / N_WORDS; + double red; + cairo_save(cr); + /* Gradient from red at angle == 60 to blue at angle == 240 */ + red = (1 + cos((angle - 60) * G_PI / 180.)) / 2; + cairo_set_source_rgb(cr, red, 0, 1.0 - red); + cairo_rotate(cr, angle * G_PI / 180.); + /* Inform Pango to re-layout the text with the new transformation */ + pango_cairo_update_layout(cr, layout); + pango_layout_get_size(layout, &width, &height); + cairo_move_to(cr, -((double)width / PANGO_SCALE) / 2, -RADIUS); + pango_cairo_show_layout(cr, layout); + cairo_restore(cr); + } /* free the layout object */ - g_object_unref (layout); + g_object_unref(layout); } -int main (int argc, char **argv) +int main(int argc, char** argv) { - cairo_t *cr; - char *filename; + cairo_t* cr; + char* filename; cairo_status_t status; - cairo_surface_t *surface; - if (argc != 2) - { - g_printerr ("Usage: cairosimple OUTPUT_FILENAME\n"); - return 1; - } + cairo_surface_t* surface; + if (argc != 2) { + g_printerr("Usage: cairosimple OUTPUT_FILENAME\n"); + return 1; + } filename = argv[1]; - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - 2 * RADIUS, 2 * RADIUS); - cr = cairo_create (surface); - cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); - cairo_paint (cr); - draw_text (cr); - cairo_destroy (cr); - status = cairo_surface_write_to_png (surface, filename); - cairo_surface_destroy (surface); - if (status != CAIRO_STATUS_SUCCESS) - { - g_printerr ("Could not save png to '%s'\n", filename); - return 1; - } + surface = + cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 2 * RADIUS, 2 * RADIUS); + cr = cairo_create(surface); + cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); + cairo_paint(cr); + draw_text(cr); + cairo_destroy(cr); + status = cairo_surface_write_to_png(surface, filename); + cairo_surface_destroy(surface); + if (status != CAIRO_STATUS_SUCCESS) { + g_printerr("Could not save png to '%s'\n", filename); + return 1; + } return 0; } diff --git a/Tests/FindGTK2/pangoft2/main.c b/Tests/FindGTK2/pangoft2/main.c index cf3459e..317f7ec 100644 --- a/Tests/FindGTK2/pangoft2/main.c +++ b/Tests/FindGTK2/pangoft2/main.c @@ -1,8 +1,8 @@ #include <pango/pangoft2.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - PangoFontMap* pfm = pango_ft2_font_map_new(); - g_object_unref(pfm); - return 0; + PangoFontMap* pfm = pango_ft2_font_map_new(); + g_object_unref(pfm); + return 0; } diff --git a/Tests/FindGTK2/pangomm/main.cpp b/Tests/FindGTK2/pangomm/main.cpp index 32ec914..47bf490 100644 --- a/Tests/FindGTK2/pangomm/main.cpp +++ b/Tests/FindGTK2/pangomm/main.cpp @@ -1,8 +1,8 @@ #include <pangomm.h> #include <pangomm/init.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - Pango::init(); - return 0; + Pango::init(); + return 0; } diff --git a/Tests/FindGTK2/pangoxft/main.c b/Tests/FindGTK2/pangoxft/main.c index cb04f61..181ba27 100644 --- a/Tests/FindGTK2/pangoxft/main.c +++ b/Tests/FindGTK2/pangoxft/main.c @@ -1,7 +1,7 @@ #include <pango/pangoxft.h> -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - pango_xft_get_context(NULL, 0); - return 0; + pango_xft_get_context(NULL, 0); + return 0; } diff --git a/Tests/FindGTK2/sigc++/main.cpp b/Tests/FindGTK2/sigc++/main.cpp index ccf415e..e56b910 100644 --- a/Tests/FindGTK2/sigc++/main.cpp +++ b/Tests/FindGTK2/sigc++/main.cpp @@ -6,24 +6,24 @@ class AlienDetector { public: - AlienDetector() {} + AlienDetector() {} - void run() {} + void run() {} - sigc::signal<void> signal_detected; + sigc::signal<void> signal_detected; }; void warn_people() { - std::cout << "There are aliens in the carpark!" << std::endl; + std::cout << "There are aliens in the carpark!" << std::endl; } int main() { - AlienDetector mydetector; - mydetector.signal_detected.connect( sigc::ptr_fun(warn_people) ); + AlienDetector mydetector; + mydetector.signal_detected.connect(sigc::ptr_fun(warn_people)); - mydetector.run(); + mydetector.run(); - return 0; + return 0; } diff --git a/Tests/FindMatlab/matlab_wrapper1.cpp b/Tests/FindMatlab/matlab_wrapper1.cpp index 4149bb9..ebf1b87 100644 --- a/Tests/FindMatlab/matlab_wrapper1.cpp +++ b/Tests/FindMatlab/matlab_wrapper1.cpp @@ -1,24 +1,25 @@ // simple workaround to some compiler specific problems -// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +// see +// http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 #include <algorithm> #include "mex.h" -// this test should return a matrix of 10 x 10 and should check some of the arguments +// this test should return a matrix of 10 x 10 and should check some of the +// arguments -void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +void mexFunction(const int nlhs, mxArray* plhs[], const int nrhs, + const mxArray* prhs[]) { - if(nrhs != 1) - { + if (nrhs != 1) { mexErrMsgTxt("Incorrect arguments"); } size_t dim1 = mxGetM(prhs[0]); size_t dim2 = mxGetN(prhs[0]); - if(dim1 == 1 || dim2 == 1) - { + if (dim1 == 1 || dim2 == 1) { mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); } diff --git a/Tests/FindModulesExecuteAll/main.c b/Tests/FindModulesExecuteAll/main.c index c13815c..f8b643a 100644 --- a/Tests/FindModulesExecuteAll/main.c +++ b/Tests/FindModulesExecuteAll/main.c @@ -1,4 +1,4 @@ int main() { - return 0; + return 0; } diff --git a/Tests/FindOpenSSL/rand/main.cc b/Tests/FindOpenSSL/rand/main.cc index a5d1ac0..d81b318 100644 --- a/Tests/FindOpenSSL/rand/main.cc +++ b/Tests/FindOpenSSL/rand/main.cc @@ -12,8 +12,7 @@ int main() int rezval = RAND_bytes(buf, sizeof(buf)); /* 1 succes, 0 otherwise */ // check result - if(rezval == 1) - { + if (rezval == 1) { retval = 0; } diff --git a/Tests/FindPNG/Test/main.c b/Tests/FindPNG/Test/main.c index 06d943d..b33b28e 100644 --- a/Tests/FindPNG/Test/main.c +++ b/Tests/FindPNG/Test/main.c @@ -7,14 +7,12 @@ int main() png_uint_32 png_version; char png_version_string[16]; - png_version = png_access_version_number (); + png_version = png_access_version_number(); - snprintf (png_version_string, 16, "%i.%i.%i", - png_version / 10000, - (png_version % 10000) / 100, - png_version % 100); + snprintf(png_version_string, 16, "%i.%i.%i", png_version / 10000, + (png_version % 10000) / 100, png_version % 100); - assert (strcmp(png_version_string, CMAKE_EXPECTED_PNG_VERSION) == 0); + assert(strcmp(png_version_string, CMAKE_EXPECTED_PNG_VERSION) == 0); return 0; } diff --git a/Tests/FindPackageModeMakefileTest/main.cpp b/Tests/FindPackageModeMakefileTest/main.cpp index db1ffb1..9def3fb 100644 --- a/Tests/FindPackageModeMakefileTest/main.cpp +++ b/Tests/FindPackageModeMakefileTest/main.cpp @@ -3,6 +3,6 @@ int main() { - printf("foo is: %d\n", foo()); - return 0; + printf("foo is: %d\n", foo()); + return 0; } diff --git a/Tests/FindPackageTest/Exporter/dummy.c b/Tests/FindPackageTest/Exporter/dummy.c index 76e8197..f8b643a 100644 --- a/Tests/FindPackageTest/Exporter/dummy.c +++ b/Tests/FindPackageTest/Exporter/dummy.c @@ -1 +1,4 @@ -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c index fc4f337..9182652 100644 --- a/Tests/FindTIFF/Test/main.c +++ b/Tests/FindTIFF/Test/main.c @@ -5,7 +5,7 @@ int main() { /* Without any TIFF file to open, test that the call fails as expected. This tests that linking worked. */ - TIFF *tiff = TIFFOpen("invalid.tiff", "r"); + TIFF* tiff = TIFFOpen("invalid.tiff", "r"); assert(!tiff); return 0; diff --git a/Tests/ForceInclude/foo.c b/Tests/ForceInclude/foo.c index af898f4..7f550d0 100644 --- a/Tests/ForceInclude/foo.c +++ b/Tests/ForceInclude/foo.c @@ -1,7 +1,10 @@ #ifndef FOO_1 -# error "foo1.h not included by /FI" +#error "foo1.h not included by /FI" #endif #ifndef FOO_2 -# error "foo2.h not included by /FI" +#error "foo2.h not included by /FI" #endif -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/Fortran/include/test_preprocess.h b/Tests/Fortran/include/test_preprocess.h index 29ac4b6..f4a00a9 100644 --- a/Tests/Fortran/include/test_preprocess.h +++ b/Tests/Fortran/include/test_preprocess.h @@ -1,5 +1,5 @@ #ifdef BAR - PRINT * , 'BAR was defined via ADD_DEFINITIONS' +PRINT*, 'BAR was defined via ADD_DEFINITIONS' #else - PRINT *, 'If you can read this something went wrong' +PRINT*, 'If you can read this something went wrong' #endif diff --git a/Tests/Framework/foo.cxx b/Tests/Framework/foo.cxx index e5c1973..c3520c1 100644 --- a/Tests/Framework/foo.cxx +++ b/Tests/Framework/foo.cxx @@ -1,8 +1,8 @@ #include <stdio.h> #if defined(_WIN32) && defined(foo_EXPORTS) -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT void foo() { diff --git a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp index 2356bc4..233eb57 100644 --- a/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp +++ b/Tests/GeneratorExpression/CMP0044/cmp0044-check.cpp @@ -1,20 +1,20 @@ #ifdef Type_Is_ -# if !Result -# error Result should be 1 in WARN mode -# endif +#if !Result +#error Result should be 1 in WARN mode +#endif #endif #ifdef Type_Is_NEW -# if Result -# error Result should be 0 in NEW mode -# endif +#if Result +#error Result should be 0 in NEW mode +#endif #endif #ifdef Type_Is_OLD -# if !Result -# error Result should be 1 in OLD mode -# endif +#if !Result +#error Result should be 1 in OLD mode +#endif #endif #if !defined(Type_Is_) && !defined(Type_Is_OLD) && !defined(Type_Is_NEW) diff --git a/Tests/GeneratorExpression/empty.cpp b/Tests/GeneratorExpression/empty.cpp index f8732a4..7be1ca5 100644 --- a/Tests/GeneratorExpression/empty.cpp +++ b/Tests/GeneratorExpression/empty.cpp @@ -1,4 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int main() { return 0; } + int main() +{ + return 0; +} diff --git a/Tests/GeneratorExpression/pwd.c b/Tests/GeneratorExpression/pwd.c index 054b1af..ed23043 100644 --- a/Tests/GeneratorExpression/pwd.c +++ b/Tests/GeneratorExpression/pwd.c @@ -15,19 +15,17 @@ int main(int argc, char* argv[]) #define BUFSZ 20000 char buf[BUFSZ + 1]; #ifdef _WIN32 - char *pos; + char* pos; #endif getcurdir(buf, BUFSZ); #ifdef _WIN32 pos = buf; - while (*pos) - { - if (*pos == '\\') - { + while (*pos) { + if (*pos == '\\') { *pos = '/'; - } - ++pos; } + ++pos; + } #endif printf("%s\n", buf); return EXIT_SUCCESS; diff --git a/Tests/GhsMulti/ReturnNum/App/Main.c b/Tests/GhsMulti/ReturnNum/App/Main.c index 1133834..db8d658 100644 --- a/Tests/GhsMulti/ReturnNum/App/Main.c +++ b/Tests/GhsMulti/ReturnNum/App/Main.c @@ -2,7 +2,7 @@ int main(int argc, const char* argv[]) { - int out; - out = giveNum(); - return out; + int out; + out = giveNum(); + return out; } diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c index d7515d7..61922bb 100644 --- a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c @@ -1,4 +1,4 @@ int giveNum(void) { - return 1; + return 1; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/main.c b/Tests/GhsMultiDuplicateSourceFilenames/main.c index 2779d68..301a32e 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/main.c +++ b/Tests/GhsMultiDuplicateSourceFilenames/main.c @@ -1,9 +1,9 @@ int test_a(void); int test_b(void); -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - test_a(); - test_b(); - return 0; + test_a(); + test_b(); + return 0; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c index e1372b9..e1e1759 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c @@ -1,5 +1,5 @@ int test_b() { - return 2; + return 2; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMultiDuplicateSourceFilenames/test.c index 60286dd..5ffcbdf 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/test.c +++ b/Tests/GhsMultiDuplicateSourceFilenames/test.c @@ -1,5 +1,5 @@ int test_a() { - return 1; + return 1; } diff --git a/Tests/IncludeDirectories/CMP0021/main.cpp b/Tests/IncludeDirectories/CMP0021/main.cpp index f886c46..f638ed1 100644 --- a/Tests/IncludeDirectories/CMP0021/main.cpp +++ b/Tests/IncludeDirectories/CMP0021/main.cpp @@ -5,7 +5,7 @@ #error Expected CMP0021_DEFINE #endif -int main(int, char **) +int main(int, char**) { return 0; } diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h index 05d3604..02e28b3 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h @@ -5,7 +5,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int configUnusedFunc() + int configUnusedFunc() { int unused; return 0; diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp index f111bfa..5516b62 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib.cpp @@ -1,4 +1,7 @@ #include "systemlib.h" -int systemlib() { return 0; } +int systemlib() +{ + return 0; +} diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h index c84de6a..1cb7eed 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/systemlib/systemlib.h @@ -5,12 +5,12 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int systemlib(); + int systemlib(); #ifdef _WIN32 __declspec(dllexport) #endif -int unusedFunc() + int unusedFunc() { int unused; return systemlib(); diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp index f716b99..c569307 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.cpp @@ -1,4 +1,7 @@ #include "upstream.h" -int upstream() { return systemlib(); } +int upstream() +{ + return systemlib(); +} diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h index 3628568..a670c2a 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/upstream.h @@ -7,6 +7,6 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int upstream(); + int upstream(); #endif diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/empty.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/empty.cpp index 7279c5e..8d91e77 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/empty.cpp +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty(void) + int empty(void) { return 0; } diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/other.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/other.cpp index 6673471..9f961ac 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/other.cpp +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/other.cpp @@ -1,6 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int other() { + int other() +{ return 0; } diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h b/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h index 4fe01dd..9b816b6 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h @@ -1 +1 @@ -//ting.h +// ting.h diff --git a/Tests/IncludeDirectories/empty.cpp b/Tests/IncludeDirectories/empty.cpp index 1787013..11ec041 100644 --- a/Tests/IncludeDirectories/empty.cpp +++ b/Tests/IncludeDirectories/empty.cpp @@ -1,4 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() { return 0; } + int empty() +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp index 9044076..a6b5592 100644 --- a/Tests/InterfaceLibrary/definetestexe.cpp +++ b/Tests/InterfaceLibrary/definetestexe.cpp @@ -18,7 +18,7 @@ extern int obj(); extern int sub(); -int main(int,char**) +int main(int, char**) { return obj() + sub(); } diff --git a/Tests/InterfaceLibrary/dummy.cpp b/Tests/InterfaceLibrary/dummy.cpp index 341aaaf..e9ad257 100644 --- a/Tests/InterfaceLibrary/dummy.cpp +++ b/Tests/InterfaceLibrary/dummy.cpp @@ -1,5 +1,5 @@ -int main(int, char **) +int main(int, char**) { return 0; } diff --git a/Tests/InterfaceLibrary/ifacedir/sub.cpp b/Tests/InterfaceLibrary/ifacedir/sub.cpp index 165a66a..cda7e4f 100644 --- a/Tests/InterfaceLibrary/ifacedir/sub.cpp +++ b/Tests/InterfaceLibrary/ifacedir/sub.cpp @@ -1 +1,4 @@ -int sub() { return 0; } +int sub() +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/map_config.cpp b/Tests/InterfaceLibrary/map_config.cpp index 81bb666..232a18e 100644 --- a/Tests/InterfaceLibrary/map_config.cpp +++ b/Tests/InterfaceLibrary/map_config.cpp @@ -9,7 +9,7 @@ #endif #endif -int main(int,char**) +int main(int, char**) { return 0; } diff --git a/Tests/InterfaceLibrary/obj.cpp b/Tests/InterfaceLibrary/obj.cpp index ee6f5fe..475800d 100644 --- a/Tests/InterfaceLibrary/obj.cpp +++ b/Tests/InterfaceLibrary/obj.cpp @@ -1 +1,4 @@ -int obj() { return 0; } +int obj() +{ + return 0; +} diff --git a/Tests/InterfaceLibrary/sharedlibtestexe.cpp b/Tests/InterfaceLibrary/sharedlibtestexe.cpp index c677f70..44f160d 100644 --- a/Tests/InterfaceLibrary/sharedlibtestexe.cpp +++ b/Tests/InterfaceLibrary/sharedlibtestexe.cpp @@ -10,7 +10,7 @@ #include "sharedlib.h" #include "shareddependlib.h" -int main(int,char**) +int main(int, char**) { SharedLibObject sl; SharedDependLibObject sdl = sl.object(); diff --git a/Tests/InterfaceLinkLibraries/bang.h b/Tests/InterfaceLinkLibraries/bang.h index acffb39..908f20c 100644 --- a/Tests/InterfaceLinkLibraries/bang.h +++ b/Tests/InterfaceLinkLibraries/bang.h @@ -1,4 +1,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int bang(); + int bang(); diff --git a/Tests/InterfaceLinkLibraries/bar.cpp b/Tests/InterfaceLinkLibraries/bar.cpp index f39bfa5..228ed80 100644 --- a/Tests/InterfaceLinkLibraries/bar.cpp +++ b/Tests/InterfaceLinkLibraries/bar.cpp @@ -4,14 +4,14 @@ #endif #ifdef BAR_USE_BANG -# ifndef BANG_LIBRARY -# error Expected BANG_LIBRARY -# endif -# include "bang.h" +#ifndef BANG_LIBRARY +#error Expected BANG_LIBRARY +#endif +#include "bang.h" #else -# ifdef BANG_LIBRARY -# error Unexpected BANG_LIBRARY -# endif +#ifdef BANG_LIBRARY +#error Unexpected BANG_LIBRARY +#endif #endif #include "bar.h" diff --git a/Tests/InterfaceLinkLibraries/bar.h b/Tests/InterfaceLinkLibraries/bar.h index f83b37e..f31a25f 100644 --- a/Tests/InterfaceLinkLibraries/bar.h +++ b/Tests/InterfaceLinkLibraries/bar.h @@ -4,4 +4,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int bar(); + int bar(); diff --git a/Tests/InterfaceLinkLibraries/foo.h b/Tests/InterfaceLinkLibraries/foo.h index e12e23c..9b73885 100644 --- a/Tests/InterfaceLinkLibraries/foo.h +++ b/Tests/InterfaceLinkLibraries/foo.h @@ -1,4 +1,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int foo(); + int foo(); diff --git a/Tests/InterfaceLinkLibraries/zot.h b/Tests/InterfaceLinkLibraries/zot.h index 5e4fb1e..e80328b 100644 --- a/Tests/InterfaceLinkLibraries/zot.h +++ b/Tests/InterfaceLinkLibraries/zot.h @@ -4,4 +4,4 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int zot(); + int zot(); diff --git a/Tests/JCTest/TestTime.cxx b/Tests/JCTest/TestTime.cxx index 5768ab5..b98e1d3 100644 --- a/Tests/JCTest/TestTime.cxx +++ b/Tests/JCTest/TestTime.cxx @@ -4,9 +4,8 @@ int main(int ac, char** av) { float d = 10.0; - for(int i =0; i < atoi(av[1]); i++) - { + for (int i = 0; i < atoi(av[1]); i++) { d *= .2; - } + } printf("%f", d); } diff --git a/Tests/JavaJavah/B.cpp b/Tests/JavaJavah/B.cpp index 2666757..491107e 100644 --- a/Tests/JavaJavah/B.cpp +++ b/Tests/JavaJavah/B.cpp @@ -4,7 +4,7 @@ #include "B.h" -JNIEXPORT void JNICALL Java_B_printName(JNIEnv *, jobject) +JNIEXPORT void JNICALL Java_B_printName(JNIEnv*, jobject) { printf("B\n"); } diff --git a/Tests/JavaJavah/C.cpp b/Tests/JavaJavah/C.cpp index ec75f42..0a3178f 100644 --- a/Tests/JavaJavah/C.cpp +++ b/Tests/JavaJavah/C.cpp @@ -4,7 +4,7 @@ #include "C.h" -JNIEXPORT void JNICALL Java_C_printName(JNIEnv *, jobject) +JNIEXPORT void JNICALL Java_C_printName(JNIEnv*, jobject) { printf("C\n"); } diff --git a/Tests/Jump/Executable/jumpExecutable.cxx b/Tests/Jump/Executable/jumpExecutable.cxx index 7a050c7..6fa2683 100644 --- a/Tests/Jump/Executable/jumpExecutable.cxx +++ b/Tests/Jump/Executable/jumpExecutable.cxx @@ -1,7 +1,7 @@ #ifdef _WIN32 -# define JUMP_IMPORT __declspec(dllimport) +#define JUMP_IMPORT __declspec(dllimport) #else -# define JUMP_IMPORT extern +#define JUMP_IMPORT extern #endif extern int jumpStatic(); diff --git a/Tests/Jump/Library/Shared/jumpShared.cxx b/Tests/Jump/Library/Shared/jumpShared.cxx index f500058..7c4dee9 100644 --- a/Tests/Jump/Library/Shared/jumpShared.cxx +++ b/Tests/Jump/Library/Shared/jumpShared.cxx @@ -1,7 +1,10 @@ #ifdef _WIN32 -# define JUMP_EXPORT __declspec(dllexport) +#define JUMP_EXPORT __declspec(dllexport) #else -# define JUMP_EXPORT +#define JUMP_EXPORT #endif -JUMP_EXPORT int jumpShared() { return 0; } +JUMP_EXPORT int jumpShared() +{ + return 0; +} diff --git a/Tests/Jump/Library/Static/jumpStatic.cxx b/Tests/Jump/Library/Static/jumpStatic.cxx index 1f92eb9..9b169cf 100644 --- a/Tests/Jump/Library/Static/jumpStatic.cxx +++ b/Tests/Jump/Library/Static/jumpStatic.cxx @@ -1 +1,4 @@ -int jumpStatic() { return 0; } +int jumpStatic() +{ + return 0; +} diff --git a/Tests/LibName/bar.c b/Tests/LibName/bar.c index f82aa28..c6c1e66 100644 --- a/Tests/LibName/bar.c +++ b/Tests/LibName/bar.c @@ -2,6 +2,6 @@ __declspec(dllexport) #endif -extern void foo() + extern void foo() { } diff --git a/Tests/LibName/foo.c b/Tests/LibName/foo.c index 6d258e0..52e8d89 100644 --- a/Tests/LibName/foo.c +++ b/Tests/LibName/foo.c @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllimport) #endif -extern void foo(); + extern void foo(); #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/Tests/LibName/foobar.c b/Tests/LibName/foobar.c index 2f8a3ff..2f28d30 100644 --- a/Tests/LibName/foobar.c +++ b/Tests/LibName/foobar.c @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllimport) #endif -extern void bar(); + extern void bar(); int main() { diff --git a/Tests/LinkDirectory/External/myexe.c b/Tests/LinkDirectory/External/myexe.c index 6ef1ebe..57d361d 100644 --- a/Tests/LinkDirectory/External/myexe.c +++ b/Tests/LinkDirectory/External/myexe.c @@ -1,3 +1,6 @@ extern int mylibA(void); extern int mylibB(void); -int main(void) { return mylibA() + mylibB(); } +int main(void) +{ + return mylibA() + mylibB(); +} diff --git a/Tests/LinkDirectory/mylibA.c b/Tests/LinkDirectory/mylibA.c index 890a089..dd9838f 100644 --- a/Tests/LinkDirectory/mylibA.c +++ b/Tests/LinkDirectory/mylibA.c @@ -1 +1,4 @@ -int mylibA(void) { return 0; } +int mylibA(void) +{ + return 0; +} diff --git a/Tests/LinkDirectory/mylibB.c b/Tests/LinkDirectory/mylibB.c index 090cc6c..87cebdf 100644 --- a/Tests/LinkDirectory/mylibB.c +++ b/Tests/LinkDirectory/mylibB.c @@ -1 +1,4 @@ -int mylibB(void) { return 0; } +int mylibB(void) +{ + return 0; +} diff --git a/Tests/LinkFlags/LinkFlags.c b/Tests/LinkFlags/LinkFlags.c index 78f2de1..8488f4e 100644 --- a/Tests/LinkFlags/LinkFlags.c +++ b/Tests/LinkFlags/LinkFlags.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/LinkFlags/LinkFlagsExe.c b/Tests/LinkFlags/LinkFlagsExe.c index 123587a..4d44146 100644 --- a/Tests/LinkFlags/LinkFlagsExe.c +++ b/Tests/LinkFlags/LinkFlagsExe.c @@ -1,6 +1,9 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} /* Intel compiler does not reject bad flags or objects! */ #if defined(__INTEL_COMPILER) -# error BADFLAG +#error BADFLAG #endif diff --git a/Tests/LinkFlags/LinkFlagsLib.c b/Tests/LinkFlags/LinkFlagsLib.c index 9d8d088..f354206 100644 --- a/Tests/LinkFlags/LinkFlagsLib.c +++ b/Tests/LinkFlags/LinkFlagsLib.c @@ -1,6 +1,9 @@ -int flags_lib(void) { return 0; } +int flags_lib(void) +{ + return 0; +} /* Intel compiler does not reject bad flags or objects! */ #if defined(__INTEL_COMPILER) -# error BADFLAG +#error BADFLAG #endif diff --git a/Tests/LinkLanguage/LinkLanguage.c b/Tests/LinkLanguage/LinkLanguage.c index cf1557c..37946c7 100644 --- a/Tests/LinkLanguage/LinkLanguage.c +++ b/Tests/LinkLanguage/LinkLanguage.c @@ -3,4 +3,3 @@ int main() { return foo(); } - diff --git a/Tests/LinkLine/One.c b/Tests/LinkLine/One.c index 167f07d..856d0d1 100644 --- a/Tests/LinkLine/One.c +++ b/Tests/LinkLine/One.c @@ -4,7 +4,7 @@ void OneFunc() { static int i = 0; ++i; - if( i==1 ) { + if (i == 1) { TwoFunc(); } } diff --git a/Tests/LinkLine/Two.c b/Tests/LinkLine/Two.c index 0db73a8..5fc212e 100644 --- a/Tests/LinkLine/Two.c +++ b/Tests/LinkLine/Two.c @@ -4,7 +4,7 @@ void TwoFunc() { static int i = 0; ++i; - if( i==1 ) { + if (i == 1) { OneFunc(); } } diff --git a/Tests/LinkLineOrder/NoDepE.c b/Tests/LinkLineOrder/NoDepE.c index e1ba749..c47bb85 100644 --- a/Tests/LinkLineOrder/NoDepE.c +++ b/Tests/LinkLineOrder/NoDepE.c @@ -4,7 +4,7 @@ void NoDepF_func(); void NoDepE_func() { static int firstcall = 1; - if( firstcall ) { + if (firstcall) { firstcall = 0; NoDepF_func(); } diff --git a/Tests/LinkLineOrder/NoDepF.c b/Tests/LinkLineOrder/NoDepF.c index 8311cb8..a814310 100644 --- a/Tests/LinkLineOrder/NoDepF.c +++ b/Tests/LinkLineOrder/NoDepF.c @@ -4,7 +4,7 @@ void NoDepE_func(); void NoDepF_func() { static int firstcall = 1; - if( firstcall ) { + if (firstcall) { firstcall = 0; NoDepE_func(); } diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c index eac121d..3558f89 100644 --- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c @@ -5,63 +5,55 @@ typedef struct { - char *LibraryName; + char* LibraryName; int Argc; char** Argv; } cmVTKWrapTclData; /* do almost everything in the initial pass */ -static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) +static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[]) { char* file; char* str; - char *srcs; + char* srcs; const char* cstr; char buffer[1024]; - void *source_file; - char *args[2]; - char *ccArgs[4]; - char *ccDep[1]; - char *ccOut[1]; - cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; - - cmVTKWrapTclData *cdata = - (cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData)); + void* source_file; + char* args[2]; + char* ccArgs[4]; + char* ccDep[1]; + char* ccOut[1]; + cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf; + + cmVTKWrapTclData* cdata = + (cmVTKWrapTclData*)malloc(sizeof(cmVTKWrapTclData)); cdata->LibraryName = "BOO"; cdata->Argc = argc; cdata->Argv = argv; - info->CAPI->SetClientData(info,cdata); + info->CAPI->SetClientData(info, cdata); /* Now check and see if the value has been stored in the cache */ /* already, if so use that value and don't look for the program */ - if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1")) - { + if (!info->CAPI->IsOn(mf, "TEST_COMMAND_TEST1")) { info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); return 1; - } + } info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); cdata->LibraryName = "HOO"; info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON", - "Test cache variable", - CM_CACHE_BOOL); + "Test cache variable", CM_CACHE_BOOL); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "", - "Test cache variable 1", - CM_CACHE_PATH); + "Test cache variable 1", CM_CACHE_PATH); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "", - "Test cache variable 2", - CM_CACHE_FILEPATH); + "Test cache variable 2", CM_CACHE_FILEPATH); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "", - "Test cache variable 3", - CM_CACHE_STRING); + "Test cache variable 3", CM_CACHE_STRING); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "", - "Test cache variable 4", - CM_CACHE_INTERNAL); + "Test cache variable 4", CM_CACHE_INTERNAL); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "", - "Test cache variable 5", - CM_CACHE_STATIC); - + "Test cache variable 5", CM_CACHE_STATIC); file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0); @@ -83,20 +75,17 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf)); info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf)); sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d", - info->CAPI->GetCacheMajorVersion(mf), - info->CAPI->GetCacheMinorVersion(mf), - info->CAPI->GetMajorVersion(mf), - info->CAPI->GetMinorVersion(mf)); + info->CAPI->GetCacheMajorVersion(mf), + info->CAPI->GetCacheMinorVersion(mf), + info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf)); info->CAPI->DisplaySatus(mf, buffer); - if ( info->CAPI->CommandExists(mf, "SET") ) - { + if (info->CAPI->CommandExists(mf, "SET")) { info->CAPI->DisplaySatus(mf, "Command SET exists"); - } - if ( info->CAPI->CommandExists(mf, "SET_FOO_BAR") ) - { + } + if (info->CAPI->CommandExists(mf, "SET_FOO_BAR")) { info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists"); return 0; - } + } info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION"); source_file = info->CAPI->CreateNewSourceFile(mf); @@ -106,17 +95,14 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) cstr = info->CAPI->SourceFileGetFullPath(source_file); sprintf(buffer, "Should be empty (source file full path): [%s]", cstr); info->CAPI->DisplaySatus(mf, buffer); - info->CAPI->DefineSourceFileProperty(mf,"SOME_PROPERTY","unused old prop", - "This property is no longer used", - 0); - if ( info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY") ) - { + info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop", + "This property is no longer used", 0); + if (info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY")) { info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined"); return 0; - } - info->CAPI->DefineSourceFileProperty(mf,"SOME_PROPERTY2","nice prop", - "This property is for testing.", - 0); + } + info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY2", "nice prop", + "This property is for testing.", 0); info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE"); cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT"); sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr); @@ -124,8 +110,8 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) info->CAPI->DestroySourceFile(source_file); - srcs = argv[2]; - info->CAPI->AddExecutable(mf,"LoadedCommand",1, &srcs, 0); + srcs = argv[2]; + info->CAPI->AddExecutable(mf, "LoadedCommand", 1, &srcs, 0); /* add customs commands to generate the source file */ ccArgs[0] = "-E"; @@ -134,30 +120,19 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) ccArgs[3] = argv[1]; ccDep[0] = ccArgs[2]; ccOut[0] = ccArgs[3]; - info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", - file, - 4, ccArgs, - 1, ccDep, - 1, ccOut, - "LoadedCommand"); - + info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", file, 4, ccArgs, 1, + ccDep, 1, ccOut, "LoadedCommand"); ccArgs[2] = argv[1]; ccArgs[3] = argv[2]; ccDep[0] = ccArgs[2]; ccOut[0] = ccArgs[3]; - info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], - file, - 4, ccArgs, - ccDep[0], + info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], file, 4, ccArgs, ccDep[0], 0, 0); - ccArgs[1] = "echo"; ccArgs[2] = "Build has finished"; - info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", - file, - 3, ccArgs, + info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", file, 3, ccArgs, CM_POST_BUILD); info->CAPI->Free(file); @@ -166,45 +141,40 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) args[1] = "TRUE"; /* code coverage */ - if (info->CAPI->GetTotalArgumentSize(2,args) != 13) - { + if (info->CAPI->GetTotalArgumentSize(2, args) != 13) { return 0; - } - info->CAPI->ExecuteCommand(mf,"SET",2,args); + } + info->CAPI->ExecuteCommand(mf, "SET", 2, args); /* make sure we can find the source file */ - if (!info->CAPI->GetSource(mf,argv[1])) - { + if (!info->CAPI->GetSource(mf, argv[1])) { info->CAPI->SetError(mf, "Source file could not be found!"); return 0; - } + } return 1; } -static void CCONV FinalPass(void *inf, void *mf) +static void CCONV FinalPass(void* inf, void* mf) { - cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; + cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = - (cmVTKWrapTclData *)info->CAPI->GetClientData(info); - if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"),"HOO") || - strcmp(cdata->LibraryName,"HOO")) - { - fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n"); - } + cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info); + if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"), "HOO") || + strcmp(cdata->LibraryName, "HOO")) { + fprintf(stderr, "*** Failed LOADED COMMAND Final Pass\n"); + } } -static void CCONV Destructor(void *inf) +static void CCONV Destructor(void* inf) { - cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; + cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = - (cmVTKWrapTclData *)info->CAPI->GetClientData(info); + cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info); free(cdata); } #ifdef MUCHO_MUDSLIDE -void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) +void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo* info) { info->InitialPass = InitialPass; info->FinalPass = FinalPass; @@ -213,7 +183,3 @@ void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) info->Name = "CMAKE_TEST_COMMAND"; } #endif - - - - diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c index eac121d..3558f89 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c @@ -5,63 +5,55 @@ typedef struct { - char *LibraryName; + char* LibraryName; int Argc; char** Argv; } cmVTKWrapTclData; /* do almost everything in the initial pass */ -static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) +static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[]) { char* file; char* str; - char *srcs; + char* srcs; const char* cstr; char buffer[1024]; - void *source_file; - char *args[2]; - char *ccArgs[4]; - char *ccDep[1]; - char *ccOut[1]; - cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; - - cmVTKWrapTclData *cdata = - (cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData)); + void* source_file; + char* args[2]; + char* ccArgs[4]; + char* ccDep[1]; + char* ccOut[1]; + cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf; + + cmVTKWrapTclData* cdata = + (cmVTKWrapTclData*)malloc(sizeof(cmVTKWrapTclData)); cdata->LibraryName = "BOO"; cdata->Argc = argc; cdata->Argv = argv; - info->CAPI->SetClientData(info,cdata); + info->CAPI->SetClientData(info, cdata); /* Now check and see if the value has been stored in the cache */ /* already, if so use that value and don't look for the program */ - if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1")) - { + if (!info->CAPI->IsOn(mf, "TEST_COMMAND_TEST1")) { info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); return 1; - } + } info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); cdata->LibraryName = "HOO"; info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON", - "Test cache variable", - CM_CACHE_BOOL); + "Test cache variable", CM_CACHE_BOOL); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "", - "Test cache variable 1", - CM_CACHE_PATH); + "Test cache variable 1", CM_CACHE_PATH); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "", - "Test cache variable 2", - CM_CACHE_FILEPATH); + "Test cache variable 2", CM_CACHE_FILEPATH); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "", - "Test cache variable 3", - CM_CACHE_STRING); + "Test cache variable 3", CM_CACHE_STRING); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "", - "Test cache variable 4", - CM_CACHE_INTERNAL); + "Test cache variable 4", CM_CACHE_INTERNAL); info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "", - "Test cache variable 5", - CM_CACHE_STATIC); - + "Test cache variable 5", CM_CACHE_STATIC); file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0); @@ -83,20 +75,17 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf)); info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf)); sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d", - info->CAPI->GetCacheMajorVersion(mf), - info->CAPI->GetCacheMinorVersion(mf), - info->CAPI->GetMajorVersion(mf), - info->CAPI->GetMinorVersion(mf)); + info->CAPI->GetCacheMajorVersion(mf), + info->CAPI->GetCacheMinorVersion(mf), + info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf)); info->CAPI->DisplaySatus(mf, buffer); - if ( info->CAPI->CommandExists(mf, "SET") ) - { + if (info->CAPI->CommandExists(mf, "SET")) { info->CAPI->DisplaySatus(mf, "Command SET exists"); - } - if ( info->CAPI->CommandExists(mf, "SET_FOO_BAR") ) - { + } + if (info->CAPI->CommandExists(mf, "SET_FOO_BAR")) { info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists"); return 0; - } + } info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION"); source_file = info->CAPI->CreateNewSourceFile(mf); @@ -106,17 +95,14 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) cstr = info->CAPI->SourceFileGetFullPath(source_file); sprintf(buffer, "Should be empty (source file full path): [%s]", cstr); info->CAPI->DisplaySatus(mf, buffer); - info->CAPI->DefineSourceFileProperty(mf,"SOME_PROPERTY","unused old prop", - "This property is no longer used", - 0); - if ( info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY") ) - { + info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop", + "This property is no longer used", 0); + if (info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY")) { info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined"); return 0; - } - info->CAPI->DefineSourceFileProperty(mf,"SOME_PROPERTY2","nice prop", - "This property is for testing.", - 0); + } + info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY2", "nice prop", + "This property is for testing.", 0); info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE"); cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT"); sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr); @@ -124,8 +110,8 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) info->CAPI->DestroySourceFile(source_file); - srcs = argv[2]; - info->CAPI->AddExecutable(mf,"LoadedCommand",1, &srcs, 0); + srcs = argv[2]; + info->CAPI->AddExecutable(mf, "LoadedCommand", 1, &srcs, 0); /* add customs commands to generate the source file */ ccArgs[0] = "-E"; @@ -134,30 +120,19 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) ccArgs[3] = argv[1]; ccDep[0] = ccArgs[2]; ccOut[0] = ccArgs[3]; - info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", - file, - 4, ccArgs, - 1, ccDep, - 1, ccOut, - "LoadedCommand"); - + info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", file, 4, ccArgs, 1, + ccDep, 1, ccOut, "LoadedCommand"); ccArgs[2] = argv[1]; ccArgs[3] = argv[2]; ccDep[0] = ccArgs[2]; ccOut[0] = ccArgs[3]; - info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], - file, - 4, ccArgs, - ccDep[0], + info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], file, 4, ccArgs, ccDep[0], 0, 0); - ccArgs[1] = "echo"; ccArgs[2] = "Build has finished"; - info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", - file, - 3, ccArgs, + info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", file, 3, ccArgs, CM_POST_BUILD); info->CAPI->Free(file); @@ -166,45 +141,40 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) args[1] = "TRUE"; /* code coverage */ - if (info->CAPI->GetTotalArgumentSize(2,args) != 13) - { + if (info->CAPI->GetTotalArgumentSize(2, args) != 13) { return 0; - } - info->CAPI->ExecuteCommand(mf,"SET",2,args); + } + info->CAPI->ExecuteCommand(mf, "SET", 2, args); /* make sure we can find the source file */ - if (!info->CAPI->GetSource(mf,argv[1])) - { + if (!info->CAPI->GetSource(mf, argv[1])) { info->CAPI->SetError(mf, "Source file could not be found!"); return 0; - } + } return 1; } -static void CCONV FinalPass(void *inf, void *mf) +static void CCONV FinalPass(void* inf, void* mf) { - cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; + cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = - (cmVTKWrapTclData *)info->CAPI->GetClientData(info); - if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"),"HOO") || - strcmp(cdata->LibraryName,"HOO")) - { - fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n"); - } + cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info); + if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"), "HOO") || + strcmp(cdata->LibraryName, "HOO")) { + fprintf(stderr, "*** Failed LOADED COMMAND Final Pass\n"); + } } -static void CCONV Destructor(void *inf) +static void CCONV Destructor(void* inf) { - cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; + cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = - (cmVTKWrapTclData *)info->CAPI->GetClientData(info); + cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info); free(cdata); } #ifdef MUCHO_MUDSLIDE -void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) +void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo* info) { info->InitialPass = InitialPass; info->FinalPass = FinalPass; @@ -213,7 +183,3 @@ void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) info->Name = "CMAKE_TEST_COMMAND"; } #endif - - - - diff --git a/Tests/MFC/mfc1/ChildFrm.cpp b/Tests/MFC/mfc1/ChildFrm.cpp index 889cceb..ddb19c6 100644 --- a/Tests/MFC/mfc1/ChildFrm.cpp +++ b/Tests/MFC/mfc1/ChildFrm.cpp @@ -11,7 +11,6 @@ #define new DEBUG_NEW #endif - // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) @@ -19,43 +18,40 @@ IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) END_MESSAGE_MAP() - // CChildFrame construction/destruction CChildFrame::CChildFrame() { - // TODO: add member initialization code here + // TODO: add member initialization code here } CChildFrame::~CChildFrame() { } - BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs - if( !CMDIChildWnd::PreCreateWindow(cs) ) - return FALSE; + // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT + // cs + if (!CMDIChildWnd::PreCreateWindow(cs)) + return FALSE; - return TRUE; + return TRUE; } - // CChildFrame diagnostics #ifdef _DEBUG void CChildFrame::AssertValid() const { - CMDIChildWnd::AssertValid(); + CMDIChildWnd::AssertValid(); } void CChildFrame::Dump(CDumpContext& dc) const { - CMDIChildWnd::Dump(dc); + CMDIChildWnd::Dump(dc); } #endif //_DEBUG - // CChildFrame message handlers diff --git a/Tests/MFC/mfc1/ChildFrm.h b/Tests/MFC/mfc1/ChildFrm.h index 34b80f1..eedf4d1 100644 --- a/Tests/MFC/mfc1/ChildFrm.h +++ b/Tests/MFC/mfc1/ChildFrm.h @@ -1,34 +1,30 @@ // ChildFrm.h : interface of the CChildFrame class // - #pragma once - class CChildFrame : public CMDIChildWnd { - DECLARE_DYNCREATE(CChildFrame) + DECLARE_DYNCREATE(CChildFrame) public: - CChildFrame(); + CChildFrame(); -// Attributes + // Attributes public: - -// Operations + // Operations public: + // Overrides + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Overrides - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - -// Implementation + // Implementation public: - virtual ~CChildFrame(); + virtual ~CChildFrame(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif -// Generated message map functions + // Generated message map functions protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; diff --git a/Tests/MFC/mfc1/MainFrm.cpp b/Tests/MFC/mfc1/MainFrm.cpp index 222c3da..c551065 100644 --- a/Tests/MFC/mfc1/MainFrm.cpp +++ b/Tests/MFC/mfc1/MainFrm.cpp @@ -11,89 +11,81 @@ #define new DEBUG_NEW #endif - // CMainFrame IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) - ON_WM_CREATE() +ON_WM_CREATE() END_MESSAGE_MAP() -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, +static UINT indicators[] = { + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; - // CMainFrame construction/destruction CMainFrame::CMainFrame() { - // TODO: add member initialization code here + // TODO: add member initialization code here } CMainFrame::~CMainFrame() { } - int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { - if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP - | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || - !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) - { - TRACE0("Failed to create toolbar\n"); - return -1; // fail to create - } - - if (!m_wndStatusBar.Create(this) || - !m_wndStatusBar.SetIndicators(indicators, - sizeof(indicators)/sizeof(UINT))) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - // TODO: Delete these three lines if you don't want the toolbar to be dockable - m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); - EnableDocking(CBRS_ALIGN_ANY); - DockControlBar(&m_wndToolBar); - - return 0; + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | + CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | + CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators) / sizeof(UINT))) { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + // TODO: Delete these three lines if you don't want the toolbar to be + // dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { - if( !CMDIFrameWnd::PreCreateWindow(cs) ) - return FALSE; - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs + if (!CMDIFrameWnd::PreCreateWindow(cs)) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs - return TRUE; + return TRUE; } - // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { - CMDIFrameWnd::AssertValid(); + CMDIFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { - CMDIFrameWnd::Dump(dc); + CMDIFrameWnd::Dump(dc); } #endif //_DEBUG - // CMainFrame message handlers diff --git a/Tests/MFC/mfc1/MainFrm.h b/Tests/MFC/mfc1/MainFrm.h index 1039ac5..3b965c9 100644 --- a/Tests/MFC/mfc1/MainFrm.h +++ b/Tests/MFC/mfc1/MainFrm.h @@ -1,38 +1,35 @@ // MainFrm.h : interface of the CMainFrame class // - #pragma once class CMainFrame : public CMDIFrameWnd { - DECLARE_DYNAMIC(CMainFrame) + DECLARE_DYNAMIC(CMainFrame) public: - CMainFrame(); + CMainFrame(); -// Attributes + // Attributes public: - -// Operations + // Operations public: - -// Overrides + // Overrides public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Implementation + // Implementation public: - virtual ~CMainFrame(); + virtual ~CMainFrame(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - CToolBar m_wndToolBar; +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; -// Generated message map functions + // Generated message map functions protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - DECLARE_MESSAGE_MAP() + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + DECLARE_MESSAGE_MAP() }; diff --git a/Tests/MFC/mfc1/Resource.h b/Tests/MFC/mfc1/Resource.h index 0a9c13f..7184e30 100644 --- a/Tests/MFC/mfc1/Resource.h +++ b/Tests/MFC/mfc1/Resource.h @@ -2,19 +2,19 @@ // Microsoft Visual C++ generated include file. // Used by mfc1.rc // -#define IDD_ABOUTBOX 100 -#define IDP_OLE_INIT_FAILED 100 -#define IDR_MAINFRAME 128 -#define IDR_mfc1TYPE 129 -#define IDR_MANIFEST CREATEPROCESS_MANIFEST_RESOURCE_ID +#define IDD_ABOUTBOX 100 +#define IDP_OLE_INIT_FAILED 100 +#define IDR_MAINFRAME 128 +#define IDR_mfc1TYPE 129 +#define IDR_MANIFEST CREATEPROCESS_MANIFEST_RESOURCE_ID // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 130 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32771 #endif #endif diff --git a/Tests/MFC/mfc1/mfc1.cpp b/Tests/MFC/mfc1/mfc1.cpp index 1777d7f..664c6c4 100644 --- a/Tests/MFC/mfc1/mfc1.cpp +++ b/Tests/MFC/mfc1/mfc1.cpp @@ -14,28 +14,25 @@ #define new DEBUG_NEW #endif - // Cmfc1App BEGIN_MESSAGE_MAP(Cmfc1App, CWinApp) - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) - // Standard file based document commands - ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) - ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) - // Standard print setup command - ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +ON_COMMAND(ID_APP_ABOUT, OnAppAbout) +// Standard file based document commands +ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) +ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +// Standard print setup command +ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() - // Cmfc1App construction Cmfc1App::Cmfc1App() { - // TODO: add construction code here, - // Place all significant initialization in InitInstance + // TODO: add construction code here, + // Place all significant initialization in InitInstance } - // The one and only Cmfc1App object Cmfc1App theApp; @@ -44,91 +41,92 @@ Cmfc1App theApp; BOOL Cmfc1App::InitInstance() { - // InitCommonControls() is required on Windows XP if an application - // manifest specifies use of ComCtl32.dll version 6 or later to enable - // visual styles. Otherwise, any window creation will fail. - InitCommonControls(); - - CWinApp::InitInstance(); - - // Initialize OLE libraries - if (!AfxOleInit()) - { - AfxMessageBox(IDP_OLE_INIT_FAILED); - return FALSE; - } - AfxEnableControlContainer(); - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need - // Change the registry key under which our settings are stored - // TODO: You should modify this string to be something appropriate - // such as the name of your company or organization - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - LoadStdProfileSettings(4); // Load standard INI file options (including MRU) - // Register the application's document templates. Document templates - // serve as the connection between documents, frame windows and views - CMultiDocTemplate* pDocTemplate; - pDocTemplate = new CMultiDocTemplate(IDR_mfc1TYPE, - RUNTIME_CLASS(Cmfc1Doc), - RUNTIME_CLASS(CChildFrame), // custom MDI child frame - RUNTIME_CLASS(Cmfc1View)); - if (!pDocTemplate) - return FALSE; - AddDocTemplate(pDocTemplate); - // create main MDI Frame window - CMainFrame* pMainFrame = new CMainFrame; - if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) - return FALSE; - m_pMainWnd = pMainFrame; - // call DragAcceptFiles only if there's a suffix - // In an MDI app, this should occur immediately after setting m_pMainWnd - // Enable drag/drop open - m_pMainWnd->DragAcceptFiles(); - // Enable DDE Execute open - EnableShellOpen(); - RegisterShellFileTypes(TRUE); - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - // Dispatch commands specified on the command line. Will return FALSE if - // app was launched with /RegServer, /Register, /Unregserver or /Unregister. - if (!ProcessShellCommand(cmdInfo)) - return FALSE; - // The main window has been initialized, so show and update it - pMainFrame->ShowWindow(m_nCmdShow); - pMainFrame->UpdateWindow(); - return TRUE; + // InitCommonControls() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + InitCommonControls(); + + CWinApp::InitInstance(); + + // Initialize OLE libraries + if (!AfxOleInit()) { + AfxMessageBox(IDP_OLE_INIT_FAILED); + return FALSE; + } + AfxEnableControlContainer(); + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + LoadStdProfileSettings(4); // Load standard INI file options (including MRU) + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views + CMultiDocTemplate* pDocTemplate; + pDocTemplate = + new CMultiDocTemplate(IDR_mfc1TYPE, RUNTIME_CLASS(Cmfc1Doc), + RUNTIME_CLASS(CChildFrame), // custom MDI child frame + RUNTIME_CLASS(Cmfc1View)); + if (!pDocTemplate) + return FALSE; + AddDocTemplate(pDocTemplate); + // create main MDI Frame window + CMainFrame* pMainFrame = new CMainFrame; + if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + // call DragAcceptFiles only if there's a suffix + // In an MDI app, this should occur immediately after setting m_pMainWnd + // Enable drag/drop open + m_pMainWnd->DragAcceptFiles(); + // Enable DDE Execute open + EnableShellOpen(); + RegisterShellFileTypes(TRUE); + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + // Dispatch commands specified on the command line. Will return FALSE if + // app was launched with /RegServer, /Register, /Unregserver or /Unregister. + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + // The main window has been initialized, so show and update it + pMainFrame->ShowWindow(m_nCmdShow); + pMainFrame->UpdateWindow(); + return TRUE; } - - // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: - CAboutDlg(); + CAboutDlg(); -// Dialog Data - enum { IDD = IDD_ABOUTBOX }; + // Dialog Data + enum + { + IDD = IDD_ABOUTBOX + }; protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support -// Implementation + // Implementation protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +CAboutDlg::CAboutDlg() + : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); + CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) @@ -137,9 +135,8 @@ END_MESSAGE_MAP() // App command to run the dialog void Cmfc1App::OnAppAbout() { - CAboutDlg aboutDlg; - aboutDlg.DoModal(); + CAboutDlg aboutDlg; + aboutDlg.DoModal(); } - // Cmfc1App message handlers diff --git a/Tests/MFC/mfc1/mfc1.h b/Tests/MFC/mfc1/mfc1.h index c273601..15e970b 100644 --- a/Tests/MFC/mfc1/mfc1.h +++ b/Tests/MFC/mfc1/mfc1.h @@ -3,11 +3,10 @@ #pragma once #ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH +#error include 'stdafx.h' before including this file for PCH #endif -#include "resource.h" // main symbols - +#include "resource.h" // main symbols // Cmfc1App: // See mfc1.cpp for the implementation of this class @@ -16,16 +15,15 @@ class Cmfc1App : public CWinApp { public: - Cmfc1App(); - + Cmfc1App(); -// Overrides + // Overrides public: - virtual BOOL InitInstance(); + virtual BOOL InitInstance(); -// Implementation - afx_msg void OnAppAbout(); - DECLARE_MESSAGE_MAP() + // Implementation + afx_msg void OnAppAbout(); + DECLARE_MESSAGE_MAP() }; extern Cmfc1App theApp; diff --git a/Tests/MFC/mfc1/mfc1Doc.cpp b/Tests/MFC/mfc1/mfc1Doc.cpp index db76b06..08ab158 100644 --- a/Tests/MFC/mfc1/mfc1Doc.cpp +++ b/Tests/MFC/mfc1/mfc1Doc.cpp @@ -11,7 +11,6 @@ #define new DEBUG_NEW #endif - // Cmfc1Doc IMPLEMENT_DYNCREATE(Cmfc1Doc, CDocument) @@ -19,13 +18,11 @@ IMPLEMENT_DYNCREATE(Cmfc1Doc, CDocument) BEGIN_MESSAGE_MAP(Cmfc1Doc, CDocument) END_MESSAGE_MAP() - // Cmfc1Doc construction/destruction Cmfc1Doc::Cmfc1Doc() { - // TODO: add one-time construction code here - + // TODO: add one-time construction code here } Cmfc1Doc::~Cmfc1Doc() @@ -34,46 +31,38 @@ Cmfc1Doc::~Cmfc1Doc() BOOL Cmfc1Doc::OnNewDocument() { - if (!CDocument::OnNewDocument()) - return FALSE; + if (!CDocument::OnNewDocument()) + return FALSE; - // TODO: add reinitialization code here - // (SDI documents will reuse this document) + // TODO: add reinitialization code here + // (SDI documents will reuse this document) - return TRUE; + return TRUE; } - - - // Cmfc1Doc serialization void Cmfc1Doc::Serialize(CArchive& ar) { - if (ar.IsStoring()) - { - // TODO: add storing code here - } - else - { - // TODO: add loading code here - } + if (ar.IsStoring()) { + // TODO: add storing code here + } else { + // TODO: add loading code here + } } - // Cmfc1Doc diagnostics #ifdef _DEBUG void Cmfc1Doc::AssertValid() const { - CDocument::AssertValid(); + CDocument::AssertValid(); } void Cmfc1Doc::Dump(CDumpContext& dc) const { - CDocument::Dump(dc); + CDocument::Dump(dc); } #endif //_DEBUG - // Cmfc1Doc commands diff --git a/Tests/MFC/mfc1/mfc1Doc.h b/Tests/MFC/mfc1/mfc1Doc.h index 92d8e35..fb43cba 100644 --- a/Tests/MFC/mfc1/mfc1Doc.h +++ b/Tests/MFC/mfc1/mfc1Doc.h @@ -1,37 +1,33 @@ // mfc1Doc.h : interface of the Cmfc1Doc class // - #pragma once class Cmfc1Doc : public CDocument { protected: // create from serialization only - Cmfc1Doc(); - DECLARE_DYNCREATE(Cmfc1Doc) + Cmfc1Doc(); + DECLARE_DYNCREATE(Cmfc1Doc) -// Attributes + // Attributes public: - -// Operations + // Operations public: + // Overrides +public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); -// Overrides - public: - virtual BOOL OnNewDocument(); - virtual void Serialize(CArchive& ar); - -// Implementation + // Implementation public: - virtual ~Cmfc1Doc(); + virtual ~Cmfc1Doc(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif protected: - -// Generated message map functions + // Generated message map functions protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; diff --git a/Tests/MFC/mfc1/mfc1View.cpp b/Tests/MFC/mfc1/mfc1View.cpp index 8000302..6169ce5 100644 --- a/Tests/MFC/mfc1/mfc1View.cpp +++ b/Tests/MFC/mfc1/mfc1View.cpp @@ -12,24 +12,22 @@ #define new DEBUG_NEW #endif - // Cmfc1View IMPLEMENT_DYNCREATE(Cmfc1View, CView) BEGIN_MESSAGE_MAP(Cmfc1View, CView) - // Standard printing commands - ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) +// Standard printing commands +ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP() // Cmfc1View construction/destruction Cmfc1View::Cmfc1View() { - // TODO: add construction code here - + // TODO: add construction code here } Cmfc1View::~Cmfc1View() @@ -38,63 +36,60 @@ Cmfc1View::~Cmfc1View() BOOL Cmfc1View::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs - return CView::PreCreateWindow(cs); + return CView::PreCreateWindow(cs); } // Cmfc1View drawing void Cmfc1View::OnDraw(CDC* /*pDC*/) { - Cmfc1Doc* pDoc = GetDocument(); - ASSERT_VALID(pDoc); - if (!pDoc) - return; + Cmfc1Doc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + if (!pDoc) + return; - // TODO: add draw code for native data here + // TODO: add draw code for native data here } - // Cmfc1View printing BOOL Cmfc1View::OnPreparePrinting(CPrintInfo* pInfo) { - // default preparation - return DoPreparePrinting(pInfo); + // default preparation + return DoPreparePrinting(pInfo); } void Cmfc1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { - // TODO: add extra initialization before printing + // TODO: add extra initialization before printing } void Cmfc1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { - // TODO: add cleanup after printing + // TODO: add cleanup after printing } - // Cmfc1View diagnostics #ifdef _DEBUG void Cmfc1View::AssertValid() const { - CView::AssertValid(); + CView::AssertValid(); } void Cmfc1View::Dump(CDumpContext& dc) const { - CView::Dump(dc); + CView::Dump(dc); } Cmfc1Doc* Cmfc1View::GetDocument() const // non-debug version is inline { - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc1Doc))); - return (Cmfc1Doc*)m_pDocument; + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc1Doc))); + return (Cmfc1Doc*)m_pDocument; } #endif //_DEBUG - // Cmfc1View message handlers diff --git a/Tests/MFC/mfc1/mfc1View.h b/Tests/MFC/mfc1/mfc1View.h index 4244653..8c827bb 100644 --- a/Tests/MFC/mfc1/mfc1View.h +++ b/Tests/MFC/mfc1/mfc1View.h @@ -1,48 +1,47 @@ // mfc1View.h : interface of the Cmfc1View class // - #pragma once - class Cmfc1View : public CView { protected: // create from serialization only - Cmfc1View(); - DECLARE_DYNCREATE(Cmfc1View) + Cmfc1View(); + DECLARE_DYNCREATE(Cmfc1View) -// Attributes + // Attributes public: - Cmfc1Doc* GetDocument() const; + Cmfc1Doc* GetDocument() const; -// Operations + // Operations +public: + // Overrides public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Overrides - public: - virtual void OnDraw(CDC* pDC); // overridden to draw this view -virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: - virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); - virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); - virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); + virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); -// Implementation + // Implementation public: - virtual ~Cmfc1View(); + virtual ~Cmfc1View(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif protected: - -// Generated message map functions + // Generated message map functions protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; -#ifndef _DEBUG // debug version in mfc1View.cpp +#ifndef _DEBUG // debug version in mfc1View.cpp inline Cmfc1Doc* Cmfc1View::GetDocument() const - { return reinterpret_cast<Cmfc1Doc*>(m_pDocument); } +{ + return reinterpret_cast<Cmfc1Doc*>(m_pDocument); +} #endif diff --git a/Tests/MFC/mfc1/stdafx.h b/Tests/MFC/mfc1/stdafx.h index 654a23f..56f8a6a 100644 --- a/Tests/MFC/mfc1/stdafx.h +++ b/Tests/MFC/mfc1/stdafx.h @@ -5,52 +5,65 @@ #pragma once #ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif // See http://msdn.microsoft.com/en-us/library/6sehtctf.aspx for more info // on WINVER and _WIN32_WINNT -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +// Modify the following defines if you have to target a platform prior to the +// ones specified below. +// Refer to MSDN for the latest info on corresponding values for different +// platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 + // or later. #if _MSC_VER < 1600 -#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#define WINVER \ + 0x0400 // Change this to the appropriate value to target Windows 98 and + // Windows 2000 or later. #else -#define WINVER 0x0501 // Target Windows XP and later with VS 10 and later +#define WINVER 0x0501 // Target Windows XP and later with VS 10 and later #endif #endif -#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or + // later. #if _MSC_VER < 1600 -#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#define _WIN32_WINNT \ + 0x0400 // Change this to the appropriate value to target Windows 98 and + // Windows 2000 or later. #else -#define _WIN32_WINNT 0x0501 // Target Windows XP and later with VS 10 and later +#define _WIN32_WINNT 0x0501 // Target Windows XP and later with VS 10 and later #endif #endif -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or + // later. #if _MSC_VER < 1600 -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#define _WIN32_WINDOWS \ + 0x0410 // Change this to the appropriate value to target Windows Me or later. #endif #endif -#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. #if _MSC_VER < 1600 -#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#define _WIN32_IE \ + 0x0400 // Change this to the appropriate value to target IE 5.0 or later. #endif #endif -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be + // explicit -// turns off MFC's hiding of some common and often safely ignored warning messages +// turns off MFC's hiding of some common and often safely ignored warning +// messages #define _AFX_ALL_WARNINGS #include <afxdisp.h> // MFC Automation classes #include <afxext.h> // MFC extensions #include <afxwin.h> // MFC core and standard components -#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT -#include <afxcmn.h> // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT diff --git a/Tests/MSManifest/Subdir/main.c b/Tests/MSManifest/Subdir/main.c index 78f2de1..8488f4e 100644 --- a/Tests/MSManifest/Subdir/main.c +++ b/Tests/MSManifest/Subdir/main.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/MacRuntimePath/A/framework.h b/Tests/MacRuntimePath/A/framework.h index bdd10f0..343317c 100644 --- a/Tests/MacRuntimePath/A/framework.h +++ b/Tests/MacRuntimePath/A/framework.h @@ -3,13 +3,13 @@ #define framework_h #ifdef WIN32 -# ifdef framework_EXPORTS -# define FRAMEWORK_EXPORT __declspec(dllexport) -# else -# define FRAMEWORK_EXPORT __declspec(dllimport) -# endif +#ifdef framework_EXPORTS +#define FRAMEWORK_EXPORT __declspec(dllexport) #else -# define FRAMEWORK_EXPORT +#define FRAMEWORK_EXPORT __declspec(dllimport) +#endif +#else +#define FRAMEWORK_EXPORT #endif void FRAMEWORK_EXPORT framework(); diff --git a/Tests/MacRuntimePath/A/framework2.h b/Tests/MacRuntimePath/A/framework2.h index 4576d12..7f45f4d 100644 --- a/Tests/MacRuntimePath/A/framework2.h +++ b/Tests/MacRuntimePath/A/framework2.h @@ -3,13 +3,13 @@ #define framework2_h #ifdef WIN32 -# ifdef framework2_EXPORTS -# define FRAMEWORK2_EXPORT __declspec(dllexport) -# else -# define FRAMEWORK2_EXPORT __declspec(dllimport) -# endif +#ifdef framework2_EXPORTS +#define FRAMEWORK2_EXPORT __declspec(dllexport) #else -# define FRAMEWORK2_EXPORT +#define FRAMEWORK2_EXPORT __declspec(dllimport) +#endif +#else +#define FRAMEWORK2_EXPORT #endif void FRAMEWORK2_EXPORT framework2(); diff --git a/Tests/MacRuntimePath/A/shared.h b/Tests/MacRuntimePath/A/shared.h index 3588fb8..28904fd 100644 --- a/Tests/MacRuntimePath/A/shared.h +++ b/Tests/MacRuntimePath/A/shared.h @@ -3,13 +3,13 @@ #define shared_h #ifdef WIN32 -# ifdef shared_EXPORTS -# define SHARED_EXPORT __declspec(dllexport) -# else -# define SHARED_EXPORT __declspec(dllimport) -# endif +#ifdef shared_EXPORTS +#define SHARED_EXPORT __declspec(dllexport) #else -# define SHARED_EXPORT +#define SHARED_EXPORT __declspec(dllimport) +#endif +#else +#define SHARED_EXPORT #endif void SHARED_EXPORT shared(); diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx index 5b94602..124eba4 100644 --- a/Tests/MathTest/MathTestExec.cxx +++ b/Tests/MathTest/MathTestExec.cxx @@ -1,26 +1,24 @@ #include <stdio.h> -#define TEST_EXPRESSION(x, y) \ - if ( (x) != (y) ) \ - { \ - printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in CMake returns: %d\n", \ - #x, (x), (y)); \ - res ++; \ - } +#define TEST_EXPRESSION(x, y) \ + if ((x) != (y)) { \ + printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in " \ + "CMake returns: %d\n", \ + #x, (x), (y)); \ + res++; \ + } int main(int argc, char* argv[]) { - if ( argc > 1 ) - { + if (argc > 1) { printf("Usage: %s\n", argv[0]); return 1; - } + } int res = 0; #include "MathTestTests.h" - if ( res != 0 ) - { + if (res != 0) { printf("%s: %d math tests failed\n", argv[0], res); return 1; - } + } return 0; } diff --git a/Tests/MissingInstall/mybin.cpp b/Tests/MissingInstall/mybin.cpp index 237c8ce..5047a34 100644 --- a/Tests/MissingInstall/mybin.cpp +++ b/Tests/MissingInstall/mybin.cpp @@ -1 +1,3 @@ -int main() {} +int main() +{ +} diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.c b/Tests/Module/CheckTypeSize/CheckTypeSize.c index 32e395c..05c798b 100644 --- a/Tests/Module/CheckTypeSize/CheckTypeSize.c +++ b/Tests/Module/CheckTypeSize/CheckTypeSize.c @@ -2,37 +2,38 @@ #include "somestruct.h" #ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> +#include <sys/types.h> #endif #ifdef HAVE_STDINT_H -# include <stdint.h> +#include <stdint.h> #endif #ifdef HAVE_STDDEF_H -# include <stddef.h> +#include <stddef.h> #endif #include <stdio.h> -#define CHECK(t,m) do { \ - if(sizeof(t) != m) \ - { \ - printf(#m ": expected %d, got %d (line %d)\n", \ - (int)sizeof(t), (int)m, __LINE__); \ - result = 1; \ - } \ - } while(0) - -#define NODEF(m) do { \ - printf(#m": not defined (line %d)\n", __LINE__); \ - result = 1; \ - } while(0) +#define CHECK(t, m) \ + do { \ + if (sizeof(t) != m) { \ + printf(#m ": expected %d, got %d (line %d)\n", (int)sizeof(t), (int)m, \ + __LINE__); \ + result = 1; \ + } \ + } while (0) + +#define NODEF(m) \ + do { \ + printf(#m ": not defined (line %d)\n", __LINE__); \ + result = 1; \ + } while (0) int main() { int result = 0; struct somestruct x; - /* void* */ +/* void* */ #if !defined(HAVE_SIZEOF_DATA_PTR) NODEF(HAVE_SIZEOF_DATA_PTR); #endif @@ -42,7 +43,7 @@ int main() NODEF(SIZEOF_DATA_PTR); #endif - /* char */ +/* char */ #if !defined(HAVE_SIZEOF_CHAR) NODEF(HAVE_SIZEOF_CHAR); #endif @@ -52,7 +53,7 @@ int main() NODEF(SIZEOF_CHAR); #endif - /* short */ +/* short */ #if !defined(HAVE_SIZEOF_SHORT) NODEF(HAVE_SIZEOF_SHORT); #endif @@ -62,7 +63,7 @@ int main() NODEF(SIZEOF_SHORT); #endif - /* int */ +/* int */ #if !defined(HAVE_SIZEOF_INT) NODEF(HAVE_SIZEOF_INT); #endif @@ -72,7 +73,7 @@ int main() NODEF(SIZEOF_INT); #endif - /* long */ +/* long */ #if !defined(HAVE_SIZEOF_LONG) NODEF(HAVE_SIZEOF_LONG); #endif @@ -82,25 +83,25 @@ int main() NODEF(SIZEOF_LONG); #endif - /* long long */ +/* long long */ #if defined(SIZEOF_LONG_LONG) CHECK(long long, SIZEOF_LONG_LONG); -# if !defined(HAVE_SIZEOF_LONG_LONG) +#if !defined(HAVE_SIZEOF_LONG_LONG) NODEF(HAVE_SIZEOF_LONG_LONG); -# endif +#endif #endif - /* __int64 */ +/* __int64 */ #if defined(SIZEOF___INT64) CHECK(__int64, SIZEOF___INT64); -# if !defined(HAVE_SIZEOF___INT64) +#if !defined(HAVE_SIZEOF___INT64) NODEF(HAVE_SIZEOF___INT64); -# endif +#endif #elif defined(HAVE_SIZEOF___INT64) NODEF(SIZEOF___INT64); #endif - /* size_t */ +/* size_t */ #if !defined(HAVE_SIZEOF_SIZE_T) NODEF(HAVE_SIZEOF_SIZE_T); #endif @@ -110,45 +111,45 @@ int main() NODEF(SIZEOF_SIZE_T); #endif - /* ssize_t */ +/* ssize_t */ #if defined(SIZEOF_SSIZE_T) CHECK(ssize_t, SIZEOF_SSIZE_T); -# if !defined(HAVE_SIZEOF_SSIZE_T) +#if !defined(HAVE_SIZEOF_SSIZE_T) NODEF(HAVE_SIZEOF_SSIZE_T); -# endif +#endif #elif defined(HAVE_SIZEOF_SSIZE_T) NODEF(SIZEOF_SSIZE_T); #endif - /* struct somestruct::someint */ +/* struct somestruct::someint */ #if defined(SIZEOF_STRUCTMEMBER_INT) CHECK(x.someint, SIZEOF_STRUCTMEMBER_INT); CHECK(x.someint, SIZEOF_INT); -# if !defined(HAVE_SIZEOF_STRUCTMEMBER_INT) +#if !defined(HAVE_SIZEOF_STRUCTMEMBER_INT) NODEF(HAVE_SIZEOF_STRUCTMEMBER_INT); -# endif +#endif #elif defined(HAVE_SIZEOF_STRUCTMEMBER_INT) NODEF(SIZEOF_STRUCTMEMBER_INT); #endif - /* struct somestruct::someptr */ +/* struct somestruct::someptr */ #if defined(SIZEOF_STRUCTMEMBER_PTR) CHECK(x.someptr, SIZEOF_STRUCTMEMBER_PTR); CHECK(x.someptr, SIZEOF_DATA_PTR); -# if !defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) +#if !defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) NODEF(HAVE_SIZEOF_STRUCTMEMBER_PTR); -# endif +#endif #elif defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) NODEF(SIZEOF_STRUCTMEMBER_PTR); #endif - /* struct somestruct::someint */ +/* struct somestruct::someint */ #if defined(SIZEOF_STRUCTMEMBER_CHAR) CHECK(x.somechar, SIZEOF_STRUCTMEMBER_CHAR); CHECK(x.somechar, SIZEOF_CHAR); -# if !defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) +#if !defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) NODEF(HAVE_SIZEOF_STRUCTMEMBER_CHAR); -# endif +#endif #elif defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) NODEF(SIZEOF_STRUCTMEMBER_CHAR); #endif diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.cxx b/Tests/Module/CheckTypeSize/CheckTypeSize.cxx index b5692cd..2ae84a3 100644 --- a/Tests/Module/CheckTypeSize/CheckTypeSize.cxx +++ b/Tests/Module/CheckTypeSize/CheckTypeSize.cxx @@ -3,37 +3,38 @@ #include "someclass.hxx" #ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> +#include <sys/types.h> #endif #ifdef HAVE_STDINT_H -# include <stdint.h> +#include <stdint.h> #endif #ifdef HAVE_STDDEF_H -# include <stddef.h> +#include <stddef.h> #endif #include <stdio.h> -#define CHECK(t,m) do { \ - if(sizeof(t) != m) \ - { \ - printf(#m ": expected %d, got %d (line %d)\n", \ - (int)sizeof(t), (int)m, __LINE__); \ - result = 1; \ - } \ - } while(0) - -#define NODEF(m) do { \ - printf(#m": not defined (line %d)\n", __LINE__); \ - result = 1; \ - } while(0) +#define CHECK(t, m) \ + do { \ + if (sizeof(t) != m) { \ + printf(#m ": expected %d, got %d (line %d)\n", (int)sizeof(t), (int)m, \ + __LINE__); \ + result = 1; \ + } \ + } while (0) + +#define NODEF(m) \ + do { \ + printf(#m ": not defined (line %d)\n", __LINE__); \ + result = 1; \ + } while (0) int main() { int result = 0; ns::someclass y; - /* void* */ +/* void* */ #if !defined(HAVE_SIZEOF_DATA_PTR) NODEF(HAVE_SIZEOF_DATA_PTR); #endif @@ -43,7 +44,7 @@ int main() NODEF(SIZEOF_DATA_PTR); #endif - /* char */ +/* char */ #if !defined(HAVE_SIZEOF_CHAR) NODEF(HAVE_SIZEOF_CHAR); #endif @@ -53,7 +54,7 @@ int main() NODEF(SIZEOF_CHAR); #endif - /* short */ +/* short */ #if !defined(HAVE_SIZEOF_SHORT) NODEF(HAVE_SIZEOF_SHORT); #endif @@ -63,7 +64,7 @@ int main() NODEF(SIZEOF_SHORT); #endif - /* int */ +/* int */ #if !defined(HAVE_SIZEOF_INT) NODEF(HAVE_SIZEOF_INT); #endif @@ -73,7 +74,7 @@ int main() NODEF(SIZEOF_INT); #endif - /* long */ +/* long */ #if !defined(HAVE_SIZEOF_LONG) NODEF(HAVE_SIZEOF_LONG); #endif @@ -83,25 +84,25 @@ int main() NODEF(SIZEOF_LONG); #endif - /* long long */ +/* long long */ #if defined(SIZEOF_LONG_LONG) CHECK(long long, SIZEOF_LONG_LONG); -# if !defined(HAVE_SIZEOF_LONG_LONG) +#if !defined(HAVE_SIZEOF_LONG_LONG) NODEF(HAVE_SIZEOF_LONG_LONG); -# endif +#endif #endif - /* __int64 */ +/* __int64 */ #if defined(SIZEOF___INT64) CHECK(__int64, SIZEOF___INT64); -# if !defined(HAVE_SIZEOF___INT64) +#if !defined(HAVE_SIZEOF___INT64) NODEF(HAVE_SIZEOF___INT64); -# endif +#endif #elif defined(HAVE_SIZEOF___INT64) NODEF(SIZEOF___INT64); #endif - /* size_t */ +/* size_t */ #if !defined(HAVE_SIZEOF_SIZE_T) NODEF(HAVE_SIZEOF_SIZE_T); #endif @@ -111,56 +112,56 @@ int main() NODEF(SIZEOF_SIZE_T); #endif - /* ssize_t */ +/* ssize_t */ #if defined(SIZEOF_SSIZE_T) CHECK(ssize_t, SIZEOF_SSIZE_T); -# if !defined(HAVE_SIZEOF_SSIZE_T) +#if !defined(HAVE_SIZEOF_SSIZE_T) NODEF(HAVE_SIZEOF_SSIZE_T); -# endif +#endif #elif defined(HAVE_SIZEOF_SSIZE_T) NODEF(SIZEOF_SSIZE_T); #endif - /* ns::someclass::someint */ +/* ns::someclass::someint */ #if defined(SIZEOF_NS_CLASSMEMBER_INT) CHECK(y.someint, SIZEOF_NS_CLASSMEMBER_INT); CHECK(y.someint, SIZEOF_INT); -# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_INT) +#if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_INT) NODEF(HAVE_SIZEOF_STRUCTMEMBER_INT); -# endif +#endif #elif defined(HAVE_SIZEOF_STRUCTMEMBER_INT) NODEF(SIZEOF_STRUCTMEMBER_INT); #endif - /* ns::someclass::someptr */ +/* ns::someclass::someptr */ #if defined(SIZEOF_NS_CLASSMEMBER_PTR) CHECK(y.someptr, SIZEOF_NS_CLASSMEMBER_PTR); CHECK(y.someptr, SIZEOF_DATA_PTR); -# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_PTR) +#if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_PTR) NODEF(HAVE_SIZEOF_NS_CLASSMEMBER_PTR); -# endif +#endif #elif defined(HAVE_SIZEOF_NS_CLASSMEMBER_PTR) NODEF(SIZEOF_NS_CLASSMEMBER_PTR); #endif - /* ns::someclass::somechar */ +/* ns::someclass::somechar */ #if defined(SIZEOF_NS_CLASSMEMBER_CHAR) CHECK(y.somechar, SIZEOF_NS_CLASSMEMBER_CHAR); CHECK(y.somechar, SIZEOF_CHAR); -# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR) +#if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR) NODEF(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR); -# endif +#endif #elif defined(HAVE_SIZEOF_NS_CLASSMEMBER_CHAR) NODEF(SIZEOF_NS_CLASSMEMBER_CHAR); #endif - /* ns::someclass::somebool */ +/* ns::someclass::somebool */ #if defined(SIZEOF_NS_CLASSMEMBER_BOOL) CHECK(y.somechar, SIZEOF_NS_CLASSMEMBER_BOOL); CHECK(y.somechar, SIZEOF_BOOL); -# if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL) +#if !defined(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL) NODEF(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL); -# endif +#endif #elif defined(HAVE_SIZEOF_NS_CLASSMEMBER_BOOL) NODEF(SIZEOF_NS_CLASSMEMBER_BOOL); #endif diff --git a/Tests/Module/CheckTypeSize/someclass.hxx b/Tests/Module/CheckTypeSize/someclass.hxx index 76c07ec..60d90db 100644 --- a/Tests/Module/CheckTypeSize/someclass.hxx +++ b/Tests/Module/CheckTypeSize/someclass.hxx @@ -2,12 +2,13 @@ #define _CMAKE_SOMECLASS_HXX namespace ns { -class someclass { +class someclass +{ public: - int someint; - void *someptr; - char somechar; - bool somebool; + int someint; + void* someptr; + char somechar; + bool somebool; }; } diff --git a/Tests/Module/CheckTypeSize/somestruct.h b/Tests/Module/CheckTypeSize/somestruct.h index e08efc4..ffff34f 100644 --- a/Tests/Module/CheckTypeSize/somestruct.h +++ b/Tests/Module/CheckTypeSize/somestruct.h @@ -1,10 +1,11 @@ #ifndef _CMAKE_SOMESTRUCT_H #define _CMAKE_SOMESTRUCT_H -struct somestruct { - int someint; - void *someptr; - char somechar; +struct somestruct +{ + int someint; + void* someptr; + char somechar; }; #endif diff --git a/Tests/Module/GenerateExportHeader/c_identifier/main.cpp b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp index 68beebb..891bc42 100644 --- a/Tests/Module/GenerateExportHeader/c_identifier/main.cpp +++ b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp @@ -1,7 +1,7 @@ #include "c_identifier_class.h" -int main(int argc, char **argv) +int main(int argc, char** argv) { CIdentifierClass cic; return cic.someMethod(); diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp index 7802c43..26bea7e 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -20,21 +20,18 @@ void compare(const char* refName, const char* testName) { std::ifstream ref; ref.open(refName); - if (!ref.is_open()) - { + if (!ref.is_open()) { std::cout << "Could not open \"" << refName << "\"." << std::endl; exit(1); - } + } std::ifstream test; test.open(testName); - if (!test.is_open()) - { + if (!test.is_open()) { std::cout << "Could not open \"" << testName << "\"." << std::endl; exit(1); - } + } - while (!ref.eof() && !test.eof()) - { + while (!ref.eof() && !test.eof()) { std::string refLine; std::string testLine; std::getline(ref, refLine); @@ -42,31 +39,26 @@ void compare(const char* refName, const char* testName) // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a // trailing null to the string that we need to strip before testing for a // trailing space. - if (refLine.size() && refLine[refLine.size()-1] == 0) - { + if (refLine.size() && refLine[refLine.size() - 1] == 0) { refLine = refLine.substr(0, refLine.size() - 1); - } - if (testLine.size() && testLine[testLine.size()-1] == 0) - { + } + if (testLine.size() && testLine[testLine.size() - 1] == 0) { testLine = testLine.substr(0, testLine.size() - 1); - } + } // The reference files never have trailing spaces: - if (testLine.size() && testLine[testLine.size()-1] == ' ') - { + if (testLine.size() && testLine[testLine.size() - 1] == ' ') { testLine = testLine.substr(0, testLine.size() - 1); - } - if (refLine != testLine) - { - std::cout << "Ref and test are not the same:\n Ref: \"" - << refLine << "\"\n Test: \"" << testLine << "\"\n"; + } + if (refLine != testLine) { + std::cout << "Ref and test are not the same:\n Ref: \"" << refLine + << "\"\n Test: \"" << testLine << "\"\n"; exit(1); - } } - if (!ref.eof() || !test.eof()) - { + } + if (!ref.eof() || !test.eof()) { std::cout << "Ref and test have differing numbers of lines."; exit(1); - } + } } int main() diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 1e07273..2764905 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -16,11 +16,13 @@ int LibsharedAndStatic::libshared_and_static_deprecated() const return 0; } -int LibsharedAndStatic::libshared_and_static_not_exported() const { +int LibsharedAndStatic::libshared_and_static_not_exported() const +{ return 0; } -int LibsharedAndStatic::libshared_and_static_excluded() const { +int LibsharedAndStatic::libshared_and_static_excluded() const +{ return 0; } @@ -39,11 +41,13 @@ int LibsharedAndStaticNotExported::libshared_and_static_deprecated() const return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const { +int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const +{ return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_excluded() const { +int LibsharedAndStaticNotExported::libshared_and_static_excluded() const +{ return 0; } @@ -62,30 +66,37 @@ int LibsharedAndStaticExcluded::libshared_and_static_deprecated() const return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const { +int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const +{ return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_excluded() const { +int LibsharedAndStaticExcluded::libshared_and_static_excluded() const +{ return 0; } -int libshared_and_static() { +int libshared_and_static() +{ return 0; } -int libshared_and_static_exported() { +int libshared_and_static_exported() +{ return 0; } -int libshared_and_static_deprecated() { +int libshared_and_static_deprecated() +{ return 0; } -int libshared_and_static_not_exported() { +int libshared_and_static_not_exported() +{ return 0; } -int libshared_and_static_excluded() { +int libshared_and_static_excluded() +{ return 0; } diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h index 5ad77f4..ea672fe 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -4,48 +4,60 @@ #include "libshared_and_static_export.h" -class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic +{ public: int libshared_and_static() const; int libshared_and_static_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED + libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT + libshared_and_static_excluded() const; }; -class LibsharedAndStaticNotExported { +class LibsharedAndStaticNotExported +{ public: int libshared_and_static() const; - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT + libshared_and_static_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED + libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT + libshared_and_static_excluded() const; }; -class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded +{ public: int libshared_and_static() const; - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT + libshared_and_static_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED + libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT + libshared_and_static_excluded() const; }; MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); -MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); +MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int +libshared_and_static_deprecated(); int libshared_and_static_not_exported(); diff --git a/Tests/Module/GenerateExportHeader/libshared/libshared.cpp b/Tests/Module/GenerateExportHeader/libshared/libshared.cpp index d4041b3..ad6d356 100644 --- a/Tests/Module/GenerateExportHeader/libshared/libshared.cpp +++ b/Tests/Module/GenerateExportHeader/libshared/libshared.cpp @@ -16,11 +16,13 @@ int Libshared::libshared_deprecated() const return 0; } -int Libshared::libshared_not_exported() const { +int Libshared::libshared_not_exported() const +{ return 0; } -int Libshared::libshared_excluded() const { +int Libshared::libshared_excluded() const +{ return 0; } @@ -39,11 +41,13 @@ int LibsharedNotExported::libshared_deprecated() const return 0; } -int LibsharedNotExported::libshared_not_exported() const { +int LibsharedNotExported::libshared_not_exported() const +{ return 0; } -int LibsharedNotExported::libshared_excluded() const { +int LibsharedNotExported::libshared_excluded() const +{ return 0; } @@ -62,30 +66,37 @@ int LibsharedExcluded::libshared_deprecated() const return 0; } -int LibsharedExcluded::libshared_not_exported() const { +int LibsharedExcluded::libshared_not_exported() const +{ return 0; } -int LibsharedExcluded::libshared_excluded() const { +int LibsharedExcluded::libshared_excluded() const +{ return 0; } -int libshared() { +int libshared() +{ return 0; } -int libshared_exported() { +int libshared_exported() +{ return 0; } -int libshared_deprecated() { +int libshared_deprecated() +{ return 0; } -int libshared_not_exported() { +int libshared_not_exported() +{ return 0; } -int libshared_excluded() { +int libshared_excluded() +{ return 0; } diff --git a/Tests/Module/GenerateExportHeader/libshared/libshared.h b/Tests/Module/GenerateExportHeader/libshared/libshared.h index 3d9bbff..bd9f2e3 100644 --- a/Tests/Module/GenerateExportHeader/libshared/libshared.h +++ b/Tests/Module/GenerateExportHeader/libshared/libshared.h @@ -4,7 +4,8 @@ #include "libshared_export.h" -class LIBSHARED_EXPORT Libshared { +class LIBSHARED_EXPORT Libshared +{ public: int libshared() const; @@ -17,7 +18,8 @@ public: int LIBSHARED_NO_EXPORT libshared_excluded() const; }; -class LibsharedNotExported { +class LibsharedNotExported +{ public: int libshared() const; @@ -30,7 +32,8 @@ public: int LIBSHARED_NO_EXPORT libshared_excluded() const; }; -class LIBSHARED_NO_EXPORT LibsharedExcluded { +class LIBSHARED_NO_EXPORT LibsharedExcluded +{ public: int libshared() const; diff --git a/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp index 0710c3e..89381af 100644 --- a/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp +++ b/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp @@ -16,11 +16,13 @@ int Libstatic::libstatic_deprecated() const return 0; } -int Libstatic::libstatic_not_exported() const { +int Libstatic::libstatic_not_exported() const +{ return 0; } -int Libstatic::libstatic_excluded() const { +int Libstatic::libstatic_excluded() const +{ return 0; } @@ -39,11 +41,13 @@ int LibstaticNotExported::libstatic_deprecated() const return 0; } -int LibstaticNotExported::libstatic_not_exported() const { +int LibstaticNotExported::libstatic_not_exported() const +{ return 0; } -int LibstaticNotExported::libstatic_excluded() const { +int LibstaticNotExported::libstatic_excluded() const +{ return 0; } @@ -62,26 +66,32 @@ int LibstaticExcluded::libstatic_deprecated() const return 0; } -int LibstaticExcluded::libstatic_not_exported() const { +int LibstaticExcluded::libstatic_not_exported() const +{ return 0; } -int LibstaticExcluded::libstatic_excluded() const { +int LibstaticExcluded::libstatic_excluded() const +{ return 0; } -int libstatic_exported() { +int libstatic_exported() +{ return 0; } -int libstatic_deprecated() { +int libstatic_deprecated() +{ return 0; } -int libstatic_not_exported() { +int libstatic_not_exported() +{ return 0; } -int libstatic_excluded() { +int libstatic_excluded() +{ return 0; } diff --git a/Tests/Module/GenerateExportHeader/libstatic/libstatic.h b/Tests/Module/GenerateExportHeader/libstatic/libstatic.h index cc7a35b..6072d9b 100644 --- a/Tests/Module/GenerateExportHeader/libstatic/libstatic.h +++ b/Tests/Module/GenerateExportHeader/libstatic/libstatic.h @@ -4,7 +4,8 @@ #include "libstatic_export.h" -class LIBSTATIC_EXPORT Libstatic { +class LIBSTATIC_EXPORT Libstatic +{ public: int libstatic() const; @@ -17,7 +18,8 @@ public: int LIBSTATIC_NO_EXPORT libstatic_excluded() const; }; -class LibstaticNotExported { +class LibstaticNotExported +{ public: int libstatic() const; @@ -30,7 +32,8 @@ public: int LIBSTATIC_NO_EXPORT libstatic_excluded() const; }; -class LIBSTATIC_NO_EXPORT LibstaticExcluded { +class LIBSTATIC_NO_EXPORT LibstaticExcluded +{ public: int libstatic() const; diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp b/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp index a3f4111..81dce62 100644 --- a/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp +++ b/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp @@ -4,6 +4,5 @@ #ifndef NODEPRECATEDLIB_NO_DEPRECATED void SomeClass::someMethod() const { - } #endif diff --git a/Tests/Module/WriteCompilerDetectionHeader/compile_tests.h b/Tests/Module/WriteCompilerDetectionHeader/compile_tests.h index 8b547d8..d3c2a2d 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/compile_tests.h +++ b/Tests/Module/WriteCompilerDetectionHeader/compile_tests.h @@ -1,8 +1,10 @@ -#define JOIN_IMPL(A, B) A ## B +#define JOIN_IMPL(A, B) A##B #define JOIN(A, B) JOIN_IMPL(A, B) -#define CHECK(FEATURE) (JOIN(PREFIX, JOIN(_COMPILER_, FEATURE)) == JOIN(EXPECTED_COMPILER_, FEATURE)) +#define CHECK(FEATURE) \ + (JOIN(PREFIX, JOIN(_COMPILER_, FEATURE)) == \ + JOIN(EXPECTED_COMPILER_, FEATURE)) #if !CHECK(CXX_DELEGATING_CONSTRUCTORS) #error cxx_delegating_constructors expected availability did not match. diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.c b/Tests/Module/WriteCompilerDetectionHeader/main.c index 9023b0f..ee6abdb 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main.c +++ b/Tests/Module/WriteCompilerDetectionHeader/main.c @@ -1,22 +1,23 @@ #include "test_compiler_detection.h" -#if !defined(TEST_COMPILER_C_FUNCTION_PROTOTYPES) || !TEST_COMPILER_C_FUNCTION_PROTOTYPES -# error Expected TEST_COMPILER_C_FUNCTION_PROTOTYPES +#if !defined(TEST_COMPILER_C_FUNCTION_PROTOTYPES) || \ + !TEST_COMPILER_C_FUNCTION_PROTOTYPES +#error Expected TEST_COMPILER_C_FUNCTION_PROTOTYPES #endif #if !EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES -# error Expected EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES +#error Expected EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES #endif #if !defined(TEST_COMPILER_C_RESTRICT) || !TEST_COMPILER_C_RESTRICT -# if EXPECTED_COMPILER_C_RESTRICT -# error Expected TEST_COMPILER_C_RESTRICT -# endif +#if EXPECTED_COMPILER_C_RESTRICT +#error Expected TEST_COMPILER_C_RESTRICT +#endif #else -# if !EXPECTED_COMPILER_C_RESTRICT -# error Expect no TEST_COMPILER_C_RESTRICT -# endif +#if !EXPECTED_COMPILER_C_RESTRICT +#error Expect no TEST_COMPILER_C_RESTRICT +#endif #endif #ifdef TEST_COMPILER_CXX_STATIC_ASSERT diff --git a/Tests/Module/WriteCompilerDetectionHeader/main_multi.c b/Tests/Module/WriteCompilerDetectionHeader/main_multi.c index 6f4573f..6e13fd7 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main_multi.c +++ b/Tests/Module/WriteCompilerDetectionHeader/main_multi.c @@ -1,22 +1,23 @@ #include "multi_file_compiler_detection.h" -#if !defined(MULTI_COMPILER_C_FUNCTION_PROTOTYPES) || !MULTI_COMPILER_C_FUNCTION_PROTOTYPES -# error Expected MULTI_COMPILER_C_FUNCTION_PROTOTYPES +#if !defined(MULTI_COMPILER_C_FUNCTION_PROTOTYPES) || \ + !MULTI_COMPILER_C_FUNCTION_PROTOTYPES +#error Expected MULTI_COMPILER_C_FUNCTION_PROTOTYPES #endif #if !EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES -# error Expected EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES +#error Expected EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES #endif #if !defined(MULTI_COMPILER_C_RESTRICT) || !MULTI_COMPILER_C_RESTRICT -# if EXPECTED_COMPILER_C_RESTRICT -# error Expected MULTI_COMPILER_C_RESTRICT -# endif +#if EXPECTED_COMPILER_C_RESTRICT +#error Expected MULTI_COMPILER_C_RESTRICT +#endif #else -# if !EXPECTED_COMPILER_C_RESTRICT -# error Expect no MULTI_COMPILER_C_RESTRICT -# endif +#if !EXPECTED_COMPILER_C_RESTRICT +#error Expect no MULTI_COMPILER_C_RESTRICT +#endif #endif #ifdef MULTI_COMPILER_CXX_STATIC_ASSERT diff --git a/Tests/ModuleDefinition/example_dll.c b/Tests/ModuleDefinition/example_dll.c index 88b3904..3d57b9a 100644 --- a/Tests/ModuleDefinition/example_dll.c +++ b/Tests/ModuleDefinition/example_dll.c @@ -1 +1,4 @@ -int example_dll_function(void) { return 0; } +int example_dll_function(void) +{ + return 0; +} diff --git a/Tests/ModuleDefinition/example_dll_2.c b/Tests/ModuleDefinition/example_dll_2.c index 9d79acd..6f33867 100644 --- a/Tests/ModuleDefinition/example_dll_2.c +++ b/Tests/ModuleDefinition/example_dll_2.c @@ -1 +1,4 @@ -int example_dll_2_function(void) { return 0; } +int example_dll_2_function(void) +{ + return 0; +} diff --git a/Tests/ModuleDefinition/example_dll_gen.c b/Tests/ModuleDefinition/example_dll_gen.c index be5d1ee..ac0a88b 100644 --- a/Tests/ModuleDefinition/example_dll_gen.c +++ b/Tests/ModuleDefinition/example_dll_gen.c @@ -1 +1,4 @@ -int example_dll_gen_function(void) { return 0; } +int example_dll_gen_function(void) +{ + return 0; +} diff --git a/Tests/ModuleDefinition/example_exe.c b/Tests/ModuleDefinition/example_exe.c index 253ae8b..dff566f 100644 --- a/Tests/ModuleDefinition/example_exe.c +++ b/Tests/ModuleDefinition/example_exe.c @@ -3,12 +3,13 @@ extern int __declspec(dllimport) example_dll_gen_function(void); #ifdef EXAMPLE_DLL_2 extern int __declspec(dllimport) example_dll_2_function(void); #endif -int example_exe_function(void) { return 0; } +int example_exe_function(void) +{ + return 0; +} int main(void) { - return - example_dll_function() + - example_dll_gen_function() + + return example_dll_function() + example_dll_gen_function() + #ifdef EXAMPLE_DLL_2 example_dll_2_function() + #endif diff --git a/Tests/ModuleDefinition/example_mod_1.c b/Tests/ModuleDefinition/example_mod_1.c index 4e2f9ba..6b355cf 100644 --- a/Tests/ModuleDefinition/example_mod_1.c +++ b/Tests/ModuleDefinition/example_mod_1.c @@ -1,7 +1,7 @@ #ifdef __WATCOMC__ -# define MODULE_CCONV __cdecl +#define MODULE_CCONV __cdecl #else -# define MODULE_CCONV +#define MODULE_CCONV #endif int __declspec(dllimport) example_exe_function(void); @@ -12,8 +12,7 @@ int __declspec(dllimport) example_dll_2_function(void); __declspec(dllexport) int MODULE_CCONV example_mod_1_function(int n) { - return - example_dll_function() + + return example_dll_function() + #ifdef EXAMPLE_DLL_2 example_dll_2_function() + #endif diff --git a/Tests/NewlineArgs/cxxonly.cxx b/Tests/NewlineArgs/cxxonly.cxx index 05d55e4..9e6f918 100644 --- a/Tests/NewlineArgs/cxxonly.cxx +++ b/Tests/NewlineArgs/cxxonly.cxx @@ -3,13 +3,12 @@ #include <stdio.h> -int main () +int main() { - if ( LibCxx1Class::Method() != 2.0 ) - { + if (LibCxx1Class::Method() != 2.0) { printf("Problem with libcxx1\n"); return 1; - } + } #ifdef TEST_FLAG_3 return 0; #else diff --git a/Tests/ObjectLibrary/A/a.h b/Tests/ObjectLibrary/A/a.h index 7259f98..b1fd42f 100644 --- a/Tests/ObjectLibrary/A/a.h +++ b/Tests/ObjectLibrary/A/a.h @@ -1,6 +1,6 @@ #ifndef A_DEF -# error "A_DEF not defined" +#error "A_DEF not defined" #endif #ifdef B_DEF -# error "B_DEF must not be defined" +#error "B_DEF must not be defined" #endif diff --git a/Tests/ObjectLibrary/A/a2.c b/Tests/ObjectLibrary/A/a2.c index d8f225e..fbb0c02 100644 --- a/Tests/ObjectLibrary/A/a2.c +++ b/Tests/ObjectLibrary/A/a2.c @@ -1,2 +1,5 @@ #include "a.h" -int a2(void) { return 0; } +int a2(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/B/b.h b/Tests/ObjectLibrary/B/b.h index 3489c71..a7bd352 100644 --- a/Tests/ObjectLibrary/B/b.h +++ b/Tests/ObjectLibrary/B/b.h @@ -1,18 +1,18 @@ #ifdef A_DEF -# error "A_DEF must not be defined" +#error "A_DEF must not be defined" #endif #ifndef B_DEF -# error "B_DEF not defined" +#error "B_DEF not defined" #endif #if defined(_WIN32) && defined(Bexport) -# define EXPORT_B __declspec(dllexport) +#define EXPORT_B __declspec(dllexport) #else -# define EXPORT_B +#define EXPORT_B #endif #if defined(_WIN32) && defined(SHARED_B) -# define IMPORT_B __declspec(dllimport) +#define IMPORT_B __declspec(dllimport) #else -# define IMPORT_B +#define IMPORT_B #endif diff --git a/Tests/ObjectLibrary/B/b1.c b/Tests/ObjectLibrary/B/b1.c index fdeffe4..d804d43 100644 --- a/Tests/ObjectLibrary/B/b1.c +++ b/Tests/ObjectLibrary/B/b1.c @@ -1,2 +1,5 @@ #include "b.h" -EXPORT_B int b1(void) { return 0; } +EXPORT_B int b1(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/B/b2.c b/Tests/ObjectLibrary/B/b2.c index 6e0d17c..4615b54 100644 --- a/Tests/ObjectLibrary/B/b2.c +++ b/Tests/ObjectLibrary/B/b2.c @@ -1,2 +1,5 @@ #include "b.h" -EXPORT_B int b2(void) { return 0; } +EXPORT_B int b2(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/ExportLanguages/a.c b/Tests/ObjectLibrary/ExportLanguages/a.c index af20d3f..1636303 100644 --- a/Tests/ObjectLibrary/ExportLanguages/a.c +++ b/Tests/ObjectLibrary/ExportLanguages/a.c @@ -1 +1,4 @@ -int a(void) { return 0; } +int a(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/ExportLanguages/a.cxx b/Tests/ObjectLibrary/ExportLanguages/a.cxx index ae9c87c..c661b94 100644 --- a/Tests/ObjectLibrary/ExportLanguages/a.cxx +++ b/Tests/ObjectLibrary/ExportLanguages/a.cxx @@ -1 +1,4 @@ -extern "C" int acxx(void) { return 0; } +extern "C" int acxx(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/c.c b/Tests/ObjectLibrary/c.c index 968095b..4c37e38 100644 --- a/Tests/ObjectLibrary/c.c +++ b/Tests/ObjectLibrary/c.c @@ -1,7 +1,7 @@ #if defined(_WIN32) && defined(Cshared_EXPORTS) -# define EXPORT_C __declspec(dllexport) +#define EXPORT_C __declspec(dllexport) #else -# define EXPORT_C +#define EXPORT_C #endif extern int a1(void); @@ -10,10 +10,5 @@ extern int b1(void); extern int b2(void); EXPORT_C int c(void) { - return 0 - + a1() - + a2() - + b1() - + b2() - ; + return 0 + a1() + a2() + b1() + b2(); } diff --git a/Tests/ObjectLibrary/dummy.c b/Tests/ObjectLibrary/dummy.c index 2b17d81..3983c6a 100644 --- a/Tests/ObjectLibrary/dummy.c +++ b/Tests/ObjectLibrary/dummy.c @@ -1 +1,4 @@ -int dummy(void) {return 0;} +int dummy(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/main.c b/Tests/ObjectLibrary/main.c index 6819f1c..b2f1d44 100644 --- a/Tests/ObjectLibrary/main.c +++ b/Tests/ObjectLibrary/main.c @@ -1,16 +1,12 @@ #if defined(_WIN32) && defined(SHARED_C) -# define IMPORT_C __declspec(dllimport) +#define IMPORT_C __declspec(dllimport) #else -# define IMPORT_C +#define IMPORT_C #endif extern IMPORT_C int b1(void); extern IMPORT_C int b2(void); extern IMPORT_C int c(void); int main(void) { - return 0 - + c() - + b1() - + b2() - ; + return 0 + c() + b1() + b2(); } diff --git a/Tests/ObjectLibrary/mainAB.c b/Tests/ObjectLibrary/mainAB.c index 38db205..a7aa393 100644 --- a/Tests/ObjectLibrary/mainAB.c +++ b/Tests/ObjectLibrary/mainAB.c @@ -11,10 +11,7 @@ int main(void) { return 0 #ifndef NO_A - + a1() - + a2() + + a1() + a2() #endif - + b1() - + b2() - ; + + b1() + b2(); } diff --git a/Tests/OutDir/OutDir.c b/Tests/OutDir/OutDir.c index 53f9259..4f6ae87 100644 --- a/Tests/OutDir/OutDir.c +++ b/Tests/OutDir/OutDir.c @@ -3,22 +3,18 @@ int main(void) { - const char* files[] = {TESTC1_LIB, TESTC2_LIB, CONLY_EXE, 0}; + const char* files[] = { TESTC1_LIB, TESTC2_LIB, CONLY_EXE, 0 }; int result = 0; const char** fname = files; - for(;*fname;++fname) - { + for (; *fname; ++fname) { FILE* f = fopen(*fname, "rb"); - if(f) - { + if (f) { printf("found: [%s]\n", *fname); fclose(f); - } - else - { + } else { printf("error: [%s]\n", *fname); result = 1; - } } + } return result; } diff --git a/Tests/OutOfBinary/outexe.c b/Tests/OutOfBinary/outexe.c index 6f14043..4170d97 100644 --- a/Tests/OutOfBinary/outexe.c +++ b/Tests/OutOfBinary/outexe.c @@ -1,2 +1,5 @@ extern int subdir(void); -int main(void) { return subdir(); } +int main(void) +{ + return subdir(); +} diff --git a/Tests/OutOfBinary/outlib.c b/Tests/OutOfBinary/outlib.c index 9ea579b..d309ebe 100644 --- a/Tests/OutOfBinary/outlib.c +++ b/Tests/OutOfBinary/outlib.c @@ -1,2 +1,4 @@ -int outlib() { return 456; } - +int outlib() +{ + return 456; +} diff --git a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx index 69d7c82..12cbd1a 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx +++ b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx @@ -10,30 +10,25 @@ extern int simple2(); #endif extern "C" int outlib(); -int main () +int main() { - if(simple() != 123) - { + if (simple() != 123) { return -3; - } - if (strcmp(animal,"SIZZLING")) - { - fprintf(stderr,"Get definitions from a subdir did not work\n"); + } + if (strcmp(animal, "SIZZLING")) { + fprintf(stderr, "Get definitions from a subdir did not work\n"); return -2; - } - if(TestLib() != 1.0) - { + } + if (TestLib() != 1.0) { return -1; - } - if(outlib() != 456) - { + } + if (outlib() != 456) { return -4; - } + } #ifndef NO_DEEPSRC - if(simple2() != 789) - { + if (simple2() != 789) { return -5; - } + } #endif return 0; } diff --git a/Tests/OutOfSource/OutOfSourceSubdir/testlib.h b/Tests/OutOfSource/OutOfSourceSubdir/testlib.h index 75c2d84..bacf5a1 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/testlib.h +++ b/Tests/OutOfSource/OutOfSourceSubdir/testlib.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef testlib_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef testlib_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float TestLib(); diff --git a/Tests/OutOfSource/SubDir/subdir.c b/Tests/OutOfSource/SubDir/subdir.c index 0d0d827..abf4e18 100644 --- a/Tests/OutOfSource/SubDir/subdir.c +++ b/Tests/OutOfSource/SubDir/subdir.c @@ -1 +1,4 @@ -int subdir(void) { return 0; } +int subdir(void) +{ + return 0; +} diff --git a/Tests/OutOfSource/simple.cxx b/Tests/OutOfSource/simple.cxx index 27e79f4..ffe0db9 100644 --- a/Tests/OutOfSource/simple.cxx +++ b/Tests/OutOfSource/simple.cxx @@ -1 +1,4 @@ -int simple() { return 123; } +int simple() +{ + return 123; +} diff --git a/Tests/PDBDirectoryAndName/myexe.c b/Tests/PDBDirectoryAndName/myexe.c index c6d9065..fdb8b09 100644 --- a/Tests/PDBDirectoryAndName/myexe.c +++ b/Tests/PDBDirectoryAndName/myexe.c @@ -2,4 +2,7 @@ extern int mylibA(); extern int mylibB(); extern int mylibC(); extern int mylibD(); -int main() { return mylibA() + mylibB() + mylibC() + mylibD(); } +int main() +{ + return mylibA() + mylibB() + mylibC() + mylibD(); +} diff --git a/Tests/PDBDirectoryAndName/myexe2.c b/Tests/PDBDirectoryAndName/myexe2.c index 75b39cd..250d651 100644 --- a/Tests/PDBDirectoryAndName/myexe2.c +++ b/Tests/PDBDirectoryAndName/myexe2.c @@ -1,3 +1,6 @@ extern int mylibA(); extern int mylibD(); -int main() { return mylibA() + mylibD(); } +int main() +{ + return mylibA() + mylibD(); +} diff --git a/Tests/PDBDirectoryAndName/mylibA.c b/Tests/PDBDirectoryAndName/mylibA.c index f4c553f..5bc279b 100644 --- a/Tests/PDBDirectoryAndName/mylibA.c +++ b/Tests/PDBDirectoryAndName/mylibA.c @@ -1 +1,4 @@ -__declspec(dllexport) int mylibA() { return 1; } +__declspec(dllexport) int mylibA() +{ + return 1; +} diff --git a/Tests/PDBDirectoryAndName/mylibB.c b/Tests/PDBDirectoryAndName/mylibB.c index 2040c67..3a95845 100644 --- a/Tests/PDBDirectoryAndName/mylibB.c +++ b/Tests/PDBDirectoryAndName/mylibB.c @@ -1 +1,4 @@ -int mylibB() { return -1; } +int mylibB() +{ + return -1; +} diff --git a/Tests/PDBDirectoryAndName/mylibC.c b/Tests/PDBDirectoryAndName/mylibC.c index adf7c70..8982849 100644 --- a/Tests/PDBDirectoryAndName/mylibC.c +++ b/Tests/PDBDirectoryAndName/mylibC.c @@ -1 +1,4 @@ -__declspec(dllexport) int mylibC() { return 1; } +__declspec(dllexport) int mylibC() +{ + return 1; +} diff --git a/Tests/PDBDirectoryAndName/mylibD.c b/Tests/PDBDirectoryAndName/mylibD.c index efa8a82..a53b7a2 100644 --- a/Tests/PDBDirectoryAndName/mylibD.c +++ b/Tests/PDBDirectoryAndName/mylibD.c @@ -1 +1,4 @@ -int mylibD() { return -1; } +int mylibD() +{ + return -1; +} diff --git a/Tests/PerConfig/pcShared.h b/Tests/PerConfig/pcShared.h index 59a6ef4..031cd79 100644 --- a/Tests/PerConfig/pcShared.h +++ b/Tests/PerConfig/pcShared.h @@ -2,13 +2,13 @@ #define pcShared_h #ifdef _WIN32 -# ifdef pcShared_EXPORTS -# define PC_EXPORT __declspec(dllexport) -# else -# define PC_EXPORT __declspec(dllimport) -# endif +#ifdef pcShared_EXPORTS +#define PC_EXPORT __declspec(dllexport) #else -# define PC_EXPORT +#define PC_EXPORT __declspec(dllimport) +#endif +#else +#define PC_EXPORT #endif PC_EXPORT const char* pcShared(void); diff --git a/Tests/Plugin/include/example.h b/Tests/Plugin/include/example.h index 1d7e8c0..87d992e 100644 --- a/Tests/Plugin/include/example.h +++ b/Tests/Plugin/include/example.h @@ -2,18 +2,17 @@ #define example_h #if defined(_WIN32) || defined(__CYGWIN__) -# if defined(example_exe_EXPORTS) -# define EXAMPLE_EXPORT __declspec(dllexport) -# else -# define EXAMPLE_EXPORT __declspec(dllimport) -# endif +#if defined(example_exe_EXPORTS) +#define EXAMPLE_EXPORT __declspec(dllexport) #else -# define EXAMPLE_EXPORT +#define EXAMPLE_EXPORT __declspec(dllimport) +#endif +#else +#define EXAMPLE_EXPORT #endif #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif EXAMPLE_EXPORT int example_exe_function(void); diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx index fd23e8f..857ad54 100644 --- a/Tests/Plugin/src/example_exe.cxx +++ b/Tests/Plugin/src/example_exe.cxx @@ -17,9 +17,9 @@ extern "C" int example_exe_function() } #ifdef CMAKE_INTDIR -# define CONFIG_DIR "/" CMAKE_INTDIR +#define CONFIG_DIR "/" CMAKE_INTDIR #else -# define CONFIG_DIR "" +#define CONFIG_DIR "" #endif int main() @@ -30,32 +30,27 @@ int main() libName += kwsys::DynamicLoader::LibExtension(); kwsys::DynamicLoader::LibraryHandle handle = kwsys::DynamicLoader::OpenLibrary(libName.c_str()); - if(!handle) - { - std::cerr << "Could not open plugin \"" - << libName.c_str() << "\"!" << std::endl; + if (!handle) { + std::cerr << "Could not open plugin \"" << libName.c_str() << "\"!" + << std::endl; return 1; - } + } kwsys::DynamicLoader::SymbolPointer sym = kwsys::DynamicLoader::GetSymbolAddress(handle, "example_mod_1_function"); - if(!sym) - { - std::cerr - << "Could not get plugin symbol \"example_mod_1_function\"!" - << std::endl; + if (!sym) { + std::cerr << "Could not get plugin symbol \"example_mod_1_function\"!" + << std::endl; return 1; - } + } #ifdef __WATCOMC__ - int(__cdecl *f)(int) = (int(__cdecl *)(int))(sym); + int(__cdecl * f)(int) = (int(__cdecl*)(int))(sym); #else - int(*f)(int) = reinterpret_cast<int(*)(int)>(sym); + int (*f)(int) = reinterpret_cast<int (*)(int)>(sym); #endif - if(f(456) != (123+456)) - { - std::cerr << "Incorrect return value from plugin!" - << std::endl; + if (f(456) != (123 + 456)) { + std::cerr << "Incorrect return value from plugin!" << std::endl; return 1; - } + } kwsys::DynamicLoader::CloseLibrary(handle); return 0; } diff --git a/Tests/Plugin/src/example_mod_1.c b/Tests/Plugin/src/example_mod_1.c index 1fc7338..a5dd984 100644 --- a/Tests/Plugin/src/example_mod_1.c +++ b/Tests/Plugin/src/example_mod_1.c @@ -3,15 +3,15 @@ #include <stdio.h> #if defined(_WIN32) -# define MODULE_EXPORT __declspec(dllexport) +#define MODULE_EXPORT __declspec(dllexport) #else -# define MODULE_EXPORT +#define MODULE_EXPORT #endif #ifdef __WATCOMC__ -# define MODULE_CCONV __cdecl +#define MODULE_CCONV __cdecl #else -# define MODULE_CCONV +#define MODULE_CCONV #endif MODULE_EXPORT int MODULE_CCONV example_mod_1_function(int n) diff --git a/Tests/PositionIndependentTargets/main.cpp b/Tests/PositionIndependentTargets/main.cpp index e72cef7..e9ad257 100644 --- a/Tests/PositionIndependentTargets/main.cpp +++ b/Tests/PositionIndependentTargets/main.cpp @@ -1,2 +1,5 @@ -int main(int,char**) { return 0; } +int main(int, char**) +{ + return 0; +} diff --git a/Tests/PositionIndependentTargets/pic_main.cpp b/Tests/PositionIndependentTargets/pic_main.cpp index 6a41a7a..3246eee 100644 --- a/Tests/PositionIndependentTargets/pic_main.cpp +++ b/Tests/PositionIndependentTargets/pic_main.cpp @@ -1,4 +1,7 @@ #include "pic_test.h" -int main(int,char**) { return 0; } +int main(int, char**) +{ + return 0; +} diff --git a/Tests/PreOrder/simple.cxx b/Tests/PreOrder/simple.cxx index ef26e79..7f99579 100644 --- a/Tests/PreOrder/simple.cxx +++ b/Tests/PreOrder/simple.cxx @@ -1,5 +1,5 @@ extern void simpleLib(); -int main () +int main() { simpleLib(); return 0; diff --git a/Tests/PrecompiledHeader/foo1.c b/Tests/PrecompiledHeader/foo1.c index b10eba7..77172ba 100644 --- a/Tests/PrecompiledHeader/foo1.c +++ b/Tests/PrecompiledHeader/foo1.c @@ -1,5 +1,5 @@ #ifndef foo_h -# error "Precompiled header foo_precompiled.h has not been loaded." +#error "Precompiled header foo_precompiled.h has not been loaded." #endif int main() diff --git a/Tests/PrecompiledHeader/foo2.c b/Tests/PrecompiledHeader/foo2.c index 2845cdb..f192e16 100644 --- a/Tests/PrecompiledHeader/foo2.c +++ b/Tests/PrecompiledHeader/foo2.c @@ -1,6 +1,6 @@ #ifndef foo_h -# include "foo.h" -# error "Precompiled header foo_precompiled.h has not been loaded." +#include "foo.h" +#error "Precompiled header foo_precompiled.h has not been loaded." #endif int foo() diff --git a/Tests/Preprocess/preprocess.c b/Tests/Preprocess/preprocess.c index af5eae6..1b038b0 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 d168103..0fab785 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; - } + } } diff --git a/Tests/Properties/SubDir/properties3.cxx b/Tests/Properties/SubDir/properties3.cxx index 1a27a04..6d24fbb 100644 --- a/Tests/Properties/SubDir/properties3.cxx +++ b/Tests/Properties/SubDir/properties3.cxx @@ -2,7 +2,7 @@ #include "properties2.h" #if defined HAVE_PROPERTIES_H && defined HAVE_PROPERTIES2_H -int main () +int main() { return 0; } diff --git a/Tests/Qt4Deploy/testdeploy.cpp b/Tests/Qt4Deploy/testdeploy.cpp index 255453a..33c0bb3 100644 --- a/Tests/Qt4Deploy/testdeploy.cpp +++ b/Tests/Qt4Deploy/testdeploy.cpp @@ -9,19 +9,19 @@ int main(int argc, char** argv) QCoreApplication app(argc, argv); qDebug() << "App path:" << app.applicationDirPath(); - qDebug() << "Plugin path:" << QLibraryInfo::location(QLibraryInfo::PluginsPath); + qDebug() << "Plugin path:" + << QLibraryInfo::location(QLibraryInfo::PluginsPath); bool foundSqlite = false; qDebug() << "Supported Database Drivers:"; - foreach(const QString &sqlDriver, QSqlDatabase::drivers()) - { + foreach (const QString& sqlDriver, QSqlDatabase::drivers()) { qDebug() << " " << sqlDriver; - if(sqlDriver == "QSQLITE") + if (sqlDriver == "QSQLITE") foundSqlite = true; } - if(foundSqlite) + if (foundSqlite) qDebug() << "Found sqlite support from plugin."; else qDebug() << "Could not find sqlite support from plugin."; diff --git a/Tests/Qt4Targets/IncrementalMoc/foo.cpp b/Tests/Qt4Targets/IncrementalMoc/foo.cpp index e924f7e..00685d0 100644 --- a/Tests/Qt4Targets/IncrementalMoc/foo.cpp +++ b/Tests/Qt4Targets/IncrementalMoc/foo.cpp @@ -4,5 +4,4 @@ Foo::Foo() : QObject(0) { - } diff --git a/Tests/Qt4Targets/activeqtexe.cpp b/Tests/Qt4Targets/activeqtexe.cpp index d4a9121..f17b0a6 100644 --- a/Tests/Qt4Targets/activeqtexe.cpp +++ b/Tests/Qt4Targets/activeqtexe.cpp @@ -9,22 +9,21 @@ class MyObject : public QObject { - Q_OBJECT + Q_OBJECT public: - MyObject(QObject *parent = 0) - : QObject(parent) - { - } + MyObject(QObject* parent = 0) + : QObject(parent) + { + } }; -QAXFACTORY_DEFAULT(MyObject, - "{4dc3f340-a6f7-44e4-a79b-3e9217685fbd}", - "{9ee49617-7d5c-441a-b833-4b068d41d751}", - "{13eca64b-ee2a-4f3c-aa04-5d9d975779a7}", - "{ce947ee3-0403-4fdc-895a-4fe779344b46}", - "{8de435ce-8d2a-46ac-b3b3-cb800d0547c7}"); +QAXFACTORY_DEFAULT(MyObject, "{4dc3f340-a6f7-44e4-a79b-3e9217685fbd}", + "{9ee49617-7d5c-441a-b833-4b068d41d751}", + "{13eca64b-ee2a-4f3c-aa04-5d9d975779a7}", + "{ce947ee3-0403-4fdc-895a-4fe779344b46}", + "{8de435ce-8d2a-46ac-b3b3-cb800d0547c7}"); -int main(int argc, char **argv) +int main(int argc, char** argv) { QApplication app(argc, argv); diff --git a/Tests/Qt4Targets/interface/myinterface.h b/Tests/Qt4Targets/interface/myinterface.h index 59b43ad..5cc3b27 100644 --- a/Tests/Qt4Targets/interface/myinterface.h +++ b/Tests/Qt4Targets/interface/myinterface.h @@ -4,7 +4,6 @@ class MyInterface { - }; Q_DECLARE_INTERFACE(MyInterface, "org.cmake.example.MyInterface") diff --git a/Tests/Qt4Targets/main.cpp b/Tests/Qt4Targets/main.cpp index 3c98c99..07443b0 100644 --- a/Tests/Qt4Targets/main.cpp +++ b/Tests/Qt4Targets/main.cpp @@ -12,7 +12,7 @@ #error Expected QT_GUI_LIB #endif -int main(int argc, char **argv) +int main(int argc, char** argv) { QApplication app(argc, argv); diff --git a/Tests/Qt4Targets/main_gen_test.cpp b/Tests/Qt4Targets/main_gen_test.cpp index 984424b..1ea390b 100644 --- a/Tests/Qt4Targets/main_gen_test.cpp +++ b/Tests/Qt4Targets/main_gen_test.cpp @@ -8,10 +8,13 @@ class MyObject : public QObject, MyInterface Q_OBJECT Q_INTERFACES(MyInterface) public: - explicit MyObject(QObject *parent = 0) : QObject(parent) { } + explicit MyObject(QObject* parent = 0) + : QObject(parent) + { + } }; -int main(int argc, char **argv) +int main(int argc, char** argv) { MyObject mo; mo.objectName(); diff --git a/Tests/Qt4Targets/main_wrap_test.cpp b/Tests/Qt4Targets/main_wrap_test.cpp index 21edc7b..7b74849 100644 --- a/Tests/Qt4Targets/main_wrap_test.cpp +++ b/Tests/Qt4Targets/main_wrap_test.cpp @@ -3,7 +3,7 @@ #include "mywrapobject.h" -int main(int argc, char **argv) +int main(int argc, char** argv) { MyWrapObject mwo; mwo.objectName(); diff --git a/Tests/Qt4Targets/mywrapobject.h b/Tests/Qt4Targets/mywrapobject.h index de23540..5d4e52a 100644 --- a/Tests/Qt4Targets/mywrapobject.h +++ b/Tests/Qt4Targets/mywrapobject.h @@ -11,7 +11,10 @@ class MyWrapObject : public QObject, MyInterface Q_OBJECT Q_INTERFACES(MyInterface) public: - explicit MyWrapObject(QObject *parent = 0) : QObject(parent) { } + explicit MyWrapObject(QObject* parent = 0) + : QObject(parent) + { + } }; #endif diff --git a/Tests/QtAutoUicInterface/klocalizedstring.cpp b/Tests/QtAutoUicInterface/klocalizedstring.cpp index f2324bb..b629cd1 100644 --- a/Tests/QtAutoUicInterface/klocalizedstring.cpp +++ b/Tests/QtAutoUicInterface/klocalizedstring.cpp @@ -1,12 +1,12 @@ #include "klocalizedstring.h" -QString tr2xi18n(const char *text, const char *) +QString tr2xi18n(const char* text, const char*) { return QLatin1String("TranslatedX") + QString::fromLatin1(text); } -QString tr2i18n(const char *text, const char *) +QString tr2i18n(const char* text, const char*) { return QLatin1String("Translated") + QString::fromLatin1(text); } diff --git a/Tests/QtAutoUicInterface/klocalizedstring.h b/Tests/QtAutoUicInterface/klocalizedstring.h index 559058f..6129599 100644 --- a/Tests/QtAutoUicInterface/klocalizedstring.h +++ b/Tests/QtAutoUicInterface/klocalizedstring.h @@ -7,11 +7,11 @@ #ifdef _WIN32 __declspec(dllexport) #endif -QString tr2xi18n(const char *text, const char *comment = 0); + QString tr2xi18n(const char* text, const char* comment = 0); #ifdef _WIN32 __declspec(dllexport) #endif -QString tr2i18n(const char *text, const char *comment = 0); + QString tr2i18n(const char* text, const char* comment = 0); #endif diff --git a/Tests/QtAutoUicInterface/libwidget.cpp b/Tests/QtAutoUicInterface/libwidget.cpp index 8a921b3..b25f3d7 100644 --- a/Tests/QtAutoUicInterface/libwidget.cpp +++ b/Tests/QtAutoUicInterface/libwidget.cpp @@ -1,9 +1,9 @@ #include "libwidget.h" -LibWidget::LibWidget(QWidget *parent) - : QWidget(parent), - ui(new Ui::LibWidget) +LibWidget::LibWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::LibWidget) { ui->setupUi(this); } diff --git a/Tests/QtAutoUicInterface/libwidget.h b/Tests/QtAutoUicInterface/libwidget.h index 8b592ec..a4400d2 100644 --- a/Tests/QtAutoUicInterface/libwidget.h +++ b/Tests/QtAutoUicInterface/libwidget.h @@ -15,7 +15,7 @@ class LibWidget : public QWidget { Q_OBJECT public: - explicit LibWidget(QWidget *parent = 0); + explicit LibWidget(QWidget* parent = 0); private: const std::auto_ptr<Ui::LibWidget> ui; diff --git a/Tests/QtAutoUicInterface/main.cpp b/Tests/QtAutoUicInterface/main.cpp index 42d5958..68bd843 100644 --- a/Tests/QtAutoUicInterface/main.cpp +++ b/Tests/QtAutoUicInterface/main.cpp @@ -3,70 +3,62 @@ #include <iostream> #include <string> -int main(int argc, char **argv) +int main(int argc, char** argv) { std::ifstream f; f.open(UI_LIBWIDGET_H); - if (!f.is_open()) - { + if (!f.is_open()) { std::cout << "Could not open \"" UI_LIBWIDGET_H "\"." << std::endl; return -1; - } + } { - bool gotTr2i18n = false; + bool gotTr2i18n = false; - while (!f.eof()) - { - std::string output; - getline(f, output); - if (!gotTr2i18n) - { - gotTr2i18n = output.find("tr2i18n") != std::string::npos; + while (!f.eof()) { + std::string output; + getline(f, output); + if (!gotTr2i18n) { + gotTr2i18n = output.find("tr2i18n") != std::string::npos; } - if (output.find("tr2xi18n") != std::string::npos) - { - std::cout << "ui_libwidget,h uses tr2xi18n, though it should not." << std::endl; - return -1; + if (output.find("tr2xi18n") != std::string::npos) { + std::cout << "ui_libwidget,h uses tr2xi18n, though it should not." + << std::endl; + return -1; } } - if (!gotTr2i18n) - { - std::cout << "Did not find tr2i18n in ui_libwidget.h" << std::endl; - return -1; + if (!gotTr2i18n) { + std::cout << "Did not find tr2i18n in ui_libwidget.h" << std::endl; + return -1; } } f.close(); f.open(UI_MYWIDGET_H); - if (!f.is_open()) - { + if (!f.is_open()) { std::cout << "Could not open \"" UI_MYWIDGET_H "\"." << std::endl; return -1; - } + } { - bool gotTr2xi18n = false; + bool gotTr2xi18n = false; - while (!f.eof()) - { - std::string output; - getline(f, output); - if (!gotTr2xi18n) - { - gotTr2xi18n = output.find("tr2xi18n") != std::string::npos; + while (!f.eof()) { + std::string output; + getline(f, output); + if (!gotTr2xi18n) { + gotTr2xi18n = output.find("tr2xi18n") != std::string::npos; } - if (output.find("tr2i18n") != std::string::npos) - { - std::cout << "ui_mywidget,h uses tr2i18n, though it should not." << std::endl; - return -1; + if (output.find("tr2i18n") != std::string::npos) { + std::cout << "ui_mywidget,h uses tr2i18n, though it should not." + << std::endl; + return -1; } } - if (!gotTr2xi18n) - { - std::cout << "Did not find tr2xi18n in ui_mywidget.h" << std::endl; - return -1; + if (!gotTr2xi18n) { + std::cout << "Did not find tr2xi18n in ui_mywidget.h" << std::endl; + return -1; } } f.close(); diff --git a/Tests/QtAutoUicInterface/mywidget.cpp b/Tests/QtAutoUicInterface/mywidget.cpp index b528b1a..885165b 100644 --- a/Tests/QtAutoUicInterface/mywidget.cpp +++ b/Tests/QtAutoUicInterface/mywidget.cpp @@ -1,9 +1,9 @@ #include "mywidget.h" -MyWidget::MyWidget(QWidget *parent) - : QWidget(parent), - ui(new Ui::MyWidget) +MyWidget::MyWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::MyWidget) { ui->setupUi(this); } diff --git a/Tests/QtAutoUicInterface/mywidget.h b/Tests/QtAutoUicInterface/mywidget.h index c96fb98..fc49e80 100644 --- a/Tests/QtAutoUicInterface/mywidget.h +++ b/Tests/QtAutoUicInterface/mywidget.h @@ -15,7 +15,7 @@ class MyWidget : public QWidget { Q_OBJECT public: - explicit MyWidget(QWidget *parent = 0); + explicit MyWidget(QWidget* parent = 0); private: const std::auto_ptr<Ui::MyWidget> ui; diff --git a/Tests/QtAutogen/Adir/libA.cpp b/Tests/QtAutogen/Adir/libA.cpp index 3968c44..f79f24a 100644 --- a/Tests/QtAutogen/Adir/libA.cpp +++ b/Tests/QtAutogen/Adir/libA.cpp @@ -1,10 +1,9 @@ #include "libA.h" -LibA::LibA(QObject *parent) +LibA::LibA(QObject* parent) : QObject(parent) { - } int LibA::foo() diff --git a/Tests/QtAutogen/Adir/libA.h b/Tests/QtAutogen/Adir/libA.h index 03ad1e0..c4eb9f7 100644 --- a/Tests/QtAutogen/Adir/libA.h +++ b/Tests/QtAutogen/Adir/libA.h @@ -10,7 +10,7 @@ class LIBA_EXPORT LibA : public QObject { Q_OBJECT public: - explicit LibA(QObject *parent = 0); + explicit LibA(QObject* parent = 0); int foo(); }; diff --git a/Tests/QtAutogen/Bdir/libB.cpp b/Tests/QtAutogen/Bdir/libB.cpp index 72f2cfa..d3b6753 100644 --- a/Tests/QtAutogen/Bdir/libB.cpp +++ b/Tests/QtAutogen/Bdir/libB.cpp @@ -1,10 +1,9 @@ #include "libB.h" -LibB::LibB(QObject *parent) +LibB::LibB(QObject* parent) : QObject(parent) { - } int LibB::foo() diff --git a/Tests/QtAutogen/Bdir/libB.h b/Tests/QtAutogen/Bdir/libB.h index 746b67a..e4ab788 100644 --- a/Tests/QtAutogen/Bdir/libB.h +++ b/Tests/QtAutogen/Bdir/libB.h @@ -11,9 +11,10 @@ class LIBB_EXPORT LibB : public QObject { Q_OBJECT public: - explicit LibB(QObject *parent = 0); + explicit LibB(QObject* parent = 0); int foo(); + private: LibA a; }; diff --git a/Tests/QtAutogen/abc.cpp b/Tests/QtAutogen/abc.cpp index 4bbc769..b19c2a1 100644 --- a/Tests/QtAutogen/abc.cpp +++ b/Tests/QtAutogen/abc.cpp @@ -11,7 +11,6 @@ See the License for more information. ============================================================================*/ - #include "abc.h" #include "abc_p.h" @@ -20,18 +19,20 @@ class PrintAbc : public QObject { Q_OBJECT - public: - PrintAbc():QObject() {} - public slots: - void print() const { printf("abc\n"); } +public: + PrintAbc() + : QObject() + { + } +public slots: + void print() const { printf("abc\n"); } }; Abc::Abc() -:QObject() + : QObject() { } - void Abc::doAbc() { PrintAbc pa; diff --git a/Tests/QtAutogen/abc.h b/Tests/QtAutogen/abc.h index d1924b0..dc085b1 100644 --- a/Tests/QtAutogen/abc.h +++ b/Tests/QtAutogen/abc.h @@ -19,10 +19,10 @@ class Abc : public QObject { Q_OBJECT - public: - Abc(); - public slots: - void doAbc(); +public: + Abc(); +public slots: + void doAbc(); }; #endif diff --git a/Tests/QtAutogen/abc_p.h b/Tests/QtAutogen/abc_p.h index 952fff3..c9139b7 100644 --- a/Tests/QtAutogen/abc_p.h +++ b/Tests/QtAutogen/abc_p.h @@ -21,10 +21,10 @@ class AbcP : public QObject { Q_OBJECT - public: - AbcP() {} - public slots: - void doAbcP() { printf("I am private abc !\n"); } +public: + AbcP() {} +public slots: + void doAbcP() { printf("I am private abc !\n"); } }; #endif diff --git a/Tests/QtAutogen/bar.cpp b/Tests/QtAutogen/bar.cpp index 8be4815..2eefd08 100644 --- a/Tests/QtAutogen/bar.cpp +++ b/Tests/QtAutogen/bar.cpp @@ -16,7 +16,7 @@ #include <stdio.h> Bar::Bar() -:QObject() + : QObject() { } diff --git a/Tests/QtAutogen/blub.cpp b/Tests/QtAutogen/blub.cpp index bd53972..bbebf08 100644 --- a/Tests/QtAutogen/blub.cpp +++ b/Tests/QtAutogen/blub.cpp @@ -18,17 +18,19 @@ class BlubBlub : public QObject { Q_OBJECT - public: - BlubBlub():QObject() {} - public slots: - int getValue() const { return 13; } +public: + BlubBlub() + : QObject() + { + } +public slots: + int getValue() const { return 13; } }; Blub::Blub() { } - void Blub::blubber() { BlubBlub bb; diff --git a/Tests/QtAutogen/blub.h b/Tests/QtAutogen/blub.h index 1967bc1..7097b67 100644 --- a/Tests/QtAutogen/blub.h +++ b/Tests/QtAutogen/blub.h @@ -18,9 +18,9 @@ class Blub { - public: - Blub(); - void blubber(); +public: + Blub(); + void blubber(); }; #endif diff --git a/Tests/QtAutogen/calwidget.cpp b/Tests/QtAutogen/calwidget.cpp index 0e314cd..380e982 100644 --- a/Tests/QtAutogen/calwidget.cpp +++ b/Tests/QtAutogen/calwidget.cpp @@ -38,400 +38,399 @@ ** ****************************************************************************/ - #include <QCalendarWidget> - #include <QCheckBox> - #include <QComboBox> - #include <QDateEdit> - #include <QGridLayout> - #include <QGroupBox> - #include <QLabel> - #include <QTextCharFormat> - - #include "calwidget.h" - - #include "ui_calwidget.h" - #ifdef UI_CALWIDGET_H - #error Definition of UI_CALWIDGET_H should be disabled by file option. - #endif - - Window::Window() +#include <QCalendarWidget> +#include <QCheckBox> +#include <QComboBox> +#include <QDateEdit> +#include <QGridLayout> +#include <QGroupBox> +#include <QLabel> +#include <QTextCharFormat> + +#include "calwidget.h" + +#include "ui_calwidget.h" +#ifdef UI_CALWIDGET_H +#error Definition of UI_CALWIDGET_H should be disabled by file option. +#endif + +Window::Window() : ui(new Ui::Window) - { - createPreviewGroupBox(); - createGeneralOptionsGroupBox(); - createDatesGroupBox(); - createTextFormatsGroupBox(); - - QGridLayout *layout = new QGridLayout; - layout->addWidget(previewGroupBox, 0, 0); - layout->addWidget(generalOptionsGroupBox, 0, 1); - layout->addWidget(datesGroupBox, 1, 0); - layout->addWidget(textFormatsGroupBox, 1, 1); - layout->setSizeConstraint(QLayout::SetFixedSize); - setLayout(layout); - - previewLayout->setRowMinimumHeight(0, calendar->sizeHint().height()); - previewLayout->setColumnMinimumWidth(0, calendar->sizeHint().width()); - - setWindowTitle(tr("Calendar Widget")); - } - - void Window::localeChanged(int index) - { - calendar->setLocale(localeCombo->itemData(index).toLocale()); - } - - void Window::firstDayChanged(int index) - { - calendar->setFirstDayOfWeek(Qt::DayOfWeek( - firstDayCombo->itemData(index).toInt())); - } - - void Window::selectionModeChanged(int index) - { - calendar->setSelectionMode(QCalendarWidget::SelectionMode( - selectionModeCombo->itemData(index).toInt())); - } - - void Window::horizontalHeaderChanged(int index) - { - calendar->setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat( - horizontalHeaderCombo->itemData(index).toInt())); - } - - void Window::verticalHeaderChanged(int index) - { - calendar->setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFormat( - verticalHeaderCombo->itemData(index).toInt())); - } - - void Window::selectedDateChanged() - { - currentDateEdit->setDate(calendar->selectedDate()); - } - - void Window::minimumDateChanged(const QDate &date) - { - calendar->setMinimumDate(date); - maximumDateEdit->setDate(calendar->maximumDate()); - } - - void Window::maximumDateChanged(const QDate &date) - { - calendar->setMaximumDate(date); - minimumDateEdit->setDate(calendar->minimumDate()); - } - - void Window::weekdayFormatChanged() - { - QTextCharFormat format; - - format.setForeground(qvariant_cast<QColor>( - weekdayColorCombo->itemData(weekdayColorCombo->currentIndex()))); - calendar->setWeekdayTextFormat(Qt::Monday, format); - calendar->setWeekdayTextFormat(Qt::Tuesday, format); - calendar->setWeekdayTextFormat(Qt::Wednesday, format); - calendar->setWeekdayTextFormat(Qt::Thursday, format); - calendar->setWeekdayTextFormat(Qt::Friday, format); - } - - void Window::weekendFormatChanged() - { - QTextCharFormat format; - - format.setForeground(qvariant_cast<QColor>( - weekendColorCombo->itemData(weekendColorCombo->currentIndex()))); - calendar->setWeekdayTextFormat(Qt::Saturday, format); - calendar->setWeekdayTextFormat(Qt::Sunday, format); - } - - void Window::reformatHeaders() - { - QString text = headerTextFormatCombo->currentText(); - QTextCharFormat format; - - if (text == tr("Bold")) { - format.setFontWeight(QFont::Bold); - } else if (text == tr("Italic")) { - format.setFontItalic(true); - } else if (text == tr("Green")) { - format.setForeground(Qt::green); - } - calendar->setHeaderTextFormat(format); - } - - void Window::reformatCalendarPage() - { - if (firstFridayCheckBox->isChecked()) { - QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1); - while (firstFriday.dayOfWeek() != Qt::Friday) - firstFriday = firstFriday.addDays(1); - QTextCharFormat firstFridayFormat; - firstFridayFormat.setForeground(Qt::blue); - calendar->setDateTextFormat(firstFriday, firstFridayFormat); - } - - //May First in Red takes precedence - if (mayFirstCheckBox->isChecked()) { - const QDate mayFirst(calendar->yearShown(), 5, 1); - QTextCharFormat mayFirstFormat; - mayFirstFormat.setForeground(Qt::red); - calendar->setDateTextFormat(mayFirst, mayFirstFormat); - } - } - - void Window::createPreviewGroupBox() - { - previewGroupBox = new QGroupBox(tr("Preview")); - - calendar = new QCalendarWidget; - calendar->setMinimumDate(QDate(1900, 1, 1)); - calendar->setMaximumDate(QDate(3000, 1, 1)); - calendar->setGridVisible(true); - - connect(calendar, SIGNAL(currentPageChanged(int,int)), - this, SLOT(reformatCalendarPage())); - - previewLayout = new QGridLayout; - previewLayout->addWidget(calendar, 0, 0, Qt::AlignCenter); - previewGroupBox->setLayout(previewLayout); - } - - void Window::createGeneralOptionsGroupBox() - { - generalOptionsGroupBox = new QGroupBox(tr("General Options")); - - localeCombo = new QComboBox; - int curLocaleIndex = -1; - int index = 0; - for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) { - QLocale::Language lang = static_cast<QLocale::Language>(_lang); - QList<QLocale::Country> countries = QLocale::countriesForLanguage(lang); - for (int i = 0; i < countries.count(); ++i) { - QLocale::Country country = countries.at(i); - QString label = QLocale::languageToString(lang); - label += QLatin1Char('/'); - label += QLocale::countryToString(country); - QLocale locale(lang, country); - if (this->locale().language() == lang && this->locale().country() == country) - curLocaleIndex = index; - localeCombo->addItem(label, locale); - ++index; - } - } - if (curLocaleIndex != -1) - localeCombo->setCurrentIndex(curLocaleIndex); - localeLabel = new QLabel(tr("&Locale")); - localeLabel->setBuddy(localeCombo); - - firstDayCombo = new QComboBox; - firstDayCombo->addItem(tr("Sunday"), Qt::Sunday); - firstDayCombo->addItem(tr("Monday"), Qt::Monday); - firstDayCombo->addItem(tr("Tuesday"), Qt::Tuesday); - firstDayCombo->addItem(tr("Wednesday"), Qt::Wednesday); - firstDayCombo->addItem(tr("Thursday"), Qt::Thursday); - firstDayCombo->addItem(tr("Friday"), Qt::Friday); - firstDayCombo->addItem(tr("Saturday"), Qt::Saturday); - - firstDayLabel = new QLabel(tr("Wee&k starts on:")); - firstDayLabel->setBuddy(firstDayCombo); - - selectionModeCombo = new QComboBox; - selectionModeCombo->addItem(tr("Single selection"), - QCalendarWidget::SingleSelection); - selectionModeCombo->addItem(tr("None"), QCalendarWidget::NoSelection); - - selectionModeLabel = new QLabel(tr("&Selection mode:")); - selectionModeLabel->setBuddy(selectionModeCombo); - - gridCheckBox = new QCheckBox(tr("&Grid")); - gridCheckBox->setChecked(calendar->isGridVisible()); - - navigationCheckBox = new QCheckBox(tr("&Navigation bar")); - navigationCheckBox->setChecked(true); - - horizontalHeaderCombo = new QComboBox; - horizontalHeaderCombo->addItem(tr("Single letter day names"), - QCalendarWidget::SingleLetterDayNames); - horizontalHeaderCombo->addItem(tr("Short day names"), - QCalendarWidget::ShortDayNames); - horizontalHeaderCombo->addItem(tr("None"), - QCalendarWidget::NoHorizontalHeader); - horizontalHeaderCombo->setCurrentIndex(1); - - horizontalHeaderLabel = new QLabel(tr("&Horizontal header:")); - horizontalHeaderLabel->setBuddy(horizontalHeaderCombo); - - verticalHeaderCombo = new QComboBox; - verticalHeaderCombo->addItem(tr("ISO week numbers"), - QCalendarWidget::ISOWeekNumbers); - verticalHeaderCombo->addItem(tr("None"), QCalendarWidget::NoVerticalHeader); - - verticalHeaderLabel = new QLabel(tr("&Vertical header:")); - verticalHeaderLabel->setBuddy(verticalHeaderCombo); - - connect(localeCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(localeChanged(int))); - connect(firstDayCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(firstDayChanged(int))); - connect(selectionModeCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(selectionModeChanged(int))); - connect(gridCheckBox, SIGNAL(toggled(bool)), - calendar, SLOT(setGridVisible(bool))); - connect(navigationCheckBox, SIGNAL(toggled(bool)), - calendar, SLOT(setNavigationBarVisible(bool))); - connect(horizontalHeaderCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(horizontalHeaderChanged(int))); - connect(verticalHeaderCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(verticalHeaderChanged(int))); - - QHBoxLayout *checkBoxLayout = new QHBoxLayout; - checkBoxLayout->addWidget(gridCheckBox); - checkBoxLayout->addStretch(); - checkBoxLayout->addWidget(navigationCheckBox); - - QGridLayout *outerLayout = new QGridLayout; - outerLayout->addWidget(localeLabel, 0, 0); - outerLayout->addWidget(localeCombo, 0, 1); - outerLayout->addWidget(firstDayLabel, 1, 0); - outerLayout->addWidget(firstDayCombo, 1, 1); - outerLayout->addWidget(selectionModeLabel, 2, 0); - outerLayout->addWidget(selectionModeCombo, 2, 1); - outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); - outerLayout->addWidget(horizontalHeaderLabel, 4, 0); - outerLayout->addWidget(horizontalHeaderCombo, 4, 1); - outerLayout->addWidget(verticalHeaderLabel, 5, 0); - outerLayout->addWidget(verticalHeaderCombo, 5, 1); - generalOptionsGroupBox->setLayout(outerLayout); - - firstDayChanged(firstDayCombo->currentIndex()); - selectionModeChanged(selectionModeCombo->currentIndex()); - horizontalHeaderChanged(horizontalHeaderCombo->currentIndex()); - verticalHeaderChanged(verticalHeaderCombo->currentIndex()); - } - - void Window::createDatesGroupBox() - { - datesGroupBox = new QGroupBox(tr("Dates")); - - minimumDateEdit = new QDateEdit; - minimumDateEdit->setDisplayFormat("MMM d yyyy"); - minimumDateEdit->setDateRange(calendar->minimumDate(), - calendar->maximumDate()); - minimumDateEdit->setDate(calendar->minimumDate()); - - minimumDateLabel = new QLabel(tr("&Minimum Date:")); - minimumDateLabel->setBuddy(minimumDateEdit); - - currentDateEdit = new QDateEdit; - currentDateEdit->setDisplayFormat("MMM d yyyy"); - currentDateEdit->setDate(calendar->selectedDate()); - currentDateEdit->setDateRange(calendar->minimumDate(), - calendar->maximumDate()); - - currentDateLabel = new QLabel(tr("&Current Date:")); - currentDateLabel->setBuddy(currentDateEdit); - - maximumDateEdit = new QDateEdit; - maximumDateEdit->setDisplayFormat("MMM d yyyy"); - maximumDateEdit->setDateRange(calendar->minimumDate(), - calendar->maximumDate()); - maximumDateEdit->setDate(calendar->maximumDate()); - - maximumDateLabel = new QLabel(tr("Ma&ximum Date:")); - maximumDateLabel->setBuddy(maximumDateEdit); - - connect(currentDateEdit, SIGNAL(dateChanged(QDate)), - calendar, SLOT(setSelectedDate(QDate))); - connect(calendar, SIGNAL(selectionChanged()), - this, SLOT(selectedDateChanged())); - connect(minimumDateEdit, SIGNAL(dateChanged(QDate)), - this, SLOT(minimumDateChanged(QDate))); - connect(maximumDateEdit, SIGNAL(dateChanged(QDate)), - this, SLOT(maximumDateChanged(QDate))); - - QGridLayout *dateBoxLayout = new QGridLayout; - dateBoxLayout->addWidget(currentDateLabel, 1, 0); - dateBoxLayout->addWidget(currentDateEdit, 1, 1); - dateBoxLayout->addWidget(minimumDateLabel, 0, 0); - dateBoxLayout->addWidget(minimumDateEdit, 0, 1); - dateBoxLayout->addWidget(maximumDateLabel, 2, 0); - dateBoxLayout->addWidget(maximumDateEdit, 2, 1); - dateBoxLayout->setRowStretch(3, 1); - - datesGroupBox->setLayout(dateBoxLayout); - } - - void Window::createTextFormatsGroupBox() - { - textFormatsGroupBox = new QGroupBox(tr("Text Formats")); - - weekdayColorCombo = createColorComboBox(); - weekdayColorCombo->setCurrentIndex( - weekdayColorCombo->findText(tr("Black"))); - - weekdayColorLabel = new QLabel(tr("&Weekday color:")); - weekdayColorLabel->setBuddy(weekdayColorCombo); - - weekendColorCombo = createColorComboBox(); - weekendColorCombo->setCurrentIndex( - weekendColorCombo->findText(tr("Red"))); - - weekendColorLabel = new QLabel(tr("Week&end color:")); - weekendColorLabel->setBuddy(weekendColorCombo); - - headerTextFormatCombo = new QComboBox; - headerTextFormatCombo->addItem(tr("Bold")); - headerTextFormatCombo->addItem(tr("Italic")); - headerTextFormatCombo->addItem(tr("Plain")); - - headerTextFormatLabel = new QLabel(tr("&Header text:")); - headerTextFormatLabel->setBuddy(headerTextFormatCombo); - - firstFridayCheckBox = new QCheckBox(tr("&First Friday in blue")); - - mayFirstCheckBox = new QCheckBox(tr("May &1 in red")); - - connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(weekdayFormatChanged())); - connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(weekendFormatChanged())); - connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)), - this, SLOT(reformatHeaders())); - connect(firstFridayCheckBox, SIGNAL(toggled(bool)), - this, SLOT(reformatCalendarPage())); - connect(mayFirstCheckBox, SIGNAL(toggled(bool)), - this, SLOT(reformatCalendarPage())); - - QHBoxLayout *checkBoxLayout = new QHBoxLayout; - checkBoxLayout->addWidget(firstFridayCheckBox); - checkBoxLayout->addStretch(); - checkBoxLayout->addWidget(mayFirstCheckBox); - - QGridLayout *outerLayout = new QGridLayout; - outerLayout->addWidget(weekdayColorLabel, 0, 0); - outerLayout->addWidget(weekdayColorCombo, 0, 1); - outerLayout->addWidget(weekendColorLabel, 1, 0); - outerLayout->addWidget(weekendColorCombo, 1, 1); - outerLayout->addWidget(headerTextFormatLabel, 2, 0); - outerLayout->addWidget(headerTextFormatCombo, 2, 1); - outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); - textFormatsGroupBox->setLayout(outerLayout); - - weekdayFormatChanged(); - weekendFormatChanged(); - reformatHeaders(); - reformatCalendarPage(); - } - -QComboBox *Window::createColorComboBox() - { - QComboBox *comboBox = new QComboBox; - comboBox->addItem(tr("Red"), QColor(Qt::red)); - comboBox->addItem(tr("Blue"), QColor(Qt::blue)); - comboBox->addItem(tr("Black"), QColor(Qt::black)); - comboBox->addItem(tr("Magenta"), QColor(Qt::magenta)); - return comboBox; - } +{ + createPreviewGroupBox(); + createGeneralOptionsGroupBox(); + createDatesGroupBox(); + createTextFormatsGroupBox(); + + QGridLayout* layout = new QGridLayout; + layout->addWidget(previewGroupBox, 0, 0); + layout->addWidget(generalOptionsGroupBox, 0, 1); + layout->addWidget(datesGroupBox, 1, 0); + layout->addWidget(textFormatsGroupBox, 1, 1); + layout->setSizeConstraint(QLayout::SetFixedSize); + setLayout(layout); + + previewLayout->setRowMinimumHeight(0, calendar->sizeHint().height()); + previewLayout->setColumnMinimumWidth(0, calendar->sizeHint().width()); + + setWindowTitle(tr("Calendar Widget")); +} + +void Window::localeChanged(int index) +{ + calendar->setLocale(localeCombo->itemData(index).toLocale()); +} + +void Window::firstDayChanged(int index) +{ + calendar->setFirstDayOfWeek( + Qt::DayOfWeek(firstDayCombo->itemData(index).toInt())); +} + +void Window::selectionModeChanged(int index) +{ + calendar->setSelectionMode(QCalendarWidget::SelectionMode( + selectionModeCombo->itemData(index).toInt())); +} + +void Window::horizontalHeaderChanged(int index) +{ + calendar->setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat( + horizontalHeaderCombo->itemData(index).toInt())); +} + +void Window::verticalHeaderChanged(int index) +{ + calendar->setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFormat( + verticalHeaderCombo->itemData(index).toInt())); +} + +void Window::selectedDateChanged() +{ + currentDateEdit->setDate(calendar->selectedDate()); +} + +void Window::minimumDateChanged(const QDate& date) +{ + calendar->setMinimumDate(date); + maximumDateEdit->setDate(calendar->maximumDate()); +} + +void Window::maximumDateChanged(const QDate& date) +{ + calendar->setMaximumDate(date); + minimumDateEdit->setDate(calendar->minimumDate()); +} + +void Window::weekdayFormatChanged() +{ + QTextCharFormat format; + + format.setForeground(qvariant_cast<QColor>( + weekdayColorCombo->itemData(weekdayColorCombo->currentIndex()))); + calendar->setWeekdayTextFormat(Qt::Monday, format); + calendar->setWeekdayTextFormat(Qt::Tuesday, format); + calendar->setWeekdayTextFormat(Qt::Wednesday, format); + calendar->setWeekdayTextFormat(Qt::Thursday, format); + calendar->setWeekdayTextFormat(Qt::Friday, format); +} + +void Window::weekendFormatChanged() +{ + QTextCharFormat format; + + format.setForeground(qvariant_cast<QColor>( + weekendColorCombo->itemData(weekendColorCombo->currentIndex()))); + calendar->setWeekdayTextFormat(Qt::Saturday, format); + calendar->setWeekdayTextFormat(Qt::Sunday, format); +} + +void Window::reformatHeaders() +{ + QString text = headerTextFormatCombo->currentText(); + QTextCharFormat format; + + if (text == tr("Bold")) { + format.setFontWeight(QFont::Bold); + } else if (text == tr("Italic")) { + format.setFontItalic(true); + } else if (text == tr("Green")) { + format.setForeground(Qt::green); + } + calendar->setHeaderTextFormat(format); +} + +void Window::reformatCalendarPage() +{ + if (firstFridayCheckBox->isChecked()) { + QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1); + while (firstFriday.dayOfWeek() != Qt::Friday) + firstFriday = firstFriday.addDays(1); + QTextCharFormat firstFridayFormat; + firstFridayFormat.setForeground(Qt::blue); + calendar->setDateTextFormat(firstFriday, firstFridayFormat); + } + + // May First in Red takes precedence + if (mayFirstCheckBox->isChecked()) { + const QDate mayFirst(calendar->yearShown(), 5, 1); + QTextCharFormat mayFirstFormat; + mayFirstFormat.setForeground(Qt::red); + calendar->setDateTextFormat(mayFirst, mayFirstFormat); + } +} + +void Window::createPreviewGroupBox() +{ + previewGroupBox = new QGroupBox(tr("Preview")); + + calendar = new QCalendarWidget; + calendar->setMinimumDate(QDate(1900, 1, 1)); + calendar->setMaximumDate(QDate(3000, 1, 1)); + calendar->setGridVisible(true); + + connect(calendar, SIGNAL(currentPageChanged(int, int)), this, + SLOT(reformatCalendarPage())); + + previewLayout = new QGridLayout; + previewLayout->addWidget(calendar, 0, 0, Qt::AlignCenter); + previewGroupBox->setLayout(previewLayout); +} + +void Window::createGeneralOptionsGroupBox() +{ + generalOptionsGroupBox = new QGroupBox(tr("General Options")); + + localeCombo = new QComboBox; + int curLocaleIndex = -1; + int index = 0; + for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) { + QLocale::Language lang = static_cast<QLocale::Language>(_lang); + QList<QLocale::Country> countries = QLocale::countriesForLanguage(lang); + for (int i = 0; i < countries.count(); ++i) { + QLocale::Country country = countries.at(i); + QString label = QLocale::languageToString(lang); + label += QLatin1Char('/'); + label += QLocale::countryToString(country); + QLocale locale(lang, country); + if (this->locale().language() == lang && + this->locale().country() == country) + curLocaleIndex = index; + localeCombo->addItem(label, locale); + ++index; + } + } + if (curLocaleIndex != -1) + localeCombo->setCurrentIndex(curLocaleIndex); + localeLabel = new QLabel(tr("&Locale")); + localeLabel->setBuddy(localeCombo); + + firstDayCombo = new QComboBox; + firstDayCombo->addItem(tr("Sunday"), Qt::Sunday); + firstDayCombo->addItem(tr("Monday"), Qt::Monday); + firstDayCombo->addItem(tr("Tuesday"), Qt::Tuesday); + firstDayCombo->addItem(tr("Wednesday"), Qt::Wednesday); + firstDayCombo->addItem(tr("Thursday"), Qt::Thursday); + firstDayCombo->addItem(tr("Friday"), Qt::Friday); + firstDayCombo->addItem(tr("Saturday"), Qt::Saturday); + + firstDayLabel = new QLabel(tr("Wee&k starts on:")); + firstDayLabel->setBuddy(firstDayCombo); + + selectionModeCombo = new QComboBox; + selectionModeCombo->addItem(tr("Single selection"), + QCalendarWidget::SingleSelection); + selectionModeCombo->addItem(tr("None"), QCalendarWidget::NoSelection); + + selectionModeLabel = new QLabel(tr("&Selection mode:")); + selectionModeLabel->setBuddy(selectionModeCombo); + + gridCheckBox = new QCheckBox(tr("&Grid")); + gridCheckBox->setChecked(calendar->isGridVisible()); + + navigationCheckBox = new QCheckBox(tr("&Navigation bar")); + navigationCheckBox->setChecked(true); + + horizontalHeaderCombo = new QComboBox; + horizontalHeaderCombo->addItem(tr("Single letter day names"), + QCalendarWidget::SingleLetterDayNames); + horizontalHeaderCombo->addItem(tr("Short day names"), + QCalendarWidget::ShortDayNames); + horizontalHeaderCombo->addItem(tr("None"), + QCalendarWidget::NoHorizontalHeader); + horizontalHeaderCombo->setCurrentIndex(1); + + horizontalHeaderLabel = new QLabel(tr("&Horizontal header:")); + horizontalHeaderLabel->setBuddy(horizontalHeaderCombo); + + verticalHeaderCombo = new QComboBox; + verticalHeaderCombo->addItem(tr("ISO week numbers"), + QCalendarWidget::ISOWeekNumbers); + verticalHeaderCombo->addItem(tr("None"), QCalendarWidget::NoVerticalHeader); + + verticalHeaderLabel = new QLabel(tr("&Vertical header:")); + verticalHeaderLabel->setBuddy(verticalHeaderCombo); + + connect(localeCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(localeChanged(int))); + connect(firstDayCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(firstDayChanged(int))); + connect(selectionModeCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(selectionModeChanged(int))); + connect(gridCheckBox, SIGNAL(toggled(bool)), calendar, + SLOT(setGridVisible(bool))); + connect(navigationCheckBox, SIGNAL(toggled(bool)), calendar, + SLOT(setNavigationBarVisible(bool))); + connect(horizontalHeaderCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(horizontalHeaderChanged(int))); + connect(verticalHeaderCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(verticalHeaderChanged(int))); + + QHBoxLayout* checkBoxLayout = new QHBoxLayout; + checkBoxLayout->addWidget(gridCheckBox); + checkBoxLayout->addStretch(); + checkBoxLayout->addWidget(navigationCheckBox); + + QGridLayout* outerLayout = new QGridLayout; + outerLayout->addWidget(localeLabel, 0, 0); + outerLayout->addWidget(localeCombo, 0, 1); + outerLayout->addWidget(firstDayLabel, 1, 0); + outerLayout->addWidget(firstDayCombo, 1, 1); + outerLayout->addWidget(selectionModeLabel, 2, 0); + outerLayout->addWidget(selectionModeCombo, 2, 1); + outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); + outerLayout->addWidget(horizontalHeaderLabel, 4, 0); + outerLayout->addWidget(horizontalHeaderCombo, 4, 1); + outerLayout->addWidget(verticalHeaderLabel, 5, 0); + outerLayout->addWidget(verticalHeaderCombo, 5, 1); + generalOptionsGroupBox->setLayout(outerLayout); + + firstDayChanged(firstDayCombo->currentIndex()); + selectionModeChanged(selectionModeCombo->currentIndex()); + horizontalHeaderChanged(horizontalHeaderCombo->currentIndex()); + verticalHeaderChanged(verticalHeaderCombo->currentIndex()); +} + +void Window::createDatesGroupBox() +{ + datesGroupBox = new QGroupBox(tr("Dates")); + + minimumDateEdit = new QDateEdit; + minimumDateEdit->setDisplayFormat("MMM d yyyy"); + minimumDateEdit->setDateRange(calendar->minimumDate(), + calendar->maximumDate()); + minimumDateEdit->setDate(calendar->minimumDate()); + + minimumDateLabel = new QLabel(tr("&Minimum Date:")); + minimumDateLabel->setBuddy(minimumDateEdit); + + currentDateEdit = new QDateEdit; + currentDateEdit->setDisplayFormat("MMM d yyyy"); + currentDateEdit->setDate(calendar->selectedDate()); + currentDateEdit->setDateRange(calendar->minimumDate(), + calendar->maximumDate()); + + currentDateLabel = new QLabel(tr("&Current Date:")); + currentDateLabel->setBuddy(currentDateEdit); + + maximumDateEdit = new QDateEdit; + maximumDateEdit->setDisplayFormat("MMM d yyyy"); + maximumDateEdit->setDateRange(calendar->minimumDate(), + calendar->maximumDate()); + maximumDateEdit->setDate(calendar->maximumDate()); + + maximumDateLabel = new QLabel(tr("Ma&ximum Date:")); + maximumDateLabel->setBuddy(maximumDateEdit); + + connect(currentDateEdit, SIGNAL(dateChanged(QDate)), calendar, + SLOT(setSelectedDate(QDate))); + connect(calendar, SIGNAL(selectionChanged()), this, + SLOT(selectedDateChanged())); + connect(minimumDateEdit, SIGNAL(dateChanged(QDate)), this, + SLOT(minimumDateChanged(QDate))); + connect(maximumDateEdit, SIGNAL(dateChanged(QDate)), this, + SLOT(maximumDateChanged(QDate))); + + QGridLayout* dateBoxLayout = new QGridLayout; + dateBoxLayout->addWidget(currentDateLabel, 1, 0); + dateBoxLayout->addWidget(currentDateEdit, 1, 1); + dateBoxLayout->addWidget(minimumDateLabel, 0, 0); + dateBoxLayout->addWidget(minimumDateEdit, 0, 1); + dateBoxLayout->addWidget(maximumDateLabel, 2, 0); + dateBoxLayout->addWidget(maximumDateEdit, 2, 1); + dateBoxLayout->setRowStretch(3, 1); + + datesGroupBox->setLayout(dateBoxLayout); +} + +void Window::createTextFormatsGroupBox() +{ + textFormatsGroupBox = new QGroupBox(tr("Text Formats")); + + weekdayColorCombo = createColorComboBox(); + weekdayColorCombo->setCurrentIndex(weekdayColorCombo->findText(tr("Black"))); + + weekdayColorLabel = new QLabel(tr("&Weekday color:")); + weekdayColorLabel->setBuddy(weekdayColorCombo); + + weekendColorCombo = createColorComboBox(); + weekendColorCombo->setCurrentIndex(weekendColorCombo->findText(tr("Red"))); + + weekendColorLabel = new QLabel(tr("Week&end color:")); + weekendColorLabel->setBuddy(weekendColorCombo); + + headerTextFormatCombo = new QComboBox; + headerTextFormatCombo->addItem(tr("Bold")); + headerTextFormatCombo->addItem(tr("Italic")); + headerTextFormatCombo->addItem(tr("Plain")); + + headerTextFormatLabel = new QLabel(tr("&Header text:")); + headerTextFormatLabel->setBuddy(headerTextFormatCombo); + + firstFridayCheckBox = new QCheckBox(tr("&First Friday in blue")); + + mayFirstCheckBox = new QCheckBox(tr("May &1 in red")); + + connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(weekdayFormatChanged())); + connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(weekendFormatChanged())); + connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)), this, + SLOT(reformatHeaders())); + connect(firstFridayCheckBox, SIGNAL(toggled(bool)), this, + SLOT(reformatCalendarPage())); + connect(mayFirstCheckBox, SIGNAL(toggled(bool)), this, + SLOT(reformatCalendarPage())); + + QHBoxLayout* checkBoxLayout = new QHBoxLayout; + checkBoxLayout->addWidget(firstFridayCheckBox); + checkBoxLayout->addStretch(); + checkBoxLayout->addWidget(mayFirstCheckBox); + + QGridLayout* outerLayout = new QGridLayout; + outerLayout->addWidget(weekdayColorLabel, 0, 0); + outerLayout->addWidget(weekdayColorCombo, 0, 1); + outerLayout->addWidget(weekendColorLabel, 1, 0); + outerLayout->addWidget(weekendColorCombo, 1, 1); + outerLayout->addWidget(headerTextFormatLabel, 2, 0); + outerLayout->addWidget(headerTextFormatCombo, 2, 1); + outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); + textFormatsGroupBox->setLayout(outerLayout); + + weekdayFormatChanged(); + weekendFormatChanged(); + reformatHeaders(); + reformatCalendarPage(); +} + +QComboBox* Window::createColorComboBox() +{ + QComboBox* comboBox = new QComboBox; + comboBox->addItem(tr("Red"), QColor(Qt::red)); + comboBox->addItem(tr("Blue"), QColor(Qt::blue)); + comboBox->addItem(tr("Black"), QColor(Qt::black)); + comboBox->addItem(tr("Magenta"), QColor(Qt::magenta)); + return comboBox; +} //#include "moc_calwidget.cpp" diff --git a/Tests/QtAutogen/calwidget.h b/Tests/QtAutogen/calwidget.h index d21a473..084d959 100644 --- a/Tests/QtAutogen/calwidget.h +++ b/Tests/QtAutogen/calwidget.h @@ -1,128 +1,127 @@ - /**************************************************************************** - ** - ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - ** the names of its contributors may be used to endorse or promote - ** products derived from this software without specific prior written - ** permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef WINDOW_H #define WINDOW_H #include <QWidget> - class QCalendarWidget; - class QCheckBox; - class QComboBox; - class QDate; - class QDateEdit; - class QGridLayout; - class QGroupBox; - class QLabel; +class QCalendarWidget; +class QCheckBox; +class QComboBox; +class QDate; +class QDateEdit; +class QGridLayout; +class QGroupBox; +class QLabel; - namespace Ui - { - class Window; - } +namespace Ui { +class Window; +} - class Window : public QWidget - { - Q_OBJECT +class Window : public QWidget +{ + Q_OBJECT - public: - Window(); +public: + Window(); - private slots: - void localeChanged(int index); - void firstDayChanged(int index); - void selectionModeChanged(int index); - void horizontalHeaderChanged(int index); - void verticalHeaderChanged(int index); - void selectedDateChanged(); - void minimumDateChanged(const QDate &date); - void maximumDateChanged(const QDate &date); - void weekdayFormatChanged(); - void weekendFormatChanged(); - void reformatHeaders(); - void reformatCalendarPage(); +private slots: + void localeChanged(int index); + void firstDayChanged(int index); + void selectionModeChanged(int index); + void horizontalHeaderChanged(int index); + void verticalHeaderChanged(int index); + void selectedDateChanged(); + void minimumDateChanged(const QDate& date); + void maximumDateChanged(const QDate& date); + void weekdayFormatChanged(); + void weekendFormatChanged(); + void reformatHeaders(); + void reformatCalendarPage(); - private: - void createPreviewGroupBox(); - void createGeneralOptionsGroupBox(); - void createDatesGroupBox(); - void createTextFormatsGroupBox(); - QComboBox *createColorComboBox(); +private: + void createPreviewGroupBox(); + void createGeneralOptionsGroupBox(); + void createDatesGroupBox(); + void createTextFormatsGroupBox(); + QComboBox* createColorComboBox(); - QGroupBox *previewGroupBox; - QGridLayout *previewLayout; - QCalendarWidget *calendar; + QGroupBox* previewGroupBox; + QGridLayout* previewLayout; + QCalendarWidget* calendar; - QGroupBox *generalOptionsGroupBox; - QLabel *localeLabel; - QLabel *firstDayLabel; - QLabel *selectionModeLabel; - QLabel *horizontalHeaderLabel; - QLabel *verticalHeaderLabel; - QComboBox *localeCombo; - QComboBox *firstDayCombo; - QComboBox *selectionModeCombo; - QCheckBox *gridCheckBox; - QCheckBox *navigationCheckBox; - QComboBox *horizontalHeaderCombo; - QComboBox *verticalHeaderCombo; + QGroupBox* generalOptionsGroupBox; + QLabel* localeLabel; + QLabel* firstDayLabel; + QLabel* selectionModeLabel; + QLabel* horizontalHeaderLabel; + QLabel* verticalHeaderLabel; + QComboBox* localeCombo; + QComboBox* firstDayCombo; + QComboBox* selectionModeCombo; + QCheckBox* gridCheckBox; + QCheckBox* navigationCheckBox; + QComboBox* horizontalHeaderCombo; + QComboBox* verticalHeaderCombo; - QGroupBox *datesGroupBox; - QLabel *currentDateLabel; - QLabel *minimumDateLabel; - QLabel *maximumDateLabel; - QDateEdit *currentDateEdit; - QDateEdit *minimumDateEdit; - QDateEdit *maximumDateEdit; + QGroupBox* datesGroupBox; + QLabel* currentDateLabel; + QLabel* minimumDateLabel; + QLabel* maximumDateLabel; + QDateEdit* currentDateEdit; + QDateEdit* minimumDateEdit; + QDateEdit* maximumDateEdit; - QGroupBox *textFormatsGroupBox; - QLabel *weekdayColorLabel; - QLabel *weekendColorLabel; - QLabel *headerTextFormatLabel; - QComboBox *weekdayColorCombo; - QComboBox *weekendColorCombo; - QComboBox *headerTextFormatCombo; + QGroupBox* textFormatsGroupBox; + QLabel* weekdayColorLabel; + QLabel* weekendColorLabel; + QLabel* headerTextFormatLabel; + QComboBox* weekdayColorCombo; + QComboBox* weekendColorCombo; + QComboBox* headerTextFormatCombo; - QCheckBox *firstFridayCheckBox; - QCheckBox *mayFirstCheckBox; + QCheckBox* firstFridayCheckBox; + QCheckBox* mayFirstCheckBox; - Ui::Window *ui; - }; + Ui::Window* ui; +}; - #endif +#endif diff --git a/Tests/QtAutogen/codeeditor.cpp b/Tests/QtAutogen/codeeditor.cpp index 01da062..0caf8a7 100644 --- a/Tests/QtAutogen/codeeditor.cpp +++ b/Tests/QtAutogen/codeeditor.cpp @@ -38,116 +38,109 @@ ** ****************************************************************************/ - #include <QtGui> - - #include "codeeditor.h" - - - CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) - { - lineNumberArea = new LineNumberArea(this); - - connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); - connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); - connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); - - updateLineNumberAreaWidth(0); - highlightCurrentLine(); - } - - - - int CodeEditor::lineNumberAreaWidth() - { - int digits = 1; - int max = qMax(1, blockCount()); - while (max >= 10) { - max /= 10; - ++digits; - } - - int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; - - return space; - } - - - - void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) - { - setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); - } - - - - void CodeEditor::updateLineNumberArea(const QRect &rect, int dy) - { - if (dy) - lineNumberArea->scroll(0, dy); - else - lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height()); - - if (rect.contains(viewport()->rect())) - updateLineNumberAreaWidth(0); - } - - - - void CodeEditor::resizeEvent(QResizeEvent *e) - { - QPlainTextEdit::resizeEvent(e); - - QRect cr = contentsRect(); - lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); - } - - - - void CodeEditor::highlightCurrentLine() - { - QList<QTextEdit::ExtraSelection> extraSelections; - - if (!isReadOnly()) { - QTextEdit::ExtraSelection selection; - - QColor lineColor = QColor(Qt::yellow).lighter(160); - - selection.format.setBackground(lineColor); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = textCursor(); - selection.cursor.clearSelection(); - extraSelections.append(selection); - } - - setExtraSelections(extraSelections); - } - - - - void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) - { - QPainter painter(lineNumberArea); - painter.fillRect(event->rect(), Qt::lightGray); - - - QTextBlock block = firstVisibleBlock(); - int blockNumber = block.blockNumber(); - int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + (int) blockBoundingRect(block).height(); - - while (block.isValid() && top <= event->rect().bottom()) { - if (block.isVisible() && bottom >= event->rect().top()) { - QString number = QString::number(blockNumber + 1); - painter.setPen(Qt::black); - painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), - Qt::AlignRight, number); - } - - block = block.next(); - top = bottom; - bottom = top + (int) blockBoundingRect(block).height(); - ++blockNumber; - } - } +#include <QtGui> + +#include "codeeditor.h" + +CodeEditor::CodeEditor(QWidget* parent) + : QPlainTextEdit(parent) +{ + lineNumberArea = new LineNumberArea(this); + + connect(this, SIGNAL(blockCountChanged(int)), this, + SLOT(updateLineNumberAreaWidth(int))); + connect(this, SIGNAL(updateRequest(QRect, int)), this, + SLOT(updateLineNumberArea(QRect, int))); + connect(this, SIGNAL(cursorPositionChanged()), this, + SLOT(highlightCurrentLine())); + + updateLineNumberAreaWidth(0); + highlightCurrentLine(); +} + +int CodeEditor::lineNumberAreaWidth() +{ + int digits = 1; + int max = qMax(1, blockCount()); + while (max >= 10) { + max /= 10; + ++digits; + } + + int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; + + return space; +} + +void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) +{ + setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); +} + +void CodeEditor::updateLineNumberArea(const QRect& rect, int dy) +{ + if (dy) + lineNumberArea->scroll(0, dy); + else + lineNumberArea->update(0, rect.y(), lineNumberArea->width(), + rect.height()); + + if (rect.contains(viewport()->rect())) + updateLineNumberAreaWidth(0); +} + +void CodeEditor::resizeEvent(QResizeEvent* e) +{ + QPlainTextEdit::resizeEvent(e); + + QRect cr = contentsRect(); + lineNumberArea->setGeometry( + QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); +} + +void CodeEditor::highlightCurrentLine() +{ + QList<QTextEdit::ExtraSelection> extraSelections; + + if (!isReadOnly()) { + QTextEdit::ExtraSelection selection; + + QColor lineColor = QColor(Qt::yellow).lighter(160); + + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + } + + setExtraSelections(extraSelections); +} + +void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) +{ + QPainter painter(lineNumberArea); + painter.fillRect(event->rect(), Qt::lightGray); + + QTextBlock block = firstVisibleBlock(); + int blockNumber = block.blockNumber(); + int top = + (int)blockBoundingGeometry(block).translated(contentOffset()).top(); + int bottom = top + (int)blockBoundingRect(block).height(); + + while (block.isValid() && top <= event->rect().bottom()) { + if (block.isVisible() && bottom >= event->rect().top()) { + QString number = QString::number(blockNumber + 1); + painter.setPen(Qt::black); + painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), + Qt::AlignRight, number); + } + + block = block.next(); + top = bottom; + bottom = top + (int)blockBoundingRect(block).height(); + ++blockNumber; + } +} #include "codeeditor.moc" diff --git a/Tests/QtAutogen/codeeditor.h b/Tests/QtAutogen/codeeditor.h index fd79a2a..b410bd4 100644 --- a/Tests/QtAutogen/codeeditor.h +++ b/Tests/QtAutogen/codeeditor.h @@ -1,99 +1,100 @@ - /**************************************************************************** - ** - ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - ** the names of its contributors may be used to endorse or promote - ** products derived from this software without specific prior written - ** permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - - #ifndef CODEEDITOR_H - #define CODEEDITOR_H - - #include <QObject> - #include <QPlainTextEdit> - - class QPaintEvent; - class QResizeEvent; - class QSize; - class QWidget; - - class LineNumberArea; - - - class CodeEditor : public QPlainTextEdit - { - Q_OBJECT - - public: - CodeEditor(QWidget *parent = 0); - - void lineNumberAreaPaintEvent(QPaintEvent *event); - int lineNumberAreaWidth(); - - protected: - void resizeEvent(QResizeEvent *event); - - private slots: - void updateLineNumberAreaWidth(int newBlockCount); - void highlightCurrentLine(); - void updateLineNumberArea(const QRect &, int); - - private: - QWidget *lineNumberArea; - }; - - - class LineNumberArea : public QWidget - { - public: - LineNumberArea(CodeEditor *editor) : QWidget(editor) { - codeEditor = editor; - } - - QSize sizeHint() const { - return QSize(codeEditor->lineNumberAreaWidth(), 0); - } - - protected: - void paintEvent(QPaintEvent *event) { - codeEditor->lineNumberAreaPaintEvent(event); - } - - private: - CodeEditor *codeEditor; - }; - - - #endif +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CODEEDITOR_H +#define CODEEDITOR_H + +#include <QObject> +#include <QPlainTextEdit> + +class QPaintEvent; +class QResizeEvent; +class QSize; +class QWidget; + +class LineNumberArea; + +class CodeEditor : public QPlainTextEdit +{ + Q_OBJECT + +public: + CodeEditor(QWidget* parent = 0); + + void lineNumberAreaPaintEvent(QPaintEvent* event); + int lineNumberAreaWidth(); + +protected: + void resizeEvent(QResizeEvent* event); + +private slots: + void updateLineNumberAreaWidth(int newBlockCount); + void highlightCurrentLine(); + void updateLineNumberArea(const QRect&, int); + +private: + QWidget* lineNumberArea; +}; + +class LineNumberArea : public QWidget +{ +public: + LineNumberArea(CodeEditor* editor) + : QWidget(editor) + { + codeEditor = editor; + } + + QSize sizeHint() const + { + return QSize(codeEditor->lineNumberAreaWidth(), 0); + } + +protected: + void paintEvent(QPaintEvent* event) + { + codeEditor->lineNumberAreaPaintEvent(event); + } + +private: + CodeEditor* codeEditor; +}; + +#endif diff --git a/Tests/QtAutogen/debug_class.cpp b/Tests/QtAutogen/debug_class.cpp index 58e72e4..46b09e7 100644 --- a/Tests/QtAutogen/debug_class.cpp +++ b/Tests/QtAutogen/debug_class.cpp @@ -2,8 +2,9 @@ #include "debug_class.h" #include "ui_debug_class.h" -DebugClass::DebugClass(QWidget *parent) - : QWidget(parent), ui(new Ui::DebugClass) +DebugClass::DebugClass(QWidget* parent) + : QWidget(parent) + , ui(new Ui::DebugClass) { ui->setupUi(this); } diff --git a/Tests/QtAutogen/debug_class.h b/Tests/QtAutogen/debug_class.h index 71bc104..c02f0ed 100644 --- a/Tests/QtAutogen/debug_class.h +++ b/Tests/QtAutogen/debug_class.h @@ -1,8 +1,7 @@ #include <QWidget> -namespace Ui -{ +namespace Ui { class DebugClass; } @@ -10,11 +9,11 @@ class DebugClass : public QWidget { Q_OBJECT public: - explicit DebugClass(QWidget *parent = 0); + explicit DebugClass(QWidget* parent = 0); signals: void someSignal(); private: - Ui::DebugClass *ui; + Ui::DebugClass* ui; }; diff --git a/Tests/QtAutogen/defines_test/defines_test.cpp b/Tests/QtAutogen/defines_test/defines_test.cpp index 2836d35..cf4e9cb 100644 --- a/Tests/QtAutogen/defines_test/defines_test.cpp +++ b/Tests/QtAutogen/defines_test/defines_test.cpp @@ -23,7 +23,7 @@ Q_SIGNALS: }; #endif -int main(int argc, char **argv) +int main(int argc, char** argv) { #ifdef QT_CORE_LIB QMetaObject sosmo = SomeObject::staticMetaObject; diff --git a/Tests/QtAutogen/empty.h b/Tests/QtAutogen/empty.h index 4566142..6bdd2ac 100644 --- a/Tests/QtAutogen/empty.h +++ b/Tests/QtAutogen/empty.h @@ -5,5 +5,5 @@ class Empty : public QObject { Q_OBJECT public: - explicit Empty(QObject *parent = 0) {} + explicit Empty(QObject* parent = 0) {} }; diff --git a/Tests/QtAutogen/foo.cpp b/Tests/QtAutogen/foo.cpp index 699ba09..23ecc30 100644 --- a/Tests/QtAutogen/foo.cpp +++ b/Tests/QtAutogen/foo.cpp @@ -18,18 +18,20 @@ class FooFoo : public QObject { Q_OBJECT - public: - FooFoo():QObject() {} - public slots: - int getValue() const { return 12; } +public: + FooFoo() + : QObject() + { + } +public slots: + int getValue() const { return 12; } }; Foo::Foo() -:QObject() + : QObject() { } - void Foo::doFoo() { FooFoo ff; diff --git a/Tests/QtAutogen/foo.h b/Tests/QtAutogen/foo.h index f23ec07..98f6292 100644 --- a/Tests/QtAutogen/foo.h +++ b/Tests/QtAutogen/foo.h @@ -18,14 +18,14 @@ class Foo #ifdef FOO - : public QObject + : public QObject #endif { Q_OBJECT - public: - Foo(); - public slots: - void doFoo(); +public: + Foo(); +public slots: + void doFoo(); }; #endif diff --git a/Tests/QtAutogen/gadget.h b/Tests/QtAutogen/gadget.h index 7c688ee..3253e31 100644 --- a/Tests/QtAutogen/gadget.h +++ b/Tests/QtAutogen/gadget.h @@ -9,7 +9,8 @@ class Gadget Q_GADGET Q_ENUMS(Type) public: - enum Type { + enum Type + { Type0, Type1 }; diff --git a/Tests/QtAutogen/generated.cpp b/Tests/QtAutogen/generated.cpp index f53bf53..d514c61 100644 --- a/Tests/QtAutogen/generated.cpp +++ b/Tests/QtAutogen/generated.cpp @@ -1,10 +1,9 @@ #include "generated.h" -Generated::Generated(QObject *parent) +Generated::Generated(QObject* parent) : QObject(parent) { - } #include "moc_generated.cpp" diff --git a/Tests/QtAutogen/generated.h b/Tests/QtAutogen/generated.h index b6c2711..62e1607 100644 --- a/Tests/QtAutogen/generated.h +++ b/Tests/QtAutogen/generated.h @@ -12,7 +12,7 @@ class Generated : public QObject, MyInterface, MyOtherInterface Q_OBJECT Q_INTERFACES(MyInterface MyOtherInterface) public: - explicit Generated(QObject *parent = 0); + explicit Generated(QObject* parent = 0); }; #endif diff --git a/Tests/QtAutogen/libC.cpp b/Tests/QtAutogen/libC.cpp index 8d61cb1..a3acff1 100644 --- a/Tests/QtAutogen/libC.cpp +++ b/Tests/QtAutogen/libC.cpp @@ -1,10 +1,9 @@ #include "libC.h" -LibC::LibC(QObject *parent) +LibC::LibC(QObject* parent) : QObject(parent) { - } int LibC::foo() diff --git a/Tests/QtAutogen/libC.h b/Tests/QtAutogen/libC.h index 6682576..3bc2bad 100644 --- a/Tests/QtAutogen/libC.h +++ b/Tests/QtAutogen/libC.h @@ -11,10 +11,10 @@ class LIBC_EXPORT LibC : public QObject { Q_OBJECT public: - explicit LibC(QObject *parent = 0); - + explicit LibC(QObject* parent = 0); int foo(); + private: LibB b; }; diff --git a/Tests/QtAutogen/main.cpp b/Tests/QtAutogen/main.cpp index 1636cd4..d557c70 100644 --- a/Tests/QtAutogen/main.cpp +++ b/Tests/QtAutogen/main.cpp @@ -56,8 +56,7 @@ #include <iostream> #endif - -int main(int argv, char **args) +int main(int argv, char** args) { QCoreApplication app(argv, args); diff --git a/Tests/QtAutogen/multiplewidgets.cpp b/Tests/QtAutogen/multiplewidgets.cpp index f143875..fda36ea 100644 --- a/Tests/QtAutogen/multiplewidgets.cpp +++ b/Tests/QtAutogen/multiplewidgets.cpp @@ -4,16 +4,16 @@ #include "ui_widget1.h" #include "ui_widget2.h" -Widget1::Widget1(QWidget *parent) - : QWidget(parent), - ui(new Ui::Widget1) +Widget1::Widget1(QWidget* parent) + : QWidget(parent) + , ui(new Ui::Widget1) { ui->setupUi(this); } -Widget2::Widget2(QWidget *parent) - : QWidget(parent), - ui(new Ui::Widget2) +Widget2::Widget2(QWidget* parent) + : QWidget(parent) + , ui(new Ui::Widget2) { ui->setupUi(this); } diff --git a/Tests/QtAutogen/multiplewidgets.h b/Tests/QtAutogen/multiplewidgets.h index 6ae6ad1..a4d0a50 100644 --- a/Tests/QtAutogen/multiplewidgets.h +++ b/Tests/QtAutogen/multiplewidgets.h @@ -12,9 +12,10 @@ class Widget1 : public QWidget { Q_OBJECT public: - Widget1(QWidget *parent = 0); + Widget1(QWidget* parent = 0); + private: - Ui::Widget1 *ui; + Ui::Widget1* ui; }; namespace Ui { @@ -25,9 +26,10 @@ class Widget2 : public QWidget { Q_OBJECT public: - Widget2(QWidget *parent = 0); + Widget2(QWidget* parent = 0); + private: - Ui::Widget2 *ui; + Ui::Widget2* ui; }; #endif diff --git a/Tests/QtAutogen/private_slot.cpp b/Tests/QtAutogen/private_slot.cpp index 1387a70..ab1682a 100644 --- a/Tests/QtAutogen/private_slot.cpp +++ b/Tests/QtAutogen/private_slot.cpp @@ -4,18 +4,13 @@ class PrivateSlotPrivate { public: - - void privateSlot() - { - - } + void privateSlot() {} }; -PrivateSlot::PrivateSlot(QObject *parent) - : QObject(parent), - d(new PrivateSlotPrivate) +PrivateSlot::PrivateSlot(QObject* parent) + : QObject(parent) + , d(new PrivateSlotPrivate) { - } #include "private_slot.moc" diff --git a/Tests/QtAutogen/private_slot.h b/Tests/QtAutogen/private_slot.h index 28e5448..8041eb2 100644 --- a/Tests/QtAutogen/private_slot.h +++ b/Tests/QtAutogen/private_slot.h @@ -10,10 +10,10 @@ class PrivateSlot : public QObject { Q_OBJECT public: - PrivateSlot(QObject *parent = 0); + PrivateSlot(QObject* parent = 0); private: - PrivateSlotPrivate * const d; + PrivateSlotPrivate* const d; Q_PRIVATE_SLOT(d, void privateSlot()) }; diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/resourcetester.cpp index 75ae28f..4ecb6b4 100644 --- a/Tests/QtAutogen/resourcetester.cpp +++ b/Tests/QtAutogen/resourcetester.cpp @@ -6,21 +6,20 @@ #include <QFile> #include <QTimer> -ResourceTester::ResourceTester(QObject *parent) +ResourceTester::ResourceTester(QObject* parent) : QObject(parent) { - } void ResourceTester::doTest() { if (!QFile::exists(":/CMakeLists.txt")) - qApp->exit(EXIT_FAILURE); + qApp->exit(EXIT_FAILURE); if (!QFile::exists(":/main.cpp")) - qApp->exit(EXIT_FAILURE); + qApp->exit(EXIT_FAILURE); #ifdef TEST_DEBUG_CLASS if (!QFile::exists(":/debug_class.ui")) - qApp->exit(EXIT_FAILURE); + qApp->exit(EXIT_FAILURE); #endif QTimer::singleShot(0, qApp, SLOT(quit())); diff --git a/Tests/QtAutogen/resourcetester.h b/Tests/QtAutogen/resourcetester.h index b02cb4e..dbdb3ad 100644 --- a/Tests/QtAutogen/resourcetester.h +++ b/Tests/QtAutogen/resourcetester.h @@ -8,7 +8,7 @@ class ResourceTester : public QObject { Q_OBJECT public: - explicit ResourceTester(QObject *parent = 0); + explicit ResourceTester(QObject* parent = 0); private slots: void doTest(); diff --git a/Tests/QtAutogen/same_name/aaa/bbb/item.cpp b/Tests/QtAutogen/same_name/aaa/bbb/item.cpp index d715116..20d0044 100644 --- a/Tests/QtAutogen/same_name/aaa/bbb/item.cpp +++ b/Tests/QtAutogen/same_name/aaa/bbb/item.cpp @@ -3,10 +3,8 @@ namespace aaa { namespace bbb { -void -Item::go ( ) +void Item::go() { } - } } diff --git a/Tests/QtAutogen/same_name/aaa/bbb/item.hpp b/Tests/QtAutogen/same_name/aaa/bbb/item.hpp index c82309d..87ac6ea 100644 --- a/Tests/QtAutogen/same_name/aaa/bbb/item.hpp +++ b/Tests/QtAutogen/same_name/aaa/bbb/item.hpp @@ -10,9 +10,8 @@ class Item : public QObject { Q_OBJECT Q_SLOT - void go ( ); + void go(); }; - } } diff --git a/Tests/QtAutogen/same_name/aaa/item.cpp b/Tests/QtAutogen/same_name/aaa/item.cpp index 7887d76..95dd3b6 100644 --- a/Tests/QtAutogen/same_name/aaa/item.cpp +++ b/Tests/QtAutogen/same_name/aaa/item.cpp @@ -2,9 +2,7 @@ namespace aaa { -void -Item::go ( ) +void Item::go() { } - } diff --git a/Tests/QtAutogen/same_name/aaa/item.hpp b/Tests/QtAutogen/same_name/aaa/item.hpp index 3c24275..68476ce 100644 --- a/Tests/QtAutogen/same_name/aaa/item.hpp +++ b/Tests/QtAutogen/same_name/aaa/item.hpp @@ -9,9 +9,8 @@ class Item : public QObject { Q_OBJECT Q_SLOT - void go ( ); + void go(); }; - } #endif diff --git a/Tests/QtAutogen/same_name/bbb/aaa/item.cpp b/Tests/QtAutogen/same_name/bbb/aaa/item.cpp index 36d5b6d..ac4b2c2 100644 --- a/Tests/QtAutogen/same_name/bbb/aaa/item.cpp +++ b/Tests/QtAutogen/same_name/bbb/aaa/item.cpp @@ -3,10 +3,8 @@ namespace bbb { namespace aaa { -void -Item::go ( ) +void Item::go() { } - } } diff --git a/Tests/QtAutogen/same_name/bbb/aaa/item.hpp b/Tests/QtAutogen/same_name/bbb/aaa/item.hpp index 35a3686..0a8e024 100644 --- a/Tests/QtAutogen/same_name/bbb/aaa/item.hpp +++ b/Tests/QtAutogen/same_name/bbb/aaa/item.hpp @@ -10,9 +10,8 @@ class Item : public QObject { Q_OBJECT Q_SLOT - void go ( ); + void go(); }; - } } diff --git a/Tests/QtAutogen/same_name/bbb/item.cpp b/Tests/QtAutogen/same_name/bbb/item.cpp index 064295b..f97a143 100644 --- a/Tests/QtAutogen/same_name/bbb/item.cpp +++ b/Tests/QtAutogen/same_name/bbb/item.cpp @@ -2,9 +2,7 @@ namespace bbb { -void -Item::go ( ) +void Item::go() { } - } diff --git a/Tests/QtAutogen/same_name/bbb/item.hpp b/Tests/QtAutogen/same_name/bbb/item.hpp index eda84a2..3da5837 100644 --- a/Tests/QtAutogen/same_name/bbb/item.hpp +++ b/Tests/QtAutogen/same_name/bbb/item.hpp @@ -9,9 +9,8 @@ class Item : public QObject { Q_OBJECT Q_SLOT - void go ( ); + void go(); }; - } #endif diff --git a/Tests/QtAutogen/same_name/ccc/item.cpp b/Tests/QtAutogen/same_name/ccc/item.cpp index 12c71d0..d90b2b8 100644 --- a/Tests/QtAutogen/same_name/ccc/item.cpp +++ b/Tests/QtAutogen/same_name/ccc/item.cpp @@ -2,8 +2,7 @@ namespace ccc { -void -Item::go ( ) +void Item::go() { } @@ -11,14 +10,12 @@ class MocTest : public QObject { Q_OBJECT; Q_SLOT - void go ( ); + void go(); }; -void -MocTest::go() +void MocTest::go() { } - } // Include own moc files diff --git a/Tests/QtAutogen/same_name/ccc/item.hpp b/Tests/QtAutogen/same_name/ccc/item.hpp index 6386dc6..c855936 100644 --- a/Tests/QtAutogen/same_name/ccc/item.hpp +++ b/Tests/QtAutogen/same_name/ccc/item.hpp @@ -9,9 +9,8 @@ class Item : public QObject { Q_OBJECT Q_SLOT - void go ( ); + void go(); }; - } #endif diff --git a/Tests/QtAutogen/same_name/main.cpp b/Tests/QtAutogen/same_name/main.cpp index fc77a99..a4ffcb3 100644 --- a/Tests/QtAutogen/same_name/main.cpp +++ b/Tests/QtAutogen/same_name/main.cpp @@ -4,7 +4,7 @@ #include "bbb/item.hpp" #include "ccc/item.hpp" -int main(int argv, char **args) +int main(int argv, char** args) { // Object instances ::aaa::Item aaa_item; diff --git a/Tests/QtAutogen/second_widget.cpp b/Tests/QtAutogen/second_widget.cpp index 65ba962..c575f10 100644 --- a/Tests/QtAutogen/second_widget.cpp +++ b/Tests/QtAutogen/second_widget.cpp @@ -2,8 +2,9 @@ #include "second_widget.h" #include "ui_second_widget.h" -SecondWidget::SecondWidget(QWidget *parent) - : QWidget(parent), ui(new Ui::SecondWidget) +SecondWidget::SecondWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::SecondWidget) { ui->setupUi(this); } diff --git a/Tests/QtAutogen/second_widget.h b/Tests/QtAutogen/second_widget.h index fe4d175..c7929c4 100644 --- a/Tests/QtAutogen/second_widget.h +++ b/Tests/QtAutogen/second_widget.h @@ -1,8 +1,7 @@ #include <QWidget> -namespace Ui -{ +namespace Ui { class SecondWidget; } @@ -10,7 +9,7 @@ class SecondWidget : public QWidget { Q_OBJECT public: - explicit SecondWidget(QWidget *parent = 0); + explicit SecondWidget(QWidget* parent = 0); ~SecondWidget(); diff --git a/Tests/QtAutogen/sub/bar.h b/Tests/QtAutogen/sub/bar.h index db56b8e..c96e123 100644 --- a/Tests/QtAutogen/sub/bar.h +++ b/Tests/QtAutogen/sub/bar.h @@ -19,10 +19,10 @@ class Bar : public QObject { Q_OBJECT - public: - Bar(); - public slots: - void doBar(); +public: + Bar(); +public slots: + void doBar(); }; #endif diff --git a/Tests/QtAutogen/sub/uiconly.cpp b/Tests/QtAutogen/sub/uiconly.cpp index cdb3318..ac22789 100644 --- a/Tests/QtAutogen/sub/uiconly.cpp +++ b/Tests/QtAutogen/sub/uiconly.cpp @@ -1,10 +1,10 @@ #include "uiconly.h" -UicOnly::UicOnly(QWidget *parent) - : QWidget(parent), ui(new Ui::UicOnly) +UicOnly::UicOnly(QWidget* parent) + : QWidget(parent) + , ui(new Ui::UicOnly) { - } int main() diff --git a/Tests/QtAutogen/sub/uiconly.h b/Tests/QtAutogen/sub/uiconly.h index 9e21f82..9b0b1b4 100644 --- a/Tests/QtAutogen/sub/uiconly.h +++ b/Tests/QtAutogen/sub/uiconly.h @@ -11,7 +11,7 @@ class UicOnly : public QWidget { Q_OBJECT public: - explicit UicOnly(QWidget *parent = 0); + explicit UicOnly(QWidget* parent = 0); private: const std::auto_ptr<Ui::UicOnly> ui; diff --git a/Tests/QtAutogen/xyz.cpp b/Tests/QtAutogen/xyz.cpp index a3562a3..c3c598e 100644 --- a/Tests/QtAutogen/xyz.cpp +++ b/Tests/QtAutogen/xyz.cpp @@ -11,17 +11,15 @@ See the License for more information. ============================================================================*/ - #include "xyz.h" #include <stdio.h> Xyz::Xyz() -:QObject() + : QObject() { } - void Xyz::doXyz() { printf("This is xyz !\n"); diff --git a/Tests/QtAutogen/xyz.h b/Tests/QtAutogen/xyz.h index 8175d37..1ba09a3 100644 --- a/Tests/QtAutogen/xyz.h +++ b/Tests/QtAutogen/xyz.h @@ -19,10 +19,10 @@ class Xyz : public QObject { Q_OBJECT - public: - Xyz(); - public slots: - void doXyz(); +public: + Xyz(); +public slots: + void doXyz(); }; #endif diff --git a/Tests/QtAutogen/yaf.cpp b/Tests/QtAutogen/yaf.cpp index d278ab4..09335a9 100644 --- a/Tests/QtAutogen/yaf.cpp +++ b/Tests/QtAutogen/yaf.cpp @@ -11,7 +11,6 @@ See the License for more information. ============================================================================*/ - #include "yaf.h" #include "yaf_p.h" @@ -21,7 +20,6 @@ Yaf::Yaf() { } - void Yaf::doYaf() { YafP yafP; diff --git a/Tests/QtAutogen/yaf.h b/Tests/QtAutogen/yaf.h index 8689f83..9755ca0 100644 --- a/Tests/QtAutogen/yaf.h +++ b/Tests/QtAutogen/yaf.h @@ -16,10 +16,11 @@ class Yaf { - public: - Yaf(); - public: - void doYaf(); +public: + Yaf(); + +public: + void doYaf(); }; #endif diff --git a/Tests/QtAutogen/yaf_p.h b/Tests/QtAutogen/yaf_p.h index f0368ad..cf317b8 100644 --- a/Tests/QtAutogen/yaf_p.h +++ b/Tests/QtAutogen/yaf_p.h @@ -21,10 +21,10 @@ class YafP : public QObject { Q_OBJECT - public: - YafP() {} - public slots: - void doYafP() { printf("I am yet another file !\n"); } +public: + YafP() {} +public slots: + void doYafP() { printf("I am yet another file !\n"); } }; #endif diff --git a/Tests/RunCMake/AutoExportDll/hello.cxx b/Tests/RunCMake/AutoExportDll/hello.cxx index 4196948..533fd3e 100644 --- a/Tests/RunCMake/AutoExportDll/hello.cxx +++ b/Tests/RunCMake/AutoExportDll/hello.cxx @@ -9,5 +9,5 @@ void hello() { printf("hello"); } -void Hello::operator delete[](void*) {}; -void Hello::operator delete(void*) {}; +void Hello::operator delete[](void*){}; +void Hello::operator delete(void*){}; diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index 0d78d4b..0178688 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -6,12 +6,11 @@ #define WINAPI #endif -extern "C" -{ +extern "C" { // test __cdecl stuff - int WINAPI foo(); +int WINAPI foo(); // test regular C - int bar(); +int bar(); } // test c++ functions diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c index bcb8745..0795aaa 100644 --- a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c @@ -1,2 +1,5 @@ #include <MakeInProjectOnly.h> -int main() { return MakeInProjectOnly(); } +int main() +{ + return MakeInProjectOnly(); +} diff --git a/Tests/RunCMake/BuildDepends/main.c b/Tests/RunCMake/BuildDepends/main.c index 78f2de1..8488f4e 100644 --- a/Tests/RunCMake/BuildDepends/main.c +++ b/Tests/RunCMake/BuildDepends/main.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0022/empty.cpp b/Tests/RunCMake/CMP0022/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0022/empty.cpp +++ b/Tests/RunCMake/CMP0022/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0026/empty.cpp b/Tests/RunCMake/CMP0026/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0026/empty.cpp +++ b/Tests/RunCMake/CMP0026/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0037/empty.cpp b/Tests/RunCMake/CMP0037/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0037/empty.cpp +++ b/Tests/RunCMake/CMP0037/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0038/empty.cpp b/Tests/RunCMake/CMP0038/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0038/empty.cpp +++ b/Tests/RunCMake/CMP0038/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0040/empty.cpp b/Tests/RunCMake/CMP0040/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0040/empty.cpp +++ b/Tests/RunCMake/CMP0040/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0041/empty.cpp b/Tests/RunCMake/CMP0041/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0041/empty.cpp +++ b/Tests/RunCMake/CMP0041/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0042/empty.cpp b/Tests/RunCMake/CMP0042/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0042/empty.cpp +++ b/Tests/RunCMake/CMP0042/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0043/empty.cpp b/Tests/RunCMake/CMP0043/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0043/empty.cpp +++ b/Tests/RunCMake/CMP0043/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0045/empty.cpp b/Tests/RunCMake/CMP0045/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0045/empty.cpp +++ b/Tests/RunCMake/CMP0045/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0046/empty.cpp b/Tests/RunCMake/CMP0046/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0046/empty.cpp +++ b/Tests/RunCMake/CMP0046/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0049/empty.cpp b/Tests/RunCMake/CMP0049/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0049/empty.cpp +++ b/Tests/RunCMake/CMP0049/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0050/empty.cpp b/Tests/RunCMake/CMP0050/empty.cpp index 182ea29..bf7d5c9 100644 --- a/Tests/RunCMake/CMP0050/empty.cpp +++ b/Tests/RunCMake/CMP0050/empty.cpp @@ -4,7 +4,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0051/empty.cpp b/Tests/RunCMake/CMP0051/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CMP0051/empty.cpp +++ b/Tests/RunCMake/CMP0051/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CMP0065/subproject/main.c b/Tests/RunCMake/CMP0065/subproject/main.c index 98725db..2adf396 100644 --- a/Tests/RunCMake/CMP0065/subproject/main.c +++ b/Tests/RunCMake/CMP0065/subproject/main.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main(int argc, char **argv) +int main(int argc, char** argv) { printf("Hello World\n"); return 0; diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp index 31a1337..766b775 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp @@ -1,5 +1,5 @@ int main() { - return 0; + return 0; } diff --git a/Tests/RunCMake/CPackInstallProperties/test.cpp b/Tests/RunCMake/CPackInstallProperties/test.cpp index 237c8ce..5047a34 100644 --- a/Tests/RunCMake/CPackInstallProperties/test.cpp +++ b/Tests/RunCMake/CPackInstallProperties/test.cpp @@ -1 +1,3 @@ -int main() {} +int main() +{ +} diff --git a/Tests/RunCMake/ClangTidy/main.c b/Tests/RunCMake/ClangTidy/main.c index 78f2de1..8488f4e 100644 --- a/Tests/RunCMake/ClangTidy/main.c +++ b/Tests/RunCMake/ClangTidy/main.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/ClangTidy/main.cxx b/Tests/RunCMake/ClangTidy/main.cxx index 76e8197..f8b643a 100644 --- a/Tests/RunCMake/ClangTidy/main.cxx +++ b/Tests/RunCMake/ClangTidy/main.cxx @@ -1 +1,4 @@ -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.h b/Tests/RunCMake/CommandLine/cmake_depends/test.h index fd87388..c2db61c 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends/test.h +++ b/Tests/RunCMake/CommandLine/cmake_depends/test.h @@ -1 +1,3 @@ -void test(void) {} +void test(void) +{ +} diff --git a/Tests/RunCMake/CompatibleInterface/main.cpp b/Tests/RunCMake/CompatibleInterface/main.cpp index 65eddcf..1c19e8d 100644 --- a/Tests/RunCMake/CompatibleInterface/main.cpp +++ b/Tests/RunCMake/CompatibleInterface/main.cpp @@ -1,5 +1,5 @@ -int main(int argc, char **argv) +int main(int argc, char** argv) { return 0; } diff --git a/Tests/RunCMake/CompileFeatures/empty.c b/Tests/RunCMake/CompileFeatures/empty.c index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CompileFeatures/empty.c +++ b/Tests/RunCMake/CompileFeatures/empty.c @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CompileFeatures/empty.cpp b/Tests/RunCMake/CompileFeatures/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/CompileFeatures/empty.cpp +++ b/Tests/RunCMake/CompileFeatures/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/CompilerLauncher/main.c b/Tests/RunCMake/CompilerLauncher/main.c index 03b2213..8488f4e 100644 --- a/Tests/RunCMake/CompilerLauncher/main.c +++ b/Tests/RunCMake/CompilerLauncher/main.c @@ -1,3 +1,4 @@ -int main(void) { +int main(void) +{ return 0; } diff --git a/Tests/RunCMake/CompilerLauncher/main.cxx b/Tests/RunCMake/CompilerLauncher/main.cxx index 76e8197..f8b643a 100644 --- a/Tests/RunCMake/CompilerLauncher/main.cxx +++ b/Tests/RunCMake/CompilerLauncher/main.cxx @@ -1 +1,4 @@ -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx index e5e94f2..6ce7183 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx +++ b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx @@ -1,4 +1,4 @@ -int main(int, char **) +int main(int, char**) { return 13; } diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx index 630adc6..a3dd891 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx +++ b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exitsuccess.cxx @@ -1,4 +1,4 @@ -int main(int, char **) +int main(int, char**) { return 0; } diff --git a/Tests/RunCMake/ExportWithoutLanguage/header.h b/Tests/RunCMake/ExportWithoutLanguage/header.h index 0c803ed..5461f8a 100644 --- a/Tests/RunCMake/ExportWithoutLanguage/header.h +++ b/Tests/RunCMake/ExportWithoutLanguage/header.h @@ -1,2 +1,5 @@ -enum some_compilers { need_more_than_nothing }; +enum some_compilers +{ + need_more_than_nothing +}; diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c index 563eef0..f097d0a 100644 --- a/Tests/RunCMake/File_Generate/empty.c +++ b/Tests/RunCMake/File_Generate/empty.c @@ -2,7 +2,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty_c() + int empty_c() { return 0; } diff --git a/Tests/RunCMake/File_Generate/empty.cpp b/Tests/RunCMake/File_Generate/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/File_Generate/empty.cpp +++ b/Tests/RunCMake/File_Generate/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp index 4149bb9..ebf1b87 100644 --- a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp +++ b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp @@ -1,24 +1,25 @@ // simple workaround to some compiler specific problems -// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +// see +// http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 #include <algorithm> #include "mex.h" -// this test should return a matrix of 10 x 10 and should check some of the arguments +// this test should return a matrix of 10 x 10 and should check some of the +// arguments -void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +void mexFunction(const int nlhs, mxArray* plhs[], const int nrhs, + const mxArray* prhs[]) { - if(nrhs != 1) - { + if (nrhs != 1) { mexErrMsgTxt("Incorrect arguments"); } size_t dim1 = mxGetM(prhs[0]); size_t dim2 = mxGetN(prhs[0]); - if(dim1 == 1 || dim2 == 1) - { + if (dim1 == 1 || dim2 == 1) { mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); } diff --git a/Tests/RunCMake/Framework/foo.c b/Tests/RunCMake/Framework/foo.c index bf7759e..b85b60d 100644 --- a/Tests/RunCMake/Framework/foo.c +++ b/Tests/RunCMake/Framework/foo.c @@ -1 +1,4 @@ -int foo() { return 42; } +int foo() +{ + return 42; +} diff --git a/Tests/RunCMake/IncludeWhatYouUse/main.c b/Tests/RunCMake/IncludeWhatYouUse/main.c index 78f2de1..8488f4e 100644 --- a/Tests/RunCMake/IncludeWhatYouUse/main.c +++ b/Tests/RunCMake/IncludeWhatYouUse/main.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/IncludeWhatYouUse/main.cxx b/Tests/RunCMake/IncludeWhatYouUse/main.cxx index 76e8197..f8b643a 100644 --- a/Tests/RunCMake/IncludeWhatYouUse/main.cxx +++ b/Tests/RunCMake/IncludeWhatYouUse/main.cxx @@ -1 +1,4 @@ -int main() { return 0; } +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/IncompatibleQt/main.cpp b/Tests/RunCMake/IncompatibleQt/main.cpp index 140a7c1..410e13c 100644 --- a/Tests/RunCMake/IncompatibleQt/main.cpp +++ b/Tests/RunCMake/IncompatibleQt/main.cpp @@ -1,7 +1,7 @@ #include <QCoreApplication> -int main(int argc, char **argv) +int main(int argc, char** argv) { QCoreApplication app(argc, argv); return app.exec(); diff --git a/Tests/RunCMake/Languages/empty.cpp b/Tests/RunCMake/Languages/empty.cpp index 7279c5e..8d91e77 100644 --- a/Tests/RunCMake/Languages/empty.cpp +++ b/Tests/RunCMake/Languages/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty(void) + int empty(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c index af20d3f..1636303 100644 --- a/Tests/RunCMake/ObjectLibrary/a.c +++ b/Tests/RunCMake/ObjectLibrary/a.c @@ -1 +1,4 @@ -int a(void) { return 0; } +int a(void) +{ + return 0; +} diff --git a/Tests/RunCMake/ObsoleteQtMacros/empty.cpp b/Tests/RunCMake/ObsoleteQtMacros/empty.cpp index 7279c5e..8d91e77 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/empty.cpp +++ b/Tests/RunCMake/ObsoleteQtMacros/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty(void) + int empty(void) { return 0; } diff --git a/Tests/RunCMake/PositionIndependentCode/main.cpp b/Tests/RunCMake/PositionIndependentCode/main.cpp index 31ba482..e9ad257 100644 --- a/Tests/RunCMake/PositionIndependentCode/main.cpp +++ b/Tests/RunCMake/PositionIndependentCode/main.cpp @@ -1,5 +1,5 @@ -int main(int,char**) +int main(int, char**) { return 0; } diff --git a/Tests/RunCMake/TargetPolicies/empty.cpp b/Tests/RunCMake/TargetPolicies/empty.cpp index 7279c5e..8d91e77 100644 --- a/Tests/RunCMake/TargetPolicies/empty.cpp +++ b/Tests/RunCMake/TargetPolicies/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty(void) + int empty(void) { return 0; } diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/TargetSources/empty_1.cpp b/Tests/RunCMake/TargetSources/empty_1.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_1.cpp +++ b/Tests/RunCMake/TargetSources/empty_1.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/TargetSources/empty_2.cpp b/Tests/RunCMake/TargetSources/empty_2.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_2.cpp +++ b/Tests/RunCMake/TargetSources/empty_2.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/TargetSources/empty_3.cpp b/Tests/RunCMake/TargetSources/empty_3.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_3.cpp +++ b/Tests/RunCMake/TargetSources/empty_3.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/TargetSources/empty_4.cpp b/Tests/RunCMake/TargetSources/empty_4.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/TargetSources/empty_4.cpp +++ b/Tests/RunCMake/TargetSources/empty_4.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/VS10Project/foo.cpp b/Tests/RunCMake/VS10Project/foo.cpp index 2fb55ee..3695dc9 100644 --- a/Tests/RunCMake/VS10Project/foo.cpp +++ b/Tests/RunCMake/VS10Project/foo.cpp @@ -1 +1,3 @@ -void foo() { } +void foo() +{ +} diff --git a/Tests/RunCMake/XcodeProject/foo.cpp b/Tests/RunCMake/XcodeProject/foo.cpp index 2fb55ee..3695dc9 100644 --- a/Tests/RunCMake/XcodeProject/foo.cpp +++ b/Tests/RunCMake/XcodeProject/foo.cpp @@ -1 +1,3 @@ -void foo() { } +void foo() +{ +} diff --git a/Tests/RunCMake/XcodeProject/main.cpp b/Tests/RunCMake/XcodeProject/main.cpp index 1695921..c94753f 100644 --- a/Tests/RunCMake/XcodeProject/main.cpp +++ b/Tests/RunCMake/XcodeProject/main.cpp @@ -1,3 +1,4 @@ -int main(int argc, const char * argv[]) { - return 0; +int main(int argc, const char* argv[]) +{ + return 0; } diff --git a/Tests/RunCMake/alias_targets/empty.cpp b/Tests/RunCMake/alias_targets/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/alias_targets/empty.cpp +++ b/Tests/RunCMake/alias_targets/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/include/empty.cpp b/Tests/RunCMake/include/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/include/empty.cpp +++ b/Tests/RunCMake/include/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/install/main.c b/Tests/RunCMake/install/main.c index 78f2de1..8488f4e 100644 --- a/Tests/RunCMake/install/main.c +++ b/Tests/RunCMake/install/main.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/pseudo_emulator.c b/Tests/RunCMake/pseudo_emulator.c index 9308f75..15f64dc 100644 --- a/Tests/RunCMake/pseudo_emulator.c +++ b/Tests/RunCMake/pseudo_emulator.c @@ -1,15 +1,14 @@ #include <stdio.h> -int main(int argc, char * argv[] ) +int main(int argc, char* argv[]) { - int ii; + int ii; - printf("Command:"); - for(ii = 1; ii < argc; ++ii) - { - printf(" \"%s\"", argv[ii]); - } - printf("\n"); + printf("Command:"); + for (ii = 1; ii < argc; ++ii) { + printf(" \"%s\"", argv[ii]); + } + printf("\n"); - return 42; + return 42; } diff --git a/Tests/RunCMake/pseudo_emulator_custom_command.c b/Tests/RunCMake/pseudo_emulator_custom_command.c index 17181c9..760e83c 100644 --- a/Tests/RunCMake/pseudo_emulator_custom_command.c +++ b/Tests/RunCMake/pseudo_emulator_custom_command.c @@ -16,19 +16,16 @@ int main(int argc, const char* argv[]) const char* substring_failure = "generated_exe_emulator_unexpected"; const char* substring_success = "generated_exe_emulator_expected"; const char* str = argv[1]; - if (argc < 2) - { + if (argc < 2) { return EXIT_FAILURE; - } - if (strstr(str, substring_success) != 0) - { + } + if (strstr(str, substring_success) != 0) { return EXIT_SUCCESS; - } - if (strstr(str, substring_failure) != 0) - { + } + if (strstr(str, substring_failure) != 0) { return EXIT_FAILURE; - } - fprintf(stderr, "Failed to find string '%s' in '%s'\n", - substring_success, str); + } + fprintf(stderr, "Failed to find string '%s' in '%s'\n", substring_success, + str); return EXIT_FAILURE; } diff --git a/Tests/RunCMake/pseudo_tidy.c b/Tests/RunCMake/pseudo_tidy.c index 766c990..c950d03 100644 --- a/Tests/RunCMake/pseudo_tidy.c +++ b/Tests/RunCMake/pseudo_tidy.c @@ -3,14 +3,12 @@ int main(int argc, char* argv[]) { int i; - for (i = 1; i < argc; ++i) - { - if (argv[i][0] != '-') - { + for (i = 1; i < argc; ++i) { + if (argv[i][0] != '-') { fprintf(stdout, "%s:0:0: warning: message [checker]\n", argv[i]); break; - } } + } fprintf(stderr, "1 warning generated.\n"); return 0; } diff --git a/Tests/RunCMake/target_compile_features/empty.c b/Tests/RunCMake/target_compile_features/empty.c index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/target_compile_features/empty.c +++ b/Tests/RunCMake/target_compile_features/empty.c @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/target_compile_features/empty.cpp b/Tests/RunCMake/target_compile_features/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/target_compile_features/empty.cpp +++ b/Tests/RunCMake/target_compile_features/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/target_link_libraries/empty.cpp b/Tests/RunCMake/target_link_libraries/empty.cpp index bfbbdde..11ec041 100644 --- a/Tests/RunCMake/target_link_libraries/empty.cpp +++ b/Tests/RunCMake/target_link_libraries/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty() + int empty() { return 0; } diff --git a/Tests/RunCMake/try_compile/other.c b/Tests/RunCMake/try_compile/other.c index 6c24f10..85c4ef8 100644 --- a/Tests/RunCMake/try_compile/other.c +++ b/Tests/RunCMake/try_compile/other.c @@ -1 +1,4 @@ -int other(void) { return 0; } +int other(void) +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/src.c b/Tests/RunCMake/try_compile/src.c index ab83eb6..5e51382 100644 --- a/Tests/RunCMake/try_compile/src.c +++ b/Tests/RunCMake/try_compile/src.c @@ -1,4 +1,7 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} #ifdef PP_ERROR -# error PP_ERROR is defined +#error PP_ERROR is defined #endif diff --git a/Tests/RunCMake/try_run/src.c b/Tests/RunCMake/try_run/src.c index 78f2de1..8488f4e 100644 --- a/Tests/RunCMake/try_run/src.c +++ b/Tests/RunCMake/try_run/src.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/RuntimePath/bar1.c b/Tests/RuntimePath/bar1.c index ebad8d2..5dc5ec9 100644 --- a/Tests/RuntimePath/bar1.c +++ b/Tests/RuntimePath/bar1.c @@ -1,2 +1,5 @@ extern int foo1(); -int bar1() { return foo1(); } +int bar1() +{ + return foo1(); +} diff --git a/Tests/RuntimePath/bar2.c b/Tests/RuntimePath/bar2.c index 60d5e68..9035489 100644 --- a/Tests/RuntimePath/bar2.c +++ b/Tests/RuntimePath/bar2.c @@ -1,2 +1,5 @@ extern int foo2(); -int bar2() { return foo2(); } +int bar2() +{ + return foo2(); +} diff --git a/Tests/RuntimePath/foo1.c b/Tests/RuntimePath/foo1.c index 27cd912..dfcb0b7 100644 --- a/Tests/RuntimePath/foo1.c +++ b/Tests/RuntimePath/foo1.c @@ -1 +1,4 @@ -int foo1() { return 0; } +int foo1() +{ + return 0; +} diff --git a/Tests/RuntimePath/foo2.c b/Tests/RuntimePath/foo2.c index 40b4f56..12a3e77 100644 --- a/Tests/RuntimePath/foo2.c +++ b/Tests/RuntimePath/foo2.c @@ -1 +1,4 @@ -int foo2() { return 0; } +int foo2() +{ + return 0; +} diff --git a/Tests/SBCS/SBCS.cxx b/Tests/SBCS/SBCS.cxx index 6ce2c9f..68c2283 100644 --- a/Tests/SBCS/SBCS.cxx +++ b/Tests/SBCS/SBCS.cxx @@ -1,21 +1,22 @@ -// Test to verify that _SBCS being defined causes CharacterSet to be set to 0 (Single Byte Character Set) +// Test to verify that _SBCS being defined causes CharacterSet to be set to 0 +// (Single Byte Character Set) -int main () +int main() { #ifdef _UNICODE - bool UnicodeSet=true; + bool UnicodeSet = true; #else - bool UnicodeSet=false; + bool UnicodeSet = false; #endif #ifdef _MBCS - bool MBCSSet=true; + bool MBCSSet = true; #else - bool MBCSSet=false; + bool MBCSSet = false; #endif // if neither _UNICODE nor _MBCS is set, CharacterSet must be set to SBCS. - bool SBCSSet=(!UnicodeSet && !MBCSSet); + bool SBCSSet = (!UnicodeSet && !MBCSSet); // Reverse boolean to indicate error case correctly return !SBCSSet; diff --git a/Tests/SameName/Exe1/conly.c b/Tests/SameName/Exe1/conly.c index eb62c30..8f2ce05 100644 --- a/Tests/SameName/Exe1/conly.c +++ b/Tests/SameName/Exe1/conly.c @@ -1,12 +1,11 @@ #include "libc1.h" #include <stdio.h> -int main () +int main() { - if ( LibC1Func() != 2.0 ) - { + if (LibC1Func() != 2.0) { printf("Problem with libc1\n"); return 1; - } + } return 0; } diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c index f59c318..b934356 100644 --- a/Tests/SetLang/bar.c +++ b/Tests/SetLang/bar.c @@ -4,18 +4,17 @@ int foo(); class A { public: - A() {this->i = foo();} + A() { this->i = foo(); } int i; }; int main() { A a; - if(a.i == 21) - { + if (a.i == 21) { printf("passed foo is 21\n"); return 0; - } + } printf("Failed foo is not 21\n"); return -1; } diff --git a/Tests/SetLang/foo.c b/Tests/SetLang/foo.c index e7918af..551dd1b 100644 --- a/Tests/SetLang/foo.c +++ b/Tests/SetLang/foo.c @@ -2,6 +2,6 @@ int foo() { int r = 10; r++; - int ret = r+10; + int ret = r + 10; return ret; } diff --git a/Tests/Simple/simple.cxx b/Tests/Simple/simple.cxx index 7bee7c0..5aa689b 100644 --- a/Tests/Simple/simple.cxx +++ b/Tests/Simple/simple.cxx @@ -2,7 +2,7 @@ extern void simpleLib(); extern "C" int FooBar(); extern int bar(); extern int bar1(); -int main () +int main() { FooBar(); bar(); diff --git a/Tests/Simple/simpleCLib.c b/Tests/Simple/simpleCLib.c index 88fc33e..6509865 100644 --- a/Tests/Simple/simpleCLib.c +++ b/Tests/Simple/simpleCLib.c @@ -4,9 +4,8 @@ int FooBar() { int class; int private = 10; - for ( class = 0; class < private; class ++ ) - { + for (class = 0; class < private; class ++) { printf("Count: %d/%d\n", class, private); - } + } return 0; } diff --git a/Tests/Simple/simpleWe.cpp b/Tests/Simple/simpleWe.cpp index e0f22ef..5211c91 100644 --- a/Tests/Simple/simpleWe.cpp +++ b/Tests/Simple/simpleWe.cpp @@ -3,10 +3,7 @@ class Foo { public: - Foo() - { - printf("This one has nonstandard extension\n"); - } + Foo() { printf("This one has nonstandard extension\n"); } int getnum() { return 0; } }; diff --git a/Tests/SimpleCOnly/bar.c b/Tests/SimpleCOnly/bar.c index 5d8eac0..570fee9 100644 --- a/Tests/SimpleCOnly/bar.c +++ b/Tests/SimpleCOnly/bar.c @@ -1 +1,4 @@ -int bar() {return 5;} +int bar() +{ + return 5; +} diff --git a/Tests/SimpleCOnly/foo.c b/Tests/SimpleCOnly/foo.c index b8cdea4..c61d212 100644 --- a/Tests/SimpleCOnly/foo.c +++ b/Tests/SimpleCOnly/foo.c @@ -1 +1,4 @@ -int foo() { return 12;} +int foo() +{ + return 12; +} diff --git a/Tests/SimpleCOnly/main.c b/Tests/SimpleCOnly/main.c index 022a8e8..54a7312 100644 --- a/Tests/SimpleCOnly/main.c +++ b/Tests/SimpleCOnly/main.c @@ -5,8 +5,8 @@ extern int bar(); int main() { - int i=foo(); - int k=bar(); - i=i*k; - return i; + int i = foo(); + int k = bar(); + i = i * k; + return i; } diff --git a/Tests/SimpleExclude/dirC/dirA/t4.c b/Tests/SimpleExclude/dirC/dirA/t4.c index 7c36ca9..b0e4000 100644 --- a/Tests/SimpleExclude/dirC/dirA/t4.c +++ b/Tests/SimpleExclude/dirC/dirA/t4.c @@ -4,14 +4,14 @@ int main() { int ac; - char*av[]; + char* av[]; #else - int main(int ac, char*av[]) - { +int main(int ac, char* av[]) +{ #endif - if(ac > 1000){return *av[0];} - printf("This is T4. This one should work.\n"); - return 0; - } - - + if (ac > 1000) { + return *av[0]; + } + printf("This is T4. This one should work.\n"); + return 0; +} diff --git a/Tests/SimpleExclude/dirC/dirB/t7.c b/Tests/SimpleExclude/dirC/dirB/t7.c index b95d3ec..b613e91 100644 --- a/Tests/SimpleExclude/dirC/dirB/t7.c +++ b/Tests/SimpleExclude/dirC/dirB/t7.c @@ -6,11 +6,10 @@ int tlib7func() { printf("This is T7\n"); - if ( tlib2func() != 2 ) - { + if (tlib2func() != 2) { fprintf(stderr, "Something wrong with T2\n"); return 1; - } + } return 7; } diff --git a/Tests/SimpleExclude/dirD/t9.c b/Tests/SimpleExclude/dirD/t9.c index 321014b..9954ea5 100644 --- a/Tests/SimpleExclude/dirD/t9.c +++ b/Tests/SimpleExclude/dirD/t9.c @@ -6,19 +6,19 @@ extern int tlib7func(); int main() { int ac; - char*av[]; + char* av[]; #else - int main(int ac, char*av[]) - { +int main(int ac, char* av[]) +{ #endif - if(ac > 1000){return *av[0];} - printf("This is T9. This one should work.\n"); - - if ( tlib7func() != 7 ) - { - fprintf(stderr, "Something wrong with T7\n"); - return 1; - } - return 0; - } + if (ac > 1000) { + return *av[0]; + } + printf("This is T9. This one should work.\n"); + if (tlib7func() != 7) { + fprintf(stderr, "Something wrong with T7\n"); + return 1; + } + return 0; +} diff --git a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx index 0277f05..0f32894 100644 --- a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx +++ b/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx @@ -2,9 +2,8 @@ int TSD(const char* foo) { - if ( strcmp(foo, "TEST") == 0 ) - { + if (strcmp(foo, "TEST") == 0) { return 0; - } + } return 1; } diff --git a/Tests/SimpleInstall/foo.h b/Tests/SimpleInstall/foo.h index 2708baf..216cdf6 100644 --- a/Tests/SimpleInstall/foo.h +++ b/Tests/SimpleInstall/foo.h @@ -8,4 +8,3 @@ extern int SomeFunctionInFoo(); #ifdef __cplusplus } #endif - diff --git a/Tests/SimpleInstall/inst.cxx b/Tests/SimpleInstall/inst.cxx index 7f2962d..ecf061c 100644 --- a/Tests/SimpleInstall/inst.cxx +++ b/Tests/SimpleInstall/inst.cxx @@ -1,37 +1,34 @@ #include "foo.h" #ifdef STAGE_2 -# include <foo/lib1.h> -# include <foo/lib2renamed.h> -# include <lib3.h> -# include <old/lib2.h> -# include <old/lib3.h> +#include <foo/lib1.h> +#include <foo/lib2renamed.h> +#include <lib3.h> +#include <old/lib2.h> +#include <old/lib3.h> #else -# include "lib1.h" -# include "lib2.h" +#include "lib1.h" +#include "lib2.h" #endif #include "lib4.h" #include <stdio.h> -int main () +int main() { - if ( Lib1Func() != 2.0 ) - { + if (Lib1Func() != 2.0) { printf("Problem with lib1\n"); return 1; - } - if ( Lib2Func() != 1.0 ) - { + } + if (Lib2Func() != 1.0) { printf("Problem with lib2\n"); return 1; - } - if ( Lib4Func() != 4.0 ) - { + } + if (Lib4Func() != 4.0) { printf("Problem with lib4\n"); return 1; - } + } printf("The value of Foo: %s\n", foo); - return SomeFunctionInFoo()-5; + return SomeFunctionInFoo() - 5; } diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h index d69b786..a3ed758 100644 --- a/Tests/SimpleInstall/lib2.h +++ b/Tests/SimpleInstall/lib2.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef test2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef test2_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h index 66bc52a..df11327 100644 --- a/Tests/SimpleInstall/lib3.h +++ b/Tests/SimpleInstall/lib3.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef test3_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef test3_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstall/lib4.cxx b/Tests/SimpleInstall/lib4.cxx index fbfa23a..fbede5c 100644 --- a/Tests/SimpleInstall/lib4.cxx +++ b/Tests/SimpleInstall/lib4.cxx @@ -4,4 +4,3 @@ float Lib4Func() { return 4.0; } - diff --git a/Tests/SimpleInstall/lib4.h b/Tests/SimpleInstall/lib4.h index 11c1272..71425a5 100644 --- a/Tests/SimpleInstall/lib4.h +++ b/Tests/SimpleInstall/lib4.h @@ -1,12 +1,11 @@ #ifdef _WIN32 -# ifdef test4_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef test4_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib4Func(); - diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx index 0277f05..0f32894 100644 --- a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx +++ b/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx @@ -2,9 +2,8 @@ int TSD(const char* foo) { - if ( strcmp(foo, "TEST") == 0 ) - { + if (strcmp(foo, "TEST") == 0) { return 0; - } + } return 1; } diff --git a/Tests/SimpleInstallS2/foo.h b/Tests/SimpleInstallS2/foo.h index 2708baf..216cdf6 100644 --- a/Tests/SimpleInstallS2/foo.h +++ b/Tests/SimpleInstallS2/foo.h @@ -8,4 +8,3 @@ extern int SomeFunctionInFoo(); #ifdef __cplusplus } #endif - diff --git a/Tests/SimpleInstallS2/inst.cxx b/Tests/SimpleInstallS2/inst.cxx index 7f2962d..ecf061c 100644 --- a/Tests/SimpleInstallS2/inst.cxx +++ b/Tests/SimpleInstallS2/inst.cxx @@ -1,37 +1,34 @@ #include "foo.h" #ifdef STAGE_2 -# include <foo/lib1.h> -# include <foo/lib2renamed.h> -# include <lib3.h> -# include <old/lib2.h> -# include <old/lib3.h> +#include <foo/lib1.h> +#include <foo/lib2renamed.h> +#include <lib3.h> +#include <old/lib2.h> +#include <old/lib3.h> #else -# include "lib1.h" -# include "lib2.h" +#include "lib1.h" +#include "lib2.h" #endif #include "lib4.h" #include <stdio.h> -int main () +int main() { - if ( Lib1Func() != 2.0 ) - { + if (Lib1Func() != 2.0) { printf("Problem with lib1\n"); return 1; - } - if ( Lib2Func() != 1.0 ) - { + } + if (Lib2Func() != 1.0) { printf("Problem with lib2\n"); return 1; - } - if ( Lib4Func() != 4.0 ) - { + } + if (Lib4Func() != 4.0) { printf("Problem with lib4\n"); return 1; - } + } printf("The value of Foo: %s\n", foo); - return SomeFunctionInFoo()-5; + return SomeFunctionInFoo() - 5; } diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h index d69b786..a3ed758 100644 --- a/Tests/SimpleInstallS2/lib2.h +++ b/Tests/SimpleInstallS2/lib2.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef test2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef test2_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h index 66bc52a..df11327 100644 --- a/Tests/SimpleInstallS2/lib3.h +++ b/Tests/SimpleInstallS2/lib3.h @@ -1,11 +1,11 @@ #ifdef _WIN32 -# ifdef test3_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef test3_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstallS2/lib4.cxx b/Tests/SimpleInstallS2/lib4.cxx index fbfa23a..fbede5c 100644 --- a/Tests/SimpleInstallS2/lib4.cxx +++ b/Tests/SimpleInstallS2/lib4.cxx @@ -4,4 +4,3 @@ float Lib4Func() { return 4.0; } - diff --git a/Tests/SimpleInstallS2/lib4.h b/Tests/SimpleInstallS2/lib4.h index 11c1272..71425a5 100644 --- a/Tests/SimpleInstallS2/lib4.h +++ b/Tests/SimpleInstallS2/lib4.h @@ -1,12 +1,11 @@ #ifdef _WIN32 -# ifdef test4_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec( dllexport ) -# else -# define CM_TEST_LIB_EXPORT __declspec( dllimport ) -# endif +#ifdef test4_EXPORTS +#define CM_TEST_LIB_EXPORT __declspec(dllexport) #else -# define CM_TEST_LIB_EXPORT +#define CM_TEST_LIB_EXPORT __declspec(dllimport) +#endif +#else +#define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib4Func(); - diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c index 212e64b..f259f98 100644 --- a/Tests/SourceGroups/main.c +++ b/Tests/SourceGroups/main.c @@ -8,6 +8,7 @@ extern int baz(void); int main() { - printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(), foobar(), barbar(), baz()); - return 0; + printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(), + foobar(), barbar(), baz()); + return 0; } diff --git a/Tests/StagingPrefix/Consumer/main.cpp b/Tests/StagingPrefix/Consumer/main.cpp index 5c0202d..d4a02bf 100644 --- a/Tests/StagingPrefix/Consumer/main.cpp +++ b/Tests/StagingPrefix/Consumer/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include "foo.h" -int main(int, char **) +int main(int, char**) { Foo f; Bar b; diff --git a/Tests/StagingPrefix/Producer/bar.h b/Tests/StagingPrefix/Producer/bar.h index acd1fae..a56bd5d 100644 --- a/Tests/StagingPrefix/Producer/bar.h +++ b/Tests/StagingPrefix/Producer/bar.h @@ -1,9 +1,9 @@ class #ifdef _WIN32 -__declspec(dllexport) + __declspec(dllexport) #endif -Bar + Bar { public: int bar(); diff --git a/Tests/StagingPrefix/Producer/foo.h b/Tests/StagingPrefix/Producer/foo.h index 614093d..17b4f77 100644 --- a/Tests/StagingPrefix/Producer/foo.h +++ b/Tests/StagingPrefix/Producer/foo.h @@ -1,9 +1,9 @@ class #ifdef _WIN32 -__declspec(dllexport) + __declspec(dllexport) #endif -Foo + Foo { public: int foo(); diff --git a/Tests/StagingPrefix/main.cpp b/Tests/StagingPrefix/main.cpp index 341aaaf..e9ad257 100644 --- a/Tests/StagingPrefix/main.cpp +++ b/Tests/StagingPrefix/main.cpp @@ -1,5 +1,5 @@ -int main(int, char **) +int main(int, char**) { return 0; } diff --git a/Tests/StringFileTest/StringFile.cxx b/Tests/StringFileTest/StringFile.cxx index 073e30c..c890e8e 100644 --- a/Tests/StringFileTest/StringFile.cxx +++ b/Tests/StringFileTest/StringFile.cxx @@ -3,7 +3,7 @@ #include "OutputFile.h" -int main(int, char*[]) +int main(int, char* []) { int res = 0; diff --git a/Tests/SubDir/Executable/test.cxx b/Tests/SubDir/Executable/test.cxx index c528fb1..06aed01 100644 --- a/Tests/SubDir/Executable/test.cxx +++ b/Tests/SubDir/Executable/test.cxx @@ -1,5 +1,5 @@ #include <stdio.h> -#include <stdlib.h> +#include <stdlib.h> #ifdef _WIN32 #include <io.h> #else @@ -10,39 +10,32 @@ int FileExists(const char* filename) { #ifdef _MSC_VER -# define access _access +#define access _access #endif #ifndef F_OK #define F_OK 0 #endif - if ( access(filename, F_OK) != 0 ) - { + if (access(filename, F_OK) != 0) { return false; - } - else - { + } else { return true; - } + } } - int main(int ac, char** av) { - if(ac <= 1) - { + if (ac <= 1) { printf("Usage: %s <file>\n", av[0]); return 1; - } - if(!FileExists(av[1])) - { + } + if (!FileExists(av[1])) { printf("Missing file %s\n", av[1]); return 1; - } - if(FileExists(av[2])) - { + } + if (FileExists(av[2])) { printf("File %s should be in subdirectory\n", av[2]); return 1; - } + } printf("%s is not there! Good.", av[2]); printf("%s is there! Good.", av[1]); return 0; diff --git a/Tests/SubDirSpaces/Executable Sources/test.cxx b/Tests/SubDirSpaces/Executable Sources/test.cxx index c528fb1..06aed01 100644 --- a/Tests/SubDirSpaces/Executable Sources/test.cxx +++ b/Tests/SubDirSpaces/Executable Sources/test.cxx @@ -1,5 +1,5 @@ #include <stdio.h> -#include <stdlib.h> +#include <stdlib.h> #ifdef _WIN32 #include <io.h> #else @@ -10,39 +10,32 @@ int FileExists(const char* filename) { #ifdef _MSC_VER -# define access _access +#define access _access #endif #ifndef F_OK #define F_OK 0 #endif - if ( access(filename, F_OK) != 0 ) - { + if (access(filename, F_OK) != 0) { return false; - } - else - { + } else { return true; - } + } } - int main(int ac, char** av) { - if(ac <= 1) - { + if (ac <= 1) { printf("Usage: %s <file>\n", av[0]); return 1; - } - if(!FileExists(av[1])) - { + } + if (!FileExists(av[1])) { printf("Missing file %s\n", av[1]); return 1; - } - if(FileExists(av[2])) - { + } + if (FileExists(av[2])) { printf("File %s should be in subdirectory\n", av[2]); return 1; - } + } printf("%s is not there! Good.", av[2]); printf("%s is there! Good.", av[1]); return 0; diff --git a/Tests/SubDirSpaces/Executable/test.cxx b/Tests/SubDirSpaces/Executable/test.cxx index c528fb1..06aed01 100644 --- a/Tests/SubDirSpaces/Executable/test.cxx +++ b/Tests/SubDirSpaces/Executable/test.cxx @@ -1,5 +1,5 @@ #include <stdio.h> -#include <stdlib.h> +#include <stdlib.h> #ifdef _WIN32 #include <io.h> #else @@ -10,39 +10,32 @@ int FileExists(const char* filename) { #ifdef _MSC_VER -# define access _access +#define access _access #endif #ifndef F_OK #define F_OK 0 #endif - if ( access(filename, F_OK) != 0 ) - { + if (access(filename, F_OK) != 0) { return false; - } - else - { + } else { return true; - } + } } - int main(int ac, char** av) { - if(ac <= 1) - { + if (ac <= 1) { printf("Usage: %s <file>\n", av[0]); return 1; - } - if(!FileExists(av[1])) - { + } + if (!FileExists(av[1])) { printf("Missing file %s\n", av[1]); return 1; - } - if(FileExists(av[2])) - { + } + if (FileExists(av[2])) { printf("File %s should be in subdirectory\n", av[2]); return 1; - } + } printf("%s is not there! Good.", av[2]); printf("%s is there! Good.", av[1]); return 0; diff --git a/Tests/SubProject/car.cxx b/Tests/SubProject/car.cxx index 95de4a3..cc3a4e0 100644 --- a/Tests/SubProject/car.cxx +++ b/Tests/SubProject/car.cxx @@ -1,6 +1,6 @@ int main(int ac, char** av) { - (void) ac; - (void) av; + (void)ac; + (void)av; return 0; } diff --git a/Tests/SubProject/foo/foo.cxx b/Tests/SubProject/foo/foo.cxx index 68fa363..50cd9e4 100644 --- a/Tests/SubProject/foo/foo.cxx +++ b/Tests/SubProject/foo/foo.cxx @@ -7,9 +7,8 @@ int main(int ac, char** av) (void)av; int ret = bar(); printf("bar = %d\n", ret); - if(ret == 10) - { + if (ret == 10) { return 0; - } + } return -1; } diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c index 13e2f8c..8877da4 100644 --- a/Tests/SwiftMix/CMain.c +++ b/Tests/SwiftMix/CMain.c @@ -1,4 +1,5 @@ extern int ObjCMain(int argc, char const* const argv[]); -int main(int argc, char* argv[]) { +int main(int argc, char* argv[]) +{ return ObjCMain(argc, argv); } diff --git a/Tests/SwigTest/example.cxx b/Tests/SwigTest/example.cxx index 1e8e203..961d6dd 100644 --- a/Tests/SwigTest/example.cxx +++ b/Tests/SwigTest/example.cxx @@ -4,25 +4,30 @@ #define M_PI 3.14159265358979323846 /* Move the shape to a new location */ -void Shape::move(double dx, double dy) { +void Shape::move(double dx, double dy) +{ x += dx; y += dy; } int Shape::nshapes = 0; -double Circle::area(void) { - return M_PI*radius*radius; +double Circle::area(void) +{ + return M_PI * radius * radius; } -double Circle::perimeter(void) { - return 2*M_PI*radius; +double Circle::perimeter(void) +{ + return 2 * M_PI * radius; } -double Square::area(void) { - return width*width; +double Square::area(void) +{ + return width * width; } -double Square::perimeter(void) { - return 4*width; +double Square::perimeter(void) +{ + return 4 * width; } diff --git a/Tests/SwigTest/example.h b/Tests/SwigTest/example.h index c9d59f2..366deb0 100644 --- a/Tests/SwigTest/example.h +++ b/Tests/SwigTest/example.h @@ -1,39 +1,37 @@ /* File : example.h */ -class Shape { +class Shape +{ public: - Shape() { - nshapes++; - } - virtual ~Shape() { - nshapes--; - }; - double x, y; - void move(double dx, double dy); + Shape() { nshapes++; } + virtual ~Shape() { nshapes--; }; + double x, y; + void move(double dx, double dy); virtual double area(void) = 0; virtual double perimeter(void) = 0; - static int nshapes; + static int nshapes; }; -class Circle : public Shape { +class Circle : public Shape +{ private: double radius; + public: - Circle(double r) : radius(r) { }; + Circle(double r) + : radius(r){}; virtual double area(void); virtual double perimeter(void); }; -class Square : public Shape { +class Square : public Shape +{ private: double width; + public: - Square(double w) : width(w) { }; + Square(double w) + : width(w){}; virtual double area(void); virtual double perimeter(void); }; - - - - - diff --git a/Tests/SystemInformation/DumpInformation.cxx b/Tests/SystemInformation/DumpInformation.cxx index acafa87..e0cc0ce 100644 --- a/Tests/SystemInformation/DumpInformation.cxx +++ b/Tests/SystemInformation/DumpInformation.cxx @@ -4,77 +4,77 @@ void cmDumpInformationPrintFile(const char* name, FILE* fout) { - fprintf(fout, - "Avoid ctest truncation of output: CTEST_FULL_OUTPUT\n"); - fprintf(fout, - "================================================================\n"); + fprintf(fout, "Avoid ctest truncation of output: CTEST_FULL_OUTPUT\n"); + fprintf( + fout, + "================================================================\n"); struct stat fs; - if(stat(name, &fs) != 0) - { + if (stat(name, &fs) != 0) { fprintf(fout, "The file \"%s\" does not exist.\n", name); fflush(fout); return; - } + } FILE* fin = fopen(name, "r"); - if(fin) - { - fprintf(fout, - "Contents of \"%s\":\n" - "----------------------------------------------------------------\n", - name); + if (fin) { + fprintf( + fout, + "Contents of \"%s\":\n" + "----------------------------------------------------------------\n", + name); const int bufferSize = 4096; char buffer[bufferSize]; int n; - while((n = fread(buffer, 1, bufferSize, fin)) > 0) - { - for(char* c = buffer; c < buffer+n; ++c) - { - switch(*c) - { - case '<': fprintf(fout, "<"); break; - case '>': fprintf(fout, ">"); break; - case '&': fprintf(fout, "&"); break; - default: putc(*c, fout); break; - } + while ((n = fread(buffer, 1, bufferSize, fin)) > 0) { + for (char* c = buffer; c < buffer + n; ++c) { + switch (*c) { + case '<': + fprintf(fout, "<"); + break; + case '>': + fprintf(fout, ">"); + break; + case '&': + fprintf(fout, "&"); + break; + default: + putc(*c, fout); + break; } - fflush(fout); } - fclose(fin); + fflush(fout); } - else - { + fclose(fin); + } else { fprintf(fout, "Error opening \"%s\" for reading.\n", name); fflush(fout); - } + } } -int main(int,char *[]) +int main(int, char* []) { - const char* files[] = - { - DumpInformation_BINARY_DIR "/SystemInformation.out", - DumpInformation_BINARY_DIR "/AllVariables.txt", - DumpInformation_BINARY_DIR "/AllCommands.txt", - DumpInformation_BINARY_DIR "/AllMacros.txt", - DumpInformation_BINARY_DIR "/OtherProperties.txt", - DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h", - DumpInformation_BINARY_DIR "/../../CMakeCache.txt", - DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeOutput.log", - DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeError.log", - DumpInformation_BINARY_DIR "/../../Bootstrap.cmk/cmake_bootstrap.log", - DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.hxx", - DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.h", - DumpInformation_BINARY_DIR "/CMakeFiles/CMakeOutput.log", - DumpInformation_BINARY_DIR "/CMakeFiles/CMakeError.log", - 0 - }; + const char* files[] = { + DumpInformation_BINARY_DIR "/SystemInformation.out", + DumpInformation_BINARY_DIR "/AllVariables.txt", + DumpInformation_BINARY_DIR "/AllCommands.txt", + DumpInformation_BINARY_DIR "/AllMacros.txt", + DumpInformation_BINARY_DIR "/OtherProperties.txt", + DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h", + DumpInformation_BINARY_DIR "/../../CMakeCache.txt", + DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeOutput.log", + DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeError.log", + DumpInformation_BINARY_DIR "/../../Bootstrap.cmk/cmake_bootstrap.log", + DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.hxx", + DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.h", + DumpInformation_BINARY_DIR "/CMakeFiles/CMakeOutput.log", + DumpInformation_BINARY_DIR "/CMakeFiles/CMakeError.log", + 0 + }; const char** f; - for(f = files; *f; ++f) - { + for (f = files; *f; ++f) { cmDumpInformationPrintFile(*f, stdout); - } + } return 0; } diff --git a/Tests/TargetName/executables/hello_world.c b/Tests/TargetName/executables/hello_world.c index 539d867..5b6eaf8 100644 --- a/Tests/TargetName/executables/hello_world.c +++ b/Tests/TargetName/executables/hello_world.c @@ -1,5 +1,5 @@ #include <stdio.h> main() { - printf("hello, world\n"); + printf("hello, world\n"); } diff --git a/Tests/TestDriver/subdir/test3.cxx b/Tests/TestDriver/subdir/test3.cxx index 976d6eb..c5a83de 100644 --- a/Tests/TestDriver/subdir/test3.cxx +++ b/Tests/TestDriver/subdir/test3.cxx @@ -1,8 +1,8 @@ #include <stdio.h> -int subdir_test3(int ac, char*av[]) +int subdir_test3(int ac, char* av[]) { printf("test3\n"); - for(int i =0; i < ac; i++) + for (int i = 0; i < ac; i++) printf("arg %d is %s\n", ac, av[i]); return 0; } diff --git a/Tests/TestDriver/test1.cxx b/Tests/TestDriver/test1.cxx index b998fda..59a6fce 100644 --- a/Tests/TestDriver/test1.cxx +++ b/Tests/TestDriver/test1.cxx @@ -5,21 +5,18 @@ int testExtraStuff2(); int test1(int ac, char* av[]) { - if(!testExtraStuff2()) - { + if (!testExtraStuff2()) { return -1; - } - if(!testExtraStuff()) - { + } + if (!testExtraStuff()) { return -1; - } - if(!testExtraStuff3()) - { + } + if (!testExtraStuff3()) { return -1; - } + } printf("test1\n"); - for(int i =0; i < ac; i++) + for (int i = 0; i < ac; i++) printf("arg %d is %s\n", ac, av[i]); return 0; } diff --git a/Tests/TestDriver/test2.cxx b/Tests/TestDriver/test2.cxx index 69f0fff..08d1e6f 100644 --- a/Tests/TestDriver/test2.cxx +++ b/Tests/TestDriver/test2.cxx @@ -1,8 +1,8 @@ #include <stdio.h> -int test2(int ac, char*av[]) +int test2(int ac, char* av[]) { printf("test2\n"); - for(int i =0; i < ac; i++) + for (int i = 0; i < ac; i++) printf("arg %d is %s\n", ac, av[i]); return 0; } diff --git a/Tests/TestDriver/testArgs.h b/Tests/TestDriver/testArgs.h index 0489366..0f1b879 100644 --- a/Tests/TestDriver/testArgs.h +++ b/Tests/TestDriver/testArgs.h @@ -1,20 +1,16 @@ -void testProccessArgs(int* ac, char***av) +void testProccessArgs(int* ac, char*** av) { char** argv = *av; - if(*ac < 2) - { + if (*ac < 2) { return; - } - if(strcmp(argv[1], "--with-threads") == 0) - { + } + if (strcmp(argv[1], "--with-threads") == 0) { printf("number of threads is %s\n", argv[2]); - *av +=2; - *ac -=2; - } - else if (strcmp(argv[1], "--without-threads") == 0) - { + *av += 2; + *ac -= 2; + } else if (strcmp(argv[1], "--without-threads") == 0) { printf("no threads\n"); *av += 1; *ac -= 1; - } + } } diff --git a/Tests/Testing/Sub/Sub2/testing2.cxx b/Tests/Testing/Sub/Sub2/testing2.cxx index 1482f27..f8b643a 100644 --- a/Tests/Testing/Sub/Sub2/testing2.cxx +++ b/Tests/Testing/Sub/Sub2/testing2.cxx @@ -1,4 +1,4 @@ -int main () +int main() { return 0; } diff --git a/Tests/Testing/testing.cxx b/Tests/Testing/testing.cxx index 1482f27..f8b643a 100644 --- a/Tests/Testing/testing.cxx +++ b/Tests/Testing/testing.cxx @@ -1,4 +1,4 @@ -int main () +int main() { return 0; } diff --git a/Tests/TestsWorkingDirectory/main.c b/Tests/TestsWorkingDirectory/main.c index d4b760c..11dd4ff 100644 --- a/Tests/TestsWorkingDirectory/main.c +++ b/Tests/TestsWorkingDirectory/main.c @@ -3,7 +3,8 @@ #include <stdlib.h> #include <string.h> -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || \ + defined(__BORLANDC__) || defined(__MINGW32__)) #include <direct.h> #include <io.h> @@ -17,23 +18,19 @@ static const char* Getcwd(char* buf, unsigned int len) { const char* ret = _getcwd(buf, len); char* p = NULL; - if(!ret) - { + if (!ret) { fprintf(stderr, "No current working directory.\n"); abort(); - } + } // make sure the drive letter is capital - if(strlen(buf) > 1 && buf[1] == ':') - { + if (strlen(buf) > 1 && buf[1] == ':') { buf[0] = toupper(buf[0]); - } - for(p = buf; *p; ++p) - { - if(*p == '\\') - { + } + for (p = buf; *p; ++p) { + if (*p == '\\') { *p = '/'; - } } + } return ret; } @@ -45,20 +42,19 @@ static const char* Getcwd(char* buf, unsigned int len) static const char* Getcwd(char* buf, unsigned int len) { const char* ret = getcwd(buf, len); - if(!ret) - { + if (!ret) { fprintf(stderr, "No current working directory\n"); abort(); - } + } return ret; } #endif -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { char buf[2048]; - const char *cwd = Getcwd(buf, sizeof(buf)); + const char* cwd = Getcwd(buf, sizeof(buf)); return strcmp(cwd, argv[1]); } diff --git a/Tests/TryCompile/Inner/innerexe.c b/Tests/TryCompile/Inner/innerexe.c index 9b121a1..e329c5f 100644 --- a/Tests/TryCompile/Inner/innerexe.c +++ b/Tests/TryCompile/Inner/innerexe.c @@ -1,2 +1,5 @@ extern int innerlib(void); -int main() { return innerlib(); } +int main() +{ + return innerlib(); +} diff --git a/Tests/TryCompile/Inner/innerlib.c b/Tests/TryCompile/Inner/innerlib.c index 0ce1179..69653ad 100644 --- a/Tests/TryCompile/Inner/innerlib.c +++ b/Tests/TryCompile/Inner/innerlib.c @@ -1 +1,4 @@ -int innerlib(void) { return 0; } +int innerlib(void) +{ + return 0; +} diff --git a/Tests/TryCompile/expect_arg.c b/Tests/TryCompile/expect_arg.c index f18e03f..267b587 100644 --- a/Tests/TryCompile/expect_arg.c +++ b/Tests/TryCompile/expect_arg.c @@ -1,22 +1,18 @@ #include <stdio.h> #include <string.h> -int main(int ac, char*av[]) +int main(int ac, char* av[]) { int i; printf("ac = [%d]\n", ac); - for(i =0; i < ac; i++) - { + for (i = 0; i < ac; i++) { printf("arg[%d] = %s\n", i, av[i]); - } - if(ac == 3) - { - if(strcmp(av[1], "arg1") ==0 - && strcmp(av[2], "arg2") ==0) - { + } + if (ac == 3) { + if (strcmp(av[1], "arg1") == 0 && strcmp(av[2], "arg2") == 0) { printf("arg1 and arg2 present and accounted for!\n"); return 0; - } } + } printf("arg1 and arg2 missing!\n"); return -1; } diff --git a/Tests/TryCompile/fail2a.c b/Tests/TryCompile/fail2a.c index 78f2de1..8488f4e 100644 --- a/Tests/TryCompile/fail2a.c +++ b/Tests/TryCompile/fail2a.c @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/TryCompile/pass.c b/Tests/TryCompile/pass.c index 43e8a7e..f8b643a 100644 --- a/Tests/TryCompile/pass.c +++ b/Tests/TryCompile/pass.c @@ -2,5 +2,3 @@ int main() { return 0; } - - diff --git a/Tests/TryCompile/pass2a.c b/Tests/TryCompile/pass2a.c index bbfe6d5..27c377b 100644 --- a/Tests/TryCompile/pass2a.c +++ b/Tests/TryCompile/pass2a.c @@ -1,2 +1,5 @@ extern int pass2b(void); -int main() { return pass2b(); } +int main() +{ + return pass2b(); +} diff --git a/Tests/TryCompile/pass2b.cxx b/Tests/TryCompile/pass2b.cxx index 4c539e2..438e9e5 100644 --- a/Tests/TryCompile/pass2b.cxx +++ b/Tests/TryCompile/pass2b.cxx @@ -1 +1,4 @@ -extern "C" int pass2b(void) { return 0; } +extern "C" int pass2b(void) +{ + return 0; +} diff --git a/Tests/TryCompile/testdef.c b/Tests/TryCompile/testdef.c index 5401e71..b05f070 100644 --- a/Tests/TryCompile/testdef.c +++ b/Tests/TryCompile/testdef.c @@ -1,4 +1,7 @@ #ifndef TESTDEF -# error "TESTDEF should be defined!" +#error "TESTDEF should be defined!" #endif -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/Tutorial/Step1/tutorial.cxx b/Tests/Tutorial/Step1/tutorial.cxx index a3584c4..7a13376 100644 --- a/Tests/Tutorial/Step1/tutorial.cxx +++ b/Tests/Tutorial/Step1/tutorial.cxx @@ -4,20 +4,16 @@ #include <stdio.h> #include <stdlib.h> -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = sqrt(inputValue); - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx index 0f7c106..2710f92 100644 --- a/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx @@ -4,10 +4,9 @@ // a hack square root calculation using simple operations double mysqrt(double x) { - if (x <= 0) - { + if (x <= 0) { return 0; - } + } double result; double delta; @@ -15,15 +14,13 @@ double mysqrt(double x) // do ten iterations int i; - for (i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } - delta = x - (result*result); - result = result + 0.5*delta/result; - fprintf(stdout,"Computing sqrt of %g to be %g\n",x,result); } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } return result; } diff --git a/Tests/Tutorial/Step2/tutorial.cxx b/Tests/Tutorial/Step2/tutorial.cxx index af88dad..2fae364 100644 --- a/Tests/Tutorial/Step2/tutorial.cxx +++ b/Tests/Tutorial/Step2/tutorial.cxx @@ -8,31 +8,26 @@ #include "MathFunctions.h" #endif -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = 0; - if(inputValue >= 0) - { + if (inputValue >= 0) { #ifdef USE_MYMATH outputValue = mysqrt(inputValue); #else outputValue = sqrt(inputValue); #endif - } + } - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx index 0f7c106..2710f92 100644 --- a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx @@ -4,10 +4,9 @@ // a hack square root calculation using simple operations double mysqrt(double x) { - if (x <= 0) - { + if (x <= 0) { return 0; - } + } double result; double delta; @@ -15,15 +14,13 @@ double mysqrt(double x) // do ten iterations int i; - for (i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } - delta = x - (result*result); - result = result + 0.5*delta/result; - fprintf(stdout,"Computing sqrt of %g to be %g\n",x,result); } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } return result; } diff --git a/Tests/Tutorial/Step3/tutorial.cxx b/Tests/Tutorial/Step3/tutorial.cxx index af88dad..2fae364 100644 --- a/Tests/Tutorial/Step3/tutorial.cxx +++ b/Tests/Tutorial/Step3/tutorial.cxx @@ -8,31 +8,26 @@ #include "MathFunctions.h" #endif -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = 0; - if(inputValue >= 0) - { + if (inputValue >= 0) { #ifdef USE_MYMATH outputValue = mysqrt(inputValue); #else outputValue = sqrt(inputValue); #endif - } + } - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx index bbd08fa..6ca264f 100644 --- a/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx @@ -7,33 +7,30 @@ // a hack square root calculation using simple operations double mysqrt(double x) { - if (x <= 0) - { + if (x <= 0) { return 0; - } + } double result; - // if we have both log and exp then use them -#if defined(HAVE_LOG) && defined (HAVE_EXP) - result = exp(log(x)*0.5); - fprintf(stdout,"Computing sqrt of %g to be %g using log\n",x,result); +// if we have both log and exp then use them +#if defined(HAVE_LOG) && defined(HAVE_EXP) + result = exp(log(x) * 0.5); + fprintf(stdout, "Computing sqrt of %g to be %g using log\n", x, result); #else double delta; result = x; // do ten iterations int i; - for (i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } - delta = x - (result*result); - result = result + 0.5*delta/result; - fprintf(stdout,"Computing sqrt of %g to be %g\n",x,result); } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } #endif return result; } diff --git a/Tests/Tutorial/Step4/tutorial.cxx b/Tests/Tutorial/Step4/tutorial.cxx index af88dad..2fae364 100644 --- a/Tests/Tutorial/Step4/tutorial.cxx +++ b/Tests/Tutorial/Step4/tutorial.cxx @@ -8,31 +8,26 @@ #include "MathFunctions.h" #endif -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = 0; - if(inputValue >= 0) - { + if (inputValue >= 0) { #ifdef USE_MYMATH outputValue = mysqrt(inputValue); #else outputValue = sqrt(inputValue); #endif - } + } - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx index a23feeb..cebd50f 100644 --- a/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx @@ -2,34 +2,31 @@ #include <math.h> #include <stdio.h> -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { int i; double result; // make sure we have enough arguments - if (argc < 2) - { + if (argc < 2) { return 1; - } + } // open the output file - FILE *fout = fopen(argv[1],"w"); - if (!fout) - { + FILE* fout = fopen(argv[1], "w"); + if (!fout) { return 1; - } + } // create a source file with a table of square roots - fprintf(fout,"double sqrtTable[] = {\n"); - for (i = 0; i < 10; ++i) - { + fprintf(fout, "double sqrtTable[] = {\n"); + for (i = 0; i < 10; ++i) { result = sqrt(static_cast<double>(i)); - fprintf(fout,"%g,\n",result); - } + fprintf(fout, "%g,\n", result); + } // close the table with a zero - fprintf(fout,"0};\n"); + fprintf(fout, "0};\n"); fclose(fout); return 0; } diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx index a488af6..458ed63 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx @@ -10,10 +10,9 @@ // a hack square root calculation using simple operations double mysqrt(double x) { - if (x <= 0) - { + if (x <= 0) { return 0; - } + } double result; @@ -22,23 +21,20 @@ double mysqrt(double x) // use the table to help find an initial value result = x; - if (x >= 1 && x < 10) - { + if (x >= 1 && x < 10) { result = sqrtTable[static_cast<int>(x)]; - } + } // do ten iterations int i; - for (i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } - delta = x - (result*result); - result = result + 0.5*delta/result; - fprintf(stdout,"Computing sqrt of %g to be %g\n",x,result); } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } return result; } diff --git a/Tests/Tutorial/Step5/tutorial.cxx b/Tests/Tutorial/Step5/tutorial.cxx index af88dad..2fae364 100644 --- a/Tests/Tutorial/Step5/tutorial.cxx +++ b/Tests/Tutorial/Step5/tutorial.cxx @@ -8,31 +8,26 @@ #include "MathFunctions.h" #endif -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = 0; - if(inputValue >= 0) - { + if (inputValue >= 0) { #ifdef USE_MYMATH outputValue = mysqrt(inputValue); #else outputValue = sqrt(inputValue); #endif - } + } - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx index a23feeb..cebd50f 100644 --- a/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx @@ -2,34 +2,31 @@ #include <math.h> #include <stdio.h> -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { int i; double result; // make sure we have enough arguments - if (argc < 2) - { + if (argc < 2) { return 1; - } + } // open the output file - FILE *fout = fopen(argv[1],"w"); - if (!fout) - { + FILE* fout = fopen(argv[1], "w"); + if (!fout) { return 1; - } + } // create a source file with a table of square roots - fprintf(fout,"double sqrtTable[] = {\n"); - for (i = 0; i < 10; ++i) - { + fprintf(fout, "double sqrtTable[] = {\n"); + for (i = 0; i < 10; ++i) { result = sqrt(static_cast<double>(i)); - fprintf(fout,"%g,\n",result); - } + fprintf(fout, "%g,\n", result); + } // close the table with a zero - fprintf(fout,"0};\n"); + fprintf(fout, "0};\n"); fclose(fout); return 0; } diff --git a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx index a488af6..458ed63 100644 --- a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx @@ -10,10 +10,9 @@ // a hack square root calculation using simple operations double mysqrt(double x) { - if (x <= 0) - { + if (x <= 0) { return 0; - } + } double result; @@ -22,23 +21,20 @@ double mysqrt(double x) // use the table to help find an initial value result = x; - if (x >= 1 && x < 10) - { + if (x >= 1 && x < 10) { result = sqrtTable[static_cast<int>(x)]; - } + } // do ten iterations int i; - for (i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } - delta = x - (result*result); - result = result + 0.5*delta/result; - fprintf(stdout,"Computing sqrt of %g to be %g\n",x,result); } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } return result; } diff --git a/Tests/Tutorial/Step6/tutorial.cxx b/Tests/Tutorial/Step6/tutorial.cxx index af88dad..2fae364 100644 --- a/Tests/Tutorial/Step6/tutorial.cxx +++ b/Tests/Tutorial/Step6/tutorial.cxx @@ -8,31 +8,26 @@ #include "MathFunctions.h" #endif -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = 0; - if(inputValue >= 0) - { + if (inputValue >= 0) { #ifdef USE_MYMATH outputValue = mysqrt(inputValue); #else outputValue = sqrt(inputValue); #endif - } + } - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx index a23feeb..cebd50f 100644 --- a/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx @@ -2,34 +2,31 @@ #include <math.h> #include <stdio.h> -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { int i; double result; // make sure we have enough arguments - if (argc < 2) - { + if (argc < 2) { return 1; - } + } // open the output file - FILE *fout = fopen(argv[1],"w"); - if (!fout) - { + FILE* fout = fopen(argv[1], "w"); + if (!fout) { return 1; - } + } // create a source file with a table of square roots - fprintf(fout,"double sqrtTable[] = {\n"); - for (i = 0; i < 10; ++i) - { + fprintf(fout, "double sqrtTable[] = {\n"); + for (i = 0; i < 10; ++i) { result = sqrt(static_cast<double>(i)); - fprintf(fout,"%g,\n",result); - } + fprintf(fout, "%g,\n", result); + } // close the table with a zero - fprintf(fout,"0};\n"); + fprintf(fout, "0};\n"); fclose(fout); return 0; } diff --git a/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx index a488af6..458ed63 100644 --- a/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx @@ -10,10 +10,9 @@ // a hack square root calculation using simple operations double mysqrt(double x) { - if (x <= 0) - { + if (x <= 0) { return 0; - } + } double result; @@ -22,23 +21,20 @@ double mysqrt(double x) // use the table to help find an initial value result = x; - if (x >= 1 && x < 10) - { + if (x >= 1 && x < 10) { result = sqrtTable[static_cast<int>(x)]; - } + } // do ten iterations int i; - for (i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } - delta = x - (result*result); - result = result + 0.5*delta/result; - fprintf(stdout,"Computing sqrt of %g to be %g\n",x,result); } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } return result; } diff --git a/Tests/Tutorial/Step7/tutorial.cxx b/Tests/Tutorial/Step7/tutorial.cxx index af88dad..2fae364 100644 --- a/Tests/Tutorial/Step7/tutorial.cxx +++ b/Tests/Tutorial/Step7/tutorial.cxx @@ -8,31 +8,26 @@ #include "MathFunctions.h" #endif -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { - if (argc < 2) - { - fprintf(stdout,"%s Version %d.%d\n", - argv[0], - Tutorial_VERSION_MAJOR, + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); - fprintf(stdout,"Usage: %s number\n",argv[0]); + fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; - } + } double inputValue = atof(argv[1]); double outputValue = 0; - if(inputValue >= 0) - { + if (inputValue >= 0) { #ifdef USE_MYMATH outputValue = mysqrt(inputValue); #else outputValue = sqrt(inputValue); #endif - } + } - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); return 0; } diff --git a/Tests/VSExternalInclude/Lib1/lib1.h b/Tests/VSExternalInclude/Lib1/lib1.h index 543e71e..178365a 100644 --- a/Tests/VSExternalInclude/Lib1/lib1.h +++ b/Tests/VSExternalInclude/Lib1/lib1.h @@ -4,5 +4,4 @@ int add1(int num); - #endif diff --git a/Tests/VSGNUFortran/c_code/main.c b/Tests/VSGNUFortran/c_code/main.c index 9157cc5..60c1120 100644 --- a/Tests/VSGNUFortran/c_code/main.c +++ b/Tests/VSGNUFortran/c_code/main.c @@ -2,6 +2,6 @@ extern void FC_hello(void); int main() { - FC_hello(); - return 0; + FC_hello(); + return 0; } diff --git a/Tests/VSMASM/main.c b/Tests/VSMASM/main.c index 570ba16..18ddb78 100644 --- a/Tests/VSMASM/main.c +++ b/Tests/VSMASM/main.c @@ -1,2 +1,5 @@ extern int foo(void); -int main(void) { return foo(); } +int main(void) +{ + return foo(); +} diff --git a/Tests/VSMidl/src/main.cpp b/Tests/VSMidl/src/main.cpp index 6b78fcc..68089ad 100644 --- a/Tests/VSMidl/src/main.cpp +++ b/Tests/VSMidl/src/main.cpp @@ -9,9 +9,9 @@ int main(int argc, char** argv) IID iid = IID_ICMakeMidlTest; printf("Running '%s'\n", argv[0]); - printf(" libid starts with '0x%08lx'\n", (long) libid.Data1); - printf(" clsid starts with '0x%08lx'\n", (long) clsid.Data1); - printf(" iid starts with '0x%08lx'\n", (long) iid.Data1); + printf(" libid starts with '0x%08lx'\n", (long)libid.Data1); + printf(" clsid starts with '0x%08lx'\n", (long)clsid.Data1); + printf(" iid starts with '0x%08lx'\n", (long)iid.Data1); return 0; } diff --git a/Tests/VSNsightTegra/jni/first.c b/Tests/VSNsightTegra/jni/first.c index f09e376..b9dee27 100644 --- a/Tests/VSNsightTegra/jni/first.c +++ b/Tests/VSNsightTegra/jni/first.c @@ -16,7 +16,7 @@ */ #include "first.h" -int first(int x, int y) +int first(int x, int y) { - return x + y; + return x + y; } diff --git a/Tests/VSNsightTegra/jni/first.h b/Tests/VSNsightTegra/jni/first.h index d893480..9dfd8b8 100644 --- a/Tests/VSNsightTegra/jni/first.h +++ b/Tests/VSNsightTegra/jni/first.h @@ -17,6 +17,6 @@ #ifndef FIRST_H #define FIRST_H -extern int first(int x, int y); +extern int first(int x, int y); #endif /* FIRST_H */ diff --git a/Tests/VSNsightTegra/jni/second.c b/Tests/VSNsightTegra/jni/second.c index 4631848..12fcdb6 100644 --- a/Tests/VSNsightTegra/jni/second.c +++ b/Tests/VSNsightTegra/jni/second.c @@ -17,11 +17,8 @@ #include "first.h" #include <jni.h> -jint -Java_com_example_twolibs_TwoLibs_add( JNIEnv* env, - jobject this, - jint x, - jint y ) +jint Java_com_example_twolibs_TwoLibs_add(JNIEnv* env, jobject this, jint x, + jint y) { - return first(x, y); + return first(x, y); } diff --git a/Tests/VSResource/lib.cpp b/Tests/VSResource/lib.cpp index 006e3e4..c912397 100644 --- a/Tests/VSResource/lib.cpp +++ b/Tests/VSResource/lib.cpp @@ -1 +1,4 @@ -int lib() { return 0; } +int lib() +{ + return 0; +} diff --git a/Tests/VSResource/main.cpp b/Tests/VSResource/main.cpp index f8372b7..b2b5ac9 100644 --- a/Tests/VSResource/main.cpp +++ b/Tests/VSResource/main.cpp @@ -5,7 +5,7 @@ extern int lib(); struct x { - const char *txt; + const char* txt; }; int main(int argc, char** argv) @@ -24,35 +24,31 @@ int main(int argc, char** argv) test.txt = "*exactly* test.txt"; fprintf(stdout, "CMAKE_RCDEFINE_NO_QUOTED_STRINGS defined\n"); fprintf(stdout, "CMAKE_RCDEFINE is %s, and is *not* a string constant\n", - CMAKE_RCDEFINE); + CMAKE_RCDEFINE); #else // Expect CMAKE_RCDEFINE to be a string: fprintf(stdout, "CMAKE_RCDEFINE='%s', and is a string constant\n", - CMAKE_RCDEFINE); + CMAKE_RCDEFINE); #endif HRSRC hello = ::FindResource(NULL, MAKEINTRESOURCE(1025), "TEXTFILE"); - if(hello) - { + if (hello) { fprintf(stdout, "FindResource worked\n"); HGLOBAL hgbl = ::LoadResource(NULL, hello); - int datasize = (int) ::SizeofResource(NULL, hello); - if(hgbl && datasize>0) - { + int datasize = (int)::SizeofResource(NULL, hello); + if (hgbl && datasize > 0) { fprintf(stdout, "LoadResource worked\n"); fprintf(stdout, "SizeofResource returned datasize='%d'\n", datasize); - void *data = ::LockResource(hgbl); - if (data) - { + void* data = ::LockResource(hgbl); + if (data) { fprintf(stdout, "LockResource worked\n"); - char *str = (char *) malloc(datasize+4); - if (str) - { + char* str = (char*)malloc(datasize + 4); + if (str) { memcpy(str, data, datasize); str[datasize] = 'E'; - str[datasize+1] = 'O'; - str[datasize+2] = 'R'; - str[datasize+3] = 0; + str[datasize + 1] = 'O'; + str[datasize + 2] = 'R'; + str[datasize + 3] = 0; fprintf(stdout, "str='%s'\n", str); free(str); @@ -62,21 +58,18 @@ int main(int argc, char** argv) fprintf(stdout, "LoadString skipped\n"); #else char buf[256]; - if (::LoadString(NULL, 1026, buf, sizeof(buf)) > 0) - { + if (::LoadString(NULL, 1026, buf, sizeof(buf)) > 0) { fprintf(stdout, "LoadString worked\n"); fprintf(stdout, "buf='%s'\n", buf); - } - else - { + } else { fprintf(stdout, "LoadString failed\n"); ret = 1; - } -#endif } +#endif } } } + } return ret + lib(); } diff --git a/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h b/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h index b58c77d..56bd398 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h +++ b/Tests/VSWinStorePhone/Direct3DApp1/BasicTimer.h @@ -9,8 +9,7 @@ public: // Initializes internal timer values. BasicTimer() { - if (!QueryPerformanceFrequency(&m_frequency)) - { + if (!QueryPerformanceFrequency(&m_frequency)) { throw ref new Platform::FailureException(); } Reset(); @@ -28,33 +27,29 @@ public: // Update the timer's internal values. void Update() { - if (!QueryPerformanceCounter(&m_currentTime)) - { + if (!QueryPerformanceCounter(&m_currentTime)) { throw ref new Platform::FailureException(); } m_total = static_cast<float>( static_cast<double>(m_currentTime.QuadPart - m_startTime.QuadPart) / - static_cast<double>(m_frequency.QuadPart) - ); + static_cast<double>(m_frequency.QuadPart)); - if (m_lastTime.QuadPart == m_startTime.QuadPart) - { - // If the timer was just reset, report a time delta equivalent to 60Hz frame time. + if (m_lastTime.QuadPart == m_startTime.QuadPart) { + // If the timer was just reset, report a time delta equivalent to 60Hz + // frame time. m_delta = 1.0f / 60.0f; - } - else - { + } else { m_delta = static_cast<float>( static_cast<double>(m_currentTime.QuadPart - m_lastTime.QuadPart) / - static_cast<double>(m_frequency.QuadPart) - ); + static_cast<double>(m_frequency.QuadPart)); } m_lastTime = m_currentTime; } - // Duration in seconds between the last call to Reset() and the last call to Update(). + // Duration in seconds between the last call to Reset() and the last call to + // Update(). property float Total { float get() { return m_total; } diff --git a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp index 7632388..1c969cd 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp +++ b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp @@ -7,9 +7,9 @@ using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; -CubeRenderer::CubeRenderer() : - m_loadingComplete(false), - m_indexCount(0) +CubeRenderer::CubeRenderer() + : m_loadingComplete(false) + , m_indexCount(0) { } @@ -20,119 +20,88 @@ void CubeRenderer::CreateDeviceResources() auto loadVSTask = DX::ReadDataAsync("SimpleVertexShader.cso"); auto loadPSTask = DX::ReadDataAsync("SimplePixelShader.cso"); - auto createVSTask = loadVSTask.then([this](Platform::Array<byte>^ fileData) { - DX::ThrowIfFailed( - m_d3dDevice->CreateVertexShader( - fileData->Data, - fileData->Length, - nullptr, - &m_vertexShader - ) - ); - - const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + auto createVSTask = + loadVSTask.then([this](Platform::Array<byte> ^ fileData) { + DX::ThrowIfFailed(m_d3dDevice->CreateVertexShader( + fileData->Data, fileData->Length, nullptr, &m_vertexShader)); + + const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + DX::ThrowIfFailed(m_d3dDevice->CreateInputLayout( + vertexDesc, ARRAYSIZE(vertexDesc), fileData->Data, fileData->Length, + &m_inputLayout)); + }); + + auto createPSTask = + loadPSTask.then([this](Platform::Array<byte> ^ fileData) { + DX::ThrowIfFailed(m_d3dDevice->CreatePixelShader( + fileData->Data, fileData->Length, nullptr, &m_pixelShader)); + + CD3D11_BUFFER_DESC constantBufferDesc( + sizeof(ModelViewProjectionConstantBuffer), D3D11_BIND_CONSTANT_BUFFER); + DX::ThrowIfFailed(m_d3dDevice->CreateBuffer(&constantBufferDesc, nullptr, + &m_constantBuffer)); + }); + + auto createCubeTask = (createPSTask && createVSTask).then([this]() { + VertexPositionColor cubeVertices[] = { + { XMFLOAT3(-0.5f, -0.5f, -0.5f), XMFLOAT3(0.0f, 0.0f, 0.0f) }, + { XMFLOAT3(-0.5f, -0.5f, 0.5f), XMFLOAT3(0.0f, 0.0f, 1.0f) }, + { XMFLOAT3(-0.5f, 0.5f, -0.5f), XMFLOAT3(0.0f, 1.0f, 0.0f) }, + { XMFLOAT3(-0.5f, 0.5f, 0.5f), XMFLOAT3(0.0f, 1.0f, 1.0f) }, + { XMFLOAT3(0.5f, -0.5f, -0.5f), XMFLOAT3(1.0f, 0.0f, 0.0f) }, + { XMFLOAT3(0.5f, -0.5f, 0.5f), XMFLOAT3(1.0f, 0.0f, 1.0f) }, + { XMFLOAT3(0.5f, 0.5f, -0.5f), XMFLOAT3(1.0f, 1.0f, 0.0f) }, + { XMFLOAT3(0.5f, 0.5f, 0.5f), XMFLOAT3(1.0f, 1.0f, 1.0f) }, }; - DX::ThrowIfFailed( - m_d3dDevice->CreateInputLayout( - vertexDesc, - ARRAYSIZE(vertexDesc), - fileData->Data, - fileData->Length, - &m_inputLayout - ) - ); - }); - - auto createPSTask = loadPSTask.then([this](Platform::Array<byte>^ fileData) { - DX::ThrowIfFailed( - m_d3dDevice->CreatePixelShader( - fileData->Data, - fileData->Length, - nullptr, - &m_pixelShader - ) - ); - - CD3D11_BUFFER_DESC constantBufferDesc(sizeof(ModelViewProjectionConstantBuffer), D3D11_BIND_CONSTANT_BUFFER); - DX::ThrowIfFailed( - m_d3dDevice->CreateBuffer( - &constantBufferDesc, - nullptr, - &m_constantBuffer - ) - ); - }); - - auto createCubeTask = (createPSTask && createVSTask).then([this] () { - VertexPositionColor cubeVertices[] = - { - {XMFLOAT3(-0.5f, -0.5f, -0.5f), XMFLOAT3(0.0f, 0.0f, 0.0f)}, - {XMFLOAT3(-0.5f, -0.5f, 0.5f), XMFLOAT3(0.0f, 0.0f, 1.0f)}, - {XMFLOAT3(-0.5f, 0.5f, -0.5f), XMFLOAT3(0.0f, 1.0f, 0.0f)}, - {XMFLOAT3(-0.5f, 0.5f, 0.5f), XMFLOAT3(0.0f, 1.0f, 1.0f)}, - {XMFLOAT3( 0.5f, -0.5f, -0.5f), XMFLOAT3(1.0f, 0.0f, 0.0f)}, - {XMFLOAT3( 0.5f, -0.5f, 0.5f), XMFLOAT3(1.0f, 0.0f, 1.0f)}, - {XMFLOAT3( 0.5f, 0.5f, -0.5f), XMFLOAT3(1.0f, 1.0f, 0.0f)}, - {XMFLOAT3( 0.5f, 0.5f, 0.5f), XMFLOAT3(1.0f, 1.0f, 1.0f)}, - }; - - D3D11_SUBRESOURCE_DATA vertexBufferData = {0}; + D3D11_SUBRESOURCE_DATA vertexBufferData = { 0 }; vertexBufferData.pSysMem = cubeVertices; vertexBufferData.SysMemPitch = 0; vertexBufferData.SysMemSlicePitch = 0; - CD3D11_BUFFER_DESC vertexBufferDesc(sizeof(cubeVertices), D3D11_BIND_VERTEX_BUFFER); - DX::ThrowIfFailed( - m_d3dDevice->CreateBuffer( - &vertexBufferDesc, - &vertexBufferData, - &m_vertexBuffer - ) - ); - - unsigned short cubeIndices[] = - { - 0,2,1, // -x - 1,2,3, - - 4,5,6, // +x - 5,7,6, - - 0,1,5, // -y - 0,5,4, - - 2,6,7, // +y - 2,7,3, - - 0,4,6, // -z - 0,6,2, - - 1,3,7, // +z - 1,7,5, + CD3D11_BUFFER_DESC vertexBufferDesc(sizeof(cubeVertices), + D3D11_BIND_VERTEX_BUFFER); + DX::ThrowIfFailed(m_d3dDevice->CreateBuffer( + &vertexBufferDesc, &vertexBufferData, &m_vertexBuffer)); + + unsigned short cubeIndices[] = { + 0, 2, 1, // -x + 1, 2, 3, + + 4, 5, 6, // +x + 5, 7, 6, + + 0, 1, 5, // -y + 0, 5, 4, + + 2, 6, 7, // +y + 2, 7, 3, + + 0, 4, 6, // -z + 0, 6, 2, + + 1, 3, 7, // +z + 1, 7, 5, }; m_indexCount = ARRAYSIZE(cubeIndices); - D3D11_SUBRESOURCE_DATA indexBufferData = {0}; + D3D11_SUBRESOURCE_DATA indexBufferData = { 0 }; indexBufferData.pSysMem = cubeIndices; indexBufferData.SysMemPitch = 0; indexBufferData.SysMemSlicePitch = 0; - CD3D11_BUFFER_DESC indexBufferDesc(sizeof(cubeIndices), D3D11_BIND_INDEX_BUFFER); - DX::ThrowIfFailed( - m_d3dDevice->CreateBuffer( - &indexBufferDesc, - &indexBufferData, - &m_indexBuffer - ) - ); + CD3D11_BUFFER_DESC indexBufferDesc(sizeof(cubeIndices), + D3D11_BIND_INDEX_BUFFER); + DX::ThrowIfFailed(m_d3dDevice->CreateBuffer( + &indexBufferDesc, &indexBufferData, &m_indexBuffer)); }); - createCubeTask.then([this] () { - m_loadingComplete = true; - }); + createCubeTask.then([this]() { m_loadingComplete = true; }); } void CubeRenderer::CreateWindowSizeDependentResources() @@ -141,8 +110,7 @@ void CubeRenderer::CreateWindowSizeDependentResources() float aspectRatio = m_windowBounds.Width / m_windowBounds.Height; float fovAngleY = 70.0f * XM_PI / 180.0f; - if (aspectRatio < 1.0f) - { + if (aspectRatio < 1.0f) { fovAngleY /= aspectRatio; } @@ -153,109 +121,60 @@ void CubeRenderer::CreateWindowSizeDependentResources() // this transform should not be applied. XMStoreFloat4x4( &m_constantBufferData.projection, - XMMatrixTranspose( - XMMatrixMultiply( - XMMatrixPerspectiveFovRH( - fovAngleY, - aspectRatio, - 0.01f, - 100.0f - ), - XMLoadFloat4x4(&m_orientationTransform3D) - ) - ) - ); + XMMatrixTranspose(XMMatrixMultiply( + XMMatrixPerspectiveFovRH(fovAngleY, aspectRatio, 0.01f, 100.0f), + XMLoadFloat4x4(&m_orientationTransform3D)))); } void CubeRenderer::Update(float timeTotal, float timeDelta) { - (void) timeDelta; // Unused parameter. + (void)timeDelta; // Unused parameter. XMVECTOR eye = XMVectorSet(0.0f, 0.7f, 1.5f, 0.0f); XMVECTOR at = XMVectorSet(0.0f, -0.1f, 0.0f, 0.0f); XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); - XMStoreFloat4x4(&m_constantBufferData.view, XMMatrixTranspose(XMMatrixLookAtRH(eye, at, up))); - XMStoreFloat4x4(&m_constantBufferData.model, XMMatrixTranspose(XMMatrixRotationY(timeTotal * XM_PIDIV4))); + XMStoreFloat4x4(&m_constantBufferData.view, + XMMatrixTranspose(XMMatrixLookAtRH(eye, at, up))); + XMStoreFloat4x4(&m_constantBufferData.model, + XMMatrixTranspose(XMMatrixRotationY(timeTotal * XM_PIDIV4))); } void CubeRenderer::Render() { const float midnightBlue[] = { 0.098f, 0.098f, 0.439f, 1.000f }; - m_d3dContext->ClearRenderTargetView( - m_renderTargetView.Get(), - midnightBlue - ); - - m_d3dContext->ClearDepthStencilView( - m_depthStencilView.Get(), - D3D11_CLEAR_DEPTH, - 1.0f, - 0 - ); + m_d3dContext->ClearRenderTargetView(m_renderTargetView.Get(), midnightBlue); + + m_d3dContext->ClearDepthStencilView(m_depthStencilView.Get(), + D3D11_CLEAR_DEPTH, 1.0f, 0); // Only draw the cube once it is loaded (loading is asynchronous). - if (!m_loadingComplete) - { + if (!m_loadingComplete) { return; } - m_d3dContext->OMSetRenderTargets( - 1, - m_renderTargetView.GetAddressOf(), - m_depthStencilView.Get() - ); - - m_d3dContext->UpdateSubresource( - m_constantBuffer.Get(), - 0, - NULL, - &m_constantBufferData, - 0, - 0 - ); + m_d3dContext->OMSetRenderTargets(1, m_renderTargetView.GetAddressOf(), + m_depthStencilView.Get()); + + m_d3dContext->UpdateSubresource(m_constantBuffer.Get(), 0, NULL, + &m_constantBufferData, 0, 0); UINT stride = sizeof(VertexPositionColor); UINT offset = 0; - m_d3dContext->IASetVertexBuffers( - 0, - 1, - m_vertexBuffer.GetAddressOf(), - &stride, - &offset - ); - - m_d3dContext->IASetIndexBuffer( - m_indexBuffer.Get(), - DXGI_FORMAT_R16_UINT, - 0 - ); + m_d3dContext->IASetVertexBuffers(0, 1, m_vertexBuffer.GetAddressOf(), + &stride, &offset); + + m_d3dContext->IASetIndexBuffer(m_indexBuffer.Get(), DXGI_FORMAT_R16_UINT, 0); m_d3dContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); m_d3dContext->IASetInputLayout(m_inputLayout.Get()); - m_d3dContext->VSSetShader( - m_vertexShader.Get(), - nullptr, - 0 - ); - - m_d3dContext->VSSetConstantBuffers( - 0, - 1, - m_constantBuffer.GetAddressOf() - ); - - m_d3dContext->PSSetShader( - m_pixelShader.Get(), - nullptr, - 0 - ); - - m_d3dContext->DrawIndexed( - m_indexCount, - 0, - 0 - ); + m_d3dContext->VSSetShader(m_vertexShader.Get(), nullptr, 0); + + m_d3dContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + m_d3dContext->PSSetShader(m_pixelShader.Get(), nullptr, 0); + + m_d3dContext->DrawIndexed(m_indexCount, 0, 0); } diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp index 41ca124..ddcd8bd 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.cpp @@ -12,71 +12,76 @@ using namespace Windows::Foundation; using namespace Windows::Graphics::Display; using namespace concurrency; -Direct3DApp1::Direct3DApp1() : - m_windowClosed(false), - m_windowVisible(true) +Direct3DApp1::Direct3DApp1() + : m_windowClosed(false) + , m_windowVisible(true) { } -void Direct3DApp1::Initialize(CoreApplicationView^ applicationView) +void Direct3DApp1::Initialize(CoreApplicationView ^ applicationView) { applicationView->Activated += - ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &Direct3DApp1::OnActivated); + ref new TypedEventHandler<CoreApplicationView ^, IActivatedEventArgs ^>( + this, &Direct3DApp1::OnActivated); - CoreApplication::Suspending += - ref new EventHandler<SuspendingEventArgs^>(this, &Direct3DApp1::OnSuspending); + CoreApplication::Suspending += ref new EventHandler<SuspendingEventArgs ^>( + this, &Direct3DApp1::OnSuspending); CoreApplication::Resuming += - ref new EventHandler<Platform::Object^>(this, &Direct3DApp1::OnResuming); + ref new EventHandler<Platform::Object ^>(this, &Direct3DApp1::OnResuming); m_renderer = ref new CubeRenderer(); } -void Direct3DApp1::SetWindow(CoreWindow^ window) +void Direct3DApp1::SetWindow(CoreWindow ^ window) { window->SizeChanged += - ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &Direct3DApp1::OnWindowSizeChanged); + ref new TypedEventHandler<CoreWindow ^, WindowSizeChangedEventArgs ^>( + this, &Direct3DApp1::OnWindowSizeChanged); window->VisibilityChanged += - ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &Direct3DApp1::OnVisibilityChanged); + ref new TypedEventHandler<CoreWindow ^, VisibilityChangedEventArgs ^>( + this, &Direct3DApp1::OnVisibilityChanged); window->Closed += - ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &Direct3DApp1::OnWindowClosed); + ref new TypedEventHandler<CoreWindow ^, CoreWindowEventArgs ^>( + this, &Direct3DApp1::OnWindowClosed); #ifndef PHONE window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); #endif window->PointerPressed += - ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Direct3DApp1::OnPointerPressed); + ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>( + this, &Direct3DApp1::OnPointerPressed); window->PointerMoved += - ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Direct3DApp1::OnPointerMoved); + ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>( + this, &Direct3DApp1::OnPointerMoved); m_renderer->Initialize(CoreWindow::GetForCurrentThread()); } -void Direct3DApp1::Load(Platform::String^ entryPoint) +void Direct3DApp1::Load(Platform::String ^ entryPoint) { } void Direct3DApp1::Run() { - BasicTimer^ timer = ref new BasicTimer(); + BasicTimer ^ timer = ref new BasicTimer(); - while (!m_windowClosed) - { - if (m_windowVisible) - { + while (!m_windowClosed) { + if (m_windowVisible) { timer->Update(); - CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents( + CoreProcessEventsOption::ProcessAllIfPresent); m_renderer->Update(timer->Total, timer->Delta); m_renderer->Render(); - m_renderer->Present(); // This call is synchronized to the display frame rate. - } - else - { - CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + m_renderer + ->Present(); // This call is synchronized to the display frame rate. + } else { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents( + CoreProcessEventsOption::ProcessOneAndAllPending); } } } @@ -85,54 +90,63 @@ void Direct3DApp1::Uninitialize() { } -void Direct3DApp1::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) +void Direct3DApp1::OnWindowSizeChanged(CoreWindow ^ sender, + WindowSizeChangedEventArgs ^ args) { m_renderer->UpdateForWindowSizeChange(); } -void Direct3DApp1::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) +void Direct3DApp1::OnVisibilityChanged(CoreWindow ^ sender, + VisibilityChangedEventArgs ^ args) { m_windowVisible = args->Visible; } -void Direct3DApp1::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) +void Direct3DApp1::OnWindowClosed(CoreWindow ^ sender, + CoreWindowEventArgs ^ args) { m_windowClosed = true; } -void Direct3DApp1::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args) +void Direct3DApp1::OnPointerPressed(CoreWindow ^ sender, + PointerEventArgs ^ args) { // Insert your code here. } -void Direct3DApp1::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args) +void Direct3DApp1::OnPointerMoved(CoreWindow ^ sender, PointerEventArgs ^ args) { // Insert your code here. } -void Direct3DApp1::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +void Direct3DApp1::OnActivated(CoreApplicationView ^ applicationView, + IActivatedEventArgs ^ args) { CoreWindow::GetForCurrentThread()->Activate(); } -void Direct3DApp1::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) +void Direct3DApp1::OnSuspending(Platform::Object ^ sender, + SuspendingEventArgs ^ args) { - // Save app state asynchronously after requesting a deferral. Holding a deferral - // indicates that the application is busy performing suspending operations. Be - // aware that a deferral may not be held indefinitely. After about five seconds, + // Save app state asynchronously after requesting a deferral. Holding a + // deferral + // indicates that the application is busy performing suspending operations. + // Be + // aware that a deferral may not be held indefinitely. After about five + // seconds, // the app will be forced to exit. - SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + SuspendingDeferral ^ deferral = args->SuspendingOperation->GetDeferral(); m_renderer->ReleaseResourcesForSuspending(); - create_task([this, deferral]() - { + create_task([this, deferral]() { // Insert your code here. deferral->Complete(); }); } -void Direct3DApp1::OnResuming(Platform::Object^ sender, Platform::Object^ args) +void Direct3DApp1::OnResuming(Platform::Object ^ sender, + Platform::Object ^ args) { // Restore any data or state that was unloaded on suspend. By default, data // and state are persisted when resuming from suspend. Note that this event @@ -140,13 +154,12 @@ void Direct3DApp1::OnResuming(Platform::Object^ sender, Platform::Object^ args) m_renderer->CreateWindowSizeDependentResources(); } -IFrameworkView^ Direct3DApplicationSource::CreateView() +IFrameworkView ^ Direct3DApplicationSource::CreateView() { - return ref new Direct3DApp1(); + return ref new Direct3DApp1(); } -[Platform::MTAThread] -int main(Platform::Array<Platform::String^>^) +[Platform::MTAThread] int main(Platform::Array<Platform::String ^> ^) { auto direct3DApplicationSource = ref new Direct3DApplicationSource(); CoreApplication::Run(direct3DApplicationSource); diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h index 6861e44..c3499c7 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DApp1.h @@ -4,38 +4,52 @@ #include "CubeRenderer.h" -ref class Direct3DApp1 sealed : public Windows::ApplicationModel::Core::IFrameworkView +ref class Direct3DApp1 sealed + : public Windows::ApplicationModel::Core::IFrameworkView { public: Direct3DApp1(); // IFrameworkView Methods. - virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); - virtual void SetWindow(Windows::UI::Core::CoreWindow^ window); - virtual void Load(Platform::String^ entryPoint); + virtual void Initialize( + Windows::ApplicationModel::Core::CoreApplicationView ^ applicationView); + virtual void SetWindow(Windows::UI::Core::CoreWindow ^ window); + virtual void Load(Platform::String ^ entryPoint); virtual void Run(); virtual void Uninitialize(); protected: // Event Handlers. - void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); - void OnLogicalDpiChanged(Platform::Object^ sender); - void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); - void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); - void OnResuming(Platform::Object^ sender, Platform::Object^ args); - void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); - void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); - void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnWindowSizeChanged(Windows::UI::Core::CoreWindow ^ sender, + Windows::UI::Core::WindowSizeChangedEventArgs ^ + args); + void OnLogicalDpiChanged(Platform::Object ^ sender); + void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView ^ + applicationView, + Windows::ApplicationModel::Activation::IActivatedEventArgs ^ + args); + void OnSuspending(Platform::Object ^ sender, + Windows::ApplicationModel::SuspendingEventArgs ^ args); + void OnResuming(Platform::Object ^ sender, Platform::Object ^ args); + void OnWindowClosed(Windows::UI::Core::CoreWindow ^ sender, + Windows::UI::Core::CoreWindowEventArgs ^ args); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow ^ sender, + Windows::UI::Core::VisibilityChangedEventArgs ^ + args); + void OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, + Windows::UI::Core::PointerEventArgs ^ args); + void OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, + Windows::UI::Core::PointerEventArgs ^ args); private: - CubeRenderer^ m_renderer; + CubeRenderer ^ m_renderer; bool m_windowClosed; bool m_windowVisible; }; -ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +ref class Direct3DApplicationSource sealed + : Windows::ApplicationModel::Core::IFrameworkViewSource { public: - virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView(); + virtual Windows::ApplicationModel::Core::IFrameworkView ^ CreateView(); }; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp index f09c8da..8f3452c 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp @@ -14,7 +14,7 @@ Direct3DBase::Direct3DBase() } // Initialize the Direct3D resources required to run. -void Direct3DBase::Initialize(CoreWindow^ window) +void Direct3DBase::Initialize(CoreWindow ^ window) { m_window = window; @@ -25,7 +25,8 @@ void Direct3DBase::Initialize(CoreWindow^ window) // Recreate all device resources and set them back to the current state. void Direct3DBase::HandleDeviceLost() { - // Reset these member variables to ensure that UpdateForWindowSizeChange recreates all resources. + // Reset these member variables to ensure that UpdateForWindowSizeChange + // recreates all resources. m_windowBounds.Width = 0; m_windowBounds.Height = 0; m_swapChain = nullptr; @@ -37,56 +38,50 @@ void Direct3DBase::HandleDeviceLost() // These are the resources that depend on the device. void Direct3DBase::CreateDeviceResources() { - // This flag adds support for surfaces with a different color channel ordering + // This flag adds support for surfaces with a different color channel + // ordering // than the API default. It is required for compatibility with Direct2D. UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; #if defined(_DEBUG) - // If the project is in a debug build, enable debugging via SDK Layers with this flag. + // If the project is in a debug build, enable debugging via SDK Layers with + // this flag. creationFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif - // This array defines the set of DirectX hardware feature levels this app will support. + // This array defines the set of DirectX hardware feature levels this app + // will support. // Note the ordering should be preserved. - // Don't forget to declare your application's minimum required feature level in its - // description. All applications are assumed to support 9.1 unless otherwise stated. - D3D_FEATURE_LEVEL featureLevels[] = - { - D3D_FEATURE_LEVEL_11_1, - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - D3D_FEATURE_LEVEL_9_3, - D3D_FEATURE_LEVEL_9_2, + // Don't forget to declare your application's minimum required feature level + // in its + // description. All applications are assumed to support 9.1 unless otherwise + // stated. + D3D_FEATURE_LEVEL featureLevels[] = { + D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1 }; // Create the Direct3D 11 API device object and a corresponding context. ComPtr<ID3D11Device> device; ComPtr<ID3D11DeviceContext> context; - DX::ThrowIfFailed( - D3D11CreateDevice( - nullptr, // Specify nullptr to use the default adapter. - D3D_DRIVER_TYPE_HARDWARE, - nullptr, - creationFlags, // Set set debug and Direct2D compatibility flags. - featureLevels, // List of feature levels this app can support. - ARRAYSIZE(featureLevels), - D3D11_SDK_VERSION, // Always set this to D3D11_SDK_VERSION for Windows Store apps. - &device, // Returns the Direct3D device created. - &m_featureLevel, // Returns feature level of device created. - &context // Returns the device immediate context. - ) - ); + DX::ThrowIfFailed(D3D11CreateDevice( + nullptr, // Specify nullptr to use the default adapter. + D3D_DRIVER_TYPE_HARDWARE, nullptr, + creationFlags, // Set set debug and Direct2D compatibility flags. + featureLevels, // List of feature levels this app can support. + ARRAYSIZE(featureLevels), + D3D11_SDK_VERSION, // Always set this to D3D11_SDK_VERSION for Windows + // Store apps. + &device, // Returns the Direct3D device created. + &m_featureLevel, // Returns feature level of device created. + &context // Returns the device immediate context. + )); // Get the Direct3D 11.1 API device and context interfaces. - DX::ThrowIfFailed( - device.As(&m_d3dDevice) - ); + DX::ThrowIfFailed(device.As(&m_d3dDevice)); - DX::ThrowIfFailed( - context.As(&m_d3dContext) - ); + DX::ThrowIfFailed(context.As(&m_d3dContext)); } // Allocate all memory resources that change on a window SizeChanged event. @@ -100,9 +95,9 @@ void Direct3DBase::CreateWindowSizeDependentResources() float windowWidth = ConvertDipsToPixels(m_windowBounds.Width); float windowHeight = ConvertDipsToPixels(m_windowBounds.Height); - // The width and height of the swap chain must be based on the window's - // landscape-oriented width and height. If the window is in a portrait - // orientation, the dimensions must be reversed. +// The width and height of the swap chain must be based on the window's +// landscape-oriented width and height. If the window is in a portrait +// orientation, the dimensions must be reversed. #if WINVER > 0x0602 m_orientation = DisplayInformation::GetForCurrentView()->CurrentOrientation; #else @@ -113,126 +108,100 @@ void Direct3DBase::CreateWindowSizeDependentResources() m_orientation = DisplayProperties::CurrentOrientation; #endif #endif - bool swapDimensions = - m_orientation == DisplayOrientations::Portrait || + bool swapDimensions = m_orientation == DisplayOrientations::Portrait || m_orientation == DisplayOrientations::PortraitFlipped; m_renderTargetSize.Width = swapDimensions ? windowHeight : windowWidth; m_renderTargetSize.Height = swapDimensions ? windowWidth : windowHeight; - if(m_swapChain != nullptr) - { + if (m_swapChain != nullptr) { // If the swap chain already exists, resize it. DX::ThrowIfFailed( - m_swapChain->ResizeBuffers( - 2, // Double-buffered swap chain. - static_cast<UINT>(m_renderTargetSize.Width), - static_cast<UINT>(m_renderTargetSize.Height), - DXGI_FORMAT_B8G8R8A8_UNORM, - 0 - ) - ); - } - else - { - // Otherwise, create a new one using the same adapter as the existing Direct3D device. - DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0}; - swapChainDesc.Width = static_cast<UINT>(m_renderTargetSize.Width); // Match the size of the window. + m_swapChain->ResizeBuffers(2, // Double-buffered swap chain. + static_cast<UINT>(m_renderTargetSize.Width), + static_cast<UINT>(m_renderTargetSize.Height), + DXGI_FORMAT_B8G8R8A8_UNORM, 0)); + } else { + // Otherwise, create a new one using the same adapter as the existing + // Direct3D device. + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 }; + swapChainDesc.Width = static_cast<UINT>( + m_renderTargetSize.Width); // Match the size of the window. swapChainDesc.Height = static_cast<UINT>(m_renderTargetSize.Height); - swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swap chain format. + swapChainDesc.Format = + DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swap chain format. swapChainDesc.Stereo = false; swapChainDesc.SampleDesc.Count = 1; // Don't use multi-sampling. swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; #if PHONE && WINVER <= 0x0602 swapChainDesc.BufferCount = 1; // Use double-buffering to minimize latency. - swapChainDesc.Scaling = DXGI_SCALING_STRETCH; // On phone, only stretch and aspect-ratio stretch scaling are allowed. - swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // On phone, no swap effects are supported. + swapChainDesc.Scaling = DXGI_SCALING_STRETCH; // On phone, only stretch and + // aspect-ratio stretch + // scaling are allowed. + swapChainDesc.SwapEffect = + DXGI_SWAP_EFFECT_DISCARD; // On phone, no swap effects are supported. #else swapChainDesc.BufferCount = 2; // Use double-buffering to minimize latency. swapChainDesc.Scaling = DXGI_SCALING_NONE; - swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect. + swapChainDesc.SwapEffect = + DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this + // SwapEffect. #endif swapChainDesc.Flags = 0; - ComPtr<IDXGIDevice1> dxgiDevice; - DX::ThrowIfFailed( - m_d3dDevice.As(&dxgiDevice) - ); + ComPtr<IDXGIDevice1> dxgiDevice; + DX::ThrowIfFailed(m_d3dDevice.As(&dxgiDevice)); ComPtr<IDXGIAdapter> dxgiAdapter; - DX::ThrowIfFailed( - dxgiDevice->GetAdapter(&dxgiAdapter) - ); + DX::ThrowIfFailed(dxgiDevice->GetAdapter(&dxgiAdapter)); ComPtr<IDXGIFactory2> dxgiFactory; DX::ThrowIfFailed( - dxgiAdapter->GetParent( - __uuidof(IDXGIFactory2), - &dxgiFactory - ) - ); - - Windows::UI::Core::CoreWindow^ window = m_window.Get(); - DX::ThrowIfFailed( - dxgiFactory->CreateSwapChainForCoreWindow( - m_d3dDevice.Get(), - reinterpret_cast<IUnknown*>(window), - &swapChainDesc, - nullptr, // Allow on all displays. - &m_swapChain - ) - ); - - // Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and - // ensures that the application will only render after each VSync, minimizing power consumption. - DX::ThrowIfFailed( - dxgiDevice->SetMaximumFrameLatency(1) - ); + dxgiAdapter->GetParent(__uuidof(IDXGIFactory2), &dxgiFactory)); + + Windows::UI::Core::CoreWindow ^ window = m_window.Get(); + DX::ThrowIfFailed(dxgiFactory->CreateSwapChainForCoreWindow( + m_d3dDevice.Get(), reinterpret_cast<IUnknown*>(window), &swapChainDesc, + nullptr, // Allow on all displays. + &m_swapChain)); + + // Ensure that DXGI does not queue more than one frame at a time. This both + // reduces latency and + // ensures that the application will only render after each VSync, + // minimizing power consumption. + DX::ThrowIfFailed(dxgiDevice->SetMaximumFrameLatency(1)); } // Set the proper orientation for the swap chain, and generate the // 3D matrix transformation for rendering to the rotated swap chain. DXGI_MODE_ROTATION rotation = DXGI_MODE_ROTATION_UNSPECIFIED; - switch (m_orientation) - { + switch (m_orientation) { case DisplayOrientations::Landscape: rotation = DXGI_MODE_ROTATION_IDENTITY; m_orientationTransform3D = XMFLOAT4X4( // 0-degree Z-rotation - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - ); + 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); break; case DisplayOrientations::Portrait: rotation = DXGI_MODE_ROTATION_ROTATE270; m_orientationTransform3D = XMFLOAT4X4( // 90-degree Z-rotation - 0.0f, 1.0f, 0.0f, 0.0f, - -1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - ); + 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); break; case DisplayOrientations::LandscapeFlipped: rotation = DXGI_MODE_ROTATION_ROTATE180; m_orientationTransform3D = XMFLOAT4X4( // 180-degree Z-rotation - -1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - ); + -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); break; case DisplayOrientations::PortraitFlipped: rotation = DXGI_MODE_ROTATION_ROTATE90; m_orientationTransform3D = XMFLOAT4X4( // 270-degree Z-rotation - 0.0f, -1.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - ); + 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); break; default: @@ -240,64 +209,35 @@ void Direct3DBase::CreateWindowSizeDependentResources() } #if !PHONE || WINVER > 0x0602 - DX::ThrowIfFailed( - m_swapChain->SetRotation(rotation) - ); + DX::ThrowIfFailed(m_swapChain->SetRotation(rotation)); #endif // !PHONE // Create a render target view of the swap chain back buffer. ComPtr<ID3D11Texture2D> backBuffer; DX::ThrowIfFailed( - m_swapChain->GetBuffer( - 0, - __uuidof(ID3D11Texture2D), - &backBuffer - ) - ); + m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), &backBuffer)); - DX::ThrowIfFailed( - m_d3dDevice->CreateRenderTargetView( - backBuffer.Get(), - nullptr, - &m_renderTargetView - ) - ); + DX::ThrowIfFailed(m_d3dDevice->CreateRenderTargetView( + backBuffer.Get(), nullptr, &m_renderTargetView)); // Create a depth stencil view. CD3D11_TEXTURE2D_DESC depthStencilDesc( - DXGI_FORMAT_D24_UNORM_S8_UINT, - static_cast<UINT>(m_renderTargetSize.Width), - static_cast<UINT>(m_renderTargetSize.Height), - 1, - 1, - D3D11_BIND_DEPTH_STENCIL - ); + DXGI_FORMAT_D24_UNORM_S8_UINT, static_cast<UINT>(m_renderTargetSize.Width), + static_cast<UINT>(m_renderTargetSize.Height), 1, 1, + D3D11_BIND_DEPTH_STENCIL); ComPtr<ID3D11Texture2D> depthStencil; DX::ThrowIfFailed( - m_d3dDevice->CreateTexture2D( - &depthStencilDesc, - nullptr, - &depthStencil - ) - ); - - CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc(D3D11_DSV_DIMENSION_TEXTURE2D); - DX::ThrowIfFailed( - m_d3dDevice->CreateDepthStencilView( - depthStencil.Get(), - &depthStencilViewDesc, - &m_depthStencilView - ) - ); + m_d3dDevice->CreateTexture2D(&depthStencilDesc, nullptr, &depthStencil)); + + CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc( + D3D11_DSV_DIMENSION_TEXTURE2D); + DX::ThrowIfFailed(m_d3dDevice->CreateDepthStencilView( + depthStencil.Get(), &depthStencilViewDesc, &m_depthStencilView)); // Set the rendering viewport to target the entire window. - CD3D11_VIEWPORT viewport( - 0.0f, - 0.0f, - m_renderTargetSize.Width, - m_renderTargetSize.Height - ); + CD3D11_VIEWPORT viewport(0.0f, 0.0f, m_renderTargetSize.Width, + m_renderTargetSize.Height); m_d3dContext->RSSetViewports(1, &viewport); } @@ -306,14 +246,15 @@ void Direct3DBase::CreateWindowSizeDependentResources() void Direct3DBase::UpdateForWindowSizeChange() { if (m_window->Bounds.Width != m_windowBounds.Width || - m_window->Bounds.Height != m_windowBounds.Height || + m_window->Bounds.Height != m_windowBounds.Height || #if WINVER > 0x0602 - m_orientation != DisplayInformation::GetForCurrentView()->CurrentOrientation) + m_orientation != + DisplayInformation::GetForCurrentView()->CurrentOrientation) #else - m_orientation != DisplayProperties::CurrentOrientation) + m_orientation != DisplayProperties::CurrentOrientation) #endif { - ID3D11RenderTargetView* nullViews[] = {nullptr}; + ID3D11RenderTargetView* nullViews[] = { nullptr }; m_d3dContext->OMSetRenderTargets(ARRAYSIZE(nullViews), nullViews, nullptr); m_renderTargetView = nullptr; m_depthStencilView = nullptr; @@ -324,10 +265,14 @@ void Direct3DBase::UpdateForWindowSizeChange() void Direct3DBase::ReleaseResourcesForSuspending() { - // Phone applications operate in a memory-constrained environment, so when entering - // the background it is a good idea to free memory-intensive objects that will be - // easy to restore upon reactivation. The swapchain and backbuffer are good candidates - // here, as they consume a large amount of memory and can be reinitialized quickly. + // Phone applications operate in a memory-constrained environment, so when + // entering + // the background it is a good idea to free memory-intensive objects that + // will be + // easy to restore upon reactivation. The swapchain and backbuffer are good + // candidates + // here, as they consume a large amount of memory and can be reinitialized + // quickly. m_swapChain = nullptr; m_renderTargetView = nullptr; m_depthStencilView = nullptr; @@ -336,9 +281,11 @@ void Direct3DBase::ReleaseResourcesForSuspending() // Method to deliver the final image to the display. void Direct3DBase::Present() { - // The first argument instructs DXGI to block until VSync, putting the application - // to sleep until the next VSync. This ensures we don't waste any cycles rendering - // frames that will never be displayed to the screen. +// The first argument instructs DXGI to block until VSync, putting the +// application +// to sleep until the next VSync. This ensures we don't waste any cycles +// rendering +// frames that will never be displayed to the screen. #if PHONE && WINVER <= 0x0602 HRESULT hr = m_swapChain->Present(1, 0); #else @@ -350,12 +297,13 @@ void Direct3DBase::Present() parameters.pScrollRect = nullptr; parameters.pScrollOffset = nullptr; - HRESULT hr = m_swapChain->Present1(1, 0 , ¶meters); + HRESULT hr = m_swapChain->Present1(1, 0, ¶meters); #endif // Discard the contents of the render target. // This is a valid operation only when the existing contents will be entirely - // overwritten. If dirty or scroll rects are used, this call should be removed. + // overwritten. If dirty or scroll rects are used, this call should be + // removed. m_d3dContext->DiscardView(m_renderTargetView.Get()); // Discard the contents of the depth stencil. @@ -363,23 +311,24 @@ void Direct3DBase::Present() // If the device was removed either by a disconnect or a driver upgrade, we // must recreate all device resources. - if (hr == DXGI_ERROR_DEVICE_REMOVED) - { + if (hr == DXGI_ERROR_DEVICE_REMOVED) { HandleDeviceLost(); - } - else - { + } else { DX::ThrowIfFailed(hr); } } -// Method to convert a length in device-independent pixels (DIPs) to a length in physical pixels. +// Method to convert a length in device-independent pixels (DIPs) to a length +// in physical pixels. float Direct3DBase::ConvertDipsToPixels(float dips) { static const float dipsPerInch = 96.0f; #if WINVER > 0x0602 - return floor(dips * DisplayInformation::GetForCurrentView()->LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. + return floor(dips * DisplayInformation::GetForCurrentView()->LogicalDpi / + dipsPerInch + + 0.5f); // Round to nearest integer. #else - return floor(dips * DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. + return floor(dips * DisplayProperties::LogicalDpi / dipsPerInch + + 0.5f); // Round to nearest integer. #endif } diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h index bba9f16..f373f00 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h +++ b/Tests/VSWinStorePhone/Direct3DApp1/Direct3DBase.h @@ -5,11 +5,10 @@ // Helper class that initializes DirectX APIs for 3D rendering. ref class Direct3DBase abstract { -internal: - Direct3DBase(); + internal : Direct3DBase(); public: - virtual void Initialize(Windows::UI::Core::CoreWindow^ window); + virtual void Initialize(Windows::UI::Core::CoreWindow ^ window); virtual void HandleDeviceLost(); virtual void CreateDeviceResources(); virtual void CreateWindowSizeDependentResources(); @@ -19,7 +18,8 @@ public: virtual void Present(); virtual float ConvertDipsToPixels(float dips); -protected private: +protected +private: // Direct3D Objects. Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice; Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h b/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h index 3434ba9..c991dbb 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h +++ b/Tests/VSWinStorePhone/Direct3DApp1/DirectXHelper.h @@ -4,27 +4,26 @@ #include <ppltasks.h> #include <wrl/client.h> -namespace DX +namespace DX { +inline void ThrowIfFailed(HRESULT hr) { - inline void ThrowIfFailed(HRESULT hr) - { - if (FAILED(hr)) - { - // Set a breakpoint on this line to catch Win32 API errors. - throw Platform::Exception::CreateException(hr); - } + if (FAILED(hr)) { + // Set a breakpoint on this line to catch Win32 API errors. + throw Platform::Exception::CreateException(hr); } +} - // Function that reads from a binary file asynchronously. - inline Concurrency::task<Platform::Array<byte>^> ReadDataAsync(Platform::String^ filename) - { - using namespace Windows::Storage; - using namespace Concurrency; +// Function that reads from a binary file asynchronously. +inline Concurrency::task<Platform::Array<byte> ^> ReadDataAsync( + Platform::String ^ filename) +{ + using namespace Windows::Storage; + using namespace Concurrency; - auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation; + auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation; - return create_task(folder->GetFileAsync(filename)).then([] (StorageFile^ file) - { + return create_task(folder->GetFileAsync(filename)) + .then([](StorageFile ^ file) { #if !PHONE return FileIO::ReadBufferAsync(file); #else @@ -35,11 +34,11 @@ namespace DX auto fileBuffer = ref new Streams::Buffer(bufferSize); return stream->ReadAsync(fileBuffer, bufferSize, Streams::InputStreamOptions::None); #endif - }).then([] (Streams::IBuffer^ fileBuffer) -> Platform::Array<byte>^ - { + }) + .then([](Streams::IBuffer ^ fileBuffer) -> Platform::Array<byte> ^ { auto fileData = ref new Platform::Array<byte>(fileBuffer->Length); Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(fileData); return fileData; }); - } +} } diff --git a/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.h b/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.h index 16222c5..3e8c883 100644 --- a/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.h +++ b/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.h @@ -2,77 +2,78 @@ namespace Farrier { - using namespace System; - using namespace System::ComponentModel; - using namespace System::Collections; - using namespace System::Windows::Forms; - using namespace System::Data; - using namespace System::Drawing; +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing; +/// <summary> +/// Summary for MyForm +/// </summary> +public +ref class MyForm : public System::Windows::Forms::Form +{ +public: + MyForm(void) + { + InitializeComponent(); + // + // TODO: Add the constructor code here + // + } + +protected: /// <summary> - /// Summary for MyForm + /// Clean up any resources being used. /// </summary> - public ref class MyForm : public System::Windows::Forms::Form + ~MyForm() { - public: - MyForm(void) - { - InitializeComponent(); - // - //TODO: Add the constructor code here - // + if (components) { + delete components; } + } - protected: - /// <summary> - /// Clean up any resources being used. - /// </summary> - ~MyForm() - { - if (components) - { - delete components; - } - } - private: System::Windows::Forms::Button^ button1; - protected: +private: + System::Windows::Forms::Button ^ button1; - private: - /// <summary> - /// Required designer variable. - /// </summary> - System::ComponentModel::Container ^components; +protected: +private: + /// <summary> + /// Required designer variable. + /// </summary> + System::ComponentModel::Container ^ components; #pragma region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - void InitializeComponent(void) - { - this->button1 = (gcnew System::Windows::Forms::Button()); - this->SuspendLayout(); - // - // button1 - // - this->button1->Location = System::Drawing::Point(13, 13); - this->button1->Name = L"button1"; - this->button1->Size = System::Drawing::Size(75, 23); - this->button1->TabIndex = 0; - this->button1->Text = L"button1"; - this->button1->UseVisualStyleBackColor = true; - // - // MyForm - // - this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); - this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; - this->ClientSize = System::Drawing::Size(284, 261); - this->Controls->Add(this->button1); - this->Name = L"MyForm"; - this->Text = L"MyForm"; - this->ResumeLayout(false); - - } + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + void InitializeComponent(void) + { + this->button1 = (gcnew System::Windows::Forms::Button()); + this->SuspendLayout(); + // + // button1 + // + this->button1->Location = System::Drawing::Point(13, 13); + this->button1->Name = L"button1"; + this->button1->Size = System::Drawing::Size(75, 23); + this->button1->TabIndex = 0; + this->button1->Text = L"button1"; + this->button1->UseVisualStyleBackColor = true; + // + // MyForm + // + this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->ClientSize = System::Drawing::Size(284, 261); + this->Controls->Add(this->button1); + this->Name = L"MyForm"; + this->Text = L"MyForm"; + this->ResumeLayout(false); + } #pragma endregion - }; +}; } diff --git a/Tests/VSWindowsFormsResx/WindowsFormsResx/Source.cpp b/Tests/VSWindowsFormsResx/WindowsFormsResx/Source.cpp index aee9e2e..d123e09 100644 --- a/Tests/VSWindowsFormsResx/WindowsFormsResx/Source.cpp +++ b/Tests/VSWindowsFormsResx/WindowsFormsResx/Source.cpp @@ -1,4 +1,4 @@ -int main(int argc, char **argv) +int main(int argc, char** argv) { return 0; } diff --git a/Tests/VSXaml/App.xaml.cpp b/Tests/VSXaml/App.xaml.cpp index a187ed5..549b7ef 100644 --- a/Tests/VSXaml/App.xaml.cpp +++ b/Tests/VSXaml/App.xaml.cpp @@ -23,7 +23,8 @@ using namespace Windows::UI::Xaml::Interop; using namespace Windows::UI::Xaml::Media; using namespace Windows::UI::Xaml::Navigation; -// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 +// The Blank Application template is documented at +// http://go.microsoft.com/fwlink/?LinkId=234227 /// <summary> /// Initializes the singleton application object. This is the first line of @@ -32,8 +33,8 @@ using namespace Windows::UI::Xaml::Navigation; /// </summary> App::App() { - InitializeComponent(); - Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); } /// <summary> @@ -42,64 +43,63 @@ App::App() /// launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> -void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +void App::OnLaunched( + Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ e) { #if _DEBUG - // Show graphics profiling information while debugging. - if (IsDebuggerPresent()) - { - // Display the current frame rate counters - DebugSettings->EnableFrameRateCounter = true; - } + // Show graphics profiling information while debugging. + if (IsDebuggerPresent()) { + // Display the current frame rate counters + DebugSettings->EnableFrameRateCounter = true; + } #endif - auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content); - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == nullptr) - { - // Create a Frame to act as the navigation context and associate it with - // a SuspensionManager key - rootFrame = ref new Frame(); - - // Set the default language - rootFrame->Language = Windows::Globalization::ApplicationLanguages::Languages->GetAt(0); - - rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); - - if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) - { - // TODO: Restore the saved session state only when appropriate, scheduling the - // final launch steps after the restore is complete - - } - - if (rootFrame->Content == nullptr) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); - } - // Place the frame in the current Window - Window::Current->Content = rootFrame; - // Ensure the current window is active - Window::Current->Activate(); - } - else - { - if (rootFrame->Content == nullptr) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); - } - // Ensure the current window is active - Window::Current->Activate(); - } + auto rootFrame = dynamic_cast<Frame ^>(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + // Set the default language + rootFrame->Language = + Windows::Globalization::ApplicationLanguages::Languages->GetAt(0); + + rootFrame->NavigationFailed += + ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler( + this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) { + // TODO: Restore the saved session state only when appropriate, + // scheduling the + // final launch steps after the restore is complete + } + + if (rootFrame->Content == nullptr) { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a + // navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } else { + if (rootFrame->Content == nullptr) { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a + // navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Ensure the current window is active + Window::Current->Activate(); + } } /// <summary> @@ -109,12 +109,12 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> -void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +void App::OnSuspending(Object ^ sender, SuspendingEventArgs ^ e) { - (void) sender; // Unused parameter - (void) e; // Unused parameter + (void)sender; // Unused parameter + (void)e; // Unused parameter - //TODO: Save application state and stop any background activity + // TODO: Save application state and stop any background activity } /// <summary> @@ -122,7 +122,10 @@ void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) /// </summary> /// <param name="sender">The Frame which failed navigation</param> /// <param name="e">Details about the navigation failure</param> -void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +void App::OnNavigationFailed( + Platform::Object ^ sender, + Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^ e) { - throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); + throw ref new FailureException("Failed to load Page " + + e->SourcePageType.Name); } diff --git a/Tests/VSXaml/App.xaml.h b/Tests/VSXaml/App.xaml.h index 1f65bda..d3711d0 100644 --- a/Tests/VSXaml/App.xaml.h +++ b/Tests/VSXaml/App.xaml.h @@ -7,21 +7,25 @@ #include "App.g.h" -namespace VSXaml +namespace VSXaml { +/// <summary> +/// Provides application-specific behavior to supplement the default +/// Application class. +/// </summary> +ref class App sealed { - /// <summary> - /// Provides application-specific behavior to supplement the default Application class. - /// </summary> - ref class App sealed - { - protected: - virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; +protected: + virtual void OnLaunched( + Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ + e) override; - internal: - App(); + internal : App(); - private: - void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); - void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); - }; +private: + void OnSuspending(Platform::Object ^ sender, + Windows::ApplicationModel::SuspendingEventArgs ^ e); + void OnNavigationFailed( + Platform::Object ^ sender, + Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^ e); +}; } diff --git a/Tests/VSXaml/MainPage.xaml.cpp b/Tests/VSXaml/MainPage.xaml.cpp index 63f2dec..51da237 100644 --- a/Tests/VSXaml/MainPage.xaml.cpp +++ b/Tests/VSXaml/MainPage.xaml.cpp @@ -20,9 +20,10 @@ using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Xaml::Media; using namespace Windows::UI::Xaml::Navigation; -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 +// The Blank Page item template is documented at +// http://go.microsoft.com/fwlink/?LinkId=234238 MainPage::MainPage() { - InitializeComponent(); + InitializeComponent(); } diff --git a/Tests/VSXaml/MainPage.xaml.h b/Tests/VSXaml/MainPage.xaml.h index ccc781b..875d227 100644 --- a/Tests/VSXaml/MainPage.xaml.h +++ b/Tests/VSXaml/MainPage.xaml.h @@ -7,15 +7,14 @@ #include "MainPage.g.h" -namespace VSXaml +namespace VSXaml { +/// <summary> +/// An empty page that can be used on its own or navigated to within a Frame. +/// </summary> +public +ref class MainPage sealed { - /// <summary> - /// An empty page that can be used on its own or navigated to within a Frame. - /// </summary> - public ref class MainPage sealed - { - public: - MainPage(); - - }; +public: + MainPage(); +}; } diff --git a/Tests/Visibility/bar.c b/Tests/Visibility/bar.c index e425999..b72a1a5 100644 --- a/Tests/Visibility/bar.c +++ b/Tests/Visibility/bar.c @@ -1 +1,3 @@ -void bar() {} +void bar() +{ +} diff --git a/Tests/Visibility/foo.cpp b/Tests/Visibility/foo.cpp index 2b66b69..8373fd2 100644 --- a/Tests/Visibility/foo.cpp +++ b/Tests/Visibility/foo.cpp @@ -1,11 +1,11 @@ class Foo { public: - void bar() {} + void bar() {} }; void baz() { - Foo foo; - foo.bar(); + Foo foo; + foo.bar(); } diff --git a/Tests/Visibility/hidden.c b/Tests/Visibility/hidden.c index 6e97343..12f071f 100644 --- a/Tests/Visibility/hidden.c +++ b/Tests/Visibility/hidden.c @@ -1,4 +1,9 @@ -int hidden_function(void) { return 0; } +int hidden_function(void) +{ + return 0; +} -__attribute__((visibility("default"))) -int not_hidden(void) { return hidden_function(); } +__attribute__((visibility("default"))) int not_hidden(void) +{ + return hidden_function(); +} diff --git a/Tests/Visibility/shared.c b/Tests/Visibility/shared.c index bb94976..7a07939 100644 --- a/Tests/Visibility/shared.c +++ b/Tests/Visibility/shared.c @@ -1,3 +1,6 @@ extern int not_hidden(void); -int shared(void) { return not_hidden(); } +int shared(void) +{ + return not_hidden(); +} diff --git a/Tests/WarnUnusedCliUnused/empty.cpp b/Tests/WarnUnusedCliUnused/empty.cpp index 7279c5e..8d91e77 100644 --- a/Tests/WarnUnusedCliUnused/empty.cpp +++ b/Tests/WarnUnusedCliUnused/empty.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif -int empty(void) + int empty(void) { return 0; } diff --git a/Tests/Wrapping/Wrap.c b/Tests/Wrapping/Wrap.c index 0a1ff50..e8fb8a5 100644 --- a/Tests/Wrapping/Wrap.c +++ b/Tests/Wrapping/Wrap.c @@ -1,23 +1,19 @@ #include <stdio.h> #ifdef __CLASSIC_C__ -int main(argc, argv) - int argc; - char ** argv; +int main(argc, argv) int argc; +char** argv; #else int main(int argc, const char* argv[]) #endif { - FILE* fout = fopen(argv[argc-1], "w"); - printf("Wrap creating \"%s\"\n", argv[argc-1]); - if(fout) - { + FILE* fout = fopen(argv[argc - 1], "w"); + printf("Wrap creating \"%s\"\n", argv[argc - 1]); + if (fout) { fprintf(fout, "int foo() { return 0; }\n"); fclose(fout); - } - else - { + } else { return -1; - } + } return 0; } diff --git a/Tests/Wrapping/fakefluid.cxx b/Tests/Wrapping/fakefluid.cxx index af44679..02c0c52 100644 --- a/Tests/Wrapping/fakefluid.cxx +++ b/Tests/Wrapping/fakefluid.cxx @@ -2,16 +2,13 @@ #include <string.h> int main(int ac, char** av) { - for(int i =0; i < ac; ++i) - { - if(strcmp(av[i], "-o") == 0 || - strcmp(av[i], "-h") == 0) - { - fprintf(stdout, "fakefluid is creating file \"%s\"\n", av[i+1]); - FILE* file = fopen(av[i+1], "w"); + for (int i = 0; i < ac; ++i) { + if (strcmp(av[i], "-o") == 0 || strcmp(av[i], "-h") == 0) { + fprintf(stdout, "fakefluid is creating file \"%s\"\n", av[i + 1]); + FILE* file = fopen(av[i + 1], "w"); fprintf(file, "// hello\n"); fclose(file); - } } + } return 0; } diff --git a/Tests/Wrapping/qtnoqtmain.cxx b/Tests/Wrapping/qtnoqtmain.cxx index 92594d5..e94a125 100644 --- a/Tests/Wrapping/qtnoqtmain.cxx +++ b/Tests/Wrapping/qtnoqtmain.cxx @@ -2,4 +2,3 @@ int main(int ac, char** av) { return 0; } - diff --git a/Tests/Wrapping/qtwrappingmain.cxx b/Tests/Wrapping/qtwrappingmain.cxx index 55c7952..37234d9 100644 --- a/Tests/Wrapping/qtwrappingmain.cxx +++ b/Tests/Wrapping/qtwrappingmain.cxx @@ -2,27 +2,25 @@ #include <qapplication.h> #ifndef _WIN32 -# include <stdio.h> -# include <stdlib.h> +#include <stdio.h> +#include <stdlib.h> #endif -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { #ifndef _WIN32 const char* display = getenv("DISPLAY"); - if ( display && strlen(display)>0 ) - { + if (display && strlen(display) > 0) { #endif - QApplication app(argc,argv); + QApplication app(argc, argv); qtwrapping qtw; app.setMainWidget(&qtw); #ifndef _WIN32 - } - else - { - printf("Environment variable DISPLAY is not set. I will pretend like the test passed, but you should really set it.\n"); - } + } else { + printf("Environment variable DISPLAY is not set. I will pretend like the " + "test passed, but you should really set it.\n"); + } #endif return 0; diff --git a/Tests/Wrapping/wrapFLTK.cxx b/Tests/Wrapping/wrapFLTK.cxx index 78f2de1..8488f4e 100644 --- a/Tests/Wrapping/wrapFLTK.cxx +++ b/Tests/Wrapping/wrapFLTK.cxx @@ -1 +1,4 @@ -int main(void) { return 0; } +int main(void) +{ + return 0; +} diff --git a/Tests/Wrapping/wrapping.cxx b/Tests/Wrapping/wrapping.cxx index 1482f27..f8b643a 100644 --- a/Tests/Wrapping/wrapping.cxx +++ b/Tests/Wrapping/wrapping.cxx @@ -1,4 +1,4 @@ -int main () +int main() { return 0; } diff --git a/Tests/X11/HelloWorldX11.cxx b/Tests/X11/HelloWorldX11.cxx index 27ab843..0863f7b 100644 --- a/Tests/X11/HelloWorldX11.cxx +++ b/Tests/X11/HelloWorldX11.cxx @@ -10,7 +10,6 @@ * */ - #ifndef MAIN_H #define MAIN_H 1 @@ -22,19 +21,17 @@ #include <X11/Xos.h> #include <X11/Xutil.h> -class Main { +class Main +{ public: // constructor - Main(int argc, char * const argv[]); - //virtual ~Main(); - + Main(int argc, char* const argv[]); + // virtual ~Main(); private: - - /* here are our X variables */ - Display *dis; + Display* dis; int screen; Window win; GC gc; @@ -44,7 +41,6 @@ private: void close_x(); void redraw(); int delay(int i); - }; #endif @@ -57,90 +53,90 @@ private: // http://www.insanityengine.com/doc/x11/xintro.html // jeff louie 02.05.2004 - - -int main (int argc, char * const argv[]) { +int main(int argc, char* const argv[]) +{ Main m(argc, argv); return 0; } -//Main::~Main() {;}; -Main::Main (int argc, char * const argv[]) { - XEvent event; // XEvent declaration - KeySym key; // KeyPress Events - char text[255]; // char buffer for KeyPress Events +// Main::~Main() {;}; +Main::Main(int argc, char* const argv[]) +{ + XEvent event; // XEvent declaration + KeySym key; // KeyPress Events + char text[255]; // char buffer for KeyPress Events init_x(); // event loop - while(1) { - // get the next event and stuff it into our event variable. - // Note: only events we set the mask for are detected! - XNextEvent(dis, &event); - - - switch (event.type) { - int x; - int y; - case Expose: - if (event.xexpose.count==0) { - redraw(); - } - break; - case KeyPress: - if (XLookupString(&event.xkey,text,255,&key,0)==1) { - // use the XLookupString routine to convert the invent - // KeyPress data into regular text. Weird but necessary... - if ((text[0]=='q') || (text[0]=='Q')) { - close_x(); - } - else { - // echo key press - printf("You pressed the %c key!\n",text[0]); + while (1) { + // get the next event and stuff it into our event variable. + // Note: only events we set the mask for are detected! + XNextEvent(dis, &event); + + switch (event.type) { + int x; + int y; + case Expose: + if (event.xexpose.count == 0) { + redraw(); + } + break; + case KeyPress: + if (XLookupString(&event.xkey, text, 255, &key, 0) == 1) { + // use the XLookupString routine to convert the invent + // KeyPress data into regular text. Weird but necessary... + if ((text[0] == 'q') || (text[0] == 'Q')) { + close_x(); + } else { + // echo key press + printf("You pressed the %c key!\n", text[0]); + } + } + break; + case ButtonPress: + // get cursor position + x = event.xbutton.x; + y = event.xbutton.y; + strcpy(text, "X is FUN!"); + XSetForeground(dis, gc, rand() % event.xbutton.x % 255); + // draw text at cursor + XDrawString(dis, win, gc, x, y, text, strlen(text)); + break; + default: + printf("Unhandled event.\n"); } - } - break; - case ButtonPress: - // get cursor position - x= event.xbutton.x; - y= event.xbutton.y; - strcpy(text,"X is FUN!"); - XSetForeground(dis,gc,rand()%event.xbutton.x%255); - // draw text at cursor - XDrawString(dis,win,gc,x,y, text, strlen(text)); - break; - default: - printf("Unhandled event.\n"); - } } } -void Main::init_x() { - unsigned long black,white; - - dis=XOpenDisplay(NULL); - screen=DefaultScreen(dis); - black=BlackPixel(dis,screen), - white=WhitePixel(dis, screen); - win=XCreateSimpleWindow(dis,DefaultRootWindow(dis),0,0, - 300, 300, 5,black, white); - XSetStandardProperties(dis,win,"Hello World","Hi",None,NULL,0,NULL); - XSelectInput(dis, win, ExposureMask|ButtonPressMask|KeyPressMask); +void Main::init_x() +{ + unsigned long black, white; + + dis = XOpenDisplay(NULL); + screen = DefaultScreen(dis); + black = BlackPixel(dis, screen), white = WhitePixel(dis, screen); + win = XCreateSimpleWindow(dis, DefaultRootWindow(dis), 0, 0, 300, 300, 5, + black, white); + XSetStandardProperties(dis, win, "Hello World", "Hi", None, NULL, 0, NULL); + XSelectInput(dis, win, ExposureMask | ButtonPressMask | KeyPressMask); // get Graphics Context - gc=XCreateGC(dis, win, 0,0); - XSetBackground(dis,gc,white); - XSetForeground(dis,gc,black); + gc = XCreateGC(dis, win, 0, 0); + XSetBackground(dis, gc, white); + XSetForeground(dis, gc, black); XClearWindow(dis, win); XMapRaised(dis, win); }; -void Main::close_x() { +void Main::close_x() +{ XFreeGC(dis, gc); - XDestroyWindow(dis,win); + XDestroyWindow(dis, win); XCloseDisplay(dis); exit(1); }; -void Main::redraw() { +void Main::redraw() +{ XClearWindow(dis, win); }; diff --git a/Tests/XCTest/CocoaExample/AppDelegate.h b/Tests/XCTest/CocoaExample/AppDelegate.h index 4bf4101..11b5886 100644 --- a/Tests/XCTest/CocoaExample/AppDelegate.h +++ b/Tests/XCTest/CocoaExample/AppDelegate.h @@ -1,6 +1,5 @@ #import <Cocoa/Cocoa.h> -@interface AppDelegate : NSObject <NSApplicationDelegate> - +@interface AppDelegate : NSObject<NSApplicationDelegate> @end diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c b/Tests/XCTest/FrameworkExample/FrameworkExample.c index 2da78da..77361c8 100644 --- a/Tests/XCTest/FrameworkExample/FrameworkExample.c +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c @@ -2,5 +2,5 @@ int FourtyTwo() { - return 42; + return 42; } diff --git a/Tests/iOSNavApp/Classes/NavApp3AppDelegate.h b/Tests/iOSNavApp/Classes/NavApp3AppDelegate.h index f1234fe..882003e 100644 --- a/Tests/iOSNavApp/Classes/NavApp3AppDelegate.h +++ b/Tests/iOSNavApp/Classes/NavApp3AppDelegate.h @@ -8,13 +8,14 @@ #import <UIKit/UIKit.h> -@interface NavApp3AppDelegate : NSObject <UIApplicationDelegate> { +@interface NavApp3AppDelegate : NSObject<UIApplicationDelegate> { - UIWindow *window; - UINavigationController *navigationController; + UIWindow* window; + UINavigationController* navigationController; } -@property (nonatomic, retain) IBOutlet UIWindow *window; -@property (nonatomic, retain) IBOutlet UINavigationController *navigationController; +@property (nonatomic, retain) IBOutlet UIWindow* window; +@property (nonatomic, retain) + IBOutlet UINavigationController* navigationController; @end diff --git a/Tests/iOSNavApp/TotalFunction.c b/Tests/iOSNavApp/TotalFunction.c index 0965a88..b228a78 100644 --- a/Tests/iOSNavApp/TotalFunction.c +++ b/Tests/iOSNavApp/TotalFunction.c @@ -8,7 +8,7 @@ #include "TotalFunction.h" -int Total(const char *context) +int Total(const char* context) { return 22; } diff --git a/Tests/iOSNavApp/TotalFunction.h b/Tests/iOSNavApp/TotalFunction.h index 1301c3d..26ff306 100644 --- a/Tests/iOSNavApp/TotalFunction.h +++ b/Tests/iOSNavApp/TotalFunction.h @@ -9,6 +9,6 @@ #ifndef NavApp3_TotalFunction_h #define NavApp3_TotalFunction_h -int Total(const char *context); +int Total(const char* context); #endif |