mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
210 stars 122 forks source link

Change (debug build) optimisation option for gcc on linux #37490

Closed jclarkeSTFC closed 3 months ago

jclarkeSTFC commented 3 months ago

The -Og optimisation option is recommended for 'the standard edit-compile-debug cycle'. Using this instead of -O0 also stops the -FORTIFY_SOURCE warning from spamming the terminal on Linux. This warning occurred because we have FORTIFY_SOURCE=2 in our config but all compiler optimisations were off. The -Og option switches on optimisations that do not interfere with debugging. This will also hopefully make debug Mantid slightly faster as a happy side effect.

For more information on the gcc optimisation options see here

For more information on FORTIFY_SOURCE see here

To test:

You should be able to compile on Linux without receiving the following warning:

warning: #warning _FORTIFY_SOURCE requires compiling with opimization (-O) [-Wcpp]

Make sure to explicitly run cmake --preset=linux before compiling so the changes are picked up.

This does not require release notes because it only affects developers.


Reviewer

Please comment on the points listed below (full description). Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

Functional Tests

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.