RTEMS | cpukit/include/rtems/score/basedefs.h: Add RTEMS_FALL_THROUGH() (!730)
Joel Sherrill (@joel)
gitlab at rtems.org
Thu Sep 18 22:02:11 UTC 2025
Joel Sherrill commented on a discussion on cpukit/include/rtems/score/basedefs.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/730#note_131223
> + *
> + * @brief This macro expands to a fall through hint.
> + *
> + * In C switch statement, it is possible for one case to "fall through"
> + * to the next. Until C23, there was no standard way for the programmer
> + * to tell the compiler this was intentional. Many times, not having
> + * a "break" statement is an error. This macro standardizes the hint
> + * for RTEMS source code.
> + *
> + * @note GCC recognizes many comment strings with "fall through" as
> + * a hint. But a cpp macro cannot insert a comment.
> + */
> +#if __STDC_VERSION__ >= 202311L
> + #define RTEMS_FALL_THROUGH() [[fallthrough]]
> +#elif __GNUC__
> + #define RTEMS_FALL_THROUGH() __attribute__ ((fallthrough))
Because other macros in this file did the same. RTEMS_UNREACHABLE is one example.
I initially did it without () and the uses looked off because it was "RTEMS_FALL_THROUGH;"
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/730#note_131223
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250918/cfcc907c/attachment-0001.htm>
More information about the bugs
mailing list