INN commit: trunk (lib/snprintf.c tests/runtests.c)

INN Commit rra at isc.org
Mon May 29 20:22:54 UTC 2017


    Date: Monday, May 29, 2017 @ 13:22:53
  Author: iulius
Revision: 10145

Update from upstream rra-c-util and C TAP Harness

Fix new warnings in GCC 7

Modified:
  trunk/lib/snprintf.c
  trunk/tests/runtests.c

------------------+
 lib/snprintf.c   |   14 +++++++++++++-
 tests/runtests.c |    1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c	2017-05-23 20:32:41 UTC (rev 10144)
+++ lib/snprintf.c	2017-05-29 20:22:53 UTC (rev 10145)
@@ -81,6 +81,7 @@
  *    fixed return value to comply with C99
  *    fixed handling of snprintf(NULL, ...)
  *    added explicit casts for double to long long int conversion
+ *    fixed various warnings with GCC 7
  *
  *  Hrvoje Niksic <hniksic at arsdigita.com> 2000-11-04
  *    include <stdio.h> for NULL.
@@ -353,6 +354,7 @@
 	break;
       case 'X':
 	flags |= DP_F_UP;
+        /* fallthrough */
       case 'x':
 	flags |= DP_F_UNSIGNED;
 	if (cflags == DP_C_SHORT)
@@ -374,6 +376,7 @@
 	break;
       case 'E':
 	flags |= DP_F_UP;
+        /* fallthrough */
       case 'e':
 	if (cflags == DP_C_LDOUBLE)
 	  fvalue = va_arg (args, LDOUBLE);
@@ -383,6 +386,7 @@
 	break;
       case 'G':
 	flags |= DP_F_UP;
+        /* fallthrough */
       case 'g':
         flags |= DP_F_FP_G;
 	if (cflags == DP_C_LDOUBLE)
@@ -614,7 +618,7 @@
   return result;
 }
 
-static LLONG pow10_int (int exp)
+static LLONG pow10_int (unsigned int exp)
 {
   LDOUBLE result = 1;
 
@@ -639,6 +643,14 @@
   return intpart;
 }
 
+/*
+ * GCC 7.1 issues this warning at the point of the function definition header
+ * (not in any actual code), and I can't figure out what's triggering it since
+ * the comparison form doesn't appear anywhere in this code.  Since this is
+ * rarely-used portability code, suppress the warning.
+ */
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+
 static int fmtfp (char *buffer, size_t *currlen, size_t maxlen,
 		  LDOUBLE fvalue, int min, int max, int flags)
 {

Modified: tests/runtests.c
===================================================================
--- tests/runtests.c	2017-05-23 20:32:41 UTC (rev 10144)
+++ tests/runtests.c	2017-05-29 20:22:53 UTC (rev 10145)
@@ -546,6 +546,7 @@
         /* Now, exec our process. */
         if (execl(path, path, (char *) 0) == -1)
             _exit(CHILDERR_EXEC);
+        break;
 
     /* In parent.  Close the extra file descriptor. */
     default:



More information about the inn-committers mailing list