summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-03-07 09:09:11 -0800
committerThiago Macieira <thiago.macieira@intel.com>2015-12-05 00:10:33 +0000
commitd386ec1fd8f4340af70a2b8687a753b46eb973ca (patch)
tree3ee7fc4dc9d20c7796af9a3b60a46c45807fafcc /mkspecs/features
parentd7302817538166b9d1948def27efca9bb352ea68 (diff)
Add some interesting warning options to the compilation
This should help improve the cleanliness of our source code, including compliance with the C++ standards. They apply to all of our code except examples (they don't load qt_common.prf). Change-Id: Ia0aac2f09e9245339951ffff13c94663c1901766 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/qt_common.prf15
-rw-r--r--mkspecs/features/qt_module_headers.prf3
2 files changed, 17 insertions, 1 deletions
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
index 38602f642d..07300842a0 100644
--- a/mkspecs/features/qt_common.prf
+++ b/mkspecs/features/qt_common.prf
@@ -44,6 +44,21 @@ contains(TEMPLATE, .*lib) {
QMAKE_PRL_INSTALL_REPLACE += lib_replace
}
+# Extra warnings for Qt non-example code, to ensure cleanliness of the sources.
+# The block below may turn these warnings into errors for some Qt targets.
+# -Wdate-time: warn if we use __DATE__ or __TIME__ (we want to be able to reproduce the exact same binary)
+# -Wvla: use of variable-length arrays (an extension to C++)
+clang {
+ # Clang 3.5 introduced -Wdate-time
+ # The conditional assumes we aren't compiling against Clang 2.x anymore
+ greaterThan(QT_CLANG_MAJOR_VERSION, 3)|greaterThan(QT_CLANG_MINOR_VERSION, 4): \
+ QMAKE_CXXFLAGS_WARN_ON += -Wdate-time
+} else: gcc:!intel_icc {
+ QMAKE_CXXFLAGS_WARN_ON += -Wvla
+ # GCC 5 introduced -Wdate-time
+ greaterThan(QT_GCC_MAJOR_VERSION, 4): QMAKE_CXXFLAGS_WARN_ON += -Wdate-time
+}
+
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
diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf
index 0dffdf21ee..a2adc19c4c 100644
--- a/mkspecs/features/qt_module_headers.prf
+++ b/mkspecs/features/qt_module_headers.prf
@@ -124,7 +124,8 @@ headersclean:!internal_module {
hcleanFLAGS -= -Wshadow
}
} else {
- hcleanFLAGS += -Wchar-subscripts
+ # options accepted by GCC and Clang
+ hcleanFLAGS += -Wchar-subscripts -Wold-style-cast
!contains(QT_ARCH, arm):!contains(QT_ARCH, mips): \
hcleanFLAGS += -Wcast-align