The GCC compiler flags that control unused warnings include:

-Wunused-function
-Wunused-label
-Wunused-parameter
-Wunused-value
-Wunused-variable
-Wunused(=all of the above)

Each of these has a corresponding negative form with "no-" inserted after the W which turns off the warning (in case it was turned on by -Wall, for example). Thus, in your case you should use

-Wno-unused-function

Of course this works for the whole code, not just compile-time asserts. For function-specific behaviour, have a look at Function attributes.

 

 

 

#ifdef __GNUC__ #define VARIABLE_IS_NOT_USED __attribute__ ((unused))

#else

#define VARIABLE_IS_NOT_USED

#endif

int VARIABLE_IS_NOT_USED your_variable;

arrow
arrow
    全站熱搜

    立你斯 發表在 痞客邦 留言(0) 人氣()