Skip to content

Commit

Permalink
Disable -Winvalid-offsetof in OMROptions and FEBase.cpp
Browse files Browse the repository at this point in the history
See #1662 for some further details. This will not be easy to solve
becalse it is not straightforward to covert `TR::JitConfig` to a POD
so we can use `offsetof`. This will hopefully be solved via the options
framework overhaul, so fixing this warning properly is not worth the
effort at the moment. Instead we locally disable this warning around
the problematic area.
  • Loading branch information
fjeremic committed Jun 29, 2021
1 parent bd2c683 commit 5521972
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
34 changes: 33 additions & 1 deletion compiler/control/OMROptions.cpp
Expand Up @@ -93,6 +93,16 @@ using namespace OMR;

static char * EXCLUDED_METHOD_OPTIONS_PREFIX = "ifExcluded";

#if defined(LINUX)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#elif defined(OSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(disable, "CCN6281")
#endif

// The following options must be placed in alphabetical order for them to work properly
TR::OptionTable OMR::Options::_jitOptions[] = {

Expand Down Expand Up @@ -1274,7 +1284,13 @@ TR::OptionTable OMR::Options::_jitOptions[] = {
{NULL}
};


#if defined(LINUX)
#pragma GCC diagnostic pop
#elif defined(OSX)
#pragma clang diagnostic pop
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(enable, "CCN6281")
#endif

int64_t
OMR::Options::getNumericValue(char * & option)
Expand Down Expand Up @@ -4398,6 +4414,15 @@ OMR::Options::getDefaultCountString()
return p;
}

#if defined(LINUX)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#elif defined(OSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(disable, "CCN6281")
#endif

char *
OMR::Options::setCount(char *option, void *base, TR::OptionTable *entry)
Expand Down Expand Up @@ -4439,6 +4464,13 @@ OMR::Options::setCount(char *option, void *base, TR::OptionTable *entry)
return option;
}

#if defined(LINUX)
#pragma GCC diagnostic pop
#elif defined(OSX)
#pragma clang diagnostic pop
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(enable, "CCN6281")
#endif

// -----------------------------------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions compiler/env/FEBase.cpp
Expand Up @@ -101,6 +101,8 @@ char *feGetEnv(const char *s)
#elif defined(OSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(disable, "CCN6281")
#endif

TR::OptionTable OMR::Options::_feOptions[] =
Expand All @@ -125,6 +127,8 @@ TR::OptionTable OMR::Options::_feOptions[] =
#pragma GCC diagnostic pop
#elif defined(OSX)
#pragma clang diagnostic pop
#elif defined(AIXPPC) || defined(J9ZOS390)
#pragma report(enable, "CCN6281")
#endif

#include "control/Recompilation.hpp"
Expand Down

0 comments on commit 5521972

Please sign in to comment.