RFC: Mirror system header exposure in libstdc++-v3's headers
Loren James Rittle
rittle@latour.rsch.comm.mot.com
Sat Apr 5 03:58:00 GMT 2003
Attached is the form of patch I'm testing right now on *-*-freebsd5*.
All posted results from ref5/beast this weekend included this patch.
Here is the form of the guards I added to the libstdc++-v3 headers:
#if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
#endif
The exact stuff I guard may be somewhat FreeBSD-centric and may not be
complete yet but does follow C99 and/or `ll' functions of same. I
attempted to only change namespace exposure not ABI and ODR-related.
Here is an example set of hooks to be dropped into an os_defines.h file:
#define _GLIBCPP_USE_C99_EXPOSURE_HOOK (__ISO_C_VISIBLE >= 1999)
#define _GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK (defined (__LONG_LONG_SUPPORTED))
Had this been a final proposal, I would have included documentation
changes for the new hooks and ChangeLog entries. I'll clean this up
after it proves to be useful and a round of comments. - Loren
Index: include/c_compatibility/math.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_compatibility/math.h,v
retrieving revision 1.1
diff -c -r1.1 math.h
*** include/c_compatibility/math.h 21 Jun 2002 20:20:44 -0000 1.1
--- include/c_compatibility/math.h 5 Apr 2003 03:32:26 -0000
***************
*** 57,62 ****
--- 57,63 ----
using std::fmod;
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
using std::fpclassify;
using std::isfinite;
using std::isinf;
***************
*** 69,74 ****
--- 70,76 ----
using std::islessequal;
using std::islessgreater;
using std::isunordered;
+ #endif
#endif
#endif
Index: include/c_compatibility/wchar.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_compatibility/wchar.h,v
retrieving revision 1.1
diff -c -r1.1 wchar.h
*** include/c_compatibility/wchar.h 21 Jun 2002 20:20:44 -0000 1.1
--- include/c_compatibility/wchar.h 5 Apr 2003 03:32:26 -0000
***************
*** 96,104 ****
--- 96,106 ----
using std::wcsftime;
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
+ #endif
#endif
#endif //_GLIBCPP_USE_WCHAR_T
Index: include/c_std/std_cmath.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/std_cmath.h,v
retrieving revision 1.6
diff -c -r1.6 std_cmath.h
*** include/c_std/std_cmath.h 21 Jun 2002 20:20:48 -0000 1.6
--- include/c_std/std_cmath.h 5 Apr 2003 03:32:26 -0000
***************
*** 503,508 ****
--- 503,509 ----
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
// These are possible macros imported from C99-land. For strict
// conformance, remove possible C99-injected names from the global
// namespace, and sequester them in the __gnu_cxx extension namespace.
***************
*** 562,567 ****
--- 563,569 ----
{ return isunordered(__f1, __f2); }
}
#endif
+ #endif
#undef fpclassify
#undef isfinite
***************
*** 577,582 ****
--- 579,585 ----
#undef isunordered
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
namespace __gnu_cxx
{
template<typename _Tp>
***************
*** 647,652 ****
--- 650,656 ----
using __gnu_cxx::islessgreater;
using __gnu_cxx::isunordered;
}
+ #endif
#endif
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
Index: include/c_std/std_cstdio.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/std_cstdio.h,v
retrieving revision 1.4
diff -c -r1.4 std_cstdio.h
*** include/c_std/std_cstdio.h 27 Mar 2002 04:29:32 -0000 1.4
--- include/c_std/std_cstdio.h 5 Apr 2003 03:32:26 -0000
***************
*** 143,148 ****
--- 143,149 ----
}
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
#undef snprintf
#undef vfscanf
***************
*** 167,172 ****
--- 168,174 ----
using __gnu_cxx::vsnprintf;
using __gnu_cxx::vsscanf;
}
+ #endif
#endif
#endif
Index: include/c_std/std_cstdlib.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/std_cstdlib.h,v
retrieving revision 1.4
diff -c -r1.4 std_cstdlib.h
*** include/c_std/std_cstdlib.h 27 Mar 2002 04:29:32 -0000 1.4
--- include/c_std/std_cstdlib.h 5 Apr 2003 03:32:26 -0000
***************
*** 123,142 ****
}
#if _GLIBCPP_USE_C99
#undef _Exit
#undef llabs
#undef lldiv
#undef atoll
#undef strtoll
#undef strtoull
#undef strtof
#undef strtold
namespace __gnu_cxx
{
- using ::lldiv_t;
using ::_Exit;
inline long long
abs(long long __x) { return __x >= 0 ? __x : -__x; }
--- 123,146 ----
}
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
#undef _Exit
+ #if !defined (_GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK) || _GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK
#undef llabs
#undef lldiv
#undef atoll
#undef strtoll
#undef strtoull
+ #endif
#undef strtof
#undef strtold
namespace __gnu_cxx
{
using ::_Exit;
+ #if !defined (_GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK) || _GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK
+ using ::lldiv_t;
inline long long
abs(long long __x) { return __x >= 0 ? __x : -__x; }
***************
*** 153,178 ****
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
using ::atoll;
- using ::strtof;
using ::strtoll;
using ::strtoull;
using ::strtold;
}
namespace std
{
- using __gnu_cxx::lldiv_t;
using __gnu_cxx::_Exit;
using __gnu_cxx::abs;
using __gnu_cxx::llabs;
using __gnu_cxx::div;
using __gnu_cxx::lldiv;
using __gnu_cxx::atoll;
- using __gnu_cxx::strtof;
using __gnu_cxx::strtoll;
using __gnu_cxx::strtoull;
using __gnu_cxx::strtold;
}
#endif
#endif
--- 157,186 ----
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
using ::atoll;
using ::strtoll;
using ::strtoull;
+ #endif
+ using ::strtof;
using ::strtold;
}
namespace std
{
using __gnu_cxx::_Exit;
+ #if !defined (_GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK) || _GLIBCPP_USE_LONG_LONG_EXPOSURE_HOOK
+ using __gnu_cxx::lldiv_t;
using __gnu_cxx::abs;
using __gnu_cxx::llabs;
using __gnu_cxx::div;
using __gnu_cxx::lldiv;
using __gnu_cxx::atoll;
using __gnu_cxx::strtoll;
using __gnu_cxx::strtoull;
+ #endif
+ using __gnu_cxx::strtof;
using __gnu_cxx::strtold;
}
+ #endif
#endif
#endif
Index: include/c_std/std_cwchar.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/std_cwchar.h,v
retrieving revision 1.4
diff -c -r1.4 std_cwchar.h
*** include/c_std/std_cwchar.h 27 Mar 2002 04:29:32 -0000 1.4
--- include/c_std/std_cwchar.h 5 Apr 2003 03:32:26 -0000
***************
*** 218,223 ****
--- 218,224 ----
}
#if _GLIBCPP_USE_C99
+ #if !defined (_GLIBCPP_USE_C99_EXPOSURE_HOOK) || _GLIBCPP_USE_C99_EXPOSURE_HOOK
#undef wcstold
#undef wcstoll
***************
*** 236,241 ****
--- 237,243 ----
using __gnu_cxx::wcstoll;
using __gnu_cxx::wcstoull;
}
+ #endif
#endif
#endif //_GLIBCPP_USE_WCHAR_T
More information about the Libstdc++
mailing list