Skip to content

Commit c350ff3

Browse files
authored
Clang workarounds (#867)
1 parent 29c7a25 commit c350ff3

File tree

2 files changed

+45
-43
lines changed

2 files changed

+45
-43
lines changed

strings/base_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ namespace winrt::impl
179179

180180
[[noreturn]] inline void __stdcall fallback_RoFailFastWithErrorContext(int32_t) noexcept
181181
{
182-
std::terminate();
182+
abort();
183183
}
184184
}
185185

strings/base_types.h

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,50 @@ WINRT_EXPORT namespace winrt
8282

8383
struct guid
8484
{
85+
private:
86+
87+
template <typename TStringView>
88+
static constexpr guid parse(TStringView const value) noexcept
89+
{
90+
if (value.size() != 36 || value[8] != '-' || value[13] != '-' || value[18] != '-' || value[23] != '-')
91+
{
92+
std::terminate();
93+
}
94+
95+
return
96+
{
97+
impl::uint8_to_uint32
98+
(
99+
impl::hex_to_uint8(value[0], value[1]),
100+
impl::hex_to_uint8(value[2], value[3]),
101+
impl::hex_to_uint8(value[4], value[5]),
102+
impl::hex_to_uint8(value[6], value[7])
103+
),
104+
impl::uint8_to_uint16
105+
(
106+
impl::hex_to_uint8(value[9], value[10]),
107+
impl::hex_to_uint8(value[11], value[12])
108+
),
109+
impl::uint8_to_uint16
110+
(
111+
impl::hex_to_uint8(value[14], value[15]),
112+
impl::hex_to_uint8(value[16], value[17])
113+
),
114+
{
115+
impl::hex_to_uint8(value[19], value[20]),
116+
impl::hex_to_uint8(value[21], value[22]),
117+
impl::hex_to_uint8(value[24], value[25]),
118+
impl::hex_to_uint8(value[26], value[27]),
119+
impl::hex_to_uint8(value[28], value[29]),
120+
impl::hex_to_uint8(value[30], value[31]),
121+
impl::hex_to_uint8(value[32], value[33]),
122+
impl::hex_to_uint8(value[34], value[35]),
123+
}
124+
};
125+
}
126+
127+
public:
128+
85129
uint32_t Data1;
86130
uint16_t Data2;
87131
uint16_t Data3;
@@ -124,48 +168,6 @@ WINRT_EXPORT namespace winrt
124168
guid(parse(value))
125169
{
126170
}
127-
128-
private:
129-
130-
template <typename TStringView>
131-
static constexpr guid parse(TStringView const value) noexcept
132-
{
133-
if (value.size() != 36 || value[8] != '-' || value[13] != '-' || value[18] != '-' || value[23] != '-')
134-
{
135-
std::terminate();
136-
}
137-
138-
return
139-
{
140-
impl::uint8_to_uint32
141-
(
142-
impl::hex_to_uint8(value[0], value[1]),
143-
impl::hex_to_uint8(value[2], value[3]),
144-
impl::hex_to_uint8(value[4], value[5]),
145-
impl::hex_to_uint8(value[6], value[7])
146-
),
147-
impl::uint8_to_uint16
148-
(
149-
impl::hex_to_uint8(value[9], value[10]),
150-
impl::hex_to_uint8(value[11], value[12])
151-
),
152-
impl::uint8_to_uint16
153-
(
154-
impl::hex_to_uint8(value[14], value[15]),
155-
impl::hex_to_uint8(value[16], value[17])
156-
),
157-
{
158-
impl::hex_to_uint8(value[19], value[20]),
159-
impl::hex_to_uint8(value[21], value[22]),
160-
impl::hex_to_uint8(value[24], value[25]),
161-
impl::hex_to_uint8(value[26], value[27]),
162-
impl::hex_to_uint8(value[28], value[29]),
163-
impl::hex_to_uint8(value[30], value[31]),
164-
impl::hex_to_uint8(value[32], value[33]),
165-
impl::hex_to_uint8(value[34], value[35]),
166-
}
167-
};
168-
}
169171
};
170172

171173
inline bool operator==(guid const& left, guid const& right) noexcept

0 commit comments

Comments
 (0)