fix for internal over-aligned types on apple clang

they made their compiler a walled-garden too?? fucking assholes
This commit is contained in:
Mark Gillard 2021-11-25 22:30:59 +02:00
parent ad4ae98af0
commit 2d1f6257ca
2 changed files with 21 additions and 6 deletions

View File

@ -278,6 +278,12 @@ TOML_ANON_NAMESPACE_START
} \
while (false)
#endif
#ifdef __APPLE__ // because, honestly, what the fuck mac OS??
#define TOML_OVERALIGNED
#else
#define TOML_OVERALIGNED alignas(32)
#endif
template <typename T>
@ -297,7 +303,7 @@ TOML_ANON_NAMESPACE_START
struct codepoints_t
{
alignas(32) utf8_codepoint buffer[block_capacity];
TOML_OVERALIGNED utf8_codepoint buffer[block_capacity];
size_t current;
size_t count;
} codepoints_;
@ -312,7 +318,7 @@ TOML_ANON_NAMESPACE_START
{
TOML_ASSERT(stream_);
alignas(32) char raw_bytes[block_capacity];
TOML_OVERALIGNED char raw_bytes[block_capacity];
size_t raw_bytes_read;
// read the next raw (encoded) block in from the stream
@ -3693,7 +3699,7 @@ TOML_ANON_NAMESPACE_START
// open file with a custom-sized stack buffer
std::ifstream file;
alignas(32) char file_buffer[sizeof(void*) * 1024u];
TOML_OVERALIGNED char file_buffer[sizeof(void*) * 1024u];
file.rdbuf()->pubsetbuf(file_buffer, sizeof(file_buffer));
file.open(file_path_str, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
if (!file.is_open())
@ -3819,5 +3825,6 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#undef TOML_OVERALIGNED
#include "header_end.h"
#endif // TOML_ENABLE_PARSER

View File

@ -10758,6 +10758,12 @@ TOML_ANON_NAMESPACE_START
} \
while (false)
#endif
#ifdef __APPLE__ // because, honestly, what the fuck mac OS??
#define TOML_OVERALIGNED
#else
#define TOML_OVERALIGNED alignas(32)
#endif
template <typename T>
@ -10777,7 +10783,7 @@ TOML_ANON_NAMESPACE_START
struct codepoints_t
{
alignas(32) utf8_codepoint buffer[block_capacity];
TOML_OVERALIGNED utf8_codepoint buffer[block_capacity];
size_t current;
size_t count;
} codepoints_;
@ -10792,7 +10798,7 @@ TOML_ANON_NAMESPACE_START
{
TOML_ASSERT(stream_);
alignas(32) char raw_bytes[block_capacity];
TOML_OVERALIGNED char raw_bytes[block_capacity];
size_t raw_bytes_read;
// read the next raw (encoded) block in from the stream
@ -14163,7 +14169,7 @@ TOML_ANON_NAMESPACE_START
// open file with a custom-sized stack buffer
std::ifstream file;
alignas(32) char file_buffer[sizeof(void*) * 1024u];
TOML_OVERALIGNED char file_buffer[sizeof(void*) * 1024u];
file.rdbuf()->pubsetbuf(file_buffer, sizeof(file_buffer));
file.open(file_path_str, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
if (!file.is_open())
@ -14289,6 +14295,8 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#undef TOML_OVERALIGNED
#ifdef _MSC_VER
#pragma pop_macro("min")
#pragma pop_macro("max")