summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-05-03 10:02:21 (GMT)
committerTobias Markmann <tm@ayena.de>2018-05-03 12:13:28 (GMT)
commitb4cec19bdc4f0fb8f45c66048882b16a4b9617c9 (patch)
tree334ae6890363cb32c14d66a48f43837bdc604f6d
parentdebc69baccc42e2fb96c0990cf9a00af4baf95ce (diff)
downloadswift-b4cec19bdc4f0fb8f45c66048882b16a4b9617c9.zip
swift-b4cec19bdc4f0fb8f45c66048882b16a4b9617c9.tar.bz2
Disable all warnings for generated Qt files
This includes compilation of MOC generated source files and adjusting the UIC generated header files with compiler pragmas that ignore all warnings. Test-Information: Tested no warnings are emitted for generated files on macOS 10.13.4 with Qt 5.5.1 and clang trunk. Change-Id: Ib49ba7bc2017e018ebd857837fbe2d9640fba2bb
-rw-r--r--BuildTools/SCons/Tools/qt4.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py
index d5c14e2..e859017 100644
--- a/BuildTools/SCons/Tools/qt4.py
+++ b/BuildTools/SCons/Tools/qt4.py
@@ -37,6 +37,7 @@ __revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/engine/SCons/T
import os.path
import re
import subprocess
+from string import Template
import SCons.Action
import SCons.Builder
@@ -129,7 +130,9 @@ class _Automoc:
# The following is kind of hacky to get builders working properly (FIXME)
objBuilderEnv = objBuilder.env
- objBuilder.env = env
+ objBuilder.env = env.Clone()
+ if os.path.basename(objBuilder.env ["CXX"]).startswith(("gcc", "clang")):
+ objBuilder.env.Append(CXXFLAGS = "-w")
mocBuilderEnv = env.Moc4.env
env.Moc4.env = env
@@ -368,8 +371,30 @@ def generate(env):
env.Append( BUILDERS = { 'Qrc': qrcbuilder } )
# Interface builder
+ def addDisableWarningsPragmaToFile(target, source, env):
+ assert( len(target) == 1 )
+ assert( len(source) == 1 )
+ srcf = str(source[0])
+ dstf = str(target[0])
+ with open(dstf, 'r+') as uiHeader:
+ data=uiHeader.read()
+
+ template = Template(
+"""#pragma once
+#pragma warning(push, 0)
+#pragma GCC system_header
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wall"
+$uiheadertext
+#pragma clang diagnostic pop
+#pragma warning(pop)
+""")
+ uiHeader.seek(0)
+ uiHeader.write(template.substitute(uiheadertext=data))
+ uiHeader.truncate()
+
uic4builder = Builder(
- action = SCons.Action.Action('$QT4_UICCOM', cmdstr = '$QT4_UICCOMSTR'),
+ action = [SCons.Action.Action('$QT4_UICCOM', cmdstr = '$QT4_UICCOMSTR'), SCons.Action.Action(addDisableWarningsPragmaToFile, None)],
src_suffix='$QT4_UISUFFIX',
suffix='$QT4_UICDECLSUFFIX',
prefix='$QT4_UICDECLPREFIX',