This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix modules issues on OS X
ClosedPublic

Authored by ldionne on Feb 27 2023, 2:00 PM.

Details

Reviewers
Mordante
philnik
Group Reviewers
Restricted Project
Commits
rGf56dfb78aa3f: [libc++] Fix modules issues on OS X
Summary

First, fix a collision with the Point type from MacTypes.h, which was
reported on Slack, 2022-07-31: https://cpplang.slack.com/archives/C2X659D1B/p1659284691275889

Second, rename the meta:: namespace to TestMeta::. OSX's "/usr/include/ncurses.h"
defines a meta function, and is (for some reason) included in
"<SDK>/usr/include/module.modulemap", so that identifier is
off-limits for us to use in anything that compiles with -fmodules:

libcxx/test/support/type_algorithms.h:16:11: error: redefinition of 'meta' as different kind of symbol
namespace meta {
           ^
<SDK>/usr/include/ncurses.h:603:28: note: previous definition is here
extern NCURSES_EXPORT(int) meta (WINDOW *,bool);                        /* implemented */
                            ^

Diff Detail

Event Timeline

ldionne created this revision.Feb 27 2023, 2:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 2:00 PM
Herald added a subscriber: mstorsjo. · View Herald Transcript
ldionne requested review of this revision.Feb 27 2023, 2:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 2:00 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

I don't have a strong preference for the new name of the namespace.

Mordante accepted this revision as: Mordante.Feb 28 2023, 10:32 AM
Mordante added subscribers: philnik, Mordante.

Mainly curios, but how do curses get pulled into our tests?

I don't have a strong opinion regarding the name, maybe @philnik has. LGTM.

We could rename it to types or something similar. It would actually also make sense to put stuff like MoveOnly, input_iterator etc. inside there. Then we'd have types::for_each(types::integral_types{}, ...). WDYT?

Could we maybe get a modules build on macOS, since it seems there are some pretty horrible things inside the system headers? Who thought it would be a good idea to reserve Point? I think Android has a few horrific things in the system headers too, but there we don't have any CI currently.

Mainly curios, but how do curses get pulled into our tests?

I think this is via Apple's SDK, which seem to provide ncurses. This is arguably not very clean.

We could rename it to types or something similar. It would actually also make sense to put stuff like MoveOnly, input_iterator etc. inside there. Then we'd have types::for_each(types::integral_types{}, ...). WDYT?

Yeah, I've been wanting a namespace to put our test support utilities. Let's use types:: for now, however I think support:: could also be a good candidate if we want to generalize this to also contain functions and so on.

Could we maybe get a modules build on macOS, since it seems there are some pretty horrible things inside the system headers? Who thought it would be a good idea to reserve Point? I think Android has a few horrific things in the system headers too, but there we don't have any CI currently.

That's a good idea, adding one.

ldionne updated this revision to Diff 501299.Feb 28 2023, 2:55 PM

Use types:: instead of TestMeta, and add CI bot.

philnik accepted this revision.Feb 28 2023, 3:01 PM

Thanks! LGTM with green CI.

This revision is now accepted and ready to land.Feb 28 2023, 3:01 PM
This revision was automatically updated to reflect the committed changes.

Mainly curios, but how do curses get pulled into our tests?

I think this is via Apple's SDK, which seem to provide ncurses. This is arguably not very clean.

Interesting.

Could we maybe get a modules build on macOS, since it seems there are some pretty horrible things inside the system headers? Who thought it would be a good idea to reserve Point? I think Android has a few horrific things in the system headers too, but there we don't have any CI currently.

That's a good idea, adding one.

I really like this, thanks.