-
Notifications
You must be signed in to change notification settings - Fork 579
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 ifdef DEBUGs to NDEBUG #5175
Conversation
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.
Thanks, but it's actually #ifndef NDEBUG
@@ -80,7 +80,7 @@ void Trilinos_Util_ReadHpc2Epetra_internal( | |||
exit(1); | |||
} | |||
int_type numGlobalEquations, total_nnz; | |||
#ifdef DEBUG | |||
#ifdef NDEBUG |
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.
It's ifndef NDEBUG
. assert
only exists if NDEBUG
is not defined.
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.
Ahh! Thanks.
I'm trying to burn through this a bit too fast today.
Status Flag 'Pre-Test Inspection' - Auto Inspected - Inspection Is Not Necessary for this Pull Request. |
Status Flag 'Pull Request AutoTester' - Testing Jenkins Projects: Pull Request Auto Testing STARTING (click to expand)Build InformationTest Name: Trilinos_pullrequest_gcc_4.8.4
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_intel_17.0.1
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_gcc_4.9.3_SERIAL
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_gcc_7.2.0
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_cuda_9.2
Jenkins Parameters
Using Repos:
Pull Request Author: ZUUL42 |
Status Flag 'Pull Request AutoTester' - Jenkins Testing: all Jobs PASSED Pull Request Auto Testing has PASSED (click to expand)Build InformationTest Name: Trilinos_pullrequest_gcc_4.8.4
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_intel_17.0.1
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_gcc_4.9.3_SERIAL
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_gcc_7.2.0
Jenkins Parameters
Build InformationTest Name: Trilinos_pullrequest_cuda_9.2
Jenkins Parameters
|
Status Flag 'Pre-Merge Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
All Jobs Finished; status = PASSED, However Inspection must be performed before merge can occur... |
Let me know via my SNL email what other patches you need reviewed, you mentioned yesterday that there were other MRs ?? |
@@ -91,12 +91,12 @@ void Trilinos_Util_ReadHpc2Epetra_internal( | |||
// the warning is easy to fix. | |||
if(sizeof(int) == sizeof(int_type)) { | |||
int numGlobalEquations_int, total_nnz_int; | |||
#ifdef DEBUG | |||
#ifndef NDEBUG | |||
cnt = | |||
#endif | |||
fscanf(in_file,"%d",&numGlobalEquations_int); | |||
assert(cnt > 0); |
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.
Doesn't this assert()
line need to be inside one of the #if
blocks?
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.
@jmgate It's fine -- assert
has the following definition, according to https://en.cppreference.com/w/cpp/error/assert :
#ifdef NDEBUG
#define assert(condition) ((void)0)
#else
#define assert(condition) /*implementation defined*/
#endif
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 macro assert()
is only defined if the macro NDEBUG
is not defined.
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.
Does the fact that all other occurrences of cnt
are wrapped in an #if
not come into play here? @mhoemmen, it sounds like you're saying line 98 gets replaced with ((void)0)
so it won't throw this error again?
error: ‘cnt’ was not declared in this scope
I'm asking Santa for a Trilinos without #ifdef
s this year.
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.
@jmgate wrote:
@mhoemmen, it sounds like you're saying line 98 gets replaced with
((void)0)
so it won't throw this error again?
Yes, that's correct. assert
is a macro. If NDEBUG
is defined, then the macro's argument does not appear in the compiled source code. That is, in fact, why the compiler was warning about "unused variables."
I'm asking Santa for a Trilinos without
#ifdef
s this year.
I ... don't have anything constructive to say about this ;-)
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.
This looks fixed.
@@ -91,12 +91,12 @@ void Trilinos_Util_ReadHpc2Epetra_internal( | |||
// the warning is easy to fix. | |||
if(sizeof(int) == sizeof(int_type)) { | |||
int numGlobalEquations_int, total_nnz_int; | |||
#ifdef DEBUG | |||
#ifndef NDEBUG | |||
cnt = | |||
#endif | |||
fscanf(in_file,"%d",&numGlobalEquations_int); | |||
assert(cnt > 0); |
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.
@jmgate It's fine -- assert
has the following definition, according to https://en.cppreference.com/w/cpp/error/assert :
#ifdef NDEBUG
#define assert(condition) ((void)0)
#else
#define assert(condition) /*implementation defined*/
#endif
We need to make one of the Trilinos PR builds set |
We were just discussing the possibility and path forward for a PR debug build at the standup this morning. Nothing concrete yet. |
Status Flag 'Pre-Merge Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
All Jobs Finished; status = PASSED, However Inspection must be performed before merge can occur... |
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.
Approved, provided that @ZUUL42 tested with a debug build and that the debug build builds this package warning free.
Status Flag 'Pre-Merge Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED AND APPROVED by [ mhoemmen bathmatt ]! |
Status Flag 'Pull Request AutoTester' - Pull Request will be Automerged |
Merge on Pull Request# 5175: IS A SUCCESS - Pull Request successfully merged |
@trilinos/triutils
Description
Correcting
ifdef DEBUG
toNDEBUG
for recent changes in #5153.Checklist