INN commit: trunk (4 files)

INN Commit rra at isc.org
Mon Jan 4 21:14:28 UTC 2021


    Date: Monday, January 4, 2021 @ 13:14:28
  Author: iulius
Revision: 10490

Silent a few gcc warnings

Found with gcc 5.5.0 on Solaris 11.

Modified:
  trunk/frontends/ovdb_monitor.c
  trunk/frontends/ovdb_server.c
  trunk/innfeed/configfile.l
  trunk/lib/snprintf.c

--------------------------+
 frontends/ovdb_monitor.c |    2 +-
 frontends/ovdb_server.c  |    2 +-
 innfeed/configfile.l     |    4 +++-
 lib/snprintf.c           |   23 ++++++-----------------
 4 files changed, 11 insertions(+), 20 deletions(-)

Modified: frontends/ovdb_monitor.c
===================================================================
--- frontends/ovdb_monitor.c	2021-01-04 21:12:44 UTC (rev 10489)
+++ frontends/ovdb_monitor.c	2021-01-04 21:14:28 UTC (rev 10490)
@@ -50,7 +50,7 @@
         syswarn("cannot open %s", path);
 	return -1;
     }
-    snprintf(buf, sizeof(buf), "%d\n", getpid());
+    snprintf(buf, sizeof(buf), "%ld\n", (long) getpid());
     if(write(fd, buf, strlen(buf)) < 0) {
         syswarn("cannot write to %s", path);
 	close(fd);

Modified: frontends/ovdb_server.c
===================================================================
--- frontends/ovdb_server.c	2021-01-04 21:12:44 UTC (rev 10489)
+++ frontends/ovdb_server.c	2021-01-04 21:14:28 UTC (rev 10490)
@@ -137,7 +137,7 @@
         syswarn("cannot open %s", path);
         return -1;
     }
-    snprintf(buf, sizeof(buf), "%d\n", getpid());
+    snprintf(buf, sizeof(buf), "%ld\n", (long) getpid());
     if(write(fd, buf, strlen(buf)) < 0) {
         syswarn("cannot write to %s", path);
         close(fd);

Modified: innfeed/configfile.l
===================================================================
--- innfeed/configfile.l	2021-01-04 21:12:44 UTC (rev 10489)
+++ innfeed/configfile.l	2021-01-04 21:14:28 UTC (rev 10490)
@@ -28,7 +28,9 @@
    that, and it's fixed in current flex, so just suppress the warning.
    Same thing for a possible NULL pointer dereference. */
 #pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wnull-dereference"
+#if __GNUC__ > 5
+# pragma GCC diagnostic ignored "-Wnull-dereference"
+#endif
 
 /* Some versions of flex (such as 2.5.35) declare twice isatty. */
 #pragma GCC diagnostic ignored "-Wredundant-decls"

Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c	2021-01-04 21:12:44 UTC (rev 10489)
+++ lib/snprintf.c	2021-01-04 21:14:28 UTC (rev 10490)
@@ -38,17 +38,6 @@
 #    endif
 #endif
 
-/*
- * Older Clang doesn't support __attribute__((fallthrough)) properly and
- * complains about the empty statement that it is decorating.  Suppress that
- * warning.  Also suppress warnings about unknown attributes to handle older
- * Clang versions.
- */
-#if !defined(__attribute__) && (defined(__llvm__) || defined(__clang__))
-#    pragma GCC diagnostic ignored "-Wattributes"
-#    pragma GCC diagnostic ignored "-Wmissing-declarations"
-#endif
-
 /* Specific to rra-c-util, but only when debugging is enabled. */
 #ifdef DEBUG_SNPRINTF
 # include "inn/messages.h"
@@ -390,9 +379,9 @@
 	break;
       case 'X':
 	flags |= DP_F_UP;
-        __attribute__((fallthrough));
-        /* fall through */
+        goto fallthrough1;
       case 'x':
+      fallthrough1:
 	flags |= DP_F_UNSIGNED;
 	if (cflags == DP_C_SHORT)
 	  value = (unsigned short int) va_arg (args, unsigned int);
@@ -413,9 +402,9 @@
 	break;
       case 'E':
 	flags |= DP_F_UP;
-        __attribute__((fallthrough));
-        /* fall through */
+        goto fallthrough2;
       case 'e':
+      fallthrough2:
 	if (cflags == DP_C_LDOUBLE)
 	  fvalue = va_arg (args, LDOUBLE);
 	else
@@ -424,9 +413,9 @@
 	break;
       case 'G':
 	flags |= DP_F_UP;
-        __attribute__((fallthrough));
-        /* fall through */
+        goto fallthrough3;
       case 'g':
+      fallthrough3:
         flags |= DP_F_FP_G;
 	if (cflags == DP_C_LDOUBLE)
 	  fvalue = va_arg (args, LDOUBLE);



More information about the inn-committers mailing list