diff options
author | Jack Lloyd <[email protected]> | 2015-10-26 14:12:23 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-10-26 14:12:23 -0400 |
commit | 54540244c1d89faa5b359c75a9c38b6fed0a08c9 (patch) | |
tree | 5725737a423af9a6224da7b060c385d886161fec /configure.py | |
parent | 475a9dacb8d285d6e5a0244bcf816d2ae72a00a8 (diff) |
Remove the strange conjoining of debug and optimization flags.
Previously a build had optimizations disabled completely when debug info was
emitted. But there are many reasons to use optimized builds with debug symbols
(running under valgrind, against afl, with Asan/Ubsan, in prod, etc).
And personally I find even debugging at -O2 or -O3 is fine most of the time and
worth it for the speed. Use the (now documented!) --no-optimizations flag if no
optimization is desired while debugging.
This also removes the distinction between library and application compile flags;
there is a single optimization level that is probably good enough for everything.
On Win32 it removes definding _CONSOLE for the application. This seems to be
some mythical value that may have been required at some point, but is not
documented anywhere I can find. Who knows what VC thinks, hoping I don't have to
add this back. It also drops defining `EBUG` which is what happens when you
tell cl.exe to '/DEBUG'. LOL.
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 66 |
1 files changed, 21 insertions, 45 deletions
diff --git a/configure.py b/configure.py index 1c6dfedc7..6536f3226 100755 --- a/configure.py +++ b/configure.py @@ -773,12 +773,9 @@ class CompilerInfo(object): 'add_lib_dir_option': '-L', 'add_lib_option': '-l', 'add_framework_option': '-framework ', - 'compile_flags_release': '', - 'compile_flags_debug': '', - 'lib_opt_flags_release': '', - 'lib_opt_flags_debug': '', - 'app_opt_flags_release': '', - 'app_opt_flags_debug': '', + 'compile_flags': '', + 'debug_info_flags': '', + 'optimization_flags': '', 'coverage_flags': '', 'sanitizer_flags': '', 'shared_flags': '', @@ -872,33 +869,23 @@ class CompilerInfo(object): return ' ' + abi_flags - """ - Return the optimization flags to use - """ - def opt_flags(self, who, options): + def cc_warning_flags(self, options): def gen_flags(): - if options.build_mode in ['debug', 'coverage']: - yield self.compile_flags_debug - else: - yield self.compile_flags_release + yield self.warning_flags + if options.maintainer_mode: + yield self.maintainer_warning_flags - if options.no_optimizations or options.build_mode == 'coverage': - return + return (' '.join(gen_flags())).strip() - if who == 'app': - if options.build_mode == 'release': - yield self.app_opt_flags_release - else: - yield self.app_opt_flags_debug - return - elif who == 'lib': - if options.build_mode == 'release': - yield self.lib_opt_flags_release - else: - yield self.lib_opt_flags_debug - return - else: - raise Exception("Invalid value of parameter 'who'.") + def cc_compile_flags(self, options): + def gen_flags(): + yield self.lang_flags + + if options.build_mode in ['debug', 'coverage', 'analyzer']: + yield self.debug_info_flags + + if not options.no_optimizations: + yield self.optimization_flags def submodel_fixup(flags, tup): return tup[0].replace('SUBMODEL', flags.replace(tup[1], '')) @@ -1146,12 +1133,13 @@ def gen_makefile_lists(var, build_config, options, modules, cc, arch, osinfo): """ def build_commands(sources, obj_dir, flags): for (obj_file,src) in zip(objectfile_list(sources, obj_dir), sources): - yield '%s: %s\n\t$(CXX)%s $(%s_FLAGS) %s%s %s %s$@\n' % ( + yield '%s: %s\n\t$(CXX)%s $(%s_FLAGS) %s%s %s %s %s$@\n' % ( obj_file, src, isa_specific_flags(cc, src), flags, cc.add_include_dir_option, build_config.include_dir, + cc.compile_flags, src, cc.output_to_option) @@ -1216,14 +1204,6 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): return os.path.join(options.with_build_dir, path) return path - def warning_flags(normal_flags, - maintainer_flags, - maintainer_mode): - if maintainer_mode and maintainer_flags != '': - return normal_flags + ' ' + maintainer_flags - else: - return normal_flags - def innosetup_arch(os, arch): if os == 'windows': inno_arch = { 'x86_32': '', 'x86_64': 'x64', 'ia64': 'ia64' } @@ -1298,12 +1278,8 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'cxx': (options.compiler_binary or cc.binary_name) + cc.mach_abi_link_flags(options), 'linker': cc.linker_name or '$(CXX)', - 'lib_opt': cc.opt_flags('lib', options), - 'app_opt': cc.opt_flags('app', options), - 'lang_flags': cc.lang_flags, - 'warn_flags': warning_flags(cc.warning_flags, - cc.maintainer_warning_flags, - options.maintainer_mode), + 'cc_compile_flags': cc.cc_compile_flags(options), + 'cc_warning_flags': cc.cc_warning_flags(options), 'shared_flags': cc.gen_shared_flags(options), 'visibility_attribute': cc.gen_visibility_attribute(options), |