warn_undefmacro

Controls the detection of undefined macros in #if/#elif conditionals.

Syntax

#pragma warn_undefmacro on | off | reset

Target

All targets.

Remarks

Listing 10.46 provides an example.

Listing 10.46 Example of Undefined Macro

#if UNDEFINEDMACRO == 4 // WARNING: undefined macro
// ’UNDEFINEDMACRO’ used in
// #if/#elif conditional

Use this pragma to detect the use of undefined macros (especially expressions) where the default value 0 is used. To suppress this warning, check if the macro is defined before using it in a #if or #elif conditional.

NOTE A warning is only issued when a macro is evaluated. A short-circuited “&&” or “||” test or unevaluated “?:” will not produce a warning.

This pragma corresponds to the Undefined Macro in #if setting . To check this setting, use __option (warn_undefmacro), described in Checking Settings. The default setting is off.