From 2d1f6257cae385205646af3bc85ad96525c7e77c Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Thu, 25 Nov 2021 22:30:59 +0200 Subject: [PATCH] fix for internal over-aligned types on apple clang they made their compiler a walled-garden too?? fucking assholes --- include/toml++/impl/parser.inl | 13 ++++++++++--- toml.hpp | 14 +++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/toml++/impl/parser.inl b/include/toml++/impl/parser.inl index 29bc8cf..f6dfd04 100644 --- a/include/toml++/impl/parser.inl +++ b/include/toml++/impl/parser.inl @@ -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 @@ -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 diff --git a/toml.hpp b/toml.hpp index a9a5d33..38f0b90 100644 --- a/toml.hpp +++ b/toml.hpp @@ -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 @@ -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")