Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230204063021.2681891-1-pcc@google.com>
Date: Fri,  3 Feb 2023 22:30:21 -0800
From: Peter Collingbourne <pcc@...gle.com>
To: musl@...ts.openwall.com
Cc: Peter Collingbourne <pcc@...gle.com>
Subject: [PATCH] arm: Use __WCHAR_TYPE__ for wchar_t if defined

When building with -fshort-wchar the definition of wchar_t is
incorrect. Get the correct definition from the compiler if available.

This is useful when reusing the freestanding parts of musl on a
bare-metal target that uses -fshort-wchar.
---
 arch/arm/bits/alltypes.h.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in
index d62bd7bd..9596466b 100644
--- a/arch/arm/bits/alltypes.h.in
+++ b/arch/arm/bits/alltypes.h.in
@@ -12,8 +12,12 @@
 #define __LONG_MAX 0x7fffffffL
 
 #ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+TYPEDEF __WCHAR_TYPE__ wchar_t;
+#else
 TYPEDEF unsigned wchar_t;
 #endif
+#endif
 
 TYPEDEF float float_t;
 TYPEDEF double double_t;
-- 
2.39.1.519.gcb327c4b5f-goog

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.