On Tue, 2022-06-14 at 11:01 +0200, Philippe Gerum via Xenomai wrote:
> Julien Blanc <[email protected]> writes:
>
> > Le mardi 14 juin 2022 à 10:04 +0200, Philippe Gerum a écrit :
> > > Julien Blanc <
> > > [email protected]
> > > > writes:
> > >
> > > > Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
> > > > > Julien Blanc via Xenomai
> > > > > > #define __fallthrough __attribute__((fallthrough))
> > > > > >
> > > > >
> > > > > 6.39. attribute syntax
> > > > > https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
> > > > >
> > > > >
> > > >
> > > > Not sure what you mean with this link. The relevant attribute is
> > > > documented here:
> > > > https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
> > > >
> > > >
> > > > > PS: fixes go with patches.
> > > >
> > > > Indeed, but i'll let Russel do this one as i don't have the
> > > > opportunity
> > > > to test it right now.
> > > >
> > >
> > > The documentation (paragraph 6.39) states that "You may optionally
> > > specify attribute names with ‘__’ preceding and following the name.
> > > This allows you to use them in header files without being concerned
> > > about a possible macro of the same name. For example, you may use the
> > > attribute name __noreturn__ instead of noreturn.".
> > >
> > > This is generally used with C attributes as a precaution against
> > > namespace conflicts in the C language space. IOW, making a C++ parser
> > > happy is ok with me as long as this does not introduce potential
> > > issues down the road with regular C code.
> >
> > Missed that part, thanks. The issue here is thus not within the
> > attribute part, which can be either fallthrough or __fallthrough__, but
> > only in the macro name, which should be __fallthrough instead of just
> > fallthrough.
>
> Fine by me now, two remarks though: as Florian noted, this patch breaks
> all current users in libevl, plus a meaningful commit log explaining why
> such change is needed would helpful for reviewers.
> (e.g. fixing conflict with C++ [[fallthough]], and maybe at some point
> in the future with the C2X standard).
>
Based on the kernel's fallthrough, introducing evl_fallthrough would
avoid all kinds of conflicts (IMHO):
#ifndev evl_fallthrough
#if __has_attribute(__fallthrough__)
# define evl_fallthrough __attribute__((__fallthrough__))
#else
# define evl_fallthrough do {} while (0) /* fallthrough */
#endif
#endif
All evl internal users would have to be migrated.