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.
This commit is contained in:
Albrecht Schlosser 2020-01-31 15:06:21 +01:00
parent a71c5f4c10
commit 65a798f9a2

View File

@ -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