[PATCH 42/59] Add fall-through between switch labels annotations

Florian Weimer fweimer@redhat.com
Fri Oct 17 21:09:35 GMT 2025


* Adhemerval Zanella:

> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
> index 215ff937ee..94d4cb852b 100644
> --- a/misc/sys/cdefs.h
> +++ b/misc/sys/cdefs.h
> @@ -883,4 +883,14 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
>  # define __attribute_struct_may_alias__
>  #endif
>  
> +/* Annotate fall-through switch labels to avoid error with
> +   -Wimplicit-fallthrough.  */
> +#ifndef FALLTHROUGH
> +# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
> +#  define __atribute_fallthrough__  __attribute__ ((__fallthrough__))
> +# else
> +#  define __atribute_fallthrough__  ((void) 0)
> +# endif
> +#endif

Typo: at[t]ribute

Can we use [[fallthrough]]; instead?  And maybe switch to
-Wimplicit-fallthrough=5 for the build?

Thanks,
Florian



More information about the Libc-alpha mailing list