<uchar.h>: Define char16_t and char32_t better.
authorSascha Wildner <saw@online.de>
Wed, 7 Aug 2019 20:00:17 +0000 (22:00 +0200)
committerSascha Wildner <saw@online.de>
Thu, 8 Aug 2019 08:31:24 +0000 (10:31 +0200)
Define them unless we use C++11 or higher. Also, remove __char16_t
and __char32_t from <sys/types.h>. Furthermore, remove the unneeded
declaration guards.

Thanks to zrj for his help.

include/uchar.h
sys/sys/types.h

index 7dccba3..4dbb1c2 100644 (file)
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
-#ifndef _CHAR16_T_DECLARED
-typedef        __char16_t      char16_t;
-#define        _CHAR16_T_DECLARED
-#endif
-
-#ifndef _CHAR32_T_DECLARED
-typedef        __char32_t      char32_t;
-#define        _CHAR32_T_DECLARED
+#if !defined(__cplusplus) || __cplusplus < 201103
+typedef        __uint_least16_t        char16_t;
+typedef        __uint_least32_t        char32_t;
 #endif
 
 #ifndef _MBSTATE_T_DECLARED
index 27ff49f..54495f7 100644 (file)
@@ -282,10 +282,4 @@ typedef    __ct_rune_t     __wint_t;       /* wint_t (see above) */
  */
 typedef        int             __nl_item;
 
-/* Clang already provides these types as built-ins, but only in c++ mode. */
-#if !defined(__clang__) || !defined(__cplusplus)
-typedef        __uint_least16_t        __char16_t;
-typedef        __uint_least32_t        __char32_t;
-#endif
-
 #endif /* !_SYS_TYPES_H_ */