Portable fallthrough attribute

This commit is contained in:
Projectitis 2021-10-02 12:38:09 +13:00 committed by Hermet Park
parent 919b002068
commit 00fe44fc71
2 changed files with 11 additions and 1 deletions

View file

@ -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++;

View file

@ -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