diff options
author | Michael Scott <michael.scott250@gmail.com> | 2015-07-27 23:07:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-29 13:20:10 (GMT) |
commit | c96fe0b40d562b65831376f927b6fd96cf999a52 (patch) | |
tree | 7a72ca8450ded588ff6a0c7247de2366d178bfe5 /Source/cmake.h | |
parent | 98d6e9ec2dd0a935b1ebfed50b6e9ecab719557d (diff) | |
download | CMake-c96fe0b40d562b65831376f927b6fd96cf999a52.zip CMake-c96fe0b40d562b65831376f927b6fd96cf999a52.tar.gz CMake-c96fe0b40d562b65831376f927b6fd96cf999a52.tar.bz2 |
cmake: Add -W options to control deprecation warnings and errors
Refactor the -Wdev and -Wno-dev to use a generic -W parser that follows
the GCC pattern. Include support for setting CMAKE_ERROR_DEPRECATED and
CMAKE_WARN_DEPRECATED via the deprecated warning. Add -Werror=dev and
-Wno-error=dev options so that dev warning options are in line with
deprecated warning options. Use a new CMAKE_SUPPRESS_DEVELOPER_ERRORS
internal cache entry to store the above new dev options persistently.
Add tests for new options and updated cmake documentation and release
notes to list new options.
Diffstat (limited to 'Source/cmake.h')
-rw-r--r-- | Source/cmake.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index 20e49e3..31f55ac 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -60,6 +60,7 @@ class cmake public: enum MessageType { AUTHOR_WARNING, + AUTHOR_ERROR, FATAL_ERROR, INTERNAL_ERROR, MESSAGE, @@ -69,6 +70,12 @@ class cmake DEPRECATION_WARNING }; + enum WarningLevel + { + IGNORE_LEVEL, + WARNING_LEVEL, + ERROR_LEVEL + }; /** \brief Describes the working modes of cmake */ enum WorkingMode @@ -272,6 +279,7 @@ class cmake void SetTrace(bool b) { this->Trace = b;} bool GetTraceExpand() { return this->TraceExpand;} void SetTraceExpand(bool b) { this->TraceExpand = b;} + void SetSuppressDevWarnings(bool b); bool GetWarnUninitialized() { return this->WarnUninitialized;} void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;} bool GetWarnUnused() { return this->WarnUnused;} @@ -292,12 +300,6 @@ class cmake std::string const& GetCMakeEditCommand() const { return this->CMakeEditCommand; } - void SetSuppressDevWarnings(bool v) - { - this->SuppressDevWarnings = v; - this->DoSuppressDevWarnings = true; - } - /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()); @@ -341,8 +343,7 @@ protected: cmPolicies *Policies; cmGlobalGenerator *GlobalGenerator; cmCacheManager *CacheManager; - bool SuppressDevWarnings; - bool DoSuppressDevWarnings; + std::map<std::string, WarningLevel> WarningLevels; std::string GeneratorPlatform; std::string GeneratorToolset; @@ -418,7 +419,15 @@ private: {"-T <toolset-name>", "Specify toolset name if supported by generator."}, \ {"-A <platform-name>", "Specify platform name if supported by generator."}, \ {"-Wno-dev", "Suppress developer warnings."},\ - {"-Wdev", "Enable developer warnings."} + {"-Wdev", "Enable developer warnings."},\ + {"-Werror=dev", "Make developer warnings errors."},\ + {"-Wno-error=dev", "Make developer warnings not errors."},\ + {"-Wdeprecated", "Enable deprecated macro and function warnings."},\ + {"-Wno-deprecated", "Suppress deprecated macro and function 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) \ |