This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Enable libstdc++ numeric conversions on Cygwin
- From: Jennifer Yao <jenny dot hyphen dot fa at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Nov 2015 12:24:56 -0500
- Subject: Re: [PATCH] Enable libstdc++ numeric conversions on Cygwin
- Authentication-results: sourceware.org; auth=none
- References: <CAPQfdh=Kshcq=Eg5EV9rpho=Q0USrGgODPoLzSLuvK+5D6LGeA at mail dot gmail dot com> <CAPQfdhmMGJeb-tq29jTheoo5jUaeiFzcycWFTrpShRE-kPftGw at mail dot gmail dot com> <CAPQfdh=uOjLzi60Dnd0Dd1ycJUDqMWQBCv1aRAGBP97DSUS3+Q at mail dot gmail dot com> <20151112114049 dot GY2937 at redhat dot com> <20151112133947 dot GA2937 at redhat dot com> <20151112145015 dot GD2937 at redhat dot com>
> On 12/11/15 13:39 +0000, Jonathan Wakely wrote:
>>
>> One downside of this change is that we introduce some (hopefully safe)
>> ODR violations, where inline functions and templates that depend on
>> _GLIBCXX_USE_C99_FOO might now be defined differently in C++98 and
>> C++11 code. Previously they had the same definition, even though in
>> C++11 mode the value of the _GLIBCXX_USE_C99_FOO macro might have been
>> sub-optimal (i.e. the C99 features were usable, but the macro said
>> they weren't). Those ODR violatiosn could be avoided if needed, by
>> always using the _GLIBCXX98_USE_C99_FOO macro in code that can be
>> included from either C++98 or C++11. We could still use the
>> _GLIBCXX11_USE_C99_FOO macro in pure C++11 code (such as the numeric
>> conversion functions) and get most of the benefit of this change.
>
>
> This patch (relative to the previous one) would avoid the ODR
> problems, by only using the C++98 macro in code that gets used in
> C++98 and later, and using the _GLIBCXX11_XXX ones in code that is
> never compiled as C++98 (specifically, the numeric conversion
> functions).
>
> Maybe this is a safer, more conservative change.
I haven't tested either of your patches yet (the testsuite runs
reeeeally slowly on Cygwin T___T), but I just wanted to express my
approval of the proposed changes (more specifically, the second patch
you posted).
Also, I was not aware that we had to worry about C++03 compatibility.
Sounds tedious.