Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'compiler-attributes-for-linus-v5.15-rc1-v2' of git://github.com/ojeda/linux

Pull compiler attributes updates from Miguel Ojeda:

- Fix __has_attribute(__no_sanitize_coverage__) for GCC 4 (Marco Elver)

- Add Nick as Reviewer for compiler_attributes.h (Nick Desaulniers)

- Move __compiletime_{error|warning} (Nick Desaulniers)

* tag 'compiler-attributes-for-linus-v5.15-rc1-v2' of git://github.com/ojeda/linux:
compiler_attributes.h: move __compiletime_{error|warning}
MAINTAINERS: add Nick as Reviewer for compiler_attributes.h
Compiler Attributes: fix __has_attribute(__no_sanitize_coverage__) for GCC 4

+26 -9
+1
MAINTAINERS
··· 4684 4684 4685 4685 COMPILER ATTRIBUTES 4686 4686 M: Miguel Ojeda <ojeda@kernel.org> 4687 + R: Nick Desaulniers <ndesaulniers@google.com> 4687 4688 S: Maintained 4688 4689 F: include/linux/compiler_attributes.h 4689 4690
-3
include/linux/compiler-gcc.h
··· 43 43 44 44 #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) 45 45 46 - #define __compiletime_warning(message) __attribute__((__warning__(message))) 47 - #define __compiletime_error(message) __attribute__((__error__(message))) 48 - 49 46 #if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) 50 47 #define __latent_entropy __attribute__((latent_entropy)) 51 48 #endif
+25
include/linux/compiler_attributes.h
··· 30 30 # define __GCC4_has_attribute___assume_aligned__ 1 31 31 # define __GCC4_has_attribute___copy__ 0 32 32 # define __GCC4_has_attribute___designated_init__ 0 33 + # define __GCC4_has_attribute___error__ 1 33 34 # define __GCC4_has_attribute___externally_visible__ 1 34 35 # define __GCC4_has_attribute___no_caller_saved_registers__ 0 35 36 # define __GCC4_has_attribute___noclone__ 1 ··· 38 37 # define __GCC4_has_attribute___nonstring__ 0 39 38 # define __GCC4_has_attribute___no_sanitize_address__ 1 40 39 # define __GCC4_has_attribute___no_sanitize_undefined__ 1 40 + # define __GCC4_has_attribute___no_sanitize_coverage__ 0 41 41 # define __GCC4_has_attribute___fallthrough__ 0 42 + # define __GCC4_has_attribute___warning__ 1 42 43 #endif 43 44 44 45 /* ··· 138 135 # define __designated_init __attribute__((__designated_init__)) 139 136 #else 140 137 # define __designated_init 138 + #endif 139 + 140 + /* 141 + * Optional: only supported since clang >= 14.0 142 + * 143 + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-error-function-attribute 144 + */ 145 + #if __has_attribute(__error__) 146 + # define __compiletime_error(msg) __attribute__((__error__(msg))) 147 + #else 148 + # define __compiletime_error(msg) 141 149 #endif 142 150 143 151 /* ··· 311 297 * clang: https://clang.llvm.org/docs/AttributeReference.html#nodiscard-warn-unused-result 312 298 */ 313 299 #define __must_check __attribute__((__warn_unused_result__)) 300 + 301 + /* 302 + * Optional: only supported since clang >= 14.0 303 + * 304 + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warning-function-attribute 305 + */ 306 + #if __has_attribute(__warning__) 307 + # define __compiletime_warning(msg) __attribute__((__warning__(msg))) 308 + #else 309 + # define __compiletime_warning(msg) 310 + #endif 314 311 315 312 /* 316 313 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute
-6
include/linux/compiler_types.h
··· 294 294 #ifndef __compiletime_object_size 295 295 # define __compiletime_object_size(obj) -1 296 296 #endif 297 - #ifndef __compiletime_warning 298 - # define __compiletime_warning(message) 299 - #endif 300 - #ifndef __compiletime_error 301 - # define __compiletime_error(message) 302 - #endif 303 297 304 298 #ifdef __OPTIMIZE__ 305 299 # define __compiletime_assert(condition, msg, prefix, suffix) \