From e217264fb4dd7914f4b787a5e625d897ac7d8415 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 23 Nov 2012 13:34:15 -0800 Subject: [PATCH 1/2] improving mk_make Signed-off-by: Leonardo de Moura --- scripts/mk_util.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/scripts/mk_util.py b/scripts/mk_util.py index b69171a24..bf28d06bd 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -484,6 +484,32 @@ def is_verbose(): def is_java_enabled(): return JAVA_ENABLED +def is_compiler(given, expected): + """ + Return True if the 'given' compiler is the expected one. + >>> is_compiler('g++', 'g++') + True + >>> is_compiler('/home/g++', 'g++') + True + >>> is_compiler(os.path.join('home', 'g++'), 'g++') + True + >>> is_compiler('clang++', 'g++') + False + >>> is_compiler(os.path.join('home', 'clang++'), 'clang++') + True + """ + if given == expected: + return True + if len(expected) < len(given): + return given[len(given) - len(expected) - 1] == os.sep and given[len(given) - len(expected):] == expected + return False + +def is_CXX_gpp(): + return is_compiler(CXX, 'g++') + +def is_CXX_clangpp(): + return is_compiler(CXX, 'clang++') + def get_cpp_files(path): return filter(lambda f: f.endswith('.cpp'), os.listdir(path)) @@ -1179,7 +1205,7 @@ def mk_config(): else: CPPFLAGS = '%s -D_MP_INTERNAL' % CPPFLAGS CXXFLAGS = '%s -c' % CXXFLAGS - if CXX == 'g++': + if is_CXX_gpp(): CXXFLAGS = '%s -fopenmp -mfpmath=sse' % CXXFLAGS LDFLAGS = '%s -fopenmp' % LDFLAGS SLIBEXTRAFLAGS = '-fopenmp' @@ -1193,7 +1219,7 @@ def mk_config(): SLIBFLAGS = '-dynamiclib' elif sysname == 'Linux': CXXFLAGS = '%s -fno-strict-aliasing -D_LINUX_' % CXXFLAGS - if CXX == 'clang++': + if is_CXX_clangpp(): CXXFLAGS = '%s -Wno-unknown-pragmas -Wno-overloaded-virtual -Wno-unused-value' % CXXFLAGS SO_EXT = '.so' LDFLAGS = '%s -lrt' % LDFLAGS @@ -1965,3 +1991,8 @@ def mk_win_dist(build_path, dist_path): for pyc in filter(lambda f: f.endswith('.pyc'), os.listdir(build_path)): shutil.copy('%s/%s' % (build_path, pyc), '%s/bin/%s' % (dist_path, pyc)) + + +if __name__ == '__main__': + import doctest + doctest.testmod() From c00f20832a0de6ef68b58693284fefe331dc327e Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 27 Nov 2012 09:23:44 -0800 Subject: [PATCH 2/2] fixed tab Signed-off-by: Leonardo de Moura --- src/api/python/z3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/python/z3.py b/src/api/python/z3.py index 84724e51e..94031cce6 100644 --- a/src/api/python/z3.py +++ b/src/api/python/z3.py @@ -632,7 +632,7 @@ class FuncDeclRef(AstRef): >>> f(x, x) f(x, ToReal(x)) """ - args = _get_args(args) + args = _get_args(args) num = len(args) if __debug__: _z3_assert(num == self.arity(), "Incorrect number of arguments to %s" % self)