[patch][libc++]using some undeclared functions with -std=c++98, -std=c++03 or -ansi

Yamaya Takashi yamayan at kbh.biglobe.ne.jp
Thu Nov 22 23:09:14 UTC 2012


hi

With -std=c++98, -std=c++03 or -ansi, __LONG_LONG_SUPPORTED is not defined.
So some functions((lldiv_t, )atoll, strtoll, strtoull, llabs, lldiv,
wcstoll, wcstoull) are undeclared.
But libc++ headers(cstdlib and cwchar) use them.


-------------- next part --------------
Index: contrib/libc++/include/cstdlib
===================================================================
--- contrib/libc++/include/cstdlib	(revision 241927)
+++ contrib/libc++/include/cstdlib	(working copy)
@@ -97,18 +97,26 @@
 using ::size_t;
 using ::div_t;
 using ::ldiv_t;
+#ifdef __LONG_LONG_SUPPORTED
 using ::lldiv_t;
+#endif
 using ::atof;
 using ::atoi;
 using ::atol;
+#ifdef __LONG_LONG_SUPPORTED
 using ::atoll;
+#endif
 using ::strtod;
 using ::strtof;
 using ::strtold;
 using ::strtol;
+#ifdef __LONG_LONG_SUPPORTED
 using ::strtoll;
+#endif
 using ::strtoul;
+#ifdef __LONG_LONG_SUPPORTED
 using ::strtoull;
+#endif
 using ::rand;
 using ::srand;
 using ::calloc;
@@ -125,10 +133,14 @@
 using ::qsort;
 using ::abs;
 using ::labs;
+#ifdef __LONG_LONG_SUPPORTED
 using ::llabs;
+#endif
 using ::div;
 using ::ldiv;
+#ifdef __LONG_LONG_SUPPORTED
 using ::lldiv;
+#endif
 using ::mblen;
 using ::mbtowc;
 using ::wctomb;
@@ -145,10 +157,14 @@
 // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
 #if !defined(_MSC_VER) && !defined(__sun__)
 inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
+#ifdef __LONG_LONG_SUPPORTED
 inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
+#endif
 
 inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) _NOEXCEPT {return  ldiv(__x, __y);}
+#ifdef __LONG_LONG_SUPPORTED
 inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
+#endif
 #endif // _MSC_VER
 
 _LIBCPP_END_NAMESPACE_STD
Index: contrib/libc++/include/cwchar
===================================================================
--- contrib/libc++/include/cwchar	(revision 241927)
+++ contrib/libc++/include/cwchar	(working copy)
@@ -151,9 +151,13 @@
 using ::wcstold;
 #endif // _MSC_VER
 using ::wcstol;
+#ifdef __LONG_LONG_SUPPORTED
 using ::wcstoll;
+#endif
 using ::wcstoul;
+#ifdef __LONG_LONG_SUPPORTED
 using ::wcstoull;
+#endif
 using ::wcscpy;
 using ::wcsncpy;
 using ::wcscat;


More information about the freebsd-toolchain mailing list