libstdc++: use extern "C++" in all our C++ system headers.

This is needed to build an independent toolchain with g++ that doesn't think
that all these headers are in C.

Change-Id: Ie9a8ccfcab7780d6a4e5722777d61c2b1b312001
diff --git a/libstdc++/include/cctype b/libstdc++/include/cctype
index e236561..e0eb981 100644
--- a/libstdc++/include/cctype
+++ b/libstdc++/include/cctype
@@ -36,6 +36,8 @@
 
 #include <ctype.h>
 
+extern "C++" {
+
 namespace std 
 {
 using ::isalnum;
@@ -53,4 +55,6 @@
 using ::toupper;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CCTYPE__
diff --git a/libstdc++/include/cmath b/libstdc++/include/cmath
index bf697ff..be70343 100644
--- a/libstdc++/include/cmath
+++ b/libstdc++/include/cmath
@@ -37,6 +37,8 @@
 #include <cstddef>
 #include <math.h>
 
+extern "C++" {
+
 namespace std
 {
 // Functions.
@@ -68,4 +70,6 @@
 using ::fmod;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CMATH__
diff --git a/libstdc++/include/csetjmp b/libstdc++/include/csetjmp
index a68d127..ba82144 100644
--- a/libstdc++/include/csetjmp
+++ b/libstdc++/include/csetjmp
@@ -36,6 +36,8 @@
 
 #include <setjmp.h>
 
+extern "C++" {
+
 #ifndef setjmp
 #define setjmp(env) setjmp (env)
 #endif
@@ -46,4 +48,6 @@
 using ::longjmp;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSETJMP__
diff --git a/libstdc++/include/csignal b/libstdc++/include/csignal
index 2600a75..84f0e1d 100644
--- a/libstdc++/include/csignal
+++ b/libstdc++/include/csignal
@@ -36,6 +36,8 @@
 
 #include <signal.h>
 
+extern "C++" {
+
 namespace std
 {
 using ::sig_atomic_t;
@@ -43,4 +45,6 @@
 using ::raise;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSIGNAL__
diff --git a/libstdc++/include/cstddef b/libstdc++/include/cstddef
index fc1ca9d..cb06b49 100644
--- a/libstdc++/include/cstddef
+++ b/libstdc++/include/cstddef
@@ -38,9 +38,13 @@
  */
 #include <stddef.h>
 
+extern "C++" {
+
 namespace std {
 using ::ptrdiff_t;
 using ::size_t;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSTDDEF__
diff --git a/libstdc++/include/cstdio b/libstdc++/include/cstdio
index d46a18b..3c8b5c6 100644
--- a/libstdc++/include/cstdio
+++ b/libstdc++/include/cstdio
@@ -36,6 +36,8 @@
 #include <cstddef>
 #include <stdio.h>
 
+extern "C++" {
+
 namespace std {
 using ::FILE;
 using ::fpos_t;
@@ -89,4 +91,6 @@
 using ::vsscanf;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSTDIO__
diff --git a/libstdc++/include/cstdlib b/libstdc++/include/cstdlib
index 5e6a0b3..e520543 100644
--- a/libstdc++/include/cstdlib
+++ b/libstdc++/include/cstdlib
@@ -35,6 +35,8 @@
  */
 #include <stdlib.h>
 
+extern "C++" {
+
 namespace std {
 
 using ::exit;
@@ -110,4 +112,6 @@
 using ::wcstombs;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSTDLIB__
diff --git a/libstdc++/include/cstring b/libstdc++/include/cstring
index 80473cc..d3d9387 100644
--- a/libstdc++/include/cstring
+++ b/libstdc++/include/cstring
@@ -37,6 +37,8 @@
 #include <cstddef>
 #include <string.h>
 
+extern "C++" {
+
 namespace std
 {
 using ::memchr;
@@ -63,4 +65,6 @@
 using ::strxfrm;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CSTRING__
diff --git a/libstdc++/include/ctime b/libstdc++/include/ctime
index 36fe7d5..9e6744f 100644
--- a/libstdc++/include/ctime
+++ b/libstdc++/include/ctime
@@ -37,6 +37,8 @@
 #include <cstddef>
 #include <time.h>
 
+extern "C++" {
+
 namespace std 
 {
 // Types.
@@ -56,4 +58,6 @@
 using ::strftime;
 }  // namespace std
 
+}  // extern C++
+
 #endif  // BIONIC_LIBSTDCPP_INCLUDE_CTIME__
diff --git a/libstdc++/include/new b/libstdc++/include/new
index 19d8185..0253e8b 100644
--- a/libstdc++/include/new
+++ b/libstdc++/include/new
@@ -4,6 +4,8 @@
 
 #include <cstddef>
 
+extern "C++" {
+
 namespace std {
     struct nothrow_t {};
     extern const nothrow_t nothrow;
@@ -25,4 +27,6 @@
 inline void  operator delete(void*, void*) { }
 inline void  operator delete[](void*, void*) { }
 
+}  // extern C++
+
 #endif // __NEW__
diff --git a/libstdc++/include/typeinfo b/libstdc++/include/typeinfo
index 8a51a54..4b48a79 100644
--- a/libstdc++/include/typeinfo
+++ b/libstdc++/include/typeinfo
@@ -1,6 +1,7 @@
 #ifndef _TYPEINFO_HEADER_GAURD
 #define _TYPEINFO_HEADER_GAURD
 
+extern "C++" {
 
 namespace std {
     class type_info;
@@ -25,4 +26,6 @@
     type_info & operator=(type_info const & right);
 };
 
+}  // C++
+
 #endif