Skip to content

Commit 49832c8

Browse files
rddunlaptorvalds
authored andcommitted
Makefile: use -Wno-main in the full kernel tree
When using gcc (SUSE Linux) 7.5.0 (on openSUSE 15.3), I see a build warning: kernel/trace/trace_osnoise.c: In function 'start_kthread': kernel/trace/trace_osnoise.c:1461:8: warning: 'main' is usually a function [-Wmain] void *main = osnoise_main; ^~~~ Quieten that warning by using "-Wno-main". It's OK to use "main" as a declaration name in the kernel. Build-tested on most ARCHes. [ v2: only do it for gcc, since clang doesn't have that particular warning ] Signed-off-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Suggested-by: Steven Rostedt <[email protected]> Suggested-by: Linus Torvalds <[email protected]> Cc: Daniel Bristot de Oliveira <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Michal Marek <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent ac08b1c commit 49832c8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ else
802802
# Disabled for clang while comment to attribute conversion happens and
803803
# https://github.com/ClangBuiltLinux/linux/issues/636 is discussed.
804804
KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=5,)
805+
# gcc inanely warns about local variables called 'main'
806+
KBUILD_CFLAGS += -Wno-main
805807
endif
806808

807809
# These warnings generated too much noise in a regular build.

0 commit comments

Comments
 (0)