-
Notifications
You must be signed in to change notification settings - Fork 708
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
Define NDEBUG in release mode #12503
Conversation
I think external projects should set it themselves (i.e., we should not add it to our list of release flags) - for example, if you do Does WorldBuilder just set their flags equal to deal.II's flags? |
@gassmoeller To answer your first question: We override CMake's default choices for debug and release builds because our autoconf/make based build system back in the day had a different set of compiler flags and compilation logic. Regarding I think the major reason why we don't already do that is the simply reason that we don't use |
We compile WorldBuilder with the ASPECT build system and that one just takes the deal.II flags. Yes, we could change ASPECT's build system to define its own flags but so far is has worked well for us. For now we fixed the whole issue by adding NDEBUG in ASPECT's build system.
Yeah I thought so. I just wanted to make sure it was not disabled on purpose for some reason.
As long as there is no reason not to do it then I think it may be useful to set it just to avoid deviating from cmake standard values. Would the way I implemented it here be correct? |
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.
As long as there is no reason not to do it then I think it may be useful to set it just to avoid deviating from cmake standard values.
That's a good point - I am now convinced that we should do this. The way this patch sets NDEBUG
is equivalent to how we set DEBUG
in debug mode so I believe this is the correct approach.
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.
Good to go! (some minor rewording request).
4e2beb3
to
4f639d6
Compare
I modified the comments. Let's see what the testers say. |
/rebuild |
I regret that I chose It makes sense to me that we either set
Since I think these two things are independent. |
Let me start by saying I am not fully aware of the impact of this. This is more of a question: By default cmake would define NDEBUG in anything but debug mode, to disable asserts in the standard library. Deal.II overwrites this default in the
DEAL_II_INITIALIZE_CACHED_VARIABLES
macro, when it resets CMAKE_CXX_FLAGS and it never defines it itself (it instead uses DEBUG to activate asserts in debug mode). I am not sure if this was made on purpose, but inside ASPECT we have some downstream projects (specifically https://github.com/GeodynamicWorldBuilder/WorldBuilder) that rely on NDEBUG to decide whether to activate asserts or not. Does it make sense to keep cmake's default behavior of defining NDEBUG in release mode? This may even give some performance benefits, but I do not know if it was removed no purpose.