Skip to content

Commit

Permalink
Define wchar_t according to __WCHAR_TYPE__ (#1431)
Browse files Browse the repository at this point in the history
b/298211986
b/246854012

Windows platform modular builds don't work with the current definition
of wchar_t for c files.

Setting wchar_t according to the predefined C macro __WCHAR_TYPE__
ensures that wchar_t is defined correctly.

Error shows up here: b/246854012#comment41 and was discussed in
go/lbreview/260401

(cherry picked from commit 474b3db)
  • Loading branch information
niranjanyardi committed Sep 20, 2023
1 parent 89532fe commit 43d5bd1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions third_party/musl/arch/aarch64/bits/alltypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
#define __LONG_MAX 0x7fffffffffffffffL

#ifndef __cplusplus
#if defined(USE_COBALT_CUSTOMIZATIONS)
typedef __WCHAR_TYPE__ wchar_t;
#else
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
typedef unsigned wchar_t;
#define __DEFINED_wchar_t
#endif
#endif // defined(USE_COBALT_CUSTOMIZATIONS)

#endif
#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
Expand Down
4 changes: 4 additions & 0 deletions third_party/musl/arch/arm/bits/alltypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
#define __LONG_MAX 0x7fffffffL

#ifndef __cplusplus
#if defined(USE_COBALT_CUSTOMIZATIONS)
typedef __WCHAR_TYPE__ wchar_t;
#else
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
typedef unsigned wchar_t;
#define __DEFINED_wchar_t
#endif
#endif // defined(USE_COBALT_CUSTOMIZATIONS)

#endif

Expand Down
6 changes: 4 additions & 2 deletions third_party/musl/arch/x86_64/bits/alltypes.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#define _Addr long
#define _Int64 long
#define _Reg long

#define __BYTE_ORDER 1234
#define __LONG_MAX 0x7fffffffffffffffL

#ifndef __cplusplus
#if defined(USE_COBALT_CUSTOMIZATIONS)
typedef __WCHAR_TYPE__ wchar_t;
#else
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
typedef int wchar_t;
#define __DEFINED_wchar_t
#endif

#endif // defined(USE_COBALT_CUSTOMIZATIONS)
#endif

#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
Expand Down

0 comments on commit 43d5bd1

Please sign in to comment.