compiler-gcc.h: Introduce __optimize function attribute
authorGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 1 Feb 2018 10:21:58 +0000 (11:21 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 8 Feb 2018 11:37:10 +0000 (22:37 +1100)
Create a new function attribute __optimize, which allows to specify an
optimization level on a per-function basis.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/linux/compiler-gcc.h
include/linux/compiler.h

index 2272ded07496d6044ebe43e930047237bb5f254e..7bba8e28c52916fb7f10811ffd9b724a5e0c4a11 100644 (file)
 #endif /* __CHECKER__ */
 #endif /* GCC_VERSION >= 40300 */
 
+#if GCC_VERSION >= 40400
+#define __optimize(level)      __attribute__((__optimize__(level)))
+#endif /* GCC_VERSION >= 40400 */
+
 #if GCC_VERSION >= 40500
 
 #ifndef __CHECKER__
index 188ed9f65517453d5bb97f2466167c069a7c0ae2..cdc629f20e20253ec2c0b088f8e9fd131459221d 100644 (file)
@@ -271,6 +271,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 
 #endif /* __ASSEMBLY__ */
 
+#ifndef __optimize
+# define __optimize(level)
+#endif
+
 /* Compile time object size, -1 for unknown */
 #ifndef __compiletime_object_size
 # define __compiletime_object_size(obj) -1