Skip to content

Commit

Permalink
Fix CCN8924
Browse files Browse the repository at this point in the history
The warning complains about passing an argument of non-POD type through
the following helper defined by Google Test:

```
static char (&Helper(...))[2];  // NOLINT
```

xlC for some reason does not like passing the non-POD type through this
helper, although it appears to work correctly. This helper is used for
statically determining whether types are implicitly covertable so all
we care about is whether `sizeof` this helper is 1 or 2. Whether the
type is passed through elipsis or as a parameter does not matter in this
case and hence we can just silence the warning on xlC.

```
CCN8924 (W) Cannot pass an argument of non-POD class type "const ASTNodeArg" through ellipsis.
```
  • Loading branch information
fjeremic committed Aug 18, 2021
1 parent a99c1b6 commit ee53df8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 0 additions & 8 deletions fvtest/tril/test/ASTTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#include <gtest/gtest.h>
#include "ast.hpp"

#if defined(AIXPPC) || defined(J9ZOS390)
#pragma report(disable, "CCN8924")
#endif

TEST(ASTValueTest, CreateInt64ASTValue) {
auto baseValue = 3UL;

Expand Down Expand Up @@ -620,7 +616,3 @@ TEST(ASTNodeTest, GetSecondNamedArgumentTest) {
argList = argList->next->next;
ASSERT_EQ(*argList, *arg);
}

#if defined(AIXPPC) || defined(J9ZOS390)
#pragma report(enable, "CCN8924")
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,14 @@ class ImplicitlyConvertible {
// possible loss of data, so we need to temporarily disable the
// warning.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
#if defined(J9ZOS390) || defined(AIXPPC)
#pragma report(disable, "CCN8924")
#endif
static const bool value =
sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
#if defined(J9ZOS390) || defined(AIXPPC)
#pragma report(enable, "CCN8924")
#endif
GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif // __BORLANDC__
};
Expand Down

0 comments on commit ee53df8

Please sign in to comment.