include/c_compatibility/stdlib.h imports wide character related symbols
into global namespace unconditionaly which causes libstdc++-v3 build
to fail when one or both of _GLIBCXX_USE_WCHAR_T and _GLIBCXX_HAVE_MBSTATE_T
are not defined.

Included patch changes it to import them into global namespace only
when they are defined in cstdlib

Andris

2016-01-26  Andris Pavenis  <andris.pave...@iki.fi>

    * include/c_compatibility/stdlib.h: Include wide character related
    definitions only when they are available in cstdlib.

>From 17778d89abe4f51f929806e67d2e2352b6b4376e Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pave...@iki.fi>
Date: Tue, 26 Jan 2016 06:24:48 +0200
Subject: [PATCH] [PATCH,libstdc++-v3] Fix use use wide character related
 symbols in stdlib.h wrapper

* include/c_compatibility/stdlib.h: include wide character related
definitions only when they are available in cstdlib
---
 libstdc++-v3/include/c_compatibility/stdlib.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libstdc++-v3/include/c_compatibility/stdlib.h b/libstdc++-v3/include/c_compatibility/stdlib.h
index bd72580..31e7e5f 100644
--- a/libstdc++-v3/include/c_compatibility/stdlib.h
+++ b/libstdc++-v3/include/c_compatibility/stdlib.h
@@ -62,9 +62,11 @@ using std::getenv;
 using std::labs;
 using std::ldiv;
 using std::malloc;
+#ifdef _GLIBCXX_HAVE_MBSTATE_T
 using std::mblen;
 using std::mbstowcs;
 using std::mbtowc;
+#endif // _GLIBCXX_HAVE_MBSTATE_T
 using std::qsort;
 using std::rand;
 using std::realloc;
@@ -73,8 +75,10 @@ using std::strtod;
 using std::strtol;
 using std::strtoul;
 using std::system;
+#ifdef _GLIBCXX_USE_WCHAR_T
 using std::wcstombs;
 using std::wctomb;
+#endif // _GLIBCXX_USE_WCHAR_T
 #endif
 
 #endif
-- 
2.5.0

Reply via email to