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: Carlos O'Donell <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 8 Jun 2016 22:22:44 -0400
- 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> <57587A0F dot 1040304 at redhat dot com> <00cdf016-b212-516e-14dc-1468c4076427 at redhat dot com>
On 06/08/2016 04:54 PM, Florian Weimer wrote:
> On 06/08/2016 10:03 PM, Carlos O'Donell wrote:
>> On 06/08/2016 11:08 AM, Florian Weimer wrote:
>>> Otherwise, /usr/include/stdlib.h turns up as a make dependency,
>>> and an implicit rule will kick and make will try to install
>>> stdlib/stdlib.h as /usr/include/stdlib.h because the target is
>>> out of date.
>>>
>>> 2016-06-08 Florian Weimer <fweimer@redhat.com>
>>>
>>> Prevent GCC 6 <cstdlib> from including /usr/include/stdlib.h. *
>>> stdlib/tst-quick_exit.cc: Include <stdlib.h> before <cstdlib>. *
>>> stdlib/tst-thread-quick_exit.cc: Likewise.
>>
>> OK, with source code comment explaining why 'stdlib.h' is being
>> included.
>
> I must have botched my initial testing. Including <stdlib.h> first
> does not fix this problem. It seems the only way is to use
> <stdlib.h> exclusively and drop the std:: namespace usage, and use
> <pthread.h> instead of <thread>. (<thread> indirectly pulls in
> /usr/include/c++/6.1.1/ext/string_conversions.h, which includes
> <cstdlib>).
That sounds terrible.
>> What's going to be our long-term solution to this problem?
>
> Merge the C and C++ run-time library implementations. :)
No, the real solution is installed-tree testing.
We install glibc into a sysroot and properly use --sysroot
for building test.
This would move us one step closer to having our tests resemble
real user applications.
> Various kludges are possible: List the GCC default search paths,
> patch them, and specify them along with -nostdinc. Do not use
> #include_next, but an #include with an absolute path, where the path
> prefix can be configured with a preprocessor macro (#include
> arguments are subject to macro expansion, although this feature is
> used rarely). I'll ask Jonathan, maybe he has some ideas.
Thanks.
In the meantime, please checkin whatever fix you have.
--
Cheers,
Carlos.