diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 10:34:04 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 16:05:19 -0400 |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/cmake.h | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | cmake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/cmake.h')
-rw-r--r-- | Source/cmake.h | 343 |
1 files changed, 186 insertions, 157 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index e41ba5699a..266c33d3dd 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -58,9 +58,10 @@ class cmGeneratedFileStream; class cmake { - public: +public: enum MessageType - { AUTHOR_WARNING, + { + AUTHOR_WARNING, AUTHOR_ERROR, FATAL_ERROR, INTERNAL_ERROR, @@ -82,12 +83,12 @@ class cmake enum WorkingMode { NORMAL_MODE, ///< Cmake runs to create project files - /** \brief Script mode (started by using -P). - * - * In script mode there is no generator and no cache. Also, - * languages are not enabled, so add_executable and things do - * nothing. - */ + /** \brief Script mode (started by using -P). + * + * In script mode there is no generator and no cache. Also, + * languages are not enabled, so add_executable and things do + * nothing. + */ SCRIPT_MODE, /** \brief A pkg-config like mode * @@ -100,10 +101,10 @@ class cmake }; struct GeneratorInfo - { + { std::string name; bool supportsToolset; - }; + }; typedef std::map<std::string, cmInstalledFile> InstalledFilesMap; @@ -112,9 +113,11 @@ class cmake /// Destructor ~cmake(); - static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";} - static const char *GetCMakeFilesDirectoryPostSlash() { - return "CMakeFiles/";} + static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } + static const char* GetCMakeFilesDirectoryPostSlash() + { + return "CMakeFiles/"; + } //@{ /** @@ -131,9 +134,11 @@ class cmake /** * Handle a command line invocation of cmake. */ - int Run(const std::vector<std::string>&args) - { return this->Run(args, false); } - int Run(const std::vector<std::string>&args, bool noconfigure); + int Run(const std::vector<std::string>& args) + { + return this->Run(args, false); + } + int Run(const std::vector<std::string>& args, bool noconfigure); /** * Run the global generator Generate step. @@ -150,10 +155,9 @@ class cmake int ActualConfigure(); ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseCacheEntry(const std::string& entry, - std::string& var, - std::string& value, - cmState::CacheEntryType& type); + static bool ParseCacheEntry(const std::string& entry, std::string& var, + std::string& value, + cmState::CacheEntryType& type); int LoadCache(); bool LoadCache(const std::string& path); @@ -168,40 +172,54 @@ class cmake cmGlobalGenerator* CreateGlobalGenerator(const std::string& name); ///! Return the global generator assigned to this instance of cmake - cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } + cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } ///! Return the global generator assigned to this instance of cmake, const const cmGlobalGenerator* GetGlobalGenerator() const - { return this->GlobalGenerator; } + { + return this->GlobalGenerator; + } ///! Return the global generator assigned to this instance of cmake - void SetGlobalGenerator(cmGlobalGenerator *); + void SetGlobalGenerator(cmGlobalGenerator*); ///! Get the names of the current registered generators void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators); ///! Set the name of the selected generator-specific platform. void SetGeneratorPlatform(std::string const& ts) - { this->GeneratorPlatform = ts; } + { + this->GeneratorPlatform = ts; + } ///! Get the name of the selected generator-specific platform. std::string const& GetGeneratorPlatform() const - { return this->GeneratorPlatform; } + { + return this->GeneratorPlatform; + } ///! Set the name of the selected generator-specific toolset. void SetGeneratorToolset(std::string const& ts) - { this->GeneratorToolset = ts; } + { + this->GeneratorToolset = ts; + } ///! Get the name of the selected generator-specific toolset. std::string const& GetGeneratorToolset() const - { return this->GeneratorToolset; } + { + return this->GeneratorToolset; + } ///! get the cmCachemManager used by this invocation of cmake - cmCacheManager *GetCacheManager() { return this->CacheManager; } + cmCacheManager* GetCacheManager() { return this->CacheManager; } const std::vector<std::string>& GetSourceExtensions() const - {return this->SourceFileExtensions;} + { + return this->SourceFileExtensions; + } const std::vector<std::string>& GetHeaderExtensions() const - {return this->HeaderFileExtensions;} + { + return this->HeaderFileExtensions; + } /** * Given a variable name, return its value (as a string). @@ -209,8 +227,7 @@ class cmake const char* GetCacheDefinition(const std::string&) const; ///! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, - int type); + const char* helpString, int type); /** * Get the system information and write it to the file specified @@ -228,8 +245,7 @@ class cmake ///! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector<std::string>&); - typedef void (*ProgressCallbackType) - (const char*msg, float progress, void *); + typedef void (*ProgressCallbackType)(const char* msg, float progress, void*); /** * Set the function used by GUIs to receive progress updates * Function gets passed: message as a const char*, a progress @@ -237,10 +253,10 @@ class cmake * number provided may be negative in cases where a message is * to be displayed without any progress percentage. */ - void SetProgressCallback(ProgressCallbackType f, void* clientData=0); + void SetProgressCallback(ProgressCallbackType f, void* clientData = 0); ///! this is called by generators to update the progress - void UpdateProgress(const char *msg, float prog); + void UpdateProgress(const char* msg, float prog); ///! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } @@ -248,20 +264,22 @@ class cmake void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&); ///! Set/Get a property of this target file - void SetProperty(const std::string& prop, const char *value); - void AppendProperty(const std::string& prop, - const char *value,bool asString=false); - const char *GetProperty(const std::string& prop); + void SetProperty(const std::string& prop, const char* value); + void AppendProperty(const std::string& prop, const char* value, + bool asString = false); + const char* GetProperty(const std::string& prop); bool GetPropertyAsBool(const std::string& prop); ///! Get or create an cmInstalledFile instance and return a pointer to it - cmInstalledFile *GetOrCreateInstalledFile( - cmMakefile* mf, const std::string& name); + cmInstalledFile* GetOrCreateInstalledFile(cmMakefile* mf, + const std::string& name); cmInstalledFile const* GetInstalledFile(const std::string& name) const; InstalledFilesMap const& GetInstalledFiles() const - { return this->InstalledFiles; } + { + return this->InstalledFiles; + } ///! Do all the checks before running configure int DoPreConfigureChecks(); @@ -270,8 +288,8 @@ class cmake WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; } ///! Debug the try compile stuff by not deleting the files - bool GetDebugTryCompile(){return this->DebugTryCompile;} - void DebugTryCompileOn(){this->DebugTryCompile = true;} + bool GetDebugTryCompile() { return this->DebugTryCompile; } + void DebugTryCompileOn() { this->DebugTryCompile = true; } /** * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries @@ -285,21 +303,21 @@ class cmake // Do we want debug output during the cmake run. bool GetDebugOutput() { return this->DebugOutput; } - void SetDebugOutputOn(bool b) { this->DebugOutput = b;} + void SetDebugOutputOn(bool b) { this->DebugOutput = b; } // Do we want trace output during the cmake run. - bool GetTrace() { return this->Trace;} - void SetTrace(bool b) { this->Trace = b;} - bool GetTraceExpand() { return this->TraceExpand;} - void SetTraceExpand(bool b) { this->TraceExpand = b;} - bool GetWarnUninitialized() { return this->WarnUninitialized;} - void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;} - bool GetWarnUnused() { return this->WarnUnused;} - void SetWarnUnused(bool b) { this->WarnUnused = b;} - bool GetWarnUnusedCli() { return this->WarnUnusedCli;} - void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b;} - bool GetCheckSystemVars() { return this->CheckSystemVars;} - void SetCheckSystemVars(bool b) { this->CheckSystemVars = b;} + bool GetTrace() { return this->Trace; } + void SetTrace(bool b) { this->Trace = b; } + bool GetTraceExpand() { return this->TraceExpand; } + void SetTraceExpand(bool b) { this->TraceExpand = b; } + bool GetWarnUninitialized() { return this->WarnUninitialized; } + void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; } + bool GetWarnUnused() { return this->WarnUnused; } + void SetWarnUnused(bool b) { this->WarnUnused = b; } + bool GetWarnUnusedCli() { return this->WarnUnusedCli; } + void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; } + bool GetCheckSystemVars() { return this->CheckSystemVars; } + void SetCheckSystemVars(bool b) { this->CheckSystemVars = b; } void MarkCliAsUsed(const std::string& variable); @@ -308,9 +326,13 @@ class cmake std::vector<std::string> GetDebugConfigs(); void SetCMakeEditCommand(std::string const& s) - { this->CMakeEditCommand = s; } + { + this->CMakeEditCommand = s; + } std::string const& GetCMakeEditCommand() const - { return this->CMakeEditCommand; } + { + return this->CMakeEditCommand; + } /* * Get the state of the suppression of developer (author) warnings. @@ -357,35 +379,38 @@ class cmake void SetDeprecatedWarningsAsErrors(bool v); /** Display a message to the user. */ - void IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace = cmListFileBacktrace(), - bool force = false); + void IssueMessage( + cmake::MessageType t, std::string const& text, + cmListFileBacktrace const& backtrace = cmListFileBacktrace(), + bool force = false); ///! run the --build option - int Build(const std::string& dir, - const std::string& target, + int Build(const std::string& dir, const std::string& target, const std::string& config, - const std::vector<std::string>& nativeOptions, - bool clean); + const std::vector<std::string>& nativeOptions, bool clean); void UnwatchUnusedCli(const std::string& var); void WatchUnusedCli(const std::string& var); cmState* GetState() const { return this->State; } void SetCurrentSnapshot(cmState::Snapshot snapshot) - { this->CurrentSnapshot = snapshot; } + { + this->CurrentSnapshot = snapshot; + } cmState::Snapshot GetCurrentSnapshot() const - { return this->CurrentSnapshot; } + { + return this->CurrentSnapshot; + } protected: void RunCheckForUnusedVariables(); void InitializeProperties(); int HandleDeleteCacheVariables(const std::string& var); - typedef - cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); - typedef std::map<std::string, - CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap; + typedef cmExternalMakefileProjectGenerator* ( + *CreateExtraGeneratorFunctionType)(); + typedef std::map<std::string, CreateExtraGeneratorFunctionType> + RegisteredExtraGeneratorsMap; typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector; RegisteredGeneratorsVector Generators; RegisteredExtraGeneratorsMap ExtraGenerators; @@ -395,14 +420,14 @@ protected: void AddExtraGenerator(const std::string& name, CreateExtraGeneratorFunctionType newFunction); - cmGlobalGenerator *GlobalGenerator; - cmCacheManager *CacheManager; + cmGlobalGenerator* GlobalGenerator; + cmCacheManager* CacheManager; std::map<std::string, DiagLevel> DiagLevels; std::string GeneratorPlatform; std::string GeneratorToolset; ///! read in a cmake list file to initialize the cache - void ReadListFile(const std::vector<std::string>& args, const char *path); + void ReadListFile(const std::vector<std::string>& args, const char* path); bool FindPackage(const std::vector<std::string>& args); ///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. @@ -426,8 +451,8 @@ protected: cmVariableWatch* VariableWatch; private: - cmake(const cmake&); // Not implemented. - void operator=(const cmake&); // Not implemented. + cmake(const cmake&); // Not implemented. + void operator=(const cmake&); // Not implemented. ProgressCallbackType ProgressCallback; void* ProgressCallbackClientData; bool Verbose; @@ -479,87 +504,91 @@ private: bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg); }; -#define CMAKE_STANDARD_OPTIONS_TABLE \ - {"-C <initial-cache>", "Pre-load a script to populate the cache."}, \ - {"-D <var>[:<type>]=<value>", "Create a cmake cache entry."}, \ - {"-U <globbing_expr>", "Remove matching entries from CMake cache."}, \ - {"-G <generator-name>", "Specify a build system generator."},\ - {"-T <toolset-name>", "Specify toolset name if supported by generator."}, \ - {"-A <platform-name>", "Specify platform name if supported by generator."}, \ - {"-Wdev", "Enable developer warnings."},\ - {"-Wno-dev", "Suppress developer warnings."},\ - {"-Werror=dev", "Make developer warnings errors."},\ - {"-Wno-error=dev", "Make developer warnings not errors."},\ - {"-Wdeprecated", "Enable deprecation warnings."},\ - {"-Wno-deprecated", "Suppress deprecation warnings."},\ - {"-Werror=deprecated", "Make deprecated macro and function warnings " \ - "errors."},\ - {"-Wno-error=deprecated", "Make deprecated macro and function warnings " \ - "not errors."} - -#define FOR_EACH_C_FEATURE(F) \ - F(c_function_prototypes) \ - F(c_restrict) \ - F(c_static_assert) \ +#define CMAKE_STANDARD_OPTIONS_TABLE \ + { "-C <initial-cache>", "Pre-load a script to populate the cache." }, \ + { "-D <var>[:<type>]=<value>", "Create a cmake cache entry." }, \ + { "-U <globbing_expr>", "Remove matching entries from CMake cache." }, \ + { "-G <generator-name>", "Specify a build system generator." }, \ + { "-T <toolset-name>", \ + "Specify toolset name if supported by generator." }, \ + { "-A <platform-name>", \ + "Specify platform name if supported by generator." }, \ + { "-Wdev", "Enable developer warnings." }, \ + { "-Wno-dev", "Suppress developer warnings." }, \ + { "-Werror=dev", "Make developer warnings errors." }, \ + { "-Wno-error=dev", "Make developer warnings not errors." }, \ + { "-Wdeprecated", "Enable deprecation warnings." }, \ + { "-Wno-deprecated", "Suppress deprecation warnings." }, \ + { "-Werror=deprecated", "Make deprecated macro and function warnings " \ + "errors." }, \ + { \ + "-Wno-error=deprecated", "Make deprecated macro and function warnings " \ + "not errors." \ + } + +#define FOR_EACH_C_FEATURE(F) \ + F(c_function_prototypes) \ + F(c_restrict) \ + F(c_static_assert) \ F(c_variadic_macros) -#define FOR_EACH_CXX_FEATURE(F) \ - F(cxx_aggregate_default_initializers) \ - F(cxx_alias_templates) \ - F(cxx_alignas) \ - F(cxx_alignof) \ - F(cxx_attributes) \ - F(cxx_attribute_deprecated) \ - F(cxx_auto_type) \ - F(cxx_binary_literals) \ - F(cxx_constexpr) \ - F(cxx_contextual_conversions) \ - F(cxx_decltype) \ - F(cxx_decltype_auto) \ - F(cxx_decltype_incomplete_return_types) \ - F(cxx_default_function_template_args) \ - F(cxx_defaulted_functions) \ - F(cxx_defaulted_move_initializers) \ - F(cxx_delegating_constructors) \ - F(cxx_deleted_functions) \ - F(cxx_digit_separators) \ - F(cxx_enum_forward_declarations) \ - F(cxx_explicit_conversions) \ - F(cxx_extended_friend_declarations) \ - F(cxx_extern_templates) \ - F(cxx_final) \ - F(cxx_func_identifier) \ - F(cxx_generalized_initializers) \ - F(cxx_generic_lambdas) \ - F(cxx_inheriting_constructors) \ - F(cxx_inline_namespaces) \ - F(cxx_lambdas) \ - F(cxx_lambda_init_captures) \ - F(cxx_local_type_template_args) \ - F(cxx_long_long_type) \ - F(cxx_noexcept) \ - F(cxx_nonstatic_member_init) \ - F(cxx_nullptr) \ - F(cxx_override) \ - F(cxx_range_for) \ - F(cxx_raw_string_literals) \ - F(cxx_reference_qualified_functions) \ - F(cxx_relaxed_constexpr) \ - F(cxx_return_type_deduction) \ - F(cxx_right_angle_brackets) \ - F(cxx_rvalue_references) \ - F(cxx_sizeof_member) \ - F(cxx_static_assert) \ - F(cxx_strong_enums) \ - F(cxx_template_template_parameters) \ - F(cxx_thread_local) \ - F(cxx_trailing_return_types) \ - F(cxx_unicode_literals) \ - F(cxx_uniform_initialization) \ - F(cxx_unrestricted_unions) \ - F(cxx_user_literals) \ - F(cxx_variable_templates) \ - F(cxx_variadic_macros) \ +#define FOR_EACH_CXX_FEATURE(F) \ + F(cxx_aggregate_default_initializers) \ + F(cxx_alias_templates) \ + F(cxx_alignas) \ + F(cxx_alignof) \ + F(cxx_attributes) \ + F(cxx_attribute_deprecated) \ + F(cxx_auto_type) \ + F(cxx_binary_literals) \ + F(cxx_constexpr) \ + F(cxx_contextual_conversions) \ + F(cxx_decltype) \ + F(cxx_decltype_auto) \ + F(cxx_decltype_incomplete_return_types) \ + F(cxx_default_function_template_args) \ + F(cxx_defaulted_functions) \ + F(cxx_defaulted_move_initializers) \ + F(cxx_delegating_constructors) \ + F(cxx_deleted_functions) \ + F(cxx_digit_separators) \ + F(cxx_enum_forward_declarations) \ + F(cxx_explicit_conversions) \ + F(cxx_extended_friend_declarations) \ + F(cxx_extern_templates) \ + F(cxx_final) \ + F(cxx_func_identifier) \ + F(cxx_generalized_initializers) \ + F(cxx_generic_lambdas) \ + F(cxx_inheriting_constructors) \ + F(cxx_inline_namespaces) \ + F(cxx_lambdas) \ + F(cxx_lambda_init_captures) \ + F(cxx_local_type_template_args) \ + F(cxx_long_long_type) \ + F(cxx_noexcept) \ + F(cxx_nonstatic_member_init) \ + F(cxx_nullptr) \ + F(cxx_override) \ + F(cxx_range_for) \ + F(cxx_raw_string_literals) \ + F(cxx_reference_qualified_functions) \ + F(cxx_relaxed_constexpr) \ + F(cxx_return_type_deduction) \ + F(cxx_right_angle_brackets) \ + F(cxx_rvalue_references) \ + F(cxx_sizeof_member) \ + F(cxx_static_assert) \ + F(cxx_strong_enums) \ + F(cxx_template_template_parameters) \ + F(cxx_thread_local) \ + F(cxx_trailing_return_types) \ + F(cxx_unicode_literals) \ + F(cxx_uniform_initialization) \ + F(cxx_unrestricted_unions) \ + F(cxx_user_literals) \ + F(cxx_variable_templates) \ + F(cxx_variadic_macros) \ F(cxx_variadic_templates) #endif |