From 7f8e5122eded387199c2401b728a77eac9f4a02d Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Mon, 24 Jun 2024 12:57:45 -0700 Subject: [PATCH] Use C++17 [[fallthrough]] in 1 file inc ../xplat/hermes/external/dtoa/dtoa.c Reviewed By: dmm-fb Differential Revision: D58818995 fbshipit-source-id: a8ee9833fd47f5b72f8f02387fe8ee64c4aebeac --- external/dtoa/dtoa.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/external/dtoa/dtoa.c b/external/dtoa/dtoa.c index 3ee602b087f..0483d728142 100644 --- a/external/dtoa/dtoa.c +++ b/external/dtoa/dtoa.c @@ -177,6 +177,17 @@ * used for input more than STRTOD_DIGLIM digits long (default 40). */ +#if defined __has_attribute + #if __has_attribute(fallthrough) + #define FALLTHROUGH __attribute__ ((fallthrough)) + #else + #define FALLTHROUGH (void)0 + #endif +#else + #define FALLTHROUGH (void)0 +#endif + + #ifndef Long #define Long long #endif @@ -2575,11 +2586,11 @@ _hermes_g_strtod for(s = s00;;s++) switch(*s) { case '-': sign = 1; - /* no break */ + FALLTHROUGH; case '+': if (*++s) goto break2; - /* no break */ + FALLTHROUGH; case 0: goto ret0; case '\t': @@ -2687,6 +2698,7 @@ _hermes_g_strtod switch(c = *++s) { case '-': esign = 1; + FALLTHROUGH; case '+': c = *++s; }