Skip to content
Permalink
Browse files

OS/2: Enable C99 stuffs in C++11

C++11 supports some C99 features. However OS/2 kLIBC headers do not
support them well.

To workaround, define some feature test macros as built-in. They are

    __STDC_CONSTANT_MACROS
    __STDC_LIMIT_MACROS
    __LONG_LONG_SUPPORTED

Especially, __LONG_LONG_SUPPORTED enables _GLIBCXX_USE_C99 feature in
libstdc++-v3, which use -std=c++98 to test C99 features in C++.

    modified:   gcc/config/i386/emx.h
    modified:   libstdc++-v3/config/os/os2/os_defines.h
  • Loading branch information...
komh committed Feb 16, 2016
1 parent abbd4b1 commit fef1630c35955e6352f9734b43d20758ce7508be
Showing with 16 additions and 0 deletions.
  1. +11 −0 gcc/config/i386/emx.h
  2. +5 −0 libstdc++-v3/config/os/os2/os_defines.h
@@ -380,6 +380,17 @@ do { \
builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
builtin_define ("_Cdecl=__attribute__((__cdecl__))"); \
} \
if (c_dialect_cxx ()) \
{ \
if (cxx_dialect >= cxx11) \
{ \
builtin_define ("__STDC_CONSTANT_MACROS"); \
builtin_define ("__STDC_LIMIT_MACROS"); \
} \
if (cxx_dialect >= cxx11 || \
flag_iso /* For _GLIBCXX_USE_C99 of libstdc++-v3) */) \
builtin_define ("__LONG_LONG_SUPPORTED"); \
} \
builtin_define_std ("__KLIBC__=0"); \
builtin_define_std ("__KLIBC_MINOR__=6"); \
builtin_define_std ("__KLIBC_PATCHLEVEL__=3"); \
@@ -33,4 +33,9 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.

#define _GLIBCXX_USE_C99_CHECK 1
#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)

#endif

0 comments on commit fef1630

Please sign in to comment.
You can’t perform that action at this time.