Only add GCC diagnostic pragmas when compiler is GCC compatible

Avoid "unknown pragma" warnings on other compilers.

Signed-off-by: Ran Benita <ran@unusedvar.com>
master
Ran Benita 2019-12-27 15:03:10 +02:00
parent 40bea8e9fa
commit 670566f0d4
4 changed files with 14 additions and 4 deletions

View File

@ -17,8 +17,10 @@ print('''
entry_offsets = {} entry_offsets = {}
print(''' print('''
#ifdef __GNUC__
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverlength-strings" #pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
static const char *keysym_names = static const char *keysym_names =
'''.strip()) '''.strip())
offs = 0 offs = 0
@ -28,7 +30,9 @@ for (name, _) in sorted(entries, key=lambda e: e[0].lower()):
offs += len(name) + 1 offs += len(name) + 1
print(''' print('''
; ;
#ifdef __GNUC__
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
'''.strip()) '''.strip())
print(''' print('''

View File

@ -5,8 +5,10 @@
* https://raw.github.com/xkbcommon/libxkbcommon/master/src/ks_tables.h * https://raw.github.com/xkbcommon/libxkbcommon/master/src/ks_tables.h
*/ */
#ifdef __GNUC__
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverlength-strings" #pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
static const char *keysym_names = static const char *keysym_names =
"0\0" "0\0"
"1\0" "1\0"
@ -2417,7 +2419,9 @@ static const char *keysym_names =
"Zstroke\0" "Zstroke\0"
"zstroke\0" "zstroke\0"
; ;
#ifdef __GNUC__
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
struct name_keysym { struct name_keysym {
xkb_keysym_t keysym; xkb_keysym_t keysym;

View File

@ -26,7 +26,9 @@
#include "test.h" #include "test.h"
#include "context.h" #include "context.h"
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wmissing-format-attribute" #pragma GCC diagnostic ignored "-Wmissing-format-attribute"
#endif
static const char * static const char *
log_level_to_string(enum xkb_log_level level) log_level_to_string(enum xkb_log_level level)

View File

@ -111,11 +111,11 @@ SOFTWARE.
* When adding new keysyms to this file, do not forget to also update the * When adding new keysyms to this file, do not forget to also update the
* following as needed: * following as needed:
* *
* - the mappings in src/KeyBind.c in the repo * - the mappings in src/KeyBind.c in the libX11 repo
* git://anongit.freedesktop.org/xorg/lib/libX11.git * https://gitlab.freedesktop.org/xorg/lib/libx11
* *
* - the protocol specification in specs/keysyms.xml * - the protocol specification in specs/keysyms.xml in this repo
* in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git * https://gitlab.freedesktop.org/xorg/proto/xorgproto
* *
*/ */