summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mpfr-impl.h9
-rw-r--r--src/vasprintf.c1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h
index 2500fc554..30c29a81a 100644
--- a/src/mpfr-impl.h
+++ b/src/mpfr-impl.h
@@ -197,6 +197,15 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_MAYBE_UNUSED
#endif
+/* This MPFR_FALLTHROUGH macro allows one to make fallthrough in switch case
+ explicit. Use this macro at the end of a switch case if it falls through,
+ in order to avoid a -Wimplicit-fallthrough warning. */
+#if __MPFR_GNUC(7,0)
+#define MPFR_FALLTHROUGH __attribute__ ((fallthrough))
+#else
+#define MPFR_FALLTHROUGH
+#endif
+
/******************************************************
diff --git a/src/vasprintf.c b/src/vasprintf.c
index 831452bbe..be7dd79c3 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -2167,6 +2167,7 @@ mpfr_vasnprintf_aux (char **ptr, char *Buf, size_t size, const char *fmt,
break;
case 'N':
++fmt;
+ MPFR_FALLTHROUGH;
default:
spec.rnd_mode = MPFR_RNDN;
}