From db588508842260d4f1333bd8b68058281007e612 Mon Sep 17 00:00:00 2001 From: Adrian Perez de Castro Date: Tue, 25 Apr 2023 03:12:20 -0700 Subject: [PATCH] REGRESSION(263331@main): [GTK] MiniBrowser cannot be built with clang due to fallthrough attribute https://bugs.webkit.org/show_bug.cgi?id=255915 Reviewed by Carlos Garcia Campos. * Tools/MiniBrowser/gtk/main.c: (parseFeaturesOptionCallback): Define and use a FALLTHROUGH macro depending on __GNUC__ and __has_attribute to maximize compiler compatibility. Canonical link: https://commits.webkit.org/263358@main --- Tools/MiniBrowser/gtk/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c index 363708820980..33e073bf84e8 100644 --- a/Tools/MiniBrowser/gtk/main.c +++ b/Tools/MiniBrowser/gtk/main.c @@ -43,6 +43,16 @@ #include #endif +#if !defined(FALLTHROUGH) && defined(__GNUC__) && defined(__has_attribute) +#if __has_attribute(fallthrough) +#define FALLTHROUGH __attribute__ ((fallthrough)) +#endif +#endif + +#if !defined(FALLTHROUGH) +#define FALLTHROUGH +#endif + #define MINI_BROWSER_ERROR (miniBrowserErrorQuark()) static const gchar **uriArguments = NULL; @@ -285,10 +295,10 @@ static gboolean parseFeaturesOptionCallback(const gchar *option, const gchar *va case '!': case '-': enabled = FALSE; - [[fallthrough]]; + FALLTHROUGH; case '+': item++; - [[fallthrough]]; + FALLTHROUGH; default: break; }