Silence compiler warnings new with gcc 8.
authorWerner Koch <wk@gnupg.org>
Mon, 17 Dec 2018 17:46:26 +0000 (18:46 +0100)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 1 Jul 2022 16:06:43 +0000 (17:06 +0100)
* dirmngr/dns.c: Include gpgrt.h.  Silence -Warray-bounds also gcc.
* tests/gpgscm/scheme.c: Include gpgrt.h.
(Eval_Cycle): Ignore -Wimplicit-fallthrough.
--

The funny use of case and labels in the CASE macro seems confuse the
fallthrough detection.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 21fc089148678f59edb02e0e16bed65b709fb972)

Gbp-Pq: Topic from-2.2.13
Gbp-Pq: Name Silence-compiler-warnings-new-with-gcc-8.patch

dirmngr/dns.c
tests/gpgscm/scheme.c

index 77f83f4373acf0113b6191cf9e5a4b7b23b9bc0b..968fc3d7b9166360d95ef19e8ff14b97fbbaf8a0 100644 (file)
@@ -77,6 +77,7 @@ typedef int socket_fd_t;
 #include <netdb.h>             /* struct addrinfo */
 #endif
 
+#include "gpgrt.h"   /* For GGPRT_GCC_VERSION */
 #include "dns.h"
 
 
@@ -7521,9 +7522,13 @@ static unsigned char *dns_so_tcp_recv_buffer(struct dns_socket *so) {
 }
 
 
-#if defined __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warray-bounds"
+
+#if GPGRT_GCC_VERSION >= 80000
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Warray-bounds"
+#elif defined __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Warray-bounds"
 #endif
 
 static int dns_so_tcp_send(struct dns_socket *so) {
@@ -7589,8 +7594,10 @@ static int dns_so_tcp_recv(struct dns_socket *so) {
        return 0;
 } /* dns_so_tcp_recv() */
 
-#if __clang__
-#pragma clang diagnostic pop
+#if GPGRT_GCC_VERSION >= 80000
+# pragma GCC diagnostic pop
+#elif __clang__
+# pragma clang diagnostic pop
 #endif
 
 
index 4384841a7dbf764041aa8ca37b719ebb8dd5d60c..b188e36ce2a61a8169097c1de9e8f08a938b5e20 100644 (file)
@@ -44,6 +44,8 @@
 # endif
 #endif
 
+#include "gpgrt.h"   /* For GGPRT_GCC_VERSION */
+
 /* Used for documentation purposes, to signal functions in 'interface' */
 #define INTERFACE
 
@@ -3438,6 +3440,11 @@ int list_length(scheme *sc, pointer a) {
 
 \f
 
+#if GPGRT_GCC_VERSION >= 80000
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#endif
+
 #define s_retbool(tf)    s_return(sc,(tf) ? sc->T : sc->F)
 
 /* kernel of this interpreter */
@@ -5323,6 +5330,11 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
   }
 }
 
+#if GPGRT_GCC_VERSION >= 80000
+# pragma GCC diagnostic pop
+#endif
+
+
 typedef int (*test_predicate)(pointer);
 
 static int is_any(pointer p) {