While looking at the Linux kernel, I noticed the line:
static void *malloc(size_t size) __maybe_unused;
in Linux v3.2 /arch/frv/kernel/gdb_stub.c . I’ve never seen __maybe_unused used before. Is it specific to the Linux kernel? Or is it defined in the C spec? And what exactly does it do?
In
include/linux/compiler-gcc.hthere is the definition of the__maybe_unusedmacro:and in
gccmanual you have the documentation of theunusedattribute for functions:http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
and for variables:
http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html