summaryrefslogtreecommitdiff
path: root/src/mpfr-impl.h
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-04-16 08:11:02 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-04-16 08:11:02 +0000
commit05c5b20719a2b459fc191bf15d27b9b96457aff6 (patch)
tree10c4d855d81514f96db86c75b20dc3b64687e74e /src/mpfr-impl.h
parentd0d12e55b5120dbe0a745e28332140f392362860 (diff)
downloadmpfr-05c5b20719a2b459fc191bf15d27b9b96457aff6.tar.gz
New macro MPFR_FALLTHROUGH to avoid -Wimplicit-fallthrough warnings
with GCC 7+. This macro also makes the code more readable by bringing the attention on an unusual fallthrough in a switch case. * src/mpfr-impl.h: define this macro. * src/vasprintf.c: use this macro in a case of fallthrough. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13467 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mpfr-impl.h')
-rw-r--r--src/mpfr-impl.h9
1 files changed, 9 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
+
/******************************************************