]> Git Repo - J-linux.git/commitdiff
Merge tag 'compiler-attributes-for-linus-v5.16' of git://github.com/ojeda/linux
authorLinus Torvalds <[email protected]>
Sun, 7 Nov 2021 18:38:17 +0000 (10:38 -0800)
committerLinus Torvalds <[email protected]>
Sun, 7 Nov 2021 18:38:17 +0000 (10:38 -0800)
Pull compiler attributes update from Miguel Ojeda:
 "An improvement for `__compiletime_assert` and a trivial cleanup"

* tag 'compiler-attributes-for-linus-v5.16' of git://github.com/ojeda/linux:
  compiler_types: mark __compiletime_assert failure as __noreturn
  Compiler Attributes: remove GCC 5.1 mention

1  2 
include/linux/compiler_attributes.h
include/linux/compiler_types.h

index 3de06a8fae73b93be81794c549223aecaa3e3059,87d1e773400c6379b9a42c16aff7e2706ff0b1ed..b9121afd873316f0778e7e63d8f36365a66672dd
  #define __aligned(x)                    __attribute__((__aligned__(x)))
  #define __aligned_largest               __attribute__((__aligned__))
  
 +/*
 + * Note: do not use this directly. Instead, use __alloc_size() since it is conditionally
 + * available and includes other attributes.
 + *
 + *   gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute
 + * clang: https://clang.llvm.org/docs/AttributeReference.html#alloc-size
 + */
 +#define __alloc_size__(x, ...)                __attribute__((__alloc_size__(x, ## __VA_ARGS__)))
 +
  /*
   * Note: users of __always_inline currently do not write "inline" themselves,
   * which seems to be required by gcc to apply the attribute according
  #define __deprecated
  
  /*
-  * Optional: only supported since gcc >= 5.1
   * Optional: not supported by clang
   * Optional: not supported by icc
   *
  
  /*
   *   gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute
 + * clang: https://clang.llvm.org/docs/AttributeReference.html#malloc
   */
  #define __malloc                        __attribute__((__malloc__))
  
index 3f198879c2928e48eff4a9e2cebbf266c5255584,ca1a66b8cd2f40022a07cc7921abda466799549c..1d32f4c03c9ef1a3371ebeb347b656fce972d5ac
@@@ -250,18 -250,6 +250,18 @@@ struct ftrace_likely_data 
  # define __cficanonical
  #endif
  
 +/*
 + * Any place that could be marked with the "alloc_size" attribute is also
 + * a place to be marked with the "malloc" attribute. Do this as part of the
 + * __alloc_size macro to avoid redundant attributes and to avoid missing a
 + * __malloc marking.
 + */
 +#ifdef __alloc_size__
 +# define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc
 +#else
 +# define __alloc_size(x, ...) __malloc
 +#endif
 +
  #ifndef asm_volatile_goto
  #define asm_volatile_goto(x...) asm goto(x)
  #endif
        (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
         sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
  
 -/* Compile time object size, -1 for unknown */
 -#ifndef __compiletime_object_size
 -# define __compiletime_object_size(obj) -1
 -#endif
 -
  #ifdef __OPTIMIZE__
  # define __compiletime_assert(condition, msg, prefix, suffix)         \
        do {                                                            \
-               extern void prefix ## suffix(void) __compiletime_error(msg); \
+               /*                                                      \
+                * __noreturn is needed to give the compiler enough     \
+                * information to avoid certain possibly-uninitialized  \
+                * warnings (regardless of the build failing).          \
+                */                                                     \
+               __noreturn extern void prefix ## suffix(void)           \
+                       __compiletime_error(msg);                       \
                if (!(condition))                                       \
                        prefix ## suffix();                             \
        } while (0)
This page took 0.058786 seconds and 4 git commands to generate.