diff --git a/builder/yajl-c.c b/builder/yajl-c.c index 67de09318..6b7594372 100644 --- a/builder/yajl-c.c +++ b/builder/yajl-c.c @@ -31,7 +31,9 @@ /* GCC can't work out that the YAJL_IS_ test is sufficient to * ensure that YAJL_GET_ later doesn't return NULL. */ +#if defined(__GNUC__) && __GNUC__ >= 6 /* gcc >= 6 */ #pragma GCC diagnostic ignored "-Wnull-dereference" +#endif #define Val_none (Val_int (0)) diff --git a/daemon/debug.c b/daemon/debug.c index 864812079..da4cfc8be 100644 --- a/daemon/debug.c +++ b/daemon/debug.c @@ -990,7 +990,9 @@ do_internal_rhbz914931 (int count) } #pragma GCC diagnostic push +#if defined(__GNUC__) && GUESTFS_GCC_VERSION >= 60000 /* gcc >= 6 */ #pragma GCC diagnostic ignored "-Wnull-dereference" +#endif static void deliberately_cause_a_segfault (void) diff --git a/daemon/ldm.c b/daemon/ldm.c index 25ca95206..8ad2fb33b 100644 --- a/daemon/ldm.c +++ b/daemon/ldm.c @@ -35,7 +35,9 @@ /* GCC can't work out that the YAJL_IS_ test is sufficient to * ensure that YAJL_GET_ later doesn't return NULL. */ +#if defined(__GNUC__) && GUESTFS_GCC_VERSION >= 60000 /* gcc >= 6 */ #pragma GCC diagnostic ignored "-Wnull-dereference" +#endif GUESTFSD_EXT_CMD(str_ldmtool, ldmtool); diff --git a/p2v/gui.c b/p2v/gui.c index e5f026f5d..58310bf05 100644 --- a/p2v/gui.c +++ b/p2v/gui.c @@ -69,7 +69,9 @@ /* errors in */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#if defined(__GNUC__) && __GNUC__ >= 6 /* gcc >= 6 */ #pragma GCC diagnostic ignored "-Wshift-overflow" +#endif #include #pragma GCC diagnostic pop diff --git a/p2v/main.c b/p2v/main.c index adbee9fae..36cf16fa1 100644 --- a/p2v/main.c +++ b/p2v/main.c @@ -36,7 +36,9 @@ /* errors in */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#if defined(__GNUC__) && __GNUC__ >= 6 /* gcc >= 6 */ #pragma GCC diagnostic ignored "-Wshift-overflow" +#endif #include #pragma GCC diagnostic pop