[PATCH] Fix pedanic warnings without a storage increase

Joel Sherrill joel at rtems.org
Tue Aug 30 14:38:42 UTC 2022


On Tue, Aug 30, 2022 at 1:10 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Use RTEMS_ZERO_LENGTH_ARRAY for flexible array member.
>
> Update #4662.
> ---
>  cpukit/include/rtems/confdefs/scheduler.h      | 10 ++++++++++
>  cpukit/include/rtems/score/schedulerpriority.h |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/include/rtems/confdefs/scheduler.h
> b/cpukit/include/rtems/confdefs/scheduler.h
> index 84ca810fd7..8ac943921f 100644
> --- a/cpukit/include/rtems/confdefs/scheduler.h
> +++ b/cpukit/include/rtems/confdefs/scheduler.h
> @@ -234,7 +234,17 @@ extern "C" {
>  #endif
>
>  #ifdef CONFIGURE_SCHEDULER
> +  /*
> +   * Ignore these warnings:
> +   *
> +   * - invalid use of structure with flexible array member
> +   *
> +   * - struct has no members
> +   */
> +  #pragma GCC diagnostic push
> +  #pragma GCC diagnostic ignored "-Wpedantic"
>

This is heavy handed. -Warray-bounds should be enough.


>    CONFIGURE_SCHEDULER;
> +  #pragma GCC diagnostic pop
>  #endif
>
>  const Scheduler_Control _Scheduler_Table[] = {
> diff --git a/cpukit/include/rtems/score/schedulerpriority.h
> b/cpukit/include/rtems/score/schedulerpriority.h
> index e485e97c60..1325224fa9 100644
> --- a/cpukit/include/rtems/score/schedulerpriority.h
> +++ b/cpukit/include/rtems/score/schedulerpriority.h
> @@ -94,7 +94,7 @@ typedef struct {
>    /**
>     * @brief One ready queue per priority level.
>     */
> -  Chain_Control Ready[ 1 ];
> +  Chain_Control Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
>  } Scheduler_priority_Context;
>
>  /**
> --
> 2.35.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20220830/a26f9e4c/attachment.htm>


More information about the devel mailing list