dist/tools: add double #pragma once error message to headerguards check#21696
Merged
crasbe merged 1 commit intoRIOT-OS:masterfrom Sep 5, 2025
Merged
dist/tools: add double #pragma once error message to headerguards check#21696crasbe merged 1 commit intoRIOT-OS:masterfrom
#pragma once error message to headerguards check#21696crasbe merged 1 commit intoRIOT-OS:masterfrom
Conversation
7b8ba18 to
22ade24
Compare
#pragma once error message#pragma once error message to headerguards check
miri64
approved these changes
Sep 5, 2025
Member
miri64
left a comment
There was a problem hiding this comment.
ACK.
(apart from my comment, the code could benefit from some decluttering with black as well, but that is for another PR)
Comment on lines
+102
to
+103
| print("%s: More than one #pragma once in the same file" % | ||
| filename, file=sys.stderr) |
Member
There was a problem hiding this comment.
Does not have to be for this PR, but
Suggested change
| print("%s: More than one #pragma once in the same file" % | |
| filename, file=sys.stderr) | |
| print(f"{filename}: More than one #pragma once in the same file", | |
| file=sys.stderr) |
in almost any case is more performant (and I don't think we do still run python versions that do not support f-strings).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Currently the headerguards check will only output
broken header guardif more than one#pragma onceis present in the file. This PR adds a separate case to print a dedicated error mesage for that case.Testing procedure
Add a second
#pragma onceto your favorite header and observe the output:master:This PR:
Issues/PRs references
Found in #21022.