Re: [PATCH 06/61] xfs: Fix fall-through warnings for Clang
From: Eric Sandeen <hidden>
Date: 2021-10-01 19:57:39
On 9/15/21 6:07 PM, Darrick J. Wong wrote:
I'd like to wrap this in
#ifdef __has_attribute
(with another else to define it away) so we don't have any gcc version surprises.
Ok? (yes, yes, old gcc yuck but would rather not break it if we don't have to)
#if defined __has_attribute
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# else
# define fallthrough do {} while (0) /* fallthrough */
# endif
#else
# define fallthrough do {} while (0) /* fallthrough */
#endif
Unless there's objection I'll do that before I merge it.
(note, can't do #if defined __has_attribute && __has_attribute(), as shown at
https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html)
Thanks,
-Eric
+#if __has_attribute(__fallthrough__)
+# define fallthrough __attribute__((__fallthrough__))
+#else
+# define fallthrough do {} while (0) /* fallthrough */
+#endif