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

[cxx-interop] Fix two headers to be valid in C++ mode. #2895

Merged
merged 2 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,12 @@ CF_EXPORT int _CFPosixSpawnFileActionsDestroy(_CFPosixSpawnFileActionsRef file_a
CF_EXPORT void _CFPosixSpawnFileActionsDealloc(_CFPosixSpawnFileActionsRef file_actions);
CF_EXPORT int _CFPosixSpawnFileActionsAddDup2(_CFPosixSpawnFileActionsRef file_actions, int filedes, int newfiledes);
CF_EXPORT int _CFPosixSpawnFileActionsAddClose(_CFPosixSpawnFileActionsRef file_actions, int filedes);
#ifdef __cplusplus
CF_EXPORT int _CFPosixSpawn(pid_t *_CF_RESTRICT pid, const char *_CF_RESTRICT path, _CFPosixSpawnFileActionsRef file_actions, _CFPosixSpawnAttrRef _Nullable _CF_RESTRICT attrp, char *const argv[], char *const envp[]);
#else
CF_EXPORT int _CFPosixSpawn(pid_t *_CF_RESTRICT pid, const char *_CF_RESTRICT path, _CFPosixSpawnFileActionsRef file_actions, _CFPosixSpawnAttrRef _Nullable _CF_RESTRICT attrp, char *_Nullable const argv[_Nullable _CF_RESTRICT], char *_Nullable const envp[_Nullable _CF_RESTRICT]);
#endif
#endif // __cplusplus
#endif // !TARGET_OS_WIN32

_CF_EXPORT_SCOPE_END

Expand Down
2 changes: 1 addition & 1 deletion CoreFoundation/Locale.subproj/CFCalendar_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "CFDateComponents.h"
#include "CFDateInterval.h"

#if __has_include(<unicode/ucal.h>)
#if __has_include(<unicode/ucal.h>) && !defined(__cplusplus)
Copy link
Contributor

Choose a reason for hiding this comment

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

Per comment: please explain here.

Copy link
Contributor Author

@zoecarver zoecarver Nov 9, 2020

Choose a reason for hiding this comment

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

With C++ Interoperability enabled, all headers are imported as C++ headers. So they will all be imported in C++ mode. Even if they're not publically exposed. In other words, all headers in the CF module will be imported as C++ headers in a program that enables C++ interoperability.

You're right, I think ForSwift may be the only place this is causing issues. To be honest, I know next to nothing about core foundation so, maybe this isn't the correct fix. Feel free to suggest an alternative.

Anyway, does that answer your question? Would you also like me to put a comment in "CFCalendar_Internal.h" explaining this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@millenomi friendly ping. I'd really like to get this moving.

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, I missed your ping back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries. I missed your comment the first time ;) Thanks!

#include <unicode/ucal.h>
#else
typedef void *UCalendar;
Expand Down