-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Allow header files to be parsed by C++ parsers #1660
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
Conversation
@swift-ci please test |
CoreFoundation/Base.subproj/CFBase.h
Outdated
#define CF_RESTRICT restrict | ||
#endif | ||
#endif | ||
|
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.
This is a public header so we can't just add the macro here. Perhaps ForSwiftFoundationOnly.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.
The restrict
is used in CFPlatform.c and CFStorage.c, so could move it into CFInternal.h instead?
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 was thinking CFInternal as well, but then it's used in ForSwiftFoundationOnly.h. I'd prefer the internal header if possible.
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.
So it looks like if we put it in CFInternal.h
then it can't be used for the ForSwiftFoundationOnly.h. We could have the macro in CFInternal for ease of maintenance and then have a special-case for the ForSwiftFoundationOnly that duplicates it, but it's not elegant.
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.
So @parkera I have moved the definitions to be internal only, but can't use it in the ForSwiftFoundation file. I'm not sure which approach you'd like me to take here in terms of conditionally defining the value of restrict
-- I've duplicated the line here, but it's introducing duplicate code which I don't like. Any other preferences/suggestions?
rdar://problem/42898878
rdar://problem/42898878
@swift-ci please test |
1 similar comment
@swift-ci please test |
@parkera any thoughts as to the new approach suggested here? |
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'm fine with this approach. If we have need for this macro elsewhere we can refactor it again a bit more.
@swift-ci please test and merge |
By replacing
namspace
withname_space
and changing therestrict
into__restrict__
in C++ mode, the headers can now be parsed by clang++ as well as clang.