Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

doc: use KCFLAGS instead of EXTRA_CFLAGS to pass flags from command line

You should use KCFLAGS to pass additional compiler flags from the
command line. Using EXTRA_CFLAGS is wrong.

EXTRA_CFLAGS is supposed to specify flags applied only to the current
Makefile (and now deprecated in favor of ccflags-y).

It is still used in arch/mips/kvm/Makefile (and possibly in external
modules too). Passing EXTRA_CFLAGS from the command line overwrites
it and breaks the build.

I also fixed drivers/gpu/drm/tilcdc/Makefile because commit 816175dd1fd7
("drivers/gpu/drm/tilcdc: Makefile, only -Werror when no -W* in
EXTRA_CFLAGS") was based on the same misunderstanding.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Alex Shi <alex.shi@linux.alibaba.com>
Acked-by: Federico Vaga <federico.vaga@vaga.pv.it>
Link: https://lore.kernel.org/r/20210221152524.197693-1-masahiroy@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Masahiro Yamada and committed by
Jonathan Corbet
163ba35f 93ea4a0b

+6 -6
+1 -1
Documentation/process/4.Coding.rst
··· 242 242 its cause. 243 243 244 244 Note that not all compiler warnings are enabled by default. Build the 245 - kernel with "make EXTRA_CFLAGS=-W" to get the full set. 245 + kernel with "make KCFLAGS=-W" to get the full set. 246 246 247 247 The kernel provides several configuration options which turn on debugging 248 248 features; most of these are found in the "kernel hacking" submenu. Several
+1 -1
Documentation/process/submit-checklist.rst
··· 96 96 injection might be appropriate. 97 97 98 98 20) Newly-added code has been compiled with ``gcc -W`` (use 99 - ``make EXTRA_CFLAGS=-W``). This will generate lots of noise, but is good 99 + ``make KCFLAGS=-W``). This will generate lots of noise, but is good 100 100 for finding bugs like "warning: comparison between signed and unsigned". 101 101 102 102 21) Tested after it has been merged into the -mm patchset to make sure
+1 -1
Documentation/translations/it_IT/process/4.Coding.rst
··· 256 256 però averne trovato la causa. 257 257 258 258 Tenete a mente che non tutti gli avvertimenti sono disabilitati di default. 259 - Costruite il kernel con "make EXTRA_CFLAGS=-W" per ottenerli tutti. 259 + Costruite il kernel con "make KCFLAGS=-W" per ottenerli tutti. 260 260 261 261 Il kernel fornisce differenti opzioni che abilitano funzionalità di debugging; 262 262 molti di queste sono trovano all'interno del sotto menu "kernel hacking".
+1 -1
Documentation/translations/it_IT/process/submit-checklist.rst
··· 104 104 l'iniezione di fallimenti specifici per il sottosistema. 105 105 106 106 22) Il nuovo codice è stato compilato con ``gcc -W`` (usate 107 - ``make EXTRA_CFLAGS=-W``). Questo genererà molti avvisi, ma è ottimo 107 + ``make KCFLAGS=-W``). Questo genererà molti avvisi, ma è ottimo 108 108 per scovare bachi come "warning: comparison between signed and unsigned". 109 109 110 110 23) La patch è stata verificata dopo essere stata inclusa nella serie di patch
+1 -1
Documentation/translations/zh_CN/process/4.Coding.rst
··· 165 165 通常,这些警告都指向真正的问题。提交以供审阅的代码通常不会产生任何编译器警告。 166 166 在消除警告时,注意了解真正的原因,并尽量避免“修复”,使警告消失而不解决其原因。 167 167 168 - 请注意,并非所有编译器警告都默认启用。使用“make EXTRA_CFLAGS=-W”构建内核以 168 + 请注意,并非所有编译器警告都默认启用。使用“make KCFLAGS=-W”构建内核以 169 169 获得完整集合。 170 170 171 171 内核提供了几个配置选项,可以打开调试功能;大多数配置选项位于“kernel hacking”
+1 -1
drivers/gpu/drm/tilcdc/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - ifeq (, $(findstring -W,$(EXTRA_CFLAGS))) 2 + ifeq (, $(findstring -W,$(KCFLAGS))) 3 3 ccflags-y += -Werror 4 4 endif 5 5