[libcxx-commits] [PATCH] D94569: [libcxx] Wipe some more macros that do not belong in C++ forwarding headers
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 18 13:01:21 PST 2021
ldionne requested changes to this revision.
ldionne added a comment.
In D94569#2505250 <https://reviews.llvm.org/D94569#2505250>, @krytarowski wrote:
> These symbols are usually macros + libc calls.
I think we're talking past each other. What I'm asking is this. Imagine the libc headers look like this:
extern int __getc_implementation(FILE*);
#define getc(stream) __getc_implementation(stream)
Now, we go and undefined the `getc` macro in our headers. When we do `using ::getc`, what happens? An error, because the C library doesn't provide a declaration for `::getc`. The only way I can see this working is if the C library looks like this instead:
extern int getc(FILE*); // actually provide a declaration for getc
extern int __getc_implementation(FILE*);
#define getc(stream) __getc_implementation(stream) // but then define getc to being some macro
Now, if when we undefine `getc` in libc++, `using ::getc` will refer to the `::getc` defined before the C library defined the macro. That's the only case in which I can imagine the `#undef`s in our `stdio.h` to make sense.
But is that really what your implementation does? If so, why? It just looks twisted to me, but there must be a reason?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94569/new/
https://reviews.llvm.org/D94569
More information about the libcxx-commits
mailing list