From: Jonathan Wakely Date: Wed, 20 Jan 2016 12:34:25 +0000 (+0000) Subject: Ensure C++ language linkage in cmath and cstdlib X-Git-Tag: upstream/12.2.0~49343 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eac437bf2c5ec74c7fd4a3e897207e6b7a5eabb2;p=platform%2Fupstream%2Fgcc.git Ensure C++ language linkage in cmath and cstdlib PR libstdc++/69386 * include/c_global/ccomplex: Ensure C++ language linkage. * include/c_global/cmath: Likewise. * include/c_global/cstdlib: Likewise. * include/c_global/ctgmath: Likewise. * testsuite/17_intro/headers/c++2011/linkage.cc: New. From-SVN: r232607 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4bf6e25..b78a2f7 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2016-01-20 Jonathan Wakely + + PR libstdc++/69386 + * include/c_global/ccomplex: Ensure C++ language linkage. + * include/c_global/cmath: Likewise. + * include/c_global/cstdlib: Likewise. + * include/c_global/ctgmath: Likewise. + * testsuite/17_intro/headers/c++2011/linkage.cc: New. + 2016-01-19 Jonathan Wakely PR libstdc++/14608 diff --git a/libstdc++-v3/include/c_global/ccomplex b/libstdc++-v3/include/c_global/ccomplex index 8879e20..df2e413 100644 --- a/libstdc++-v3/include/c_global/ccomplex +++ b/libstdc++-v3/include/c_global/ccomplex @@ -35,6 +35,8 @@ # include #endif +extern "C++" { #include +} #endif diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath index 45e40ab..c4ee3f5 100644 --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath @@ -74,6 +74,8 @@ #undef tan #undef tanh +extern "C++" +{ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1790,4 +1792,6 @@ _GLIBCXX_END_NAMESPACE_VERSION # include #endif +} // extern "C++" + #endif diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib index 44b6e5c..1ba5fb7 100644 --- a/libstdc++-v3/include/c_global/cstdlib +++ b/libstdc++-v3/include/c_global/cstdlib @@ -115,6 +115,8 @@ namespace std #undef wcstombs #undef wctomb +extern "C++" +{ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -272,6 +274,8 @@ namespace std #endif // _GLIBCXX_USE_C99_STDLIB +} // extern "C++" + #endif // !_GLIBCXX_HOSTED #endif diff --git a/libstdc++-v3/include/c_global/ctgmath b/libstdc++-v3/include/c_global/ctgmath index 2fee958..4314516 100644 --- a/libstdc++-v3/include/c_global/ctgmath +++ b/libstdc++-v3/include/c_global/ctgmath @@ -35,7 +35,9 @@ # include #else # include +extern "C++" { # include +} #endif #endif diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc new file mode 100644 index 0000000..33e7053 --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc @@ -0,0 +1,50 @@ +// Copyright (C) 2016 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-options "-std=gnu++11" } +// { dg-do compile } + +// libstdc++/69386 + +extern "C" +{ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +}