Skip to content

Commit

Permalink
Cherry pick PR #1431: Define wchar_t according to __WCHAR_TYPE__ (#1462)
Browse files Browse the repository at this point in the history
Refer to the original PR: #1431

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

Co-authored-by: Niranjan Yardi <[email protected]>
  • Loading branch information
1 parent b01d7bf commit 0f5941f
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 0f5941f

Please sign in to comment.