From 00fe44fc71a5ebfb1302d35a68db4c096b706e88 Mon Sep 17 00:00:00 2001 From: Projectitis Date: Sat, 2 Oct 2021 12:38:09 +1300 Subject: [PATCH] Portable fallthrough attribute --- src/lib/gl_engine/tvgGlGeometry.cpp | 2 +- src/lib/tvgCommon.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/gl_engine/tvgGlGeometry.cpp b/src/lib/gl_engine/tvgGlGeometry.cpp index 0b9c7afa..8d2dc677 100644 --- a/src/lib/gl_engine/tvgGlGeometry.cpp +++ b/src/lib/gl_engine/tvgGlGeometry.cpp @@ -80,7 +80,7 @@ bool GlGeometry::decomposeOutline(const Shape& shape) mPrimitives.push_back(GlPrimitive()); curPrimitive = &mPrimitives.back(); } - __attribute__ ((fallthrough)); + TVG_FALLTHROUGH case PathCommand::LineTo: { if (curPrimitive) addPoint(*curPrimitive, pts[0], min, max); pts++; diff --git a/src/lib/tvgCommon.h b/src/lib/tvgCommon.h index 9389156a..a2256803 100644 --- a/src/lib/tvgCommon.h +++ b/src/lib/tvgCommon.h @@ -37,6 +37,16 @@ using namespace tvg; #define TVG_UNUSED __attribute__ ((__unused__)) #endif +// Portable 'fallthrough' attribute +#if __has_cpp_attribute(fallthrough) + #ifdef _MSC_VER + #define TVG_FALLTHROUGH [[fallthrough]]; + #else + #define TVG_FALLTHROUGH __attribute__ ((fallthrough)); + #endif +#else + #define TVG_FALLTHROUGH +#endif //TVG class identifier values #define TVG_CLASS_ID_UNDEFINED 0