]> eyrie.org Git - kerberos/pam-krb5.git/commitdiff
Suppress fallthrough warnings with clang 10
authorRuss Allbery <rra@debian.org>
Sun, 29 Mar 2020 04:28:38 +0000 (21:28 -0700)
committerRuss Allbery <rra@debian.org>
Sun, 29 Mar 2020 04:28:38 +0000 (21:28 -0700)
clang 10 (and possibly clang 9) requires an __attribute__ marker
to suppress fallthrough warnings and no longer supports a special
comment.  Adjust portable/snprintf.c accordingly.

portable/snprintf.c

index 1128b2fa489fb93878b9bde7597b052e7f6d3c42..9c94451064321ebb44d0a152f04c2efd7a68e1a9 100644 (file)
 # define vsnprintf test_vsnprintf
 #endif
 
+/*
+ * __attribute__ is available in gcc 2.5 and later, but only with gcc 2.7
+ * could you use the __format__ form of the attributes, which is what we use
+ * (to avoid confusion with other macros).
+ */
+#ifndef __attribute__
+#    if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#        define __attribute__(spec) /* empty */
+#    endif
+#endif
+
 /* Specific to rra-c-util, but only when debugging is enabled. */
 #ifdef DEBUG_SNPRINTF
 # include <util/messages.h>
@@ -366,7 +377,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
        break;
       case 'X':
        flags |= DP_F_UP;
-        /* fallthrough */
+        __attribute__((fallthrough));
       case 'x':
        flags |= DP_F_UNSIGNED;
        if (cflags == DP_C_SHORT)
@@ -388,7 +399,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
        break;
       case 'E':
        flags |= DP_F_UP;
-        /* fallthrough */
+        __attribute__((fallthrough));
       case 'e':
        if (cflags == DP_C_LDOUBLE)
          fvalue = va_arg (args, LDOUBLE);
@@ -398,7 +409,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
        break;
       case 'G':
        flags |= DP_F_UP;
-        /* fallthrough */
+        __attribute__((fallthrough));
       case 'g':
         flags |= DP_F_FP_G;
        if (cflags == DP_C_LDOUBLE)