-
Notifications
You must be signed in to change notification settings - Fork 682
Description
There are few compiler warnings that are issued when compiling the code using a newer gcc (GCC 7.2.1)
The patch provided fixes those for gcc 7 or newer.
Thanks
/hb-ot-shape-fallback.cc: In function ‘void position_mark(const hb_ot_shape_plan_t*, hb_font_t*, hb_buffer_t*, hb_glyph_extents_t&, unsigned int, unsigned int)’:
/hb-ot-shape-fallback.cc:223:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
} else if (buffer->props.direction == HB_DIRECTION_RTL) {
^~
/hb-ot-shape-fallback.cc:229:5: note: here
default:
^~~~~~~
/hb-ot-shape-fallback.cc:261:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
base_extents.height -= y_gap;
~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/hb-ot-shape-fallback.cc:264:5: note: here
case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
^~~~
/hb-ot-shape-fallback.cc:282:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
base_extents.height -= y_gap;
~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/hb-ot-shape-fallback.cc:285:5: note: here
case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
^~~~
diff --git a/src/hb-private.hh b/src/hb-private.hh
index eba797c..1719f51 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -161,6 +161,9 @@ extern "C" void hb_free_impl(void *ptr);
*/
# include <sal.h>
# define HB_FALLTHROUGH __fallthrough
+#elif __GNUC__ >= 7
+ /* GNU fallthrough attribute is available from GCC7 */
+# define HB_FALLTHROUGH __attribute__((fallthrough))
#else
# define HB_FALLTHROUGH /* FALLTHROUGH */
#endif