Skip to content

Replace include guards with #pragma once#2871

Merged
daljit46 merged 3 commits intodevfrom
pragmaonce
Apr 8, 2024
Merged

Replace include guards with #pragma once#2871
daljit46 merged 3 commits intodevfrom
pragmaonce

Conversation

@daljit46
Copy link
Member

@daljit46 daljit46 commented Apr 5, 2024

Proposal to replace header include guards with #pragma once. This means less typing and lines of code, less distractions and less chances of symbol collisions (caused by same values used by guard values).
It would also address most of the issue outlined #2862.

Migration from include guards was done using guardonce. The only manual change needed was to address the following in core/fixel/legacy/image.h:

#error File that #includes "fixel/legacy/image.h" must explicitly #include "image.h" beforehand

@daljit46 daljit46 self-assigned this Apr 5, 2024
@daljit46 daljit46 marked this pull request as draft April 5, 2024 13:21
Copy link
Member

@Lestropie Lestropie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Tried restarting the clang-tidy job, but I've a suspicion it'll time out again because of the number of files to check. Feel free to merge without it.

@daljit46
Copy link
Member Author

daljit46 commented Apr 8, 2024

Tried restarting the clang-tidy job, but I've a suspicion it'll time out again because of the number of files to check. Feel free to merge without it.

The log message says:

CMake Warning at core/CMakeLists.txt:79 (message):
libpng not found, disabling PNG support
CMake Warning at core/CMakeLists.txt:86 (message):
libtiff not found, disabling TIFF support
fatal: detected dubious ownership in repository at '/github/workspace'
To add an exception for this directory, call:
git config --global --add safe.directory /github/workspace
fatal: detected dubious ownership in repository at '/github/workspace'
To add an exception for this directory, call:
git config --global --add safe.directory /github/workspace
CMake Error at /github/workspace/cmake/FindVersion.cmake:21 (message):
MRtrix3 base version does not match the git tag!

However, I think this issue is independent of the changes in this PR so it should be safe to merge regardless (indeed same can be seen in #2865 https://github.com/MRtrix3/mrtrix3/actions/runs/8558271362/job/23452463438?pr=2865)

@daljit46 daljit46 marked this pull request as ready for review April 8, 2024 10:48
@daljit46 daljit46 merged commit 63f5650 into dev Apr 8, 2024
@daljit46 daljit46 deleted the pragmaonce branch April 8, 2024 10:57
daljit46 added a commit that referenced this pull request Apr 24, 2024
Was mistakenly removed in #2871
daljit46 added a commit that referenced this pull request Apr 24, 2024
Was mistakenly removed in #2871
Lestropie added a commit that referenced this pull request Oct 8, 2025
- Stop usage of C-style string data and functions; can be viewed as an exhaustive extension of #2911.
- Ensure that "#pragma one" is used instead of the historical "#ifndef __headerpath__", as introduced in #2871.
- Enforce use of nested namespaces, as first introduced in #2652.
- Enforce explicit resolution of MR::abs() for templated data types; where data types are exclusively scalar floating-point, std::fabs() is instead used.
- Preclude use of C-style casts, as proposed in #3010.
- Add to MR namespace "NaNF" and "InfF" as floating-point variants of the already-defined default_type "NaN" and "Inf", and preclude use of macros "NAN" and "INFINITY" in favour of either one of those or std::numeric_limits<>, as proposed in #3192.
- Preclude use of "NULL" macro, replacing with nullptr.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants