Commit f6d133f8 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

compiler-gcc.h: neatening

 - Move the inline and noinline blocks together

 - Comment neatening

 - Alignment of __attribute__ uses

 - Consistent naming of __must_be_array macro argument

 - Multiline macro neatening
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Alan Modra <amodra@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2e13ba54
...@@ -47,15 +47,18 @@ ...@@ -47,15 +47,18 @@
* case either is valid. * case either is valid.
*/ */
#define RELOC_HIDE(ptr, off) \ #define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \ ({ \
unsigned long __ptr; \
__asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
(typeof(ptr)) (__ptr + (off)); }) (typeof(ptr)) (__ptr + (off)); \
})
/* Make the optimizer believe the variable can be manipulated arbitrarily. */ /* Make the optimizer believe the variable can be manipulated arbitrarily. */
#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) #define OPTIMIZER_HIDE_VAR(var) \
__asm__ ("" : "=r" (var) : "0" (var))
#ifdef __CHECKER__ #ifdef __CHECKER__
#define __must_be_array(arr) 0 #define __must_be_array(a) 0
#else #else
/* &a[0] degrades to a pointer: a different type from an array */ /* &a[0] degrades to a pointer: a different type from an array */
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
...@@ -67,30 +70,35 @@ ...@@ -67,30 +70,35 @@
*/ */
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
# define inline inline __attribute__((always_inline)) notrace #define inline inline __attribute__((always_inline)) notrace
# define __inline__ __inline__ __attribute__((always_inline)) notrace #define __inline__ __inline__ __attribute__((always_inline)) notrace
# define __inline __inline __attribute__((always_inline)) notrace #define __inline __inline __attribute__((always_inline)) notrace
#else #else
/* A lot of inline functions can cause havoc with function tracing */ /* A lot of inline functions can cause havoc with function tracing */
# define inline inline notrace #define inline inline notrace
# define __inline__ __inline__ notrace #define __inline__ __inline__ notrace
# define __inline __inline notrace #define __inline __inline notrace
#endif #endif
#define __always_inline inline __attribute__((always_inline))
#define noinline __attribute__((noinline))
#define __deprecated __attribute__((deprecated)) #define __deprecated __attribute__((deprecated))
#define __packed __attribute__((packed)) #define __packed __attribute__((packed))
#define __weak __attribute__((weak)) #define __weak __attribute__((weak))
#define __alias(symbol) __attribute__((alias(#symbol))) #define __alias(symbol) __attribute__((alias(#symbol)))
/* /*
* it doesn't make sense on ARM (currently the only user of __naked) to trace * it doesn't make sense on ARM (currently the only user of __naked)
* naked functions because then mcount is called without stack and frame pointer * to trace naked functions because then mcount is called without
* being set up and there is no chance to restore the lr register to the value * stack and frame pointer being set up and there is no chance to
* before mcount was called. * restore the lr register to the value before mcount was called.
*
* The asm() bodies of naked functions often depend on standard calling
* conventions, therefore they must be noinline and noclone.
* *
* The asm() bodies of naked functions often depend on standard calling conventions, * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
* therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce * See GCC PR44290.
* this, so we must do so ourselves. See GCC PR44290.
*/ */
#define __naked __attribute__((naked)) noinline __noclone notrace #define __naked __attribute__((naked)) noinline __noclone notrace
...@@ -110,7 +118,6 @@ ...@@ -110,7 +118,6 @@
#define __aligned(x) __attribute__((aligned(x))) #define __aligned(x) __attribute__((aligned(x)))
#define __printf(a, b) __attribute__((format(printf, a, b))) #define __printf(a, b) __attribute__((format(printf, a, b)))
#define __scanf(a, b) __attribute__((format(scanf, a, b))) #define __scanf(a, b) __attribute__((format(scanf, a, b)))
#define noinline __attribute__((noinline))
#define __attribute_const__ __attribute__((__const__)) #define __attribute_const__ __attribute__((__const__))
#define __maybe_unused __attribute__((unused)) #define __maybe_unused __attribute__((unused))
#define __always_unused __attribute__((unused)) #define __always_unused __attribute__((unused))
...@@ -129,5 +136,3 @@ ...@@ -129,5 +136,3 @@
* code * code
*/ */
#define uninitialized_var(x) x = x #define uninitialized_var(x) x = x
#define __always_inline inline __attribute__((always_inline))
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