Skip to content

Commit c9029ef

Browse files
nathanchancempe
authored andcommitted
powerpc: Avoid clang warnings around setjmp and longjmp
Commit aea4471 ("powerpc: Disable -Wbuiltin-requires-header when setjmp is used") disabled -Wbuiltin-requires-header because of a warning about the setjmp and longjmp declarations. r367387 in clang added another diagnostic around this, complaining that there is no jmp_buf declaration. In file included from ../arch/powerpc/xmon/xmon.c:47: ../arch/powerpc/include/asm/setjmp.h:10:13: error: declaration of built-in function 'setjmp' requires the declaration of the 'jmp_buf' type, commonly provided in the header <setjmp.h>. [-Werror,-Wincomplete-setjmp-declaration] extern long setjmp(long *); ^ ../arch/powerpc/include/asm/setjmp.h:11:13: error: declaration of built-in function 'longjmp' requires the declaration of the 'jmp_buf' type, commonly provided in the header <setjmp.h>. [-Werror,-Wincomplete-setjmp-declaration] extern void longjmp(long *, long); ^ 2 errors generated. We are not using the standard library's longjmp/setjmp implementations for obvious reasons; make this clear to clang by using -ffreestanding on these files. Cc: [email protected] # 4.14+ Suggested-by: Segher Boessenkool <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 465bfd9 commit c9029ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/powerpc/kexec/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Makefile for the linux kernel.
44
#
55

6-
# Disable clang warning for using setjmp without setjmp.h header
7-
CFLAGS_crash.o += $(call cc-disable-warning, builtin-requires-header)
6+
# Avoid clang warnings around longjmp/setjmp declarations
7+
CFLAGS_crash.o += -ffreestanding
88

99
obj-y += core.o crash.o core_$(BITS).o
1010

arch/powerpc/xmon/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SPDX-License-Identifier: GPL-2.0
22
# Makefile for xmon
33

4-
# Disable clang warning for using setjmp without setjmp.h header
5-
subdir-ccflags-y := $(call cc-disable-warning, builtin-requires-header)
4+
# Avoid clang warnings around longjmp/setjmp declarations
5+
subdir-ccflags-y := -ffreestanding
66

77
GCOV_PROFILE := n
88
KCOV_INSTRUMENT := n

0 commit comments

Comments
 (0)