Skip to content

Commit

Permalink
OS/2: Enable C99 stuffs in C++11
Browse files Browse the repository at this point in the history
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 20, 2016
1 parent abbd4b1 commit fef1630
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gcc/config/i386/emx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"); \
Expand Down
5 changes: 5 additions & 0 deletions libstdc++-v3/config/os/os2/os_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.