This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

-Wundef option?

Is there a way to get an "undefined macro" warning with this code:

#if FOO
\\do something
#endif

but FOO is not defined?

Parents Reply Children
  • Note that the link does not contain one sentence about the construct of using #error.

    It all relates to a glibc policy and relating to the availability of the gcc-specific -Wundef

    In a large number of situations, you aren't the owner of the original #define so you have no choice when it comes to #if xx or #if defined(xx) - you design based on what the library or target compiler supplies.

    The main issue is to inform the developer that the code doesn't support, or hasn't been tested with, the current set of definitions.