Commit 7dab4d8b authored by Chris Cantwell's avatar Chris Cantwell

Enable -Werror with CMake flag (on by default).

Added additional information on fixing warnings to CONTRIBUTING.md.
parent a565a5dc
Pipeline #1044 passed with stages
......@@ -169,6 +169,9 @@ OPTION(NEKTAR_TEST_ALL "Include full set of regression tests to this build." OFF
OPTION(NEKTAR_TEST_USE_HOSTFILE "Use a hostfile to explicitly specify number of
slots." OFF)
OPTION(NEKTAR_ERROR_ON_WARNINGS "Use -Werror to make warnings stop compilation." ON)
MARK_AS_ADVANCED(NEKTAR_ERROR_ON_WARNINGS)
# Meshing utilities and library
IF (NOT WIN32)
OPTION(NEKTAR_USE_MESHGEN "Build mesh generation utilities." OFF)
......
......@@ -52,8 +52,15 @@ project. It's a pretty simple process:
- Did you add regression tests (for fixes) or unit tests and/or normal tests for
new features?
- Have you run your branch through buildbot and do all the tests pass?
- Have you fixed any compiler warnings your code has introduced into the
compilation step on any of the Linux buildbots?
- Have you fixed any new compiler warnings your code has introduced into the
compilation step for all of the Linux buildbots?
- **unused parameters**: if these are genuinely needed (e.g. virtual functions
in a derived class, please use `boost::ignore_unused()` to mark as such.
- **switch case may fall-through**: for switch statements which
*intentionally* exploit fall-through between cases, mark the end of such
cases with the comment `/* Falls through. */` to suppress the warning.
- Avoid `ASSERTL0(false, msg)`; instead use `NEKERROR(ErrorUtil:efatal, msg)`.
- Ensure variables are initialised with sensible default values.
- Is there documentation in the user guide and/or developer guide?
- Have you added a CHANGELOG entry, including the MR number?
- Are there any massive files you might have added in the commit history? We try
......
......@@ -77,6 +77,9 @@ MACRO(SET_COMMON_PROPERTIES name)
ELSE ()
# Enable all warnings
TARGET_COMPILE_OPTIONS(${name} PRIVATE -Wpedantic -Wall -Wextra)
IF ( NEKTAR_ERROR_ON_WARNINGS )
TARGET_COMPILE_OPTIONS(${name} PRIVATE -Werror)
ENDIF()
ENDIF()
IF (${CMAKE_COMPILER_IS_GNUCXX})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment