Although this fixes the warning in the testsuite, it is hackish to require users to copy this kind of conditional compilation to their code, and I don't really like how it looks personally. I might prefer Joel's approach, but applied to the test, e.g.,
static const char name[] = "test"; (void) name; Alternatively, you might think about other approaches that might be more user-friendly. What about using ISR_LOCK_DEFINE() to declare the initializer variable? What about passing the string literal directly without a variable container? On Thu, Apr 23, 2020 at 7:23 AM Richi Dubey <richidu...@gmail.com> wrote: > > Hey everyone, > > I made this small change and rebuilt the leon32 bsp. It stopped > showing the earlier warnings: > > > log/sparc-leon3.log:../../../../../../rtems/c/src/../../testsuites/sptests/sp37/init.c:172:21: > warning: unused variable 'name' [-Wunused-variable] > log/sparc-leon3.log:../../../../../../rtems/c/src/../../testsuites/sptests/sp37/init.c:172:21: > warning: 'name' defined but not used [-Wunused-const-variable=] > > Can someone please check and let me know if this is correct and would > work or not. > > Thanks. > ------------------------------------------------------------ > > From c9eb205f37aa575a01ef446db3d7b4e34e1a1fae Mon Sep 17 00:00:00 2001 > From: Richi Dubey <richidu...@gmail.com> > Date: Thu, 23 Apr 2020 18:38:56 +0530 > Subject: [PATCH 2/2] Added smp check > > --- > testsuites/sptests/sp37/init.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c > index 22c7d4f2ef..3b79682fa1 100644 > --- a/testsuites/sptests/sp37/init.c > +++ b/testsuites/sptests/sp37/init.c > @@ -169,7 +169,9 @@ static void test_isr_level( void ) > > static void test_isr_locks( void ) > { > +#if defined( RTEMS_SMP ) > static const char name[] = "test"; > +#endif > ISR_Level normal_interrupt_level = _ISR_Get_level(); > ISR_lock_Control initialized = ISR_LOCK_INITIALIZER( name ); > ISR_lock_Control zero_initialized; > -- > 2.17.1 > > ---------------------------------------------- > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel