macro: Add macro PA_UNUSED

the macro PA_UNUSED may be used to suppress a warning when a variable
is not used, or assigned and never used; this typically happens
when the only use of the variable is within an assert() that can
be optimized away (i.e. with NDEBUG set)

has an effect with GCC only

v2: (thanks to Alexander Patrakov)
* fix patch subject/description

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald 2014-11-09 17:28:36 +01:00 committed by Peter Meerwald
parent 094de7f024
commit 87d188b46c

View file

@ -77,6 +77,12 @@ static inline size_t PA_PAGE_ALIGN(size_t l) {
return (l + PA_PAGE_SIZE - 1) & ~(PA_PAGE_SIZE - 1); return (l + PA_PAGE_SIZE - 1) & ~(PA_PAGE_SIZE - 1);
} }
#if defined(__GNUC__)
#define PA_UNUSED __attribute__ ((unused))
#else
#define PA_UNUSED
#endif
#define PA_ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0])) #define PA_ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
#if defined(__GNUC__) #if defined(__GNUC__)