diff options
author | Kitware Robot <kwrobot@kitware.com> | 2018-06-01 13:53:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-06-01 13:53:42 (GMT) |
commit | d7204e649ed4ebb19bb341b4e49eb51514364922 (patch) | |
tree | d9ac3ded5ae6899be7188795011743fe3e6da0a6 /Tests/RunCMake | |
parent | 12fed3edb107c949671043196fa94c542b45452a (diff) | |
download | CMake-d7204e649ed4ebb19bb341b4e49eb51514364922.zip CMake-d7204e649ed4ebb19bb341b4e49eb51514364922.tar.gz CMake-d7204e649ed4ebb19bb341b4e49eb51514364922.tar.bz2 |
Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`. Use `clang-format` version 6.0.
* 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/RunCMake')
20 files changed, 139 insertions, 135 deletions
diff --git a/Tests/RunCMake/Android/android.cxx b/Tests/RunCMake/Android/android.cxx index 2dee8f9..a6d8c55 100644 --- a/Tests/RunCMake/Android/android.cxx +++ b/Tests/RunCMake/Android/android.cxx @@ -1,19 +1,19 @@ #include "android.h" #ifndef STL_NONE -#include <cmath> -#include <cstdio> -#ifndef STL_SYSTEM -#include <exception> -#include <typeinfo> -#ifndef STL_STLPORT -#include <cxxabi.h> -#endif -#ifndef STL_GABI -#include <iostream> -#include <string> -#endif -#endif +# include <cmath> +# include <cstdio> +# ifndef STL_SYSTEM +# include <exception> +# include <typeinfo> +# ifndef STL_STLPORT +# include <cxxabi.h> +# endif +# ifndef STL_GABI +# include <iostream> +# include <string> +# endif +# endif #endif int main() @@ -30,19 +30,19 @@ int main() try { delete (new int); } catch (std::exception const& e) { -#if defined(STL_GABI) +# if defined(STL_GABI) e.what(); typeid(e).name(); -#else +# else std::cerr << e.what() << std::endl; std::cerr << typeid(e).name() << std::endl; -#endif +# endif } -#if defined(STL_GABI) +# if defined(STL_GABI) return 0; -#else +# else std::string s; return static_cast<int>(s.size()); -#endif +# endif #endif } diff --git a/Tests/RunCMake/Android/android.h b/Tests/RunCMake/Android/android.h index a5fd67e..2c5cd95 100644 --- a/Tests/RunCMake/Android/android.h +++ b/Tests/RunCMake/Android/android.h @@ -1,103 +1,103 @@ #ifndef __ANDROID__ -#error "__ANDROID__ not defined" +# error "__ANDROID__ not defined" #endif #include <android/api-level.h> #if API_LEVEL != __ANDROID_API__ -#error "API levels do not match" +# error "API levels do not match" #endif #ifdef COMPILER_IS_CLANG -#ifndef __clang__ -#error "COMPILER_IS_CLANG but __clang__ is not defined" -#endif +# ifndef __clang__ +# error "COMPILER_IS_CLANG but __clang__ is not defined" +# endif #else -#ifdef __clang__ -#error "!COMPILER_IS_CLANG but __clang__ is defined" -#endif +# ifdef __clang__ +# error "!COMPILER_IS_CLANG but __clang__ is defined" +# endif #endif #ifdef ARM_MODE -#if ARM_MODE == 1 && defined(__thumb__) -#error "ARM_MODE==1 but __thumb__ is defined" -#elif ARM_MODE == 0 && !defined(__thumb__) -#error "ARM_MODE==0 but __thumb__ is not defined" -#endif +# if ARM_MODE == 1 && defined(__thumb__) +# error "ARM_MODE==1 but __thumb__ is defined" +# elif ARM_MODE == 0 && !defined(__thumb__) +# error "ARM_MODE==0 but __thumb__ is not defined" +# endif #endif #ifdef ARM_NEON -#if ARM_NEON == 0 && defined(__ARM_NEON__) -#error "ARM_NEON==0 but __ARM_NEON__ is defined" -#elif ARM_NEON == 1 && !defined(__ARM_NEON__) -#error "ARM_NEON==1 but __ARM_NEON__ is not defined" -#endif +# if ARM_NEON == 0 && defined(__ARM_NEON__) +# error "ARM_NEON==0 but __ARM_NEON__ is defined" +# elif ARM_NEON == 1 && !defined(__ARM_NEON__) +# error "ARM_NEON==1 but __ARM_NEON__ is not defined" +# endif #endif #ifdef ABI_armeabi -#ifndef __ARM_EABI__ -#error "ABI_armeabi: __ARM_EABI__ not defined" -#endif -#if __ARM_ARCH != 5 -#error "ABI_armeabi: __ARM_ARCH is not 5" -#endif +# ifndef __ARM_EABI__ +# error "ABI_armeabi: __ARM_EABI__ not defined" +# endif +# if __ARM_ARCH != 5 +# error "ABI_armeabi: __ARM_ARCH is not 5" +# endif #endif #ifdef ABI_armeabi_v6 -#ifndef __ARM_EABI__ -#error "ABI_armeabi_v6: __ARM_EABI__ not defined" -#endif -#if __ARM_ARCH != 6 -#error "ABI_armeabi_v6: __ARM_ARCH is not 6" -#endif +# ifndef __ARM_EABI__ +# error "ABI_armeabi_v6: __ARM_EABI__ not defined" +# endif +# if __ARM_ARCH != 6 +# error "ABI_armeabi_v6: __ARM_ARCH is not 6" +# endif #endif #ifdef ABI_armeabi_v7a -#ifndef __ARM_EABI__ -#error "ABI_armeabi_v7a: __ARM_EABI__ not defined" -#endif -#if __ARM_ARCH != 7 -#error "ABI_armeabi_v7a: __ARM_ARCH is not 7" -#endif +# ifndef __ARM_EABI__ +# error "ABI_armeabi_v7a: __ARM_EABI__ not defined" +# endif +# if __ARM_ARCH != 7 +# error "ABI_armeabi_v7a: __ARM_ARCH is not 7" +# endif #endif #ifdef ABI_arm64_v8a -#ifdef __ARM_EABI__ -#error "ABI_arm64_v8a: __ARM_EABI__ defined" -#endif -#ifndef __aarch64__ -#error "ABI_arm64_v8a: __aarch64__ not defined" -#endif +# ifdef __ARM_EABI__ +# error "ABI_arm64_v8a: __ARM_EABI__ defined" +# endif +# ifndef __aarch64__ +# error "ABI_arm64_v8a: __aarch64__ not defined" +# endif #endif #ifdef ABI_mips -#if __mips != 32 -#error "ABI_mips: __mips != 32" -#endif -#ifndef _ABIO32 -#error "ABI_mips: _ABIO32 not defined" -#endif +# if __mips != 32 +# error "ABI_mips: __mips != 32" +# endif +# ifndef _ABIO32 +# error "ABI_mips: _ABIO32 not defined" +# endif #endif #ifdef ABI_mips64 -#if __mips != 64 -#error "ABI_mips64: __mips != 64" -#endif -#ifndef _ABI64 -#error "ABI_mips: _ABI64 not defined" -#endif +# if __mips != 64 +# error "ABI_mips64: __mips != 64" +# endif +# ifndef _ABI64 +# error "ABI_mips: _ABI64 not defined" +# endif #endif #ifdef ABI_x86 -#ifndef __i686__ -#error "ABI_x86: __i686__ not defined" -#endif +# ifndef __i686__ +# error "ABI_x86: __i686__ not defined" +# endif #endif #ifdef ABI_x86_64 -#ifndef __x86_64__ -#error "ABI_x86_64: __x86_64__ not defined" -#endif +# ifndef __x86_64__ +# error "ABI_x86_64: __x86_64__ not defined" +# endif #endif #include <stddef.h> diff --git a/Tests/RunCMake/Android/android_sysinc.c b/Tests/RunCMake/Android/android_sysinc.c index 18d73db..f7cc6f0 100644 --- a/Tests/RunCMake/Android/android_sysinc.c +++ b/Tests/RunCMake/Android/android_sysinc.c @@ -1,7 +1,7 @@ #include <dlfcn.h> #ifndef NOT_SYSTEM_DLFCN_HEADER -#error "sysroot /usr/include appears too early" +# error "sysroot /usr/include appears too early" #endif #include "android.c" diff --git a/Tests/RunCMake/Android/android_sysinc.cxx b/Tests/RunCMake/Android/android_sysinc.cxx index 5c5694b..9379f14 100644 --- a/Tests/RunCMake/Android/android_sysinc.cxx +++ b/Tests/RunCMake/Android/android_sysinc.cxx @@ -1,7 +1,7 @@ #include <dlfcn.h> #ifndef NOT_SYSTEM_DLFCN_HEADER -#error "sysroot /usr/include appears too early" +# error "sysroot /usr/include appears too early" #endif #include "android.cxx" diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c index 4b1318b..d13bc3e 100644 --- a/Tests/RunCMake/AutoExportDll/foo.c +++ b/Tests/RunCMake/AutoExportDll/foo.c @@ -1,7 +1,7 @@ #ifdef _MSC_VER -#include "windows.h" +# include "windows.h" #else -#define WINAPI +# define WINAPI #endif int WINAPI foo() diff --git a/Tests/RunCMake/AutoExportDll/hello.h b/Tests/RunCMake/AutoExportDll/hello.h index 3749b97..7192f65 100644 --- a/Tests/RunCMake/AutoExportDll/hello.h +++ b/Tests/RunCMake/AutoExportDll/hello.h @@ -1,11 +1,11 @@ #ifndef _MSC_VER -#define winexport +# define winexport #else -#ifdef autoexport_EXPORTS -#define winexport -#else -#define winexport __declspec(dllimport) -#endif +# ifdef autoexport_EXPORTS +# define winexport +# else +# define winexport __declspec(dllimport) +# endif #endif class Hello diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index 51060e8..c8bfcc7 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -1,9 +1,9 @@ #include "hello.h" #include <stdio.h> #ifdef _MSC_VER -#include "windows.h" +# include "windows.h" #else -#define WINAPI +# define WINAPI #endif extern "C" { diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h index 8d5eb62..76b97c4 100644 --- a/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibMixedNative.h @@ -1,9 +1,9 @@ #pragma once #ifdef ImportLibMixed_EXPORTS -#define mixedAPI __declspec(dllexport) +# define mixedAPI __declspec(dllexport) #else -#define mixedAPI __declspec(dllimport) +# define mixedAPI __declspec(dllimport) #endif class mixedAPI ImportLibMixedNative diff --git a/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h b/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h index 7c85626..77bcb82 100644 --- a/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h +++ b/Tests/RunCMake/CSharpReferenceImport/ImportLibNative.h @@ -1,9 +1,9 @@ #pragma once #ifdef ImportLibNative_EXPORTS -#define nativeAPI __declspec(dllexport) +# define nativeAPI __declspec(dllexport) #else -#define nativeAPI __declspec(dllimport) +# define nativeAPI __declspec(dllimport) #endif class nativeAPI ImportLibNative diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 9ac8381..752b49e 100644 --- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -1,7 +1,7 @@ #include "libshared_and_static.h" #ifndef MY_CUSTOM_CONTENT_ADDED -#error "MY_CUSTOM_CONTENT_ADDED not defined!" +# error "MY_CUSTOM_CONTENT_ADDED not defined!" #endif int libshared_and_static::Class::method() const diff --git a/Tests/RunCMake/GoogleTest/timeout_test.cpp b/Tests/RunCMake/GoogleTest/timeout_test.cpp index 9162dcf..b8ad055 100644 --- a/Tests/RunCMake/GoogleTest/timeout_test.cpp +++ b/Tests/RunCMake/GoogleTest/timeout_test.cpp @@ -1,7 +1,7 @@ #if defined(_WIN32) -#include <windows.h> +# include <windows.h> #else -#include <unistd.h> +# include <unistd.h> #endif #include <iostream> diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c index 5beb3f1..8e490f3 100644 --- a/Tests/RunCMake/ObjectLibrary/a.c +++ b/Tests/RunCMake/ObjectLibrary/a.c @@ -1,7 +1,7 @@ #if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) -#define EXPORT __declspec(dllexport) +# define EXPORT __declspec(dllexport) #else -#define EXPORT +# define EXPORT #endif EXPORT int a(void) diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c index 7549abf..220ce03 100644 --- a/Tests/RunCMake/ObjectLibrary/b.c +++ b/Tests/RunCMake/ObjectLibrary/b.c @@ -1,7 +1,7 @@ #if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) -#define EXPORT __declspec(dllexport) +# define EXPORT __declspec(dllexport) #else -#define EXPORT +# define EXPORT #endif extern int a(void); @@ -10,5 +10,5 @@ EXPORT int b() return a(); } #ifndef REQUIRED -#error "REQUIRED needs to be defined" +# error "REQUIRED needs to be defined" #endif diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c index 6efdae7..2e08700 100644 --- a/Tests/RunCMake/ObjectLibrary/exe.c +++ b/Tests/RunCMake/ObjectLibrary/exe.c @@ -1,7 +1,7 @@ #if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) -#define IMPORT __declspec(dllimport) +# define IMPORT __declspec(dllimport) #else -#define IMPORT +# define IMPORT #endif extern IMPORT int b(void); @@ -10,5 +10,5 @@ int main() return b(); } #ifndef REQUIRED -#error "REQUIRED needs to be defined" +# error "REQUIRED needs to be defined" #endif diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c index d524952..685632b 100644 --- a/Tests/RunCMake/ObjectLibrary/requires.c +++ b/Tests/RunCMake/ObjectLibrary/requires.c @@ -4,5 +4,5 @@ int required() return 0; } #else -#error "REQUIRED not defined" +# error "REQUIRED not defined" #endif diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.c b/Tests/RunCMake/XcodeProject/DeploymentTarget.c index 51af046..5e0f40f 100644 --- a/Tests/RunCMake/XcodeProject/DeploymentTarget.c +++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.c @@ -2,23 +2,23 @@ #include <TargetConditionals.h> #if TARGET_OS_OSX -#if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11 -#error macOS deployment version mismatch -#endif +# if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11 +# error macOS deployment version mismatch +# endif #elif TARGET_OS_IOS -#if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1 -#error iOS deployment version mismatch -#endif +# if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1 +# error iOS deployment version mismatch +# endif #elif TARGET_OS_WATCH -#if __WATCH_OS_VERSION_MIN_REQUIRED != __WATCHOS_2_0 -#error watchOS deployment version mismatch -#endif +# if __WATCH_OS_VERSION_MIN_REQUIRED != __WATCHOS_2_0 +# error watchOS deployment version mismatch +# endif #elif TARGET_OS_TV -#if __TV_OS_VERSION_MIN_REQUIRED != __TVOS_9_0 -#error tvOS deployment version mismatch -#endif +# if __TV_OS_VERSION_MIN_REQUIRED != __TVOS_9_0 +# error tvOS deployment version mismatch +# endif #else -#error unknown OS +# error unknown OS #endif void foo() diff --git a/Tests/RunCMake/pseudo_cppcheck.c b/Tests/RunCMake/pseudo_cppcheck.c index 8667e5e..75f3cec 100644 --- a/Tests/RunCMake/pseudo_cppcheck.c +++ b/Tests/RunCMake/pseudo_cppcheck.c @@ -16,17 +16,21 @@ int main(int argc, char* argv[]) fprintf(stderr, "[/foo/bar.c:2]: (error) Array 'abc[10]' accessed at index 12," " which is out of bounds.\n"); - fprintf(stderr, "[/foo/bar.c:2]: (warning) Member variable 'foo::bar' is " - "not initialized in the constructor.\n"); + fprintf(stderr, + "[/foo/bar.c:2]: (warning) Member variable 'foo::bar' is " + "not initialized in the constructor.\n"); fprintf(stderr, "[/foo/bar.c:2]: (style) C-style pointer casting.\n"); - fprintf(stderr, "[/foo/bar.c:2]: (performance) Variable 'm_message' is " - "assigned in constructor body. Consider performing " - "initialization in initialization list.\n"); - fprintf(stderr, "[/foo/bar.c:2]: (portability) scanf without field width " - "limits can crash with huge input data on some versions of " - "libc\n"); - fprintf(stderr, "[/foo/bar.c:2]: (information) cannot find all the include " - "files (use --check-config for details)\n"); + fprintf(stderr, + "[/foo/bar.c:2]: (performance) Variable 'm_message' is " + "assigned in constructor body. Consider performing " + "initialization in initialization list.\n"); + fprintf(stderr, + "[/foo/bar.c:2]: (portability) scanf without field width " + "limits can crash with huge input data on some versions of " + "libc\n"); + fprintf(stderr, + "[/foo/bar.c:2]: (information) cannot find all the include " + "files (use --check-config for details)\n"); // we allow this to return 1 as we ignore it return 1; } diff --git a/Tests/RunCMake/try_compile/CStandardGNU.c b/Tests/RunCMake/try_compile/CStandardGNU.c index ac26c15..f7ddff4 100644 --- a/Tests/RunCMake/try_compile/CStandardGNU.c +++ b/Tests/RunCMake/try_compile/CStandardGNU.c @@ -1,8 +1,8 @@ #if __STDC_VERSION__ != 199901L -#error "Not GNU C 99 mode!" +# error "Not GNU C 99 mode!" #endif #ifndef __STRICT_ANSI__ -#error "Not GNU C strict ANSI!" +# error "Not GNU C strict ANSI!" #endif int main(void) { diff --git a/Tests/RunCMake/try_compile/CxxStandardGNU.cxx b/Tests/RunCMake/try_compile/CxxStandardGNU.cxx index 7990a78..ef65e26 100644 --- a/Tests/RunCMake/try_compile/CxxStandardGNU.cxx +++ b/Tests/RunCMake/try_compile/CxxStandardGNU.cxx @@ -1,9 +1,9 @@ #if __cplusplus != 201103L && \ !(__cplusplus < 201103L && defined(__GXX_EXPERIMENTAL_CXX0X__)) -#error "Not GNU C++ 11 mode!" +# error "Not GNU C++ 11 mode!" #endif #ifndef __STRICT_ANSI__ -#error "Not GNU C++ strict ANSI!" +# error "Not GNU C++ strict ANSI!" #endif int main() { diff --git a/Tests/RunCMake/try_compile/src.c b/Tests/RunCMake/try_compile/src.c index 5e51382..beed9b1 100644 --- a/Tests/RunCMake/try_compile/src.c +++ b/Tests/RunCMake/try_compile/src.c @@ -3,5 +3,5 @@ int main(void) return 0; } #ifdef PP_ERROR -#error PP_ERROR is defined +# error PP_ERROR is defined #endif |