Rename PACKAGE_KEY and LIB_NAME in build system.
[ghc.git] / mk / warnings.mk
1 SRC_CC_WARNING_OPTS =
2 SRC_HC_WARNING_OPTS =
3
4
5 #####################
6 # Warnings
7
8 ifneq "$(GccIsClang)" "YES"
9
10 # Debian doesn't turn -Werror=unused-but-set-variable on by default, so
11 # we turn it on explicitly for consistency with other users
12 ifeq "$(GccLT46)" "NO"
13 # Never set the flag on Windows as the host gcc may be too old.
14 ifneq "$(HostOS_CPP)" "mingw32"
15 SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable
16 endif
17 # gcc 4.6 gives 3 warning for giveCapabilityToTask not being inlined
18 SRC_CC_WARNING_OPTS += -Wno-error=inline
19 endif
20
21 else
22
23 # Don't warn about unknown GCC pragmas when using clang
24 SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas
25
26 endif
27
28 SRC_CC_OPTS += -Wall
29 SRC_HC_OPTS += -Wall
30
31 GhcStage1HcOpts += -fwarn-tabs
32 GhcStage2HcOpts += -fwarn-tabs
33
34 utils/hpc_dist-install_EXTRA_HC_OPTS += -fwarn-tabs
35
36
37 ######################################################################
38 # Disable some warnings in packages we use
39
40 # Libraries that have dubious RULES
41 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-inline-rule-shadowing
42
43 # Cabal doesn't promise to be warning-free
44 utils/ghc-cabal_dist_EXTRA_HC_OPTS += -w
45 libraries/Cabal/Cabal_dist-boot_EXTRA_HC_OPTS += -w
46 libraries/Cabal/Cabal_dist-install_EXTRA_HC_OPTS += -w
47
48 # Turn off import warnings for bad unused imports
49 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
50 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
51 utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-unused-imports
52 libraries/vector_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
53
54 # haddock's attoparsec uses deprecated `inlinePerformIO`
55 utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-deprecations
56
57 # containers uses bitSize at the moment
58 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
59 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
60
61 # On Windows, there are also some unused import warnings
62 ifeq "$(HostOS_CPP)" "mingw32"
63 libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports -fno-warn-identities
64 endif
65
66 # haskeline has warnings about deprecated use of block/unblock
67 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
68 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
69 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
70
71 # binary upstream has some warnings, so don't use -Werror for it
72 libraries/binary_dist-boot_EXTRA_HC_OPTS += -Wwarn
73 libraries/binary_dist-install_EXTRA_HC_OPTS += -Wwarn
74
75 # temporarily turn off unused-imports warnings for pretty
76 libraries/pretty_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
77
78 # primitive has a warning about deprecated use of GHC.IOBase
79 libraries/primitive_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
80
81 # temporarily turn off unused-imports warnings for terminfo
82 libraries/terminfo_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-imports
83 libraries/terminfo_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
84
85 # vector has some unused match warnings
86 libraries/vector_dist-install_EXTRA_HC_OPTS += -Wwarn
87
88 # temporarily turn off unused-imports warnings for xhtml
89 libraries/xhtml_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
90
91 libraries/dph/dph-base_dist-install_EXTRA_HC_OPTS += -Wwarn
92 libraries/dph/dph-prim-interface_dist-install_EXTRA_HC_OPTS += -Wwarn
93 libraries/dph/dph-prim-seq_dist-install_EXTRA_HC_OPTS += -Wwarn
94 libraries/dph/dph-prim-par_dist-install_EXTRA_HC_OPTS += -Wwarn
95 libraries/dph/dph-lifted-common-install_EXTRA_HC_OPTS += -Wwarn
96
97 # transformers has unused function parameters warnings
98 libraries/transformers_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports
99 libraries/transformers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports
100 libraries/transformers_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
101
102 # Turn of trustworthy-safe warning
103 libraries/base_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
104 libraries/ghc-prim_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
105 libraries/Win32_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
106
107 # We need -fno-warn-deprecated-flags to avoid failure with -Werror
108 GhcLibExtraHcOpts += -fno-warn-deprecated-flags
109 GhcBootLibExtraHcOpts += -fno-warn-deprecated-flags
110
111 # The warning suppression flag below is a temporary kludge. While working with
112 # modules that contain tabs, please de-tab them so this flag can be eventually
113 # removed. See
114 # http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
115 # for details
116 #
117 GhcLibExtraHcOpts += -fno-warn-tabs
118 GhcBootLibExtraHcOpts += -fno-warn-tabs