History

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

Linus Torvalds committed 5 years ago

Commit c3e46872 parents d41adc4 b83a9084 files · +26 −9Browse files

Unified · Split

4 files
  1. MAINTAINERS +1 −0
  2. include/linux/compiler-gcc.h +0 −3
  3. include/linux/compiler_attributes.h +25 −0
  4. include/linux/compiler_types.h +0 −6
MAINTAINERS+1−0
@@ -4684,6 +4684,7 @@ F: drivers/platform/x86/compal-laptop.c · 4683 unmodified lines
4684 4684
4685COMPILER ATTRIBUTES4685COMPILER ATTRIBUTES
4686M: Miguel Ojeda <ojeda@kernel.org>4686M: Miguel Ojeda <ojeda@kernel.org>
4687R: Nick Desaulniers <ndesaulniers@google.com>
4687S: Maintained4688S: Maintained
4688F: include/linux/compiler_attributes.h4689F: include/linux/compiler_attributes.h
4689 4690
include/linux/compiler-gcc.h+0−3
@@ -43,9 +43,6 @@ · 42 unmodified lines
43 43
44#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)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#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)46#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
50#define __latent_entropy __attribute__((latent_entropy))47#define __latent_entropy __attribute__((latent_entropy))
51#endif48#endif
include/linux/compiler_attributes.h+25−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
30# define __GCC4_has_attribute___assume_aligned__ 130# define __GCC4_has_attribute___assume_aligned__ 1
31# define __GCC4_has_attribute___copy__ 031# define __GCC4_has_attribute___copy__ 0
32# define __GCC4_has_attribute___designated_init__ 032# define __GCC4_has_attribute___designated_init__ 0
33# define __GCC4_has_attribute___error__ 1
33# define __GCC4_has_attribute___externally_visible__ 134# define __GCC4_has_attribute___externally_visible__ 1
34# define __GCC4_has_attribute___no_caller_saved_registers__ 035# define __GCC4_has_attribute___no_caller_saved_registers__ 0
35# define __GCC4_has_attribute___noclone__ 136# define __GCC4_has_attribute___noclone__ 1
@@ -37,7 +38,9 @@ · 1 unmodified line
37# define __GCC4_has_attribute___nonstring__ 038# define __GCC4_has_attribute___nonstring__ 0
38# define __GCC4_has_attribute___no_sanitize_address__ 139# define __GCC4_has_attribute___no_sanitize_address__ 1
39# define __GCC4_has_attribute___no_sanitize_undefined__ 140# define __GCC4_has_attribute___no_sanitize_undefined__ 1
41# define __GCC4_has_attribute___no_sanitize_coverage__ 0
40# define __GCC4_has_attribute___fallthrough__ 042# define __GCC4_has_attribute___fallthrough__ 0
43# define __GCC4_has_attribute___warning__ 1
41#endif44#endif
42 45
43/*46/*
@@ -137,6 +140,17 @@ · 93 unmodified lines
137# define __designated_init140# define __designated_init
138#endif141#endif
139 142
143/*
144 * Optional: only supported since clang >= 14.0
145 *
146 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-error-function-attribute
147 */
148#if __has_attribute(__error__)
149# define __compiletime_error(msg) __attribute__((__error__(msg)))
150#else
151# define __compiletime_error(msg)
152#endif
153
140/*154/*
141 * Optional: not supported by clang155 * Optional: not supported by clang
142 *156 *
@@ -298,6 +312,17 @@ · 155 unmodified lines
298 */312 */
299#define __must_check __attribute__((__warn_unused_result__))313#define __must_check __attribute__((__warn_unused_result__))
300 314
315/*
316 * Optional: only supported since clang >= 14.0
317 *
318 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warning-function-attribute
319 */
320#if __has_attribute(__warning__)
321# define __compiletime_warning(msg) __attribute__((__warning__(msg)))
322#else
323# define __compiletime_warning(msg)
324#endif
325
301/*326/*
302 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute327 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute
303 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute328 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute
include/linux/compiler_types.h+0−6
@@ -294,12 +294,6 @@ struct ftrace_likely_data { · 293 unmodified lines
294#ifndef __compiletime_object_size294#ifndef __compiletime_object_size
295# define __compiletime_object_size(obj) -1295# define __compiletime_object_size(obj) -1
296#endif296#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#ifdef __OPTIMIZE__298#ifdef __OPTIMIZE__
305# define __compiletime_assert(condition, msg, prefix, suffix) \299# define __compiletime_assert(condition, msg, prefix, suffix) \