Commit b00d2092 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'compiler-attributes-for-linus-v4.20-rc2' of https://github.com/ojeda/linux

Pull compiler attribute fixlets from Miguel Ojeda:
 "Small improvements to Compiler Attributes:

   - Define asm_volatile_goto for non-gcc compilers (Nick Desaulniers)

   - Improve the explanation of compiler_attributes.h"

* tag 'compiler-attributes-for-linus-v4.20-rc2' of https://github.com/ojeda/linux:
  Compiler Attributes: improve explanation of header
  include/linux/compiler*.h: define asm_volatile_goto
parents d50ffc58 24efee41
...@@ -4,22 +4,26 @@ ...@@ -4,22 +4,26 @@
/* /*
* The attributes in this file are unconditionally defined and they directly * The attributes in this file are unconditionally defined and they directly
* map to compiler attribute(s) -- except those that are optional. * map to compiler attribute(s), unless one of the compilers does not support
* the attribute. In that case, __has_attribute is used to check for support
* and the reason is stated in its comment ("Optional: ...").
* *
* Any other "attributes" (i.e. those that depend on a configuration option, * Any other "attributes" (i.e. those that depend on a configuration option,
* on a compiler, on an architecture, on plugins, on other attributes...) * on a compiler, on an architecture, on plugins, on other attributes...)
* should be defined elsewhere (e.g. compiler_types.h or compiler-*.h). * should be defined elsewhere (e.g. compiler_types.h or compiler-*.h).
* The intention is to keep this file as simple as possible, as well as
* compiler- and version-agnostic (e.g. avoiding GCC_VERSION checks).
* *
* This file is meant to be sorted (by actual attribute name, * This file is meant to be sorted (by actual attribute name,
* not by #define identifier). Use the __attribute__((__name__)) syntax * not by #define identifier). Use the __attribute__((__name__)) syntax
* (i.e. with underscores) to avoid future collisions with other macros. * (i.e. with underscores) to avoid future collisions with other macros.
* If an attribute is optional, state the reason in the comment. * Provide links to the documentation of each supported compiler, if it exists.
*/ */
/* /*
* To check for optional attributes, we use __has_attribute, which is supported * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17.
* on gcc >= 5, clang >= 2.9 and icc >= 17. In the meantime, to support * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute
* 4.6 <= gcc < 5, we implement __has_attribute by hand. * by hand.
* *
* sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__ * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__
* depending on the compiler used to build it; however, these attributes have * depending on the compiler used to build it; however, these attributes have
......
...@@ -130,6 +130,10 @@ struct ftrace_likely_data { ...@@ -130,6 +130,10 @@ struct ftrace_likely_data {
# define randomized_struct_fields_end # define randomized_struct_fields_end
#endif #endif
#ifndef asm_volatile_goto
#define asm_volatile_goto(x...) asm goto(x)
#endif
/* Are two types/vars the same type (ignoring qualifiers)? */ /* Are two types/vars the same type (ignoring qualifiers)? */
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment