From 357f7837e322e2568c165c78e7d691b8418c6b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20R=C3=A5de?= Date: Tue, 26 Nov 2024 16:35:24 +0100 Subject: [PATCH 1/2] Fixed Visual Studio compiler warning "#pragma GCC" causes warning 4068 "Unknown pragma" when compiling with Visual Studio 2022. Maybe the condition should be #if defined(__GNUC__) || defined(__clang__) instead. Both are used in the other files. --- include/gtl/vector.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/gtl/vector.hpp b/include/gtl/vector.hpp index 26efda8..4f123aa 100644 --- a/include/gtl/vector.hpp +++ b/include/gtl/vector.hpp @@ -1311,10 +1311,14 @@ class vector { impl_.e_ += n; } else { if constexpr (std::is_trivially_copyable_v && usingStdAllocator) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnonnull" // disable erroneous warning +#if defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" // disable erroneous warning +#endif std::memmove((void*)(position + n), (void*)position, tail * sizeof(T)); -#pragma GCC diagnostic pop +#if defined(__GNUC__) + #pragma GCC diagnostic pop +#endif impl_.e_ += n; } else { D_uninitialized_move_a(impl_.e_, impl_.e_ - n, impl_.e_); From cc04c56a4ab1aee344cff533e788d4eb2318ee2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20R=C3=A5de?= Date: Tue, 26 Nov 2024 20:44:00 +0100 Subject: [PATCH 2/2] Fixed Visual Studio compiler warning Replaced #if defined(__GNUC__) by #if defined(__GNUC__) || defined(__clang__) --- include/gtl/vector.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gtl/vector.hpp b/include/gtl/vector.hpp index 4f123aa..7c9c9de 100644 --- a/include/gtl/vector.hpp +++ b/include/gtl/vector.hpp @@ -1311,12 +1311,12 @@ class vector { impl_.e_ += n; } else { if constexpr (std::is_trivially_copyable_v && usingStdAllocator) { -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnonnull" // disable erroneous warning #endif std::memmove((void*)(position + n), (void*)position, tail * sizeof(T)); -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif impl_.e_ += n;