-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix -Wnonnull warnings with GCC 11 #7403
Conversation
OpenJ9 itself appears to build fully with |
A partial alternate solution would be to remove I think that would improve warnings under |
I suppose |
@mpirvu These were the few lines in |
@@ -1230,7 +1230,7 @@ void TR_CopyPropagation::replaceCopySymbolReferenceByOriginalIn(TR::SymbolRefere | |||
if (origNode->getNumChildren() == 2) | |||
{ | |||
twoChildrenCase = true; | |||
TR_ASSERT(0, "Only in WCode we can add extra children\n"); | |||
TR_ASSERT_FATAL(0, "Only in WCode we can add extra children\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fatal assert message should be re-written to be "Cannot add extra children". The WCode message is no longer relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Maybe the code handling the twoChildrenCase
should be removed in future?
@@ -1230,7 +1230,7 @@ void TR_CopyPropagation::replaceCopySymbolReferenceByOriginalIn(TR::SymbolRefere | |||
if (origNode->getNumChildren() == 2) | |||
{ | |||
twoChildrenCase = true; | |||
TR_ASSERT(0, "Only in WCode we can add extra children\n"); | |||
TR_ASSERT_FATAL(0, "Only in WCode we can add extra children\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow how making this assert fatal resolves the problem since it does not operate on the nullness of a particular pointer (only "0").
For the record, I think this should be a fatal assert as you have it, but I'm not clear how this resolves the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should have explained. I'd have to recompile to be sure, but from what I recall, the actual compilation error was a little down from here, in one of the if (twoChildrenCase)
blocks. (I think the dumpOptDetails
call might have been the source). This is the only place where twoChildrenCase
can be set to true
, so the fatal assert makes those blocks unreachable.
af0d39d
to
8566182
Compare
Version 11 and later of GCC consider the implicit `this` parameter of nonstatic member functions to be annotated with `nonnull` for the purposes of the `-Wnonnull` warning. This change generates new warnings that are resolved here with the use of `TR_ASSERT_FATAL` on the objects that the compiler thinks could be `NULL`. The macro `TR_ASSERT` is insufficient, as the `TR::assertion` method isn't (and cannot be) annotated with `OMR_NORETURN`. Signed-off-by: Christian Despres <despresc@ibm.com>
8566182
to
c40a511
Compare
Jenkins build all |
Version 11 and later of GCC consider the implicit
this
parameter of nonstatic member functions to be annotated withnonnull
for the purposes of the-Wnonnull
warning. This change generates new warnings that are resolved here with the use ofTR_ASSERT_FATAL
on the objects that the compiler thinks could beNULL
. The macroTR_ASSERT
is insufficient, as theTR::assertion
method isn't (and cannot be) annotated withOMR_NORETURN
.Fixes: #7402