diff options
author | Michael Scott <michael.scott250@gmail.com> | 2015-12-21 21:39:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-01-12 19:02:51 (GMT) |
commit | 28f2d750edaf6ee1af660d3a0ae6792c65c47997 (patch) | |
tree | 3e22c760e48a58d34c9e337c9ffef0f6295f0ebe /Source/cmake.h | |
parent | b5009720d3020021f189570d72c099963795a5c5 (diff) | |
download | CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.zip CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.tar.gz CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.tar.bz2 |
Add -Werror and -Wno-error command-line options
Expand the -W set of cmake options to include support for the -Werror
and -Wno-error format, which is used to control upgrading and
downgrading warning and error messages. Implement support for these new
formats for the dev and deprecated message types.
Add tests and updated documentation for new options.
Diffstat (limited to 'Source/cmake.h')
-rw-r--r-- | Source/cmake.h | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index 298d82b..8496705 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -59,6 +59,7 @@ class cmake public: enum MessageType { AUTHOR_WARNING, + AUTHOR_ERROR, FATAL_ERROR, INTERNAL_ERROR, MESSAGE, @@ -71,7 +72,8 @@ class cmake enum DiagLevel { DIAG_IGNORE, - DIAG_WARN + DIAG_WARN, + DIAG_ERROR }; /** \brief Describes the working modes of cmake */ @@ -330,6 +332,28 @@ class cmake */ void SetSuppressDeprecatedWarnings(bool v); + /* + * Get the state of treating developer (author) warnings as errors. + * Returns false, by default, if warnings should not be treated as errors, + * true otherwise. + */ + bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL); + /** + * Set the state of treating developer (author) warnings as errors. + */ + void SetDevWarningsAsErrors(bool v); + + /* + * Get the state of treating deprecated warnings as errors. + * Returns false, by default, if warnings should not be treated as errors, + * true otherwise. + */ + bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL); + /** + * Set the state of treating developer (author) warnings as errors. + */ + void SetDeprecatedWarningsAsErrors(bool v); + /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace(), @@ -441,6 +465,12 @@ private: // Print a list of valid generators to stderr. void PrintGeneratorList(); + /** + * Convert a message type between a warning and an error, based on the state + * of the error output CMake variables, in the cache. + */ + cmake::MessageType ConvertMessageType(cmake::MessageType t); + /* * Check if messages of this type should be output, based on the state of the * warning and error output CMake variables, in the cache. @@ -457,10 +487,16 @@ private: {"-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."}, \ - {"-Wno-dev", "Suppress developer warnings."},\ {"-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."} + {"-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) \ |