Skip to content
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

Use #pragma once #406

Merged
merged 2 commits into from
Jan 3, 2020
Merged

Conversation

matthew-reynolds
Copy link
Member

Part of #403.

Replace all preprocessor header guards with #pragma once. Also adds missing header guard to transmission_interface/test/loader_utils.h. Every .h file now includes #pragma once.

@Karsten1987
Copy link

I just wanted to mention here that this pragma is not standard compliant. As most compilers do support it, but as said it’s not in the official standard.
https://stackoverflow.com/questions/23696115/is-pragma-once-part-of-the-c11-standard#23699893

@bmagyar
Copy link
Member

bmagyar commented Dec 31, 2019

If all relevant compilers support it (heck, even MSVC does!) then I think it is a safe bet.
supported compilers

@matthew-reynolds matthew-reynolds force-pushed the pragma-once branch 2 times, most recently from b76cc3e to 59f3887 Compare January 3, 2020 00:31
@matthew-reynolds
Copy link
Member Author

Rebased and updated following #395

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

Looks great, thanks a lot!

@bmagyar bmagyar merged commit 34a9a4d into ros-controls:melodic-devel Jan 3, 2020
@bmagyar bmagyar mentioned this pull request Jan 3, 2020
@matthew-reynolds matthew-reynolds deleted the pragma-once branch January 3, 2020 12:50
@mathias-luedtke
Copy link
Contributor

mathias-luedtke commented Jan 24, 2020

Ah, I am too late for this one.

If all relevant compilers support it (heck, even MSVC does!) then I think it is a safe bet.

Not all versions support it and some implementations have serious flaws.
Even worse: If a compiler does not support it, it must (?) ignore it.

@mathias-luedtke
Copy link
Contributor

@matthew-reynolds
Copy link
Member Author

I don't have a strong opinion here, I'm just following #403. Happy to revert to #ifndef guards if that's the consensus of you maintainers.

I do wonder how many C++14-compatible compilers don't support #pragma once, but that's not an easy audit to make to cover every obscure compiler out there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants