Skip to content

Commit

Permalink
Fixed Visual Studio compiler warning (#30)
Browse files Browse the repository at this point in the history
* 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.

* Fixed Visual Studio compiler warning

Replaced
    #if defined(__GNUC__)
by
    #if defined(__GNUC__) || defined(__clang__)
  • Loading branch information
jrade authored Nov 26, 2024
1 parent b19d1a7 commit bbfc46c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/gtl/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,10 +1311,14 @@ class vector {
impl_.e_ += n;
} else {
if constexpr (std::is_trivially_copyable_v<T> && usingStdAllocator) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull" // disable erroneous warning
#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));
#pragma GCC diagnostic pop
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
impl_.e_ += n;
} else {
D_uninitialized_move_a(impl_.e_, impl_.e_ - n, impl_.e_);
Expand Down

0 comments on commit bbfc46c

Please sign in to comment.