Skip to content

Rectify definition and use of #if(def) HAVE_SOMETHING (WITH_SOMETHING, etc.) #1739

@jimklimov

Description

@jimklimov

Some items are defined by autoconf methods, others by NUT code (and then often only optionally - defining as 1 if a feature is present).

As a consequence, some features can be flagged by simple #if FLAG while others should pedantically be #if ( defined(FLAG) && (FLAG) ) or some such. Use of #ifdef FLAG falters if it is defined but zero. Use of #if FLAG falters if it is not defined (GCC helps by defaulting it to 0 but generally it is undefined preprocessor behavior). Note that autotools config.h is generated to either #define a token with some value (may be 0 or not), or add a commented-away #undef of the token.

We should recomb the codebase to pick one standard and stick to it, avoiding confusion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrefactor/fightwarnPR or issue proposal to improve code maintainability without functional changes, or to fix warnings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions