[v3] Use Solaris prototypes if possible (PR libstdc++-v3/1773)
Thu Aug 18 10:24:00 GMT 2011
On Tue, 9 Aug 2011, Rainer Orth wrote:
> This patch is the last but one in the series to finally fix
> PR libstdc++-v3/1773 __cplusplus defined to 1, should be 199711L
Only piece left before the switch :-)
> * include/c_global/cmath (double abs(double)): Wrap in
> !__CORRECT_ISO_CPP_MATH_H_PROTO1 &&
> (float abs(float), long double abs(long double): Wrap in
> (float acos(float), long double acos(long double)): Likewise.
I guess it would also be possible to reorder the declarations so as to
have a single #ifdef (well, two), but then the various overloads of each
function wouldn't be adjacent anymore.
> * include/tr1/cmath (float fabs(float), long double fabs(long
> double)): Wrap in !__CORRECT_ISO_CPP_MATH_H_PROTO1.
There is a comment:
// Note: we deal with fabs in a special way, because an using std::fabs
// would bring in also the overloads for complex types, which in C++0x
// mode have a different return type.
and then it proceeds to using ::fabs and declare the float and long double
overloads. Now on solaris, using ::fabs is going to be equivalent to using
std::fabs. I don't know if that creates problems for the complex types,
and in that case what can be done about it (declare fabs(double) instead
of importing the global one?).
More information about the Libstdc++