From 1b620c7d25e7168aa6abc45f13f46fdb92d5e5d1 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Thu, 31 Dec 2009 00:45:19 +0000 Subject: [PATCH] Avoid GCC 4.4 warnings from the code generated by our dummy QT moc and uic utilities by using fputs() instead of printf(). git-svn-id: http://scons.tigris.org/svn/scons/trunk@4587 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- QMTest/TestSCons.py | 10 ++++-- test/QT/QTFLAGS.py | 78 +-------------------------------------------- 2 files changed, 9 insertions(+), 79 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 03bf5521..bc1ba034 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -675,7 +675,8 @@ import getopt import sys import string import re -cmd_opts, args = getopt.getopt(sys.argv[1:], 'io:', []) +# -w and -z are fake options used in test/QT/QTFLAGS.py +cmd_opts, args = getopt.getopt(sys.argv[1:], 'io:wz', []) output = None impl = 0 opt_string = '' @@ -683,6 +684,7 @@ for opt, arg in cmd_opts: if opt == '-o': output = open(arg, 'wb') elif opt == '-i': impl = 1 else: opt_string = opt_string + ' ' + opt +output.write("/* mymoc.py%s */\\n" % opt_string) for a in args: contents = open(a, 'rb').read() a = string.replace(a, '\\\\', '\\\\\\\\') @@ -703,6 +705,7 @@ output_arg = 0 impl_arg = 0 impl = None source = None +opt_string = '' for arg in sys.argv[1:]: if output_arg: output = open(arg, 'wb') @@ -714,11 +717,14 @@ for arg in sys.argv[1:]: output_arg = 1 elif arg == "-impl": impl_arg = 1 + elif arg[0:1] == "-": + opt_string = opt_string + ' ' + arg else: if source: sys.exit(1) source = open(arg, 'rb') sourceFile = arg +output.write("/* myuic.py%s */\\n" % opt_string) if impl: output.write( '#include "' + impl + '"\\n' ) includes = re.findall('(.*?)', source.read()) @@ -741,7 +747,7 @@ void my_qt_symbol(const char *arg); #include "../include/my_qobject.h" #include void my_qt_symbol(const char *arg) { - printf( arg ); + fputs( arg, stdout ); } """) diff --git a/test/QT/QTFLAGS.py b/test/QT/QTFLAGS.py index 2537c80c..62155fd2 100644 --- a/test/QT/QTFLAGS.py +++ b/test/QT/QTFLAGS.py @@ -38,83 +38,7 @@ test = TestSCons.TestSCons() test.subdir( 'qt', ['qt', 'bin'], ['qt', 'include'], ['qt', 'lib'], 'work1', 'work2') -# create a dummy qt installation - -test.write(['qt', 'bin', 'mymoc.py'], """ -import getopt -import sys -import string -import re -cmd_opts, args = getopt.getopt(sys.argv[1:], 'wzio:', []) -output = None -impl = 0 -opt_string = '' -for opt, arg in cmd_opts: - if opt == '-o': output = open(arg, 'wb') - elif opt == '-i': impl = 1 - else: opt_string = opt_string + ' ' + opt -output.write( "/* mymoc.py%s */\\n" % opt_string) -for a in args: - contents = open(a, 'rb').read() - subst = r'{ my_qt_symbol( "' + a + '\\\\n" ); }' - if impl: - contents = re.sub( r'#include.*', '', contents ) - output.write(string.replace(contents, 'Q_OBJECT', subst)) -output.close() -sys.exit(0) -""" ) - -test.write(['qt', 'bin', 'myuic.py'], """ -import sys -import string -output_arg = 0 -impl_arg = 0 -impl = None -source = None -opt_string = '' -for arg in sys.argv[1:]: - if output_arg: - output = open(arg, 'wb') - output_arg = 0 - elif impl_arg: - impl = arg - impl_arg = 0 - elif arg == "-o": - output_arg = 1 - elif arg == "-impl": - impl_arg = 1 - elif arg[0:1] == "-": - opt_string = opt_string + ' ' + arg - else: - if source: - sys.exit(1) - source = open(arg, 'rb') -output.write("/* myuic.py%s */\\n" % opt_string) -if impl: - output.write( '#include "' + impl + '"\\n' ) -else: - output.write( '#include "my_qobject.h"\\n' + source.read() + " Q_OBJECT \\n" ) -output.close() -sys.exit(0) -""" ) - -test.write(['qt', 'include', 'my_qobject.h'], r""" -#define Q_OBJECT ; -void my_qt_symbol(const char *arg); -""") - -test.write(['qt', 'lib', 'my_qobject.cpp'], r""" -#include "../include/my_qobject.h" -#include -void my_qt_symbol(const char *arg) { - printf( arg ); -} -""") - -test.write(['qt', 'lib', 'SConstruct'], r""" -env = Environment() -env.StaticLibrary( 'myqt', 'my_qobject.cpp' ) -""") +test.Qt_dummy_installation() test.run(chdir=test.workpath('qt','lib'), arguments = '.', stderr=TestSCons.noisy_ar, -- 2.26.2