Skip to content

Commit

Permalink
common/nutwriter.cpp: NutConfConfigWriter::writeConfig(): encase in p…
Browse files Browse the repository at this point in the history
…ragmas to hush warnings about macro code [networkupstools#2294]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Apr 29, 2024
1 parent 0b1b915 commit 07b7d9c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common/nutwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,30 @@ NutWriter::status_t NutConfConfigWriter::writeConfig(const NutConfiguration & co
return status;
}

#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE)
# pragma GCC diagnostic push
#endif
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE
# pragma GCC diagnostic ignored "-Wunreachable-code"
#endif
/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunreachable-code"
#endif
SHELL_CONFIG_DIRECTIVEX("ALLOW_NO_DEVICE", bool, config.allowNoDevice, false);
SHELL_CONFIG_DIRECTIVEX("ALLOW_NOT_ALL_LISTENERS", bool, config.allowNotAllListeners, false);
SHELL_CONFIG_DIRECTIVEX("UPSD_OPTIONS", std::string, config.upsdOptions, true);
SHELL_CONFIG_DIRECTIVEX("UPSMON_OPTIONS", std::string, config.upsmonOptions, true);
SHELL_CONFIG_DIRECTIVEX("POWEROFF_WAIT", unsigned int, config.poweroffWait, false);
SHELL_CONFIG_DIRECTIVEX("POWEROFF_QUIET", bool, config.poweroffQuiet, false);
SHELL_CONFIG_DIRECTIVEX("NUT_DEBUG_LEVEL", int, config.debugLevel, false);
#ifdef __clang__
# pragma clang diagnostic pop
#endif
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE)
# pragma GCC diagnostic pop
#endif

return NUTW_OK;
}
Expand Down

0 comments on commit 07b7d9c

Please sign in to comment.