From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A111D3858012; Wed, 28 Oct 2020 12:50:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A111D3858012 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-4476] libstdc++: Fix name clash with _Cosh in QNX headers [PR 95592] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 0f7cd5e5735e5536bf7bc8ca2b998f7ce8b4ddee X-Git-Newrev: 72a87d82e0d0741d75c72c8f3d2fc070e3a02b5f Message-Id: <20201028125035.A111D3858012@sourceware.org> Date: Wed, 28 Oct 2020 12:50:35 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Oct 2020 12:50:35 -0000 https://gcc.gnu.org/g:72a87d82e0d0741d75c72c8f3d2fc070e3a02b5f commit r11-4476-g72a87d82e0d0741d75c72c8f3d2fc070e3a02b5f Author: Jonathan Wakely Date: Wed Oct 28 12:35:44 2020 +0000 libstdc++: Fix name clash with _Cosh in QNX headers [PR 95592] This replaces unqualified names like _Cosh with struct std::_Cosh to ensure there is no ambiguity with other entities with the same name. libstdc++-v3/ChangeLog: PR libstdc++/95592 * include/bits/valarray_after.h (_DEFINE_EXPR_UNARY_OPERATOR) (_DEFINE_EXPR_BINARY_OPERATOR, _DEFINE_EXPR_BINARY_FUNCTION): Use elaborated-type-specifier and qualified-id to avoid ambiguities with QNX system headers. * testsuite/26_numerics/valarray/95592.cc: New test. Diff: --- libstdc++-v3/include/bits/valarray_after.h | 74 +++++++++++----------- .../testsuite/26_numerics/valarray/95592.cc | 29 +++++++++ 2 files changed, 66 insertions(+), 37 deletions(-) diff --git a/libstdc++-v3/include/bits/valarray_after.h b/libstdc++-v3/include/bits/valarray_after.h index cf84e17e5ad..439b3e9a5ed 100644 --- a/libstdc++-v3/include/bits/valarray_after.h +++ b/libstdc++-v3/include/bits/valarray_after.h @@ -331,9 +331,9 @@ namespace __detail return _Expr<_Closure, _Tp>(_Closure(this->_M_closure)); \ } - _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus) - _DEFINE_EXPR_UNARY_OPERATOR(-, __negate) - _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not) + _DEFINE_EXPR_UNARY_OPERATOR(+, struct std::__unary_plus) + _DEFINE_EXPR_UNARY_OPERATOR(-, struct std::__negate) + _DEFINE_EXPR_UNARY_OPERATOR(~, struct std::__bitwise_not) #undef _DEFINE_EXPR_UNARY_OPERATOR @@ -402,24 +402,24 @@ namespace __detail return _Expr<_Closure, _Value>(_Closure(__v, __e ())); \ } - _DEFINE_EXPR_BINARY_OPERATOR(+, __plus) - _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) - _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies) - _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) - _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) - _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor) - _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) - _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or) - _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left) - _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right) - _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and) - _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or) - _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to) - _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to) - _DEFINE_EXPR_BINARY_OPERATOR(<, __less) - _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) - _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal) - _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal) + _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus) + _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) + _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies) + _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) + _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) + _DEFINE_EXPR_BINARY_OPERATOR(^, struct std::__bitwise_xor) + _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) + _DEFINE_EXPR_BINARY_OPERATOR(|, struct std::__bitwise_or) + _DEFINE_EXPR_BINARY_OPERATOR(<<, struct std::__shift_left) + _DEFINE_EXPR_BINARY_OPERATOR(>>, struct std::__shift_right) + _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) + _DEFINE_EXPR_BINARY_OPERATOR(||, struct std::__logical_or) + _DEFINE_EXPR_BINARY_OPERATOR(==, struct std::__equal_to) + _DEFINE_EXPR_BINARY_OPERATOR(!=, struct std::__not_equal_to) + _DEFINE_EXPR_BINARY_OPERATOR(<, struct std::__less) + _DEFINE_EXPR_BINARY_OPERATOR(>, struct std::__greater) + _DEFINE_EXPR_BINARY_OPERATOR(<=, struct std::__less_equal) + _DEFINE_EXPR_BINARY_OPERATOR(>=, struct std::__greater_equal) #undef _DEFINE_EXPR_BINARY_OPERATOR @@ -442,20 +442,20 @@ namespace __detail return _Expr<_Closure, _Tp>(_Closure(__v)); \ } - _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs) - _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos) - _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos) - _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh) - _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin) - _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin) - _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh) - _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan) - _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh) - _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan) - _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp) - _DEFINE_EXPR_UNARY_FUNCTION(log, _Log) - _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10) - _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt) + _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs) + _DEFINE_EXPR_UNARY_FUNCTION(cos, struct std::_Cos) + _DEFINE_EXPR_UNARY_FUNCTION(acos, struct std::_Acos) + _DEFINE_EXPR_UNARY_FUNCTION(cosh, struct std::_Cosh) + _DEFINE_EXPR_UNARY_FUNCTION(sin, struct std::_Sin) + _DEFINE_EXPR_UNARY_FUNCTION(asin, struct std::_Asin) + _DEFINE_EXPR_UNARY_FUNCTION(sinh, struct std::_Sinh) + _DEFINE_EXPR_UNARY_FUNCTION(tan, struct std::_Tan) + _DEFINE_EXPR_UNARY_FUNCTION(tanh, struct std::_Tanh) + _DEFINE_EXPR_UNARY_FUNCTION(atan, struct std::_Atan) + _DEFINE_EXPR_UNARY_FUNCTION(exp, struct std::_Exp) + _DEFINE_EXPR_UNARY_FUNCTION(log, struct std::_Log) + _DEFINE_EXPR_UNARY_FUNCTION(log10, struct std::_Log10) + _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt) #undef _DEFINE_EXPR_UNARY_FUNCTION @@ -545,8 +545,8 @@ namespace __detail return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ } -_DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2) -_DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow) +_DEFINE_EXPR_BINARY_FUNCTION(atan2, struct std::_Atan2) +_DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) #undef _DEFINE_EXPR_BINARY_FUNCTION diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/95592.cc b/libstdc++-v3/testsuite/26_numerics/valarray/95592.cc new file mode 100644 index 00000000000..e530cbdc212 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/95592.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile } + +// PR libstdc++/95592 +// Collision with struct _Cosh when Cross compiling libstdc++ + +namespace std +{ + double _Cosh(double); + double _Pow(double, double); +} + +#include