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 /src | |
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 'src')
-rw-r--r-- | src/build-data/buildh.in | 2 | ||||
-rw-r--r-- | src/build-data/cc/clang.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/ekopath.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/gcc.txt | 9 | ||||
-rw-r--r-- | src/build-data/cc/hpcc.txt | 11 | ||||
-rw-r--r-- | src/build-data/cc/icc.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/msvc.txt | 17 | ||||
-rw-r--r-- | src/build-data/cc/pgi.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/sunstudio.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/xlc.txt | 7 | ||||
-rw-r--r-- | src/build-data/makefile/header.in | 13 |
11 files changed, 44 insertions, 50 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 3061c9608..23bb86e20 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -6,7 +6,7 @@ * %{user}@%{hostname} running '%{command_line}' * * Target -* - Compiler: %{cxx} %{lib_opt} +* - Compiler: %{cxx} %{cc_compile_flags} * - Arch: %{submodel}/%{arch} * - OS: %{os} */ diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt index 129218dcd..fd11e59ec 100644 --- a/src/build-data/cc/clang.txt +++ b/src/build-data/cc/clang.txt @@ -13,10 +13,9 @@ lang_flags "-std=c++11 -D_REENTRANT -fstack-protector" warning_flags "-Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wunreachable-code" maintainer_warning_flags "-Qunused-arguments -Werror -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=unreachable-code" -compile_flags_release "-c" -compile_flags_debug "-c -g" -lib_opt_flags_release "-O3" -app_opt_flags_release "-O2" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-O3" shared_flags "-fPIC" coverage_flags "--coverage" diff --git a/src/build-data/cc/ekopath.txt b/src/build-data/cc/ekopath.txt index a41abc7c4..549c21a23 100644 --- a/src/build-data/cc/ekopath.txt +++ b/src/build-data/cc/ekopath.txt @@ -7,10 +7,9 @@ add_include_dir_option -I add_lib_dir_option -L add_lib_option -l -compile_flags_release "-c" -compile_flags_debug "-c -g" -lib_opt_flags_release "-O3 -OPT:Ofast:alias=disjoint" -app_opt_flags_release "-O2" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-O3" lang_flags "-D_REENTRANT -ansi -Wno-long-long" warning_flags "-W -Wall" diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt index 4eacacef2..3531e9355 100644 --- a/src/build-data/cc/gcc.txt +++ b/src/build-data/cc/gcc.txt @@ -11,12 +11,9 @@ lang_flags "-std=c++11 -D_REENTRANT" maintainer_warning_flags "-Wold-style-cast -Werror -Wno-error=old-style-cast -Wno-error=zero-as-null-pointer-constant -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=strict-overflow" warning_flags "-Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant" -compile_flags_release "-c" -compile_flags_debug "-c -g" -lib_opt_flags_release "-O2" -lib_opt_flags_debug "-O0" -app_opt_flags_release "-O2" -app_opt_flags_debug "-O0" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-O2" shared_flags "-fPIC" coverage_flags "--coverage" diff --git a/src/build-data/cc/hpcc.txt b/src/build-data/cc/hpcc.txt index 2e30995f6..2f2686d10 100644 --- a/src/build-data/cc/hpcc.txt +++ b/src/build-data/cc/hpcc.txt @@ -7,13 +7,12 @@ add_include_dir_option -I add_lib_dir_option -L add_lib_option -l -compile_flags_release "-c" -compile_flags_debug "-c -g" -lib_opt_flags_release "+O2" -app_opt_flags_release "+O2" - lang_flags "-AA -ext +eh -z" -warning_flags "" # +w + +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "+O2" +warning_flags "+w" shared_flags "+Z" makefile_style gmake diff --git a/src/build-data/cc/icc.txt b/src/build-data/cc/icc.txt index f7fdf72be..084d2a4f2 100644 --- a/src/build-data/cc/icc.txt +++ b/src/build-data/cc/icc.txt @@ -7,10 +7,9 @@ add_include_dir_option -I add_lib_dir_option -L add_lib_option -l -compile_flags_release "-c -fomit-frame-pointer" -compile_flags_debug "-c -g" -lib_opt_flags_release "-O2 -ip -unroll" -app_opt_flags_release "-O2" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-O2" lang_flags "-std=c++0x" warning_flags "-w1" diff --git a/src/build-data/cc/msvc.txt b/src/build-data/cc/msvc.txt index 7a35f9648..67e5023aa 100644 --- a/src/build-data/cc/msvc.txt +++ b/src/build-data/cc/msvc.txt @@ -8,10 +8,15 @@ add_include_dir_option "/I" add_lib_dir_option -L add_lib_option "" -compile_flags_release "/nologo /c /bigobj /O2" -compile_flags_debug "/nologo /c /bigobj /Od /Zi /FS /DEBUG" -app_opt_flags_release "/D_CONSOLE" -app_opt_flags_debug "/D_CONSOLE" +compile_flags "/nologo /c" + +optimization_flags "/O2" + +# for debug info in the object file: +#debug_info_flags "/Z7" + +# for using a PDB file: +debug_info_flags "/Zi /FS" lang_flags "/EHs /GR" warning_flags "/W3 /wd4275 /wd4267" @@ -46,6 +51,6 @@ default-debug -> "$(LINKER) /DEBUG" </binary_link_commands> <mach_abi_linking> -all -> "/MD" -all-debug -> "/MDd" +all -> "/MD /bigobj" +all-debug -> "/MDd /bigobj" </mach_abi_linking> diff --git a/src/build-data/cc/pgi.txt b/src/build-data/cc/pgi.txt index ca4b49cd9..06b2f8400 100644 --- a/src/build-data/cc/pgi.txt +++ b/src/build-data/cc/pgi.txt @@ -7,10 +7,9 @@ add_include_dir_option -I add_lib_dir_option -L add_lib_option -l -compile_flags_release "-c" -compile_flags_debug "-c" -lib_opt_flags_release "-fast -Minline" -app_opt_flags_release "-fast" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-fast -Minline" shared_flags "-fPIC" makefile_style gmake diff --git a/src/build-data/cc/sunstudio.txt b/src/build-data/cc/sunstudio.txt index 964c878ff..9ace5107c 100644 --- a/src/build-data/cc/sunstudio.txt +++ b/src/build-data/cc/sunstudio.txt @@ -7,10 +7,9 @@ add_include_dir_option -I add_lib_dir_option -L add_lib_option -l -compile_flags_release "-c" -compile_flags_debug "-c -g" -lib_opt_flags_release "-xO5" -app_opt_flags_release "-xO2" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-xO2" shared_flags "-KPIC" warning_flags "+w -erroff=truncwarn,wnoretvalue" diff --git a/src/build-data/cc/xlc.txt b/src/build-data/cc/xlc.txt index 68dc62582..55b9e7092 100644 --- a/src/build-data/cc/xlc.txt +++ b/src/build-data/cc/xlc.txt @@ -7,10 +7,9 @@ add_include_dir_option -I add_lib_dir_option -L add_lib_option -l -compile_flags_release "-c" -compile_flags_debug "-c -g" -lib_opt_flags_release "-O2" -app_opt_flags_release "-O2" +compile_flags "-c" +debug_info_flags "-g" +optimization_flags "-O2" lang_flags "" diff --git a/src/build-data/makefile/header.in b/src/build-data/makefile/header.in index a83184bb8..3c4272d05 100644 --- a/src/build-data/makefile/header.in +++ b/src/build-data/makefile/header.in @@ -1,10 +1,9 @@ # Compiler Options CXX = %{cxx} LINKER = %{linker} -LIB_OPT = %{lib_opt} -APP_OPT = %{app_opt} -LANG_FLAGS = %{lang_flags} -WARN_FLAGS = %{warn_flags} + +CXXFLAGS = %{cc_compile_flags} +WARN_FLAGS = %{cc_warning_flags} SO_OBJ_FLAGS = %{shared_flags} LIB_LINK_CMD = %{lib_link_cmd} @@ -15,9 +14,9 @@ LIB_LINKS_TO = %{link_to} APP_LINKS_TO = $(LIB_LINKS_TO) TEST_LINKS_TO = $(LIB_LINKS_TO) -LIB_FLAGS = $(SO_OBJ_FLAGS) $(LANG_FLAGS) $(LIB_OPT) $(WARN_FLAGS) -APP_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) -TEST_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) +LIB_FLAGS = $(SO_OBJ_FLAGS) $(CXXFLAGS) $(WARN_FLAGS) +APP_FLAGS = $(CXXFLAGS) $(WARN_FLAGS) +TEST_FLAGS = $(CXXFLAGS) $(WARN_FLAGS) SCRIPTS_DIR = %{scripts_dir} |