Skip to content

Add "nonstring" attribute to hostmot2.h: rtapi_u8 board_name[8]; // ascii string, but not NULL terminated! #3698

@smoe

Description

@smoe
hal/drivers/mesa-hostmot2/llio_info.c:173:31: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
  173 |                 .board_name = "MESA7C80",
      |                               ^~~~~~~~~~
hal/drivers/mesa-hostmot2/llio_info.c:184:31: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
  184 |                 .board_name = "MESA7C81",
      |                               ^~~~~~~~~~
hal/drivers/mesa-hostmot2/llio_info.c:195:31: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
  195 |                 .board_name = "MESA7I90",
      |                               ^~~~~~~~~~
hal/drivers/mesa-hostmot2/llio_info.c:206:31: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
  206 |                 .board_name = "MESA7I43"

and indeed

hal/drivers/mesa-hostmot2/hostmot2.h:    rtapi_u8 board_name[8];  // ascii string, but not NULL terminated!

I suggest to follow the advice and add the https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#nonstring .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions