summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2015-12-31 22:01:26 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2015-12-31 22:35:49 +0100
commit0d20737860c29169d89c1d5ea728f3848cc28564 (patch)
tree8044cd1d918e4dcca74f086d09faf6e9ffe0aed3
parenteae40e16a0933fe3b6cb0ee4dc9cdbe3d21e44ce (diff)
downloadhaskell-0d20737860c29169d89c1d5ea728f3848cc28564.tar.gz
Drop redundant/explicit `=1` in `-DFOO=1` flags
Quoting the POSIX standard for the `-D` C compiler flag: -D name[=value] Define name as if by a C-language #define directive. If no `=value` is given, a value of 1 shall be used. [...] Removing this explicit `=1` definition from `-D` flags which are used to define boolean macro constants makes the CLI invocation a bit more idiomatic and reduces visual noise in debugging output (flags containing `=`s are additionally put in single-quotes by GHC)
-rw-r--r--compiler/main/DriverPipeline.hs28
-rw-r--r--mk/config.mk.in6
-rw-r--r--testsuite/tests/rts/Makefile4
3 files changed, 19 insertions, 19 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index a6a5e1de0b..17a72143b4 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2001,30 +2001,30 @@ doCpp dflags raw input_fn output_fn = do
| otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args)
let target_defs =
- [ "-D" ++ HOST_OS ++ "_BUILD_OS=1",
- "-D" ++ HOST_ARCH ++ "_BUILD_ARCH=1",
- "-D" ++ TARGET_OS ++ "_HOST_OS=1",
- "-D" ++ TARGET_ARCH ++ "_HOST_ARCH=1" ]
+ [ "-D" ++ HOST_OS ++ "_BUILD_OS",
+ "-D" ++ HOST_ARCH ++ "_BUILD_ARCH",
+ "-D" ++ TARGET_OS ++ "_HOST_OS",
+ "-D" ++ TARGET_ARCH ++ "_HOST_ARCH" ]
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
let sse_defs =
- [ "-D__SSE__=1" | isSseEnabled dflags ] ++
- [ "-D__SSE2__=1" | isSse2Enabled dflags ] ++
- [ "-D__SSE4_2__=1" | isSse4_2Enabled dflags ]
+ [ "-D__SSE__" | isSseEnabled dflags ] ++
+ [ "-D__SSE2__" | isSse2Enabled dflags ] ++
+ [ "-D__SSE4_2__" | isSse4_2Enabled dflags ]
let avx_defs =
- [ "-D__AVX__=1" | isAvxEnabled dflags ] ++
- [ "-D__AVX2__=1" | isAvx2Enabled dflags ] ++
- [ "-D__AVX512CD__=1" | isAvx512cdEnabled dflags ] ++
- [ "-D__AVX512ER__=1" | isAvx512erEnabled dflags ] ++
- [ "-D__AVX512F__=1" | isAvx512fEnabled dflags ] ++
- [ "-D__AVX512PF__=1" | isAvx512pfEnabled dflags ]
+ [ "-D__AVX__" | isAvxEnabled dflags ] ++
+ [ "-D__AVX2__" | isAvx2Enabled dflags ] ++
+ [ "-D__AVX512CD__" | isAvx512cdEnabled dflags ] ++
+ [ "-D__AVX512ER__" | isAvx512erEnabled dflags ] ++
+ [ "-D__AVX512F__" | isAvx512fEnabled dflags ] ++
+ [ "-D__AVX512PF__" | isAvx512pfEnabled dflags ]
backend_defs <- getBackendDefs dflags
#ifdef GHCI
- let th_defs = [ "-D__GLASGOW_HASKELL_TH__=1" ]
+ let th_defs = [ "-D__GLASGOW_HASKELL_TH__" ]
#else
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=0" ]
#endif
diff --git a/mk/config.mk.in b/mk/config.mk.in
index fd0bb5167e..e107beac0e 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -647,9 +647,9 @@ ifeq "$(CrossCompiling)" "YES"
SRC_HSC2HS_OPTS_STAGE1 += --cross-compile
SRC_HSC2HS_OPTS_STAGE2 += --cross-compile
endif
-SRC_HSC2HS_OPTS_STAGE0 += --cflag=-D$(HostArch_CPP)_HOST_ARCH=1 --cflag=-D$(HostOS_CPP)_HOST_OS=1
-SRC_HSC2HS_OPTS_STAGE1 += --cflag=-D$(TargetArch_CPP)_HOST_ARCH=1 --cflag=-D$(TargetOS_CPP)_HOST_OS=1
-SRC_HSC2HS_OPTS_STAGE2 += --cflag=-D$(TargetArch_CPP)_HOST_ARCH=1 --cflag=-D$(TargetOS_CPP)_HOST_OS=1
+SRC_HSC2HS_OPTS_STAGE0 += --cflag=-D$(HostArch_CPP)_HOST_ARCH --cflag=-D$(HostOS_CPP)_HOST_OS
+SRC_HSC2HS_OPTS_STAGE1 += --cflag=-D$(TargetArch_CPP)_HOST_ARCH --cflag=-D$(TargetOS_CPP)_HOST_OS
+SRC_HSC2HS_OPTS_STAGE2 += --cflag=-D$(TargetArch_CPP)_HOST_ARCH --cflag=-D$(TargetOS_CPP)_HOST_OS
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
WINDRES = $(INPLACE_MINGW)/bin/windres
diff --git a/testsuite/tests/rts/Makefile b/testsuite/tests/rts/Makefile
index 52de19c876..70bcfd4b87 100644
--- a/testsuite/tests/rts/Makefile
+++ b/testsuite/tests/rts/Makefile
@@ -53,14 +53,14 @@ T5423:
define run_T5435_v
$(RM) T5435_load_v_$(1) T5435_v_$(1)$(exeext)
-'$(TEST_HC)' $(TEST_HC_OPTS) -optc-D$(HostOS)_HOST_OS=1 -v0 -c T5435_$(1).c -o T5435_load_v_$(1).o
+'$(TEST_HC)' $(TEST_HC_OPTS) -optc-D$(HostOS)_HOST_OS -v0 -c T5435_$(1).c -o T5435_load_v_$(1).o
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 T5435.hs -osuf main_v_$(1)_o -o T5435_v_$(1)$(exeext)
./T5435_v_$(1) v ./T5435_load_v_$(1).o
endef
define run_T5435_dyn
$(RM) T5435_load_dyn_$(1) T5435_dyn_$(1)$(exeext)
-'$(TEST_HC)' $(filter-out -rtsopts, $(TEST_HC_OPTS)) -optc-D$(HostOS)_HOST_OS=1 -v0 -fPIC -shared -c T5435_$(1).c -osuf dyn_$(1)_o -o T5435_load_dyn_$(1)$(dllext)
+'$(TEST_HC)' $(filter-out -rtsopts, $(TEST_HC_OPTS)) -optc-D$(HostOS)_HOST_OS -v0 -fPIC -shared -c T5435_$(1).c -osuf dyn_$(1)_o -o T5435_load_dyn_$(1)$(dllext)
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 T5435.hs -osuf main_dyn_$(1)_o -o T5435_dyn_$(1)$(exeext)
./T5435_dyn_$(1) dyn ./T5435_load_dyn_$(1)$(dllext)
endef