From 6a0d23af49e16577418566ab4fb165fea2efe286 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 3 Oct 2016 12:50:46 +0100 Subject: [PATCH] Ensure "C++" language linkage for std::abs overloads PR libstdc++/77814 * include/bits/std_abs.h: Use "C++" language linkage. * testsuite/17_intro/headers/c++2011/linkage.cc: Move to the end. Add . From-SVN: r240710 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/bits/std_abs.h | 3 +++ .../testsuite/17_intro/headers/c++2011/linkage.cc | 13 ++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 31dfa65bf56..8c744356325 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2016-10-03 Jonathan Wakely + + PR libstdc++/77814 + * include/bits/std_abs.h: Use "C++" language linkage. + * testsuite/17_intro/headers/c++2011/linkage.cc: Move to + the end. Add . + 2016-10-03 Ville Voutilainen PR libstdc++/77802 diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h index ab0f980a3a6..732b81a3700 100644 --- a/libstdc++-v3/include/bits/std_abs.h +++ b/libstdc++-v3/include/bits/std_abs.h @@ -43,6 +43,8 @@ #undef abs +extern "C++" +{ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -103,5 +105,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace +} #endif // _GLIBCXX_BITS_STD_ABS_H diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc index 67c384b81ff..bb56dbf16bb 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/linkage.cc @@ -25,9 +25,7 @@ extern "C" { #include -#ifdef _GLIBCXX_HAVE_COMPLEX_H -#include -#endif +// See below for #include #include #ifdef _GLIBCXX_HAVE_FENV_H @@ -43,6 +41,9 @@ extern "C" #include #include #include +#if _GLIBCXX_HAVE_STDALIGN_H +#include +#endif #include #ifdef _GLIBCXX_HAVE_STDBOOL_H #include @@ -67,4 +68,10 @@ extern "C" #ifdef _GLIBCXX_HAVE_WCTYPE_H #include #endif + +// Include this last, because it adds extern "C++" and so hides problems in +// other headers if included first (e.g. PR libstdc++/77814). +#ifdef _GLIBCXX_HAVE_COMPLEX_H +#include +#endif } -- 2.30.2