summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-01-31 15:06:21 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-01-31 15:06:21 +0100
commit65a798f9a237f149d5c320697440fd9cb030f460 (patch)
tree7ecc88ff03fb6f86e7273bd84d08072bc2dd2cea
parenta71c5f4c10089cfc749df0869bd5fec253655d59 (diff)
Disable X11 "deprecated declaration" warning
... for GCC >= 4.6 and clang compilers. This annoying warning exists on X11 (Linux/Unix/macOS) platforms because we need to use XKeycodeToKeysym() although it is deprecated. See STR 2913 for discussion and details.
-rw-r--r--src/Fl_x.cxx28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 59c442ed5..79110fba1 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1254,14 +1254,36 @@ static long getIncrData(uchar* &data, const XSelectionEvent& selevent, long lowe
return (long)total;
}
-/* Internal function to reduce "deprecated" warnings for XKeycodeToKeysym().
- This way we get only one warning. The option to use XkbKeycodeToKeysym()
- instead would not help much - see STR #2913 for more information.
+/*
+ Internal function to reduce "deprecated" warnings for XKeycodeToKeysym().
+ This way we get at most one warning. The option to use XkbKeycodeToKeysym()
+ instead would not help much - see STR #2913 for more information.
+
+ Update (Jan 31, 2020): disable "deprecated declaration" warnings in
+ this function for GCC >= 4.6 and clang (all versions) to get rid of
+ these warnings at least for current GCC and clang compilers.
+
+ Note: '#pragma GCC diagnostic push' needs at least GCC 4.6.
*/
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
static KeySym fl_KeycodeToKeysym(Display *d, KeyCode k, unsigned i) {
return XKeycodeToKeysym(d, k, i);
}
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
+#pragma GCC diagnostic pop
+#endif
+
+#pragma clang diagnostic push
+
#if USE_XRANDR
static void react_to_screen_reconfiguration() {
#if USE_XFT