This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] Handle C++11 <math.h> overloads on Solaris 12


Jonathan Wakely <jwakely@redhat.com> writes:

> On 17/11/15 13:33 +0100, Rainer Orth wrote:
>>Solaris 12 recently introduced the C++11 <math.h> overloads, which
>>caused bootstrap to be broken on both mainline and the gcc-5 branch:
>>
>>In file included from /vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdc++.h:41:0:
>>/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath: In function 'constexpr int std::fpclassify(float)':
>>/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:561:3: error: redefinition of 'constexpr int std::fpclassify(float)'
>>   fpclassify(float __x)
>>   ^
>>In file included from /usr/include/math.h:13:0,
>>                 from /var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:44,
>>                 from /vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdc++.h:41:
>>/usr/include/iso/math_c99.h:647:13: note: 'int std::fpclassify(float)' previously defined here
>>  inline int fpclassify(float __X) { return __builtin_fpclassify(
>>             ^
>>
>>The following patch fixes this by testing for the problem and wrapping
>>the overloads in include/c_global/cmath and include/tr1/cmath
>>appropriately.  The test needs to be dynamic since apparently a backport
>>to Solaris 11 (and perhaps even Solaris 10) is planned.
>
> Why does <tr1/cmath> need to change, did Solaris also define the
> functions in namespace std::tr1?

Without that part, I get errors like

In file included from /vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdtr1c++.h:37:0:
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/tr1/cmath: In function 'float std::tr1::acosh(float)':
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/tr1/cmath:423:18: error: 'float std::tr1::acosh(float)' conflicts with a previous declaration
   acosh(float __x)
                  ^

In file included from /usr/include/math.h:13:0,
                 from /var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:44,
                 from /var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/i386-pc-solaris2.12/bits/stdc++.h:41,
                 from /vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdtr1c++.h:29:
/usr/include/iso/math_c99.h:712:15: note: previous declaration 'float std::acosh(float)'
  inline float acosh(float __X) { return __acoshf(__X); }
               ^~~~~

In file included from /vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdtr1c++.h:37:0:
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/tr1/cmath: In function 'long double std::tr1::acosh(long double)':
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/tr1/cmath:427:24: error: 'long double std::tr1::acosh(long double)' conflicts with a previous declaration
   acosh(long double __x)
                        ^

In file included from /usr/include/math.h:13:0,
                 from /var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:44,
                 from /var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/i386-pc-solaris2.12/bits/stdc++.h:41,
                 from /vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdtr1c++.h:29:
/usr/include/iso/math_c99.h:754:21: note: previous declaration 'long double std::acosh(long double)'
  inline long double acosh(long double __X) { return __acoshl(__X); }
                     ^~~~~

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]