summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-11 05:40:31 +0100
committerDavid Robillard <d@drobilla.net>2021-01-11 14:01:49 +0100
commita25ce7e9b8838c8e341c409aa85d44b55b448239 (patch)
tree1a1ba2c283570e08cba47ed02f04369c0d4378b6 /src
parent00e62c5b0298aacddae4c65a780e8fb551600782 (diff)
downloadsuil-a25ce7e9b8838c8e341c409aa85d44b55b448239.tar.gz
suil-a25ce7e9b8838c8e341c409aa85d44b55b448239.tar.bz2
suil-a25ce7e9b8838c8e341c409aa85d44b55b448239.zip
Suppress Gtk and Qt header warnings in code
Diffstat (limited to 'src')
-rw-r--r--src/cocoa_in_gtk2.mm3
-rw-r--r--src/gtk2_in_qt5.cpp5
-rw-r--r--src/qt5_in_gtk.cpp7
-rw-r--r--src/warnings.h73
-rw-r--r--src/win_in_gtk2.cpp3
-rw-r--r--src/x11_in_gtk2.c4
-rw-r--r--src/x11_in_gtk3.c4
-rw-r--r--src/x11_in_qt5.cpp3
8 files changed, 102 insertions, 0 deletions
diff --git a/src/cocoa_in_gtk2.mm b/src/cocoa_in_gtk2.mm
index d940d87..0bf9fe7 100644
--- a/src/cocoa_in_gtk2.mm
+++ b/src/cocoa_in_gtk2.mm
@@ -16,12 +16,15 @@
*/
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/options/options.h"
#include "lv2/urid/urid.h"
+SUIL_DISABLE_GTK_WARNINGS
#include <gdk/gdkquartz.h>
#include <gtk/gtk.h>
+SUIL_RESTORE_WARNINGS
#include <string.h>
diff --git a/src/gtk2_in_qt5.cpp b/src/gtk2_in_qt5.cpp
index ce32c10..69b4dce 100644
--- a/src/gtk2_in_qt5.cpp
+++ b/src/gtk2_in_qt5.cpp
@@ -18,23 +18,28 @@
#include "dylib.h"
#include "suil_config.h" // IWYU pragma: keep
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/core/lv2.h"
#include "suil/suil.h"
+SUIL_DISABLE_QT_WARNINGS
#include <QVBoxLayout>
#include <QWidget>
#include <QWindow>
#include <Qt>
#include <QtGui>
+SUIL_RESTORE_WARNINGS
#undef signals
+SUIL_DISABLE_GTK_WARNINGS
#include <gdk/gdk.h>
#include <glib-object.h>
#include <glib.h>
#include <gobject/gclosure.h>
#include <gtk/gtk.h>
+SUIL_RESTORE_WARNINGS
#include <cstdlib>
diff --git a/src/qt5_in_gtk.cpp b/src/qt5_in_gtk.cpp
index d657124..3699ae8 100644
--- a/src/qt5_in_gtk.cpp
+++ b/src/qt5_in_gtk.cpp
@@ -16,6 +16,7 @@
*/
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/core/lv2.h"
#include "lv2/options/options.h"
@@ -23,14 +24,18 @@
#include "lv2/urid/urid.h"
#include "suil/suil.h"
+SUIL_DISABLE_QT_WARNINGS
#include <QVBoxLayout>
#include <QWidget>
#include <QWindow>
#include <Qt>
#include <QtGui>
+SUIL_RESTORE_WARNINGS
#undef signals
+SUIL_DISABLE_GTK_WARNINGS
+
#include <glib-object.h>
#include <glib.h>
#include <gobject/gclosure.h>
@@ -40,6 +45,8 @@
# include <gtk/gtkx.h>
#endif
+SUIL_RESTORE_WARNINGS
+
#include <cstdlib>
#include <cstring>
diff --git a/src/warnings.h b/src/warnings.h
new file mode 100644
index 0000000..b7a03aa
--- /dev/null
+++ b/src/warnings.h
@@ -0,0 +1,73 @@
+/*
+ Copyright 2021 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#ifndef SUIL_WARNINGS_H
+#define SUIL_WARNINGS_H
+
+#if defined(__clang__)
+
+# define SUIL_DISABLE_GTK_WARNINGS \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Weverything\"")
+
+# define SUIL_DISABLE_QT_WARNINGS \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Weverything\"")
+
+# define SUIL_RESTORE_WARNINGS _Pragma("clang diagnostic pop")
+
+#elif defined(__GNUC__)
+
+# if defined(__cplusplus)
+# define SUIL_DISABLE_GTK_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
+ _Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
+ _Pragma("GCC diagnostic ignored \"-Wvolatile\"") \
+ _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
+# else
+# define SUIL_DISABLE_GTK_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wc++-compat\"") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
+ _Pragma("GCC diagnostic ignored \"-Wstrict-prototypes\"")
+# endif
+
+# define SUIL_DISABLE_QT_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wconversion\"") \
+ _Pragma("GCC diagnostic ignored \"-Wctor-dtor-privacy\"") \
+ _Pragma("GCC diagnostic ignored \"-Weffc++\"") \
+ _Pragma("GCC diagnostic ignored \"-Wmultiple-inheritance\"") \
+ _Pragma("GCC diagnostic ignored \"-Wnoexcept\"") \
+ _Pragma("GCC diagnostic ignored \"-Wredundant-tags\"") \
+ _Pragma("GCC diagnostic ignored \"-Wsign-promo\"") \
+ _Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
+ _Pragma("GCC diagnostic ignored \"-Wabi-tag\"") \
+ _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
+
+# define SUIL_RESTORE_WARNINGS _Pragma("GCC diagnostic pop")
+
+#else
+
+# define SUIL_DISABLE_GTK_WARNINGS
+# define SUIL_RESTORE_WARNINGS
+
+#endif
+
+#endif // SUIL_WARNINGS_H
diff --git a/src/win_in_gtk2.cpp b/src/win_in_gtk2.cpp
index 1a34dfa..14b82e8 100644
--- a/src/win_in_gtk2.cpp
+++ b/src/win_in_gtk2.cpp
@@ -15,12 +15,15 @@
*/
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/options/options.h"
#include "lv2/urid/urid.h"
+SUIL_DISABLE_GTK_WARNINGS
#include <gdk/gdkwin32.h>
#include <gtk/gtk.h>
+SUIL_RESTORE_WARNINGS
#ifndef WM_MOUSEWHEEL
# define WM_MOUSEWHEEL 0x020A
diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c
index 4553132..80eef1a 100644
--- a/src/x11_in_gtk2.c
+++ b/src/x11_in_gtk2.c
@@ -15,6 +15,7 @@
*/
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/core/lv2.h"
#include "lv2/options/options.h"
@@ -26,12 +27,15 @@
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+
+SUIL_DISABLE_GTK_WARNINGS
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <glib-object.h>
#include <glib.h>
#include <gobject/gclosure.h>
#include <gtk/gtk.h>
+SUIL_RESTORE_WARNINGS
#include <stdbool.h>
#include <stdint.h>
diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c
index 04927d8..c93f3dd 100644
--- a/src/x11_in_gtk3.c
+++ b/src/x11_in_gtk3.c
@@ -15,6 +15,7 @@
*/
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/core/lv2.h"
#include "lv2/options/options.h"
@@ -25,6 +26,8 @@
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+
+SUIL_DISABLE_GTK_WARNINGS
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <glib-object.h>
@@ -32,6 +35,7 @@
#include <gobject/gclosure.h>
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
+SUIL_RESTORE_WARNINGS
#include <stdbool.h>
#include <stdint.h>
diff --git a/src/x11_in_qt5.cpp b/src/x11_in_qt5.cpp
index b8c3f18..ba7f036 100644
--- a/src/x11_in_qt5.cpp
+++ b/src/x11_in_qt5.cpp
@@ -16,11 +16,13 @@
*/
#include "suil_internal.h"
+#include "warnings.h"
#include "lv2/core/lv2.h"
#include "lv2/ui/ui.h"
#include "suil/suil.h"
+SUIL_DISABLE_QT_WARNINGS
#include <QResizeEvent>
#include <QSize>
#include <QTimerEvent>
@@ -30,6 +32,7 @@
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+SUIL_RESTORE_WARNINGS
#include <cstdint>
#include <cstdlib>