This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Prevent GCC 6 <cstdlib> from including /usr/include/stdlib.h
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: libc-alpha at sourceware dot org
- Date: Mon, 13 Jun 2016 11:13:55 +0200 (CEST)
- Subject: Re: [PATCH] Prevent GCC 6 <cstdlib> from including /usr/include/stdlib.h
- Authentication-results: sourceware.org; auth=none
- References: <20160608150824 dot C6B3A4012D197 at oldenburg dot str dot redhat dot com> <mvma8iv66k7 dot fsf at hawking dot suse dot de> <66891e52-9d31-9c8e-02f8-ee068d041184 at redhat dot com> <20160610220726 dot 98FE62C39F7 at topped-with-meat dot com> <e7755ec7-4df0-b085-d7d7-9d820fc74370 at redhat dot com>
On Sat, 11 Jun 2016, Florian Weimer wrote:
There is a need to wrap around glibc headers (do some stuff before and after
<stdlib.h> and other headers are included) to get support for some C++
functionality, in addition to other header file coordination work.
It's not that we do point releases to add C++ support to our headers, so I
can see why GCC is doing this.
Note that gcc doesn't need to do it this way. Currently, taking abs as
a random example:
libc-stdlib.h declares abs in the global namespace
gcc-cstdlib imports it in namespace std and adds some overloads
gcc-stdlib.h imports the std overloads back to the global namespace
We could just as well have:
libc-stdlib.h declares abs in the global namespace
gcc-stdlib.h adds some overloads in the global namespace
gcc-cstdlib imports the lot in namespace std
where gcc's stdlib.h would #include_next libc's stdlib.h, the usual
scenario for #include_next. Would that help or would we get exactly the
same issue?
--
Marc Glisse