Skip to content

Commit 74e7ea5

Browse files
authored
Merge pull request #3912 from BsAtHome/fix_clang-attr-nonstring
build: Need clang 21+ for nonstring attribute
2 parents c7be441 + 1166565 commit 74e7ea5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/hal/drivers/mesa-hostmot2/hostmot2.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,18 @@
140140
// IDROM and MD structs
141141
//
142142

143+
// Need clang 21+ for the nonstring attribute
144+
#if !defined(__clang__) || (defined(__clang_major__) && __clang_major__ >= 21)
145+
#define HM2_ATTRIBUTE_NONSTRING __attribute__((nonstring))
146+
#else
147+
#define HM2_ATTRIBUTE_NONSTRING
148+
#endif
143149

144150
typedef struct {
145151
rtapi_u32 idrom_type;
146152
rtapi_u32 offset_to_modules;
147153
rtapi_u32 offset_to_pin_desc;
148-
rtapi_u8 board_name[8] __attribute__ ((nonstring)); // ASCII string, but not NULL terminated!
154+
rtapi_u8 board_name[8] HM2_ATTRIBUTE_NONSTRING; // ASCII string, but not NULL terminated!
149155
rtapi_u32 fpga_size;
150156
rtapi_u32 fpga_pins;
151157
rtapi_u32 io_ports;

src/hal/drivers/mesa-hostmot2/llio_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "llio_info.h"
2727

2828
typedef struct __info_entry_t {
29-
char board_name[8] __attribute__ ((nonstring));
29+
char board_name[8] HM2_ATTRIBUTE_NONSTRING;
3030
const char *base_name;
3131
int num_ioport_connectors;
3232
int pins_per_connector;

0 commit comments

Comments
 (0)