From d76958202309288588cda8fc7dd11af15202f02f Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Mon, 22 Feb 2021 15:53:31 -0600 Subject: [PATCH] Ignore intentional redundant move under GCC This bubbled up after Wredundant-move was added to the build script and was observed under the CI environment running GCC 9.3.0. --- src/env_dispatch.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 376e185be..0f9beba64 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -308,8 +308,17 @@ static std::unique_ptr create_dispatch_table() { var_dispatch_table->add(L"TZ", handle_tz_change); var_dispatch_table->add(L"fish_use_posix_spawn", handle_fish_use_posix_spawn_change); - // This std::move is required to avoid a build error on old versions of libc++ (#5801) + // This std::move is required to avoid a build error on old versions of libc++ (#5801), + // but it causes a different warning under newer versions of GCC (observed under GCC 9.3.0, + // but not under llvm/clang 9). +#if __GNUC__ > 4 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-move" +#endif return std::move(var_dispatch_table); +#if __GNUC__ > 4 +#pragma GCC diagnostic pop +#endif } static void run_inits(const environment_t &vars) {