From 2eae410c5458b05c3f6ead9db55270f4813659aa Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Wed, 16 Jun 2021 17:46:17 +0000 Subject: includes: Provide `wchar.h` with `wchar_t` and `wint_t` Change-Id: Iacb0e4eaf3f0b6bf843f3bfda5bdfde0f7a98808 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/55590 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- payloads/libpayload/curses/curses.h | 10 ++++------ payloads/libpayload/include/stddef.h | 7 +++++++ payloads/libpayload/include/wchar.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 payloads/libpayload/include/wchar.h (limited to 'payloads/libpayload') diff --git a/payloads/libpayload/curses/curses.h b/payloads/libpayload/curses/curses.h index b802adb3f4..96fa9ac846 100644 --- a/payloads/libpayload/curses/curses.h +++ b/payloads/libpayload/curses/curses.h @@ -154,9 +154,9 @@ typedef unsigned long mmask_t; //// #define va_list int // FIXME #define _XOPEN_SOURCE_EXTENDED 1 // XXX -//// #ifdef _XOPEN_SOURCE_EXTENDED -//// #include /* we want wchar_t */ -//// #endif /* _XOPEN_SOURCE_EXTENDED */ +#ifdef _XOPEN_SOURCE_EXTENDED +#include /* we want wchar_t */ +#endif /* _XOPEN_SOURCE_EXTENDED */ /* XSI and SVr4 specify that curses implements 'bool'. However, C++ may also * implement it. If so, we must use the C++ compiler's type to avoid conflict @@ -350,9 +350,7 @@ typedef chtype attr_t; /* ...must be at least as wide as chtype */ #endif #if 1 -//// #include /* ...to get mbstate_t, etc. */ -typedef unsigned long wchar_t; // XXX -typedef unsigned long wint_t; // XXX +#include /* ...to get mbstate_t, etc. */ #endif #if 0 diff --git a/payloads/libpayload/include/stddef.h b/payloads/libpayload/include/stddef.h index 18c22f02a8..e1273454c2 100644 --- a/payloads/libpayload/include/stddef.h +++ b/payloads/libpayload/include/stddef.h @@ -3,6 +3,13 @@ #include +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +#ifndef __cplusplus +typedef __WCHAR_TYPE__ wchar_t; +#endif + #ifndef __SIZE_TYPE__ #define __SIZE_TYPE__ unsigned long #endif diff --git a/payloads/libpayload/include/wchar.h b/payloads/libpayload/include/wchar.h new file mode 100644 index 0000000000..9c79b892a3 --- /dev/null +++ b/payloads/libpayload/include/wchar.h @@ -0,0 +1,11 @@ +#ifndef _WCHAR_H +#define _WCHAR_H + +#include + +#ifndef __WINT_TYPE__ +# define __WINT_TYPE__ unsigned int +#endif +typedef __WINT_TYPE__ wint_t; + +#endif -- cgit v1.2.3