Merge tag 'compiler-attributes-for-linus-4.20-rc1' of https://github.com/ojeda/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Nov 2018 01:34:46 +0000 (18:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Nov 2018 01:34:46 +0000 (18:34 -0700)
Pull compiler attribute updates from Miguel Ojeda:
 "This is an effort to disentangle the include/linux/compiler*.h headers
  and bring them up to date.

  The main idea behind the series is to use feature checking macros
  (i.e. __has_attribute) instead of compiler version checks (e.g.
  GCC_VERSION), which are compiler-agnostic (so they can be shared,
  reducing the size of compiler-specific headers) and version-agnostic.

  Other related improvements have been performed in the headers as well,
  which on top of the use of __has_attribute it has amounted to a
  significant simplification of these headers (e.g. GCC_VERSION is now
  only guarding a few non-attribute macros).

  This series should also help the efforts to support compiling the
  kernel with clang and icc. A fair amount of documentation and comments
  have also been added, clarified or removed; and the headers are now
  more readable, which should help kernel developers in general.

  The series was triggered due to the move to gcc >= 4.6. In turn, this
  series has also triggered Sparse to gain the ability to recognize
  __has_attribute on its own.

  Finally, the __nonstring variable attribute series has been also
  applied on top; plus two related patches from Nick Desaulniers for
  unreachable() that came a bit afterwards"

* tag 'compiler-attributes-for-linus-4.20-rc1' of https://github.com/ojeda/linux:
  compiler-gcc: remove comment about gcc 4.5 from unreachable()
  compiler.h: update definition of unreachable()
  Compiler Attributes: ext4: remove local __nonstring definition
  Compiler Attributes: auxdisplay: panel: use __nonstring
  Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
  Compiler Attributes: add support for __nonstring (gcc >= 8)
  Compiler Attributes: add MAINTAINERS entry
  Compiler Attributes: add Doc/process/programming-language.rst
  Compiler Attributes: remove uses of __attribute__ from compiler.h
  Compiler Attributes: KENTRY used twice the "used" attribute
  Compiler Attributes: use feature checks instead of version checks
  Compiler Attributes: add missing SPDX ID in compiler_types.h
  Compiler Attributes: remove unneeded sparse (__CHECKER__) tests
  Compiler Attributes: homogenize __must_be_array
  Compiler Attributes: remove unneeded tests
  Compiler Attributes: always use the extra-underscores syntax
  Compiler Attributes: remove unused attributes

1  2 
Documentation/process/index.rst
MAINTAINERS
fs/ext4/ext4.h
include/linux/compiler-gcc.h
include/linux/compiler.h
scripts/Makefile.extrawarn

@@@ -19,12 -19,11 +19,13 @@@ Below are the essential guides that eve
  .. toctree::
     :maxdepth: 1
  
 +   license-rules
     howto
     code-of-conduct
 +   code-of-conduct-interpretation
     development-process
     submitting-patches
+    programming-language
     coding-style
     maintainer-pgp-guide
     email-clients
diff --cc MAINTAINERS
Simple merge
diff --cc fs/ext4/ext4.h
Simple merge
  #define KASAN_ABI_VERSION 3
  #endif
  
- #if GCC_VERSION >= 40902
 +/*
-  * Tell the compiler that address safety instrumentation (KASAN)
-  * should not be applied to that function.
-  * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
++ * Because __no_sanitize_address conflicts with inlining:
++ *   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
++ * we do one or the other. 
 + */
- #define __no_sanitize_address __attribute__((no_sanitize_address))
 +#ifdef CONFIG_KASAN
 +#define __no_sanitize_address_or_inline                                       \
 +      __no_sanitize_address __maybe_unused notrace
 +#else
 +#define __no_sanitize_address_or_inline inline
 +#endif
- #endif
 +
  #if GCC_VERSION >= 50100
- /*
-  * Mark structures as requiring designated initializers.
-  * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
-  */
- #define __designated_init __attribute__((designated_init))
  #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
  #endif
  
@@@ -290,51 -302,8 +293,47 @@@ static inline void *offset_to_ptr(cons
        return (void *)((unsigned long)off + *off);
  }
  
 +#else /* __ASSEMBLY__ */
 +
 +#ifdef __KERNEL__
 +#ifndef LINKER_SCRIPT
 +
 +#ifdef CONFIG_STACK_VALIDATION
 +.macro ANNOTATE_UNREACHABLE counter:req
 +\counter:
 +      .pushsection .discard.unreachable
 +      .long \counter\()b -.
 +      .popsection
 +.endm
 +
 +.macro ANNOTATE_REACHABLE counter:req
 +\counter:
 +      .pushsection .discard.reachable
 +      .long \counter\()b -.
 +      .popsection
 +.endm
 +
 +.macro ASM_UNREACHABLE
 +999:
 +      .pushsection .discard.unreachable
 +      .long 999b - .
 +      .popsection
 +.endm
 +#else /* CONFIG_STACK_VALIDATION */
 +.macro ANNOTATE_UNREACHABLE counter:req
 +.endm
 +
 +.macro ANNOTATE_REACHABLE counter:req
 +.endm
 +
 +.macro ASM_UNREACHABLE
 +.endm
 +#endif /* CONFIG_STACK_VALIDATION */
 +
 +#endif /* LINKER_SCRIPT */
 +#endif /* __KERNEL__ */
  #endif /* __ASSEMBLY__ */
  
- #ifndef __optimize
- # define __optimize(level)
- #endif
  /* Compile time object size, -1 for unknown */
  #ifndef __compiletime_object_size
  # define __compiletime_object_size(obj) -1
Simple merge