[PATCH] Prevent GCC 6 <cstdlib> from including /usr/include/stdlib.h
Florian Weimer
fweimer@redhat.com
Wed Jun 8 20:54:00 GMT 2016
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>).
> What's going to be our long-term solution to this problem?
Merge the C and C++ run-time library implementations. :)
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.
Florian
More information about the Libc-alpha
mailing list