[PATCH v2 0/2] CLANG_VERSION and __diag macros

From: Nick Desaulniers
Date: Mon Jul 30 2018 - 17:34:22 EST


clang-7 has a new warning (-Wreturn-stack-address) for warning when a
function returns the address of a local variable. This is in general a
good warning, but the kernel has a few places where GNU statement
expressions return the address of a label in order to get the current
instruction pointer (see _THIS_IP_ and current_text_addr).

In order to disable a warning at a single call site, the kernel already
has __diag macros for inserting compiler and compiler-version specific
_Pragma's.

This series adds CLANG_VERSION macros necessary for proper __diag
support, and whitelists the case in _THIS_IP_. current_text_addr will be
consolidated in a follow up series.

Nick Desaulniers (2):
compiler-clang.h: Add CLANG_VERSION and __diag macros
kernel.h: Disable -Wreturn-stack-address for _THIS_IP_

include/linux/compiler-clang.h | 19 +++++++++++++++++++
include/linux/compiler_types.h | 4 ++++
include/linux/kernel.h | 10 +++++++++-
3 files changed, 32 insertions(+), 1 deletion(-)

--
2.18.0.345.g5c9ce644c3-goog