diff oct-conf-post.in.h @ 23826:d69021d58a61

avoid fallthrough warnings * oct-conf-post.in.h (OCTAVE_FALLTHROUGH): New macro. * mk-octave-config-h.sh: Emit OCTAVE_FALLTROUGH definition. * balance.cc, find.cc, gcd.cc, quad.cc, qz.cc, ov-classdef.cc, DASPK.cc, lo-utils.cc: Use OCTAVE_FALLTHROUGH to avoid warnings.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Aug 2017 17:16:19 -0400
parents 08036a7f3660
children 194eb4bd202b
line wrap: on
line diff
--- a/oct-conf-post.in.h	Wed Aug 02 16:11:44 2017 -0400
+++ b/oct-conf-post.in.h	Wed Aug 02 17:16:19 2017 -0400
@@ -50,6 +50,16 @@
 #  define OCTAVE_UNUSED
 #endif
 
+#if ! defined (OCTAVE_FALLTHROUGH)
+#  if defined (__cplusplus) && __cplusplus > 201402L
+#    define OCTAVE_FALLTHROUGH [[fallthrough]]
+#  elif defined (__GNUC__) && __GNUC__ < 7
+#    define OCTAVE_FALLTHROUGH ((void) 0)
+#  else
+#    define OCTAVE_FALLTHROUGH __attribute__ ((__fallthrough__))
+#  endif
+#endif
+
 /* This macro could have a better name...  It is intended to be used
    only to enable inline functions or typedefs that provide access to
    symbols that have been moved to the octave namespace.  It may be