Commit 7b2a35132ad0a70902dcd2844c27ed64cda0ce9b

Authored by Li Zefan
Committed by Ingo Molnar
1 parent c4b8ac2c1a

compiler: Introduce __always_unused

I wrote some code which is used as compile-time checker, and the
code should be elided after compile.

So I need to annotate the code as "always unused", compared to
"maybe unused".

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <4AEE2CEC.8040206@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 2 changed files with 5 additions and 0 deletions Side-by-side Diff

include/linux/compiler-gcc.h
... ... @@ -79,6 +79,7 @@
79 79 #define noinline __attribute__((noinline))
80 80 #define __attribute_const__ __attribute__((__const__))
81 81 #define __maybe_unused __attribute__((unused))
  82 +#define __always_unused __attribute__((unused))
82 83  
83 84 #define __gcc_header(x) #x
84 85 #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
include/linux/compiler.h
... ... @@ -213,6 +213,10 @@
213 213 # define __maybe_unused /* unimplemented */
214 214 #endif
215 215  
  216 +#ifndef __always_unused
  217 +# define __always_unused /* unimplemented */
  218 +#endif
  219 +
216 220 #ifndef noinline
217 221 #define noinline
218 222 #endif