-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Replace header guards style with #pragma once
#102298
base: master
Are you sure you want to change the base?
Conversation
Should probably be handled safely generally but just to confirm one area of potential issue: |
Heh, I remember the time when @vnen said it is wrong idea: #18143 (comment) |
Verified locally that it does work!
I understand the hesitation for adding non-standard functionality, but I can make an exception here for a few reasons:
|
#pragma once
#pragma once
Yeah it's fine I've been using I'm personally in favour of As we said last time:
|
cb27716
to
7c9cac4
Compare
If explicit affirmation is necessary, then I'll echo that I'm very much in favor of this as well. In addition to the points lawnjelly already mentioned, it'll be MUCH less of a headache to enforce in terms of hooks/tools. The existing methods we have now are pretty hacky, because they have to account for the exact situations |
Just a thought, does this observably affect compile time? |
I tested this about half a month ago using |
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.
Makes sense to me. Changes to tests/create_test.py
look good.
7c9cac4
to
a944877
Compare
An upcoming core meeting will touch on using
#pragma once
instead of traditional header guards. This draft is meant to accompany that future discussion, as it showcases the overall scope of a total conversion. While this would affect virtually every non-thirdparty header in the repo, the scope is isolated to such an extent that it can be safely excluded via.git-blame-ignore-revs
. Changes to non-header files — builders, pre-commit, etc — were handled in a separate commit which would not be excluded. Does not convert headers for*-so_wrap.h
files (generated externally),nor ObjC files (guards shouldn't be there in the first place, but removing them is out-of-scope; handled in #101174 instead).EDIT: Now also includes ObjC files, as their compilers also handle
#pragma once
just fine. Having them included means that the logic for checking header guards has been reduced significantly.