mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] arm: Use __WCHAR_TYPE__ for wchar_t if defined
@ 2023-02-04  6:30 Peter Collingbourne
  2023-02-04  7:08 ` alice
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Collingbourne @ 2023-02-04  6:30 UTC (permalink / raw)
  To: musl; +Cc: Peter Collingbourne

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-07 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04  6:30 [musl] [PATCH] arm: Use __WCHAR_TYPE__ for wchar_t if defined Peter Collingbourne
2023-02-04  7:08 ` alice
2023-02-05 20:00   ` Markus Wichmann
2023-02-05 23:49     ` Rich Felker
2023-02-07  1:15       ` Peter Collingbourne
2023-02-07 14:59         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).