From 7ec08391fee73d7a25855089f4996f3c4f448007 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 4 Oct 2019 09:22:04 +0200 Subject: linkersets: Avoid use of zero-length array Use RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION() instead. --- cpukit/include/rtems/linkersets.h | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/cpukit/include/rtems/linkersets.h b/cpukit/include/rtems/linkersets.h index bad046999c..4a23d7a696 100644 --- a/cpukit/include/rtems/linkersets.h +++ b/cpukit/include/rtems/linkersets.h @@ -28,14 +28,19 @@ extern "C" { _Linker_set_##set##_end #define RTEMS_LINKER_ROSET_DECLARE( set, type ) \ - extern type const RTEMS_LINKER_SET_BEGIN( set )[0]; \ - extern type const RTEMS_LINKER_SET_END( set )[0] + extern type const RTEMS_LINKER_SET_BEGIN( set )[]; \ + extern type const RTEMS_LINKER_SET_END( set )[] #define RTEMS_LINKER_ROSET( set, type ) \ - type const RTEMS_LINKER_SET_BEGIN( set )[0] \ - RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \ - type const RTEMS_LINKER_SET_END( set )[0] \ - RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED + RTEMS_LINKER_ROSET_DECLARE( set, type ); \ + RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \ + RTEMS_LINKER_SET_BEGIN( set ), \ + ".rtemsroset." #set ".begin" \ + ); \ + RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \ + RTEMS_LINKER_SET_END( set ), \ + ".rtemsroset." #set ".end" \ + ) #define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \ extern type const _Linker_set_##set##_##item @@ -59,14 +64,19 @@ extern "C" { RTEMS_SECTION( ".rtemsroset." #set ".content" ) #define RTEMS_LINKER_RWSET_DECLARE( set, type ) \ - extern type RTEMS_LINKER_SET_BEGIN( set )[0]; \ - extern type RTEMS_LINKER_SET_END( set )[0] + extern type RTEMS_LINKER_SET_BEGIN( set )[]; \ + extern type RTEMS_LINKER_SET_END( set )[] #define RTEMS_LINKER_RWSET( set, type ) \ - type RTEMS_LINKER_SET_BEGIN( set )[0] \ - RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \ - type RTEMS_LINKER_SET_END( set )[0] \ - RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED + RTEMS_LINKER_RWSET_DECLARE( set, type ); \ + RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \ + RTEMS_LINKER_SET_BEGIN( set ), \ + ".rtemsrwset." #set ".begin" \ + ); \ + RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION( \ + RTEMS_LINKER_SET_END( set ), \ + ".rtemsrwset." #set ".end" \ + ) #define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \ extern type _Linker_set_##set##_##item -- cgit v1.2.3