From 64108448bc4e3b49cf56fb4a2dde93ee08ef1f42 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 14 May 2022 12:06:19 +0200 Subject: [PATCH] Fixes build --- src/String/StringView.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/String/StringView.hpp b/src/String/StringView.hpp index 05f8f10..c5d6b3a 100644 --- a/src/String/StringView.hpp +++ b/src/String/StringView.hpp @@ -22,10 +22,16 @@ namespace ArbUt { public: __ConstStringCharHolder(const char* non_null value, size_t length) : _value(new char[length + 1]) { EnsureNotNull(value); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-truncation" + // For GCC we need to disable a diagnostic that does not like this. +#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif strncpy(_value, value, length); -#pragma GCC diagnostic pop +#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop +#endif + _value[length] = 0; } ~__ConstStringCharHolder() noexcept { delete[] _value; }