diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-12-21 18:31:54 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-28 23:43:36 +0100 |
commit | ebfd85a499a4382ace09d443b1f35cd6b1848af6 (patch) | |
tree | 3d957d0d57b49ee34b82a60f316ab5bb88e7e013 /mkspecs | |
parent | 0520631b2ba04fb99d3d46385f04279cd89a7732 (diff) |
Add the infrastructure to compile Qt with -Werror
This is enabled only for -developer-builds and only for certain
compiler-version combinations that are in a whitelist.
It also requires each library, plugin or tool to declare whether it is
supposedly clean of warnings. When most targets are clean, we can
consider inverting.
Change-Id: I17b5c4e45aee5078f9788e846a45d619c144095a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'mkspecs')
-rw-r--r-- | mkspecs/features/qt_common.prf | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 2400ab0c2c..10b7736749 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -18,3 +18,37 @@ contains(TEMPLATE, .*lib) { contains(QT_CONFIG, separate_debug_info): CONFIG += separate_debug_info contains(QT_CONFIG, separate_debug_info_nocopy): CONFIG += separate_debug_info_nocopy } + +warnings_are_errors:warning_clean { + # If the module declares that it has does its clean-up of warnings, enable -Werror. + # This setting is compiler-dependent anyway because it depends on the version of the + # compiler. + clang { + # Apple clang 4.0+ or clang 3.1+ + greaterThan(QT_CLANG_MAJOR_VERSION, 3) | \ + if(equals(QT_CLANG_MAJOR_VERSION, 3):greaterThan(QT_CLANG_MINOR_VERSION, 1)) | \ + greaterThan(QT_APPLE_CLANG_MAJOR_VERSION, 3) { + QMAKE_CXXFLAGS += -Werror -Wno-error=\\$${LITERAL_HASH}warnings $$WERROR + } + } else:intel_icc { + # Intel CC 13.0+ (a.k.a. Intel Composer XE 2013) + greaterThan(QT_ICC_MAJOR_VERSION, 12) { + # 177: function "entity" was declared but never referenced + # (too aggressive; ICC reports even for functions created due to template instantiation) + # 1224: #warning directive + # 1881: argument must be a constant null pointer value + # (NULL in C++ is usually a literal 0) + QMAKE_CXXFLAGS += -Werror -ww177,1224,1881 $$WERROR + } + } else:gcc { + # GCC 4.6+ + # note: there was no GCC 3.6 and this assumes no one is crazy enough to compile Qt with GCC 2.7 + greaterThan(QT_GCC_MAJOR_VERSION, 4)|greaterThan(QT_GCC_MINOR_VERSION, 5) { + QMAKE_CXXFLAGS += -Werror -Wno-error=cpp $$WERROR + + # GCC prints this bogus warning, after it has inlined a lot of code + # error: assuming signed overflow does not occur when assuming that (X + c) < X is always false + QMAKE_CXXFLAGS += -Wno-error=strict-overflow + } + } +} |