-
Notifications
You must be signed in to change notification settings - Fork 2k
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
dist: tools: add headerguard check script #7095
dist: tools: add headerguard check script #7095
Conversation
54768cb
to
7aace34
Compare
|
Why? I think that puts many constraints on the filename. E.g. if I have a module |
No, the script doesn't remove underscores that are in the filename. |
@miri64 do we have any header files with leading underscores in the file name, or is this a non-issue? |
A quick |
As of now, it wouldn't, because we don't have header filenames with a leading I was actually surprised how many guards were wrong (copy&pasta, file renames), or which had wrong comments at the closing |
This won't solve potential collisions, but how about |
I'll add that. |
|
|
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.
Since this enforces a new naming rule for header rules, please update also the coding conventions accordingly.
Also I'm unsure if replacing _
and /
to the same character string might lead to future problems, but since this is a future problem leave this task to future us ;-).
@@ -15,8 +15,8 @@ | |||
* | |||
* @author Martine Lenders <mlenders@inf.fu-berlin.de> | |||
*/ | |||
#ifndef RIOT_INTTYPES_H | |||
#define RIOT_INTTYPES_H |
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.
Assorted musings / talking while thinking: mhhhh a RIOT prefix might make sense (but let's keep this patch as simple as possible and go with the more established solution)
_in = "/-." | ||
_out = "___" | ||
|
||
transtab = str.maketrans(_in, _out) |
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.
I learned a new python thing \o/ (I usually use re.sub()
for that).
(please squash) |
27a7cc8
to
60fb6d2
Compare
|
Thanks for reviewing! |
This PR adds a python script checking for header guards.
Features:
#endif
include/
, or none if there's noinclude
in the path. (e.g., 'sys/include/a/b/c.h' -> 'A_B_C_H'), 'sys/posix/blah/foo.h' -> 'FOO_H'One commit adds some missing header guards (changes made manually),
another commit applies the headercheck output to the codebase.