From 2b0841b0c910506b9b4ceaf9edf107b163447da5 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 10 Nov 2023 13:14:34 +0100 Subject: [PATCH] Move LYX_(BEGIN|END)_MUTE_GCC_WARNING macros to their own header. It was not nice to other build systems to define that in configure.ac. --- configure.ac | 26 -------------------------- src/Mover.h | 1 + src/WordList.h | 1 + src/frontends/FontMetrics.h | 2 ++ src/frontends/qt/GuiApplication.cpp | 1 + src/support/Makefile.am | 1 + 6 files changed, 6 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 6688cbfb94..d93bf4eb36 100644 --- a/configure.ac +++ b/configure.ac @@ -313,32 +313,6 @@ char * strerror(int n); # define USE_WCHAR_T #endif -#if defined(__GNUC__) && !defined(__clang__) -/* This macro can be used to stipulate that a given GCC warning is not - * relevant in a given block. - * - * The -Wpragmas bit takes care of the case where -W is not implemented - * - * The idea for PRAGMA_IGNORE has been stolen from - * https://stackoverflow.com/questions/45762357/how-to-concatenate-strings-in-the-arguments-of-pragma#comment124444258_45783809 - * The difficulty is to put the value inside nested quotes; it is done - * using nested macros. - */ -# define PRAGMA_IGNORE(x) PRAGMA_IGNORE_1(-W##x) -# define PRAGMA_IGNORE_1(x) PRAGMA_IGNORE_2(#x) -# define PRAGMA_IGNORE_2(x) PRAGMA_IGNORE_3(GCC diagnostic ignored x) -# define PRAGMA_IGNORE_3(x) _Pragma(#x) -# define LYX_BEGIN_MUTE_GCC_WARNING(warn) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wpragmas\"") \ - PRAGMA_IGNORE(warn) -# define LYX_END_MUTE_GCC_WARNING \ - _Pragma("GCC diagnostic pop") -#else -# define LYX_BEGIN_MUTE_GCC_WARNING(warn) -# define LYX_END_MUTE_GCC_WARNING -#endif - #endif ]) diff --git a/src/Mover.h b/src/Mover.h index 1cd3698e72..bfddd95a30 100644 --- a/src/Mover.h +++ b/src/Mover.h @@ -15,6 +15,7 @@ #include #include +#include "support/mute_warning.h" namespace lyx { diff --git a/src/WordList.h b/src/WordList.h index 9819a31bbe..9c2eaf1b8e 100644 --- a/src/WordList.h +++ b/src/WordList.h @@ -13,6 +13,7 @@ #define WORDLIST_H #include "support/docstring.h" +#include "support/mute_warning.h" #include diff --git a/src/frontends/FontMetrics.h b/src/frontends/FontMetrics.h index c1b7e028eb..c9a1d86cda 100644 --- a/src/frontends/FontMetrics.h +++ b/src/frontends/FontMetrics.h @@ -14,6 +14,8 @@ #ifndef FONT_METRICS_H #define FONT_METRICS_H + +#include "support/mute_warning.h" #include "support/strfwd.h" #include diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp index 44b4278be6..26288a5f55 100644 --- a/src/frontends/qt/GuiApplication.cpp +++ b/src/frontends/qt/GuiApplication.cpp @@ -71,6 +71,7 @@ #include "support/lassert.h" #include "support/lstrings.h" #include "support/lyxalgo.h" // sorted +#include "support/mute_warning.h" #include "support/textutils.h" #include "support/Messages.h" #include "support/os.h" diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 925cb62d04..2c2fce5f46 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -85,6 +85,7 @@ liblyxsupport_a_SOURCES = \ lyxmagic.h \ lyxtime.cpp \ lyxtime.h \ + mute_warning.h \ mutex.h \ mutex.cpp \ Messages.cpp \ -- 2.39.5