~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/Makefile.extrawarn

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/Makefile.extrawarn (Version linux-6.12-rc7) and /scripts/Makefile.extrawarn (Version linux-4.20.17)


  1 # SPDX-License-Identifier: GPL-2.0                  1 # SPDX-License-Identifier: GPL-2.0
  2 # ============================================      2 # ==========================================================================
  3 # make W=... settings                          << 
  4 #                                                   3 #
  5 # There are four warning groups enabled by W=1 !!   4 # make W=... settings
  6 # They are independent, and can be combined li << 
  7 # ============================================ << 
  8                                                << 
  9 # Default set of warnings, always enabled      << 
 10 KBUILD_CFLAGS += -Wall                         << 
 11 KBUILD_CFLAGS += -Wundef                       << 
 12 KBUILD_CFLAGS += -Werror=implicit-function-dec << 
 13 KBUILD_CFLAGS += -Werror=implicit-int          << 
 14 KBUILD_CFLAGS += -Werror=return-type           << 
 15 KBUILD_CFLAGS += -Werror=strict-prototypes     << 
 16 KBUILD_CFLAGS += -Wno-format-security          << 
 17 KBUILD_CFLAGS += -Wno-trigraphs                << 
 18 KBUILD_CFLAGS += $(call cc-disable-warning,fra << 
 19 KBUILD_CFLAGS += $(call cc-disable-warning, ad << 
 20 KBUILD_CFLAGS += -Wmissing-declarations        << 
 21 KBUILD_CFLAGS += -Wmissing-prototypes          << 
 22                                                << 
 23 ifneq ($(CONFIG_FRAME_WARN),0)                 << 
 24 KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_ << 
 25 endif                                          << 
 26                                                << 
 27 KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror    << 
 28 KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)        << 
 29 KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) +=  << 
 30                                                << 
 31 ifdef CONFIG_CC_IS_CLANG                       << 
 32 # The kernel builds with '-std=gnu11' so use o << 
 33 KBUILD_CFLAGS += -Wno-gnu                      << 
 34 else                                           << 
 35                                                << 
 36 # gcc inanely warns about local variables call << 
 37 KBUILD_CFLAGS += -Wno-main                     << 
 38 endif                                          << 
 39                                                << 
 40 # These result in bogus false positives        << 
 41 KBUILD_CFLAGS += $(call cc-disable-warning, da << 
 42                                                << 
 43 # Variable Length Arrays (VLAs) should not be  << 
 44 KBUILD_CFLAGS += -Wvla                         << 
 45                                                << 
 46 # disable pointer signed / unsigned warnings i << 
 47 KBUILD_CFLAGS += -Wno-pointer-sign             << 
 48                                                << 
 49 # In order to make sure new function cast mism << 
 50 # in the kernel (to avoid tripping CFI checkin << 
 51 # globally built with -Wcast-function-type.    << 
 52 KBUILD_CFLAGS += $(call cc-option, -Wcast-func << 
 53                                                << 
 54 # The allocators already balk at large sizes,  << 
 55 # warnings for bounds checks involving those p << 
 56 # -Wno-alloc-size-larger-than would normally b << 
 57 # of gcc (<9.1) weirdly don't handle the optio << 
 58 # warnings are produced (?!). Using -Walloc-si << 
 59 # doesn't work (as it is documented to), silen << 
 60 # version 9.1 (and producing an error more rec << 
 61 # than PTRDIFF_MAX also don't work prior to ve << 
 62 # ignored, continuing to default to PTRDIFF_MA << 
 63 # choice, we must perform a versioned check to << 
 64 # https://lore.kernel.org/lkml/20210824115859. << 
 65 KBUILD_CFLAGS-$(call gcc-min-version, 90100) + << 
 66 KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_C << 
 67                                                << 
 68 # Prohibit date/time macros, which would make  << 
 69 KBUILD_CFLAGS += -Werror=date-time             << 
 70                                                << 
 71 # enforce correct pointer usage                << 
 72 KBUILD_CFLAGS += $(call cc-option,-Werror=inco << 
 73                                                << 
 74 # Require designated initializers for all mark << 
 75 KBUILD_CFLAGS += $(call cc-option,-Werror=desi << 
 76                                                << 
 77 # Warn if there is an enum types mismatch      << 
 78 KBUILD_CFLAGS += $(call cc-option,-Wenum-conve << 
 79                                                << 
 80 KBUILD_CFLAGS += -Wextra                       << 
 81 KBUILD_CFLAGS += -Wunused                      << 
 82                                                << 
 83 #                                                   5 #
 84 # W=1 - warnings which may be relevant and do  !!   6 # W=1 - warnings that may be relevant and does not occur too often
                                                   >>   7 # W=2 - warnings that occur quite often but may still be relevant
                                                   >>   8 # W=3 - the more obscure warnings, can most likely be ignored
 85 #                                                   9 #
 86 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) !!  10 # $(call cc-option, -W...) handles gcc -W.. options which
 87                                                !!  11 # are not supported by all versions of the compiler
 88 KBUILD_CFLAGS += -Wmissing-format-attribute    !!  12 # ==========================================================================
 89 KBUILD_CFLAGS += -Wmissing-include-dirs        << 
 90 KBUILD_CFLAGS += $(call cc-option, -Wunused-co << 
 91                                                << 
 92 KBUILD_CPPFLAGS += -Wundef                     << 
 93 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1        << 
 94                                                << 
 95 else                                           << 
 96                                                    13 
 97 # Some diagnostics enabled by default are nois << 
 98 # Suppress them by using -Wno... except for W= << 
 99 KBUILD_CFLAGS += $(call cc-disable-warning, un << 
100 KBUILD_CFLAGS += $(call cc-disable-warning, un << 
101 KBUILD_CFLAGS += $(call cc-disable-warning, pa     14 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
102 KBUILD_CFLAGS += $(call cc-disable-warning, fo << 
103 ifdef CONFIG_CC_IS_GCC                         << 
104 KBUILD_CFLAGS += $(call cc-disable-warning, fo << 
105 else                                           << 
106 # Clang checks for overflow/truncation with '% << 
107 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id << 
108 KBUILD_CFLAGS += $(call cc-disable-warning, fo << 
109 KBUILD_CFLAGS += $(call cc-disable-warning, fo << 
110 endif                                          << 
111 KBUILD_CFLAGS += $(call cc-disable-warning, st << 
112                                                    15 
113 KBUILD_CFLAGS += -Wno-override-init # alias fo !!  16 ifeq ("$(origin W)", "command line")
114                                                !!  17   export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
115 ifdef CONFIG_CC_IS_CLANG                       << 
116 # Clang before clang-16 would warn on default  << 
117 ifneq ($(call clang-min-version, 160000),y)    << 
118 # Disable -Wformat                             << 
119 KBUILD_CFLAGS += -Wno-format                   << 
120 # Then re-enable flags that were part of the - << 
121 # problematic.                                 << 
122 KBUILD_CFLAGS += -Wformat-extra-args -Wformat- << 
123 KBUILD_CFLAGS += -Wformat-zero-length -Wnonnul << 
124 # Requires clang-12+.                          << 
125 ifeq ($(call clang-min-version, 120000),y)     << 
126 KBUILD_CFLAGS += -Wformat-insufficient-args    << 
127 endif                                          << 
128 endif                                          << 
129 KBUILD_CFLAGS += $(call cc-disable-warning, po << 
130 KBUILD_CFLAGS += -Wno-tautological-constant-ou << 
131 KBUILD_CFLAGS += $(call cc-disable-warning, un << 
132 KBUILD_CFLAGS += -Wno-enum-compare-conditional << 
133 KBUILD_CFLAGS += -Wno-enum-enum-conversion     << 
134 endif                                              18 endif
135                                                    19 
136 endif                                          !!  20 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
137                                                !!  21 warning-  := $(empty)
138 #                                              << 
139 # W=2 - warnings which occur quite often but m << 
140 #                                              << 
141 ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) << 
142                                                << 
143 KBUILD_CFLAGS += -Wdisabled-optimization       << 
144 KBUILD_CFLAGS += -Wshadow                      << 
145 KBUILD_CFLAGS += $(call cc-option, -Wlogical-o << 
146 KBUILD_CFLAGS += $(call cc-option, -Wunused-ma << 
147                                                << 
148 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2        << 
149                                                << 
150 else                                           << 
151                                                << 
152 # The following turn off the warnings enabled  << 
153 KBUILD_CFLAGS += -Wno-missing-field-initialize << 
154 KBUILD_CFLAGS += -Wno-type-limits              << 
155 KBUILD_CFLAGS += -Wno-shift-negative-value     << 
156                                                    22 
157 ifdef CONFIG_CC_IS_GCC                         !!  23 warning-1 := -Wextra -Wunused -Wno-unused-parameter
158 KBUILD_CFLAGS += -Wno-maybe-uninitialized      !!  24 warning-1 += -Wmissing-declarations
159 endif                                          !!  25 warning-1 += -Wmissing-format-attribute
                                                   >>  26 warning-1 += $(call cc-option, -Wmissing-prototypes)
                                                   >>  27 warning-1 += -Wold-style-definition
                                                   >>  28 warning-1 += $(call cc-option, -Wmissing-include-dirs)
                                                   >>  29 warning-1 += $(call cc-option, -Wunused-but-set-variable)
                                                   >>  30 warning-1 += $(call cc-option, -Wunused-const-variable)
                                                   >>  31 warning-1 += $(call cc-option, -Wpacked-not-aligned)
                                                   >>  32 warning-1 += $(call cc-option, -Wstringop-truncation)
                                                   >>  33 warning-1 += $(call cc-disable-warning, missing-field-initializers)
                                                   >>  34 warning-1 += $(call cc-disable-warning, sign-compare)
                                                   >>  35 
                                                   >>  36 warning-2 := -Waggregate-return
                                                   >>  37 warning-2 += -Wcast-align
                                                   >>  38 warning-2 += -Wdisabled-optimization
                                                   >>  39 warning-2 += -Wnested-externs
                                                   >>  40 warning-2 += -Wshadow
                                                   >>  41 warning-2 += $(call cc-option, -Wlogical-op)
                                                   >>  42 warning-2 += $(call cc-option, -Wmissing-field-initializers)
                                                   >>  43 warning-2 += $(call cc-option, -Wsign-compare)
                                                   >>  44 warning-2 += $(call cc-option, -Wmaybe-uninitialized)
                                                   >>  45 warning-2 += $(call cc-option, -Wunused-macros)
                                                   >>  46 
                                                   >>  47 warning-3 := -Wbad-function-cast
                                                   >>  48 warning-3 += -Wcast-qual
                                                   >>  49 warning-3 += -Wconversion
                                                   >>  50 warning-3 += -Wpacked
                                                   >>  51 warning-3 += -Wpadded
                                                   >>  52 warning-3 += -Wpointer-arith
                                                   >>  53 warning-3 += -Wredundant-decls
                                                   >>  54 warning-3 += -Wswitch-default
                                                   >>  55 warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
                                                   >>  56 
                                                   >>  57 warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
                                                   >>  58 warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
                                                   >>  59 warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
160                                                    60 
                                                   >>  61 ifeq ("$(strip $(warning))","")
                                                   >>  62         $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
161 endif                                              63 endif
162                                                    64 
163 #                                              !!  65 KBUILD_CFLAGS += $(warning)
164 # W=3 - more obscure warnings, can most likely << 
165 #                                              << 
166 ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) << 
167                                                << 
168 KBUILD_CFLAGS += -Wbad-function-cast           << 
169 KBUILD_CFLAGS += -Wcast-align                  << 
170 KBUILD_CFLAGS += -Wcast-qual                   << 
171 KBUILD_CFLAGS += -Wconversion                  << 
172 KBUILD_CFLAGS += -Wpacked                      << 
173 KBUILD_CFLAGS += -Wpadded                      << 
174 KBUILD_CFLAGS += -Wpointer-arith               << 
175 KBUILD_CFLAGS += -Wredundant-decls             << 
176 KBUILD_CFLAGS += -Wsign-compare                << 
177 KBUILD_CFLAGS += -Wswitch-default              << 
178                                                << 
179 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3        << 
180                                                << 
181 else                                               66 else
182                                                    67 
183 # The following turn off the warnings enabled  !!  68 ifdef CONFIG_CC_IS_CLANG
184 KBUILD_CFLAGS += -Wno-sign-compare             !!  69 KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
185 KBUILD_CFLAGS += -Wno-unused-parameter         !!  70 KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
186                                                !!  71 KBUILD_CFLAGS += $(call cc-disable-warning, format)
                                                   >>  72 KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
                                                   >>  73 KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
                                                   >>  74 KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
187 endif                                              75 endif
188                                                << 
189 #                                              << 
190 # W=e - error out on warnings                  << 
191 #                                              << 
192 ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) << 
193                                                << 
194 KBUILD_CFLAGS += -Werror                       << 
195                                                << 
196 endif                                              76 endif
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php