Declaring setjmp()/longjmp() as taking longs makes the signature non-standard, and makes clang complain. In the past, this has been worked around by adding -ffreestanding to the compile flags. The implementation looks like it only ever propagates the value (in longjmp) or sets it to 1 (in setjmp), and we only call longjmp with integer parameters. This allows removing -ffreestanding from the compilation flags.
Unified · Split
| @@ -7,7 +7,9 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #define JMP_BUF_LEN 23 | 8 | #define JMP_BUF_LEN 23 |
| 9 | 9 | ||
| 10 | extern long setjmp(long *) __attribute__((returns_twice)); | 10 | typedef long jmp_buf[JMP_BUF_LEN]; |
| 11 | extern void longjmp(long *, long) __attribute__((noreturn)); | 11 | |
| 12 | extern int setjmp(jmp_buf env) __attribute__((returns_twice)); | ||
| 13 | extern void longjmp(jmp_buf env, int val) __attribute__((noreturn)); | ||
| 12 | 14 | ||
| 13 | #endif /* _ASM_POWERPC_SETJMP_H */ | 15 | #endif /* _ASM_POWERPC_SETJMP_H */ |
| @@ -3,9 +3,6 @@ · 2 unmodified lines | |||
| 3 | # Makefile for the linux kernel. | 3 | # Makefile for the linux kernel. |
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | # Avoid clang warnings around longjmp/setjmp declarations | ||
| 7 | CFLAGS_crash.o += -ffreestanding | ||
| 8 | |||
| 9 | obj-y += core.o crash.o core_$(BITS).o | 6 | obj-y += core.o crash.o core_$(BITS).o |
| 10 | 7 | ||
| 11 | obj-$(CONFIG_PPC32) += relocate_32.o | 8 | obj-$(CONFIG_PPC32) += relocate_32.o |
| @@ -1,9 +1,6 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # Makefile for xmon | 2 | # Makefile for xmon |
| 3 | 3 | ||
| 4 | # Avoid clang warnings around longjmp/setjmp declarations | ||
| 5 | subdir-ccflags-y := -ffreestanding | ||
| 6 | |||
| 7 | GCOV_PROFILE := n | 4 | GCOV_PROFILE := n |
| 8 | KCOV_INSTRUMENT := n | 5 | KCOV_INSTRUMENT := n |
| 9 | UBSAN_SANITIZE := n | 6 | UBSAN_SANITIZE := n |