[PATCH] Removes build time warning for all smp-disabled bsps

Richi Dubey richidubey at gmail.com
Fri Apr 24 13:28:34 UTC 2020


Dear Dr. Bloom,

Thanks for your suggestion. Yes, indeed this looks a little bad.

Please find the below attached new patch for the same. I have rebuilt
the leon3 bsp with this change and the build process was successful
without any errors. Also, I have added another patch which I had some
doubts on, please check it out.

----------------------------------------------------------------------------------------------------------------------
>From 4b5dc1d3dcb3319f51effeb3c9789d5e518311c0 Mon Sep 17 00:00:00 2001
From: Richi Dubey <richidubey at gmail.com>
Date: Fri, 24 Apr 2020 18:19:31 +0530
Subject: [PATCH 2/2] This removes the warning unused name variable warning

---
 testsuites/sptests/sp37/init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c
index 22c7d4f2ef..4358e9fffb 100644
--- a/testsuites/sptests/sp37/init.c
+++ b/testsuites/sptests/sp37/init.c
@@ -169,9 +169,9 @@ static void test_isr_level( void )

 static void test_isr_locks( void )
 {
-  static const char name[] = "test";
+
   ISR_Level normal_interrupt_level = _ISR_Get_level();
-  ISR_lock_Control initialized = ISR_LOCK_INITIALIZER( name );
+  ISR_lock_Control initialized = ISR_LOCK_INITIALIZER( "test" );
   ISR_lock_Control zero_initialized;
   union {
     ISR_lock_Control lock;
@@ -183,7 +183,7 @@ static void test_isr_locks( void )
   ISR_Level interrupt_level;

   memset( &container, 0xff, sizeof( container ) );
-  _ISR_lock_Initialize( &container.lock, name );
+  _ISR_lock_Initialize( &container.lock, "test" );
   bytes = (const uint8_t *) &initialized;

   for ( i = 0; i < sizeof( container ); ++i ) {
@@ -193,7 +193,7 @@ static void test_isr_locks( void )
   }

   memset( &zero_initialized, 0, sizeof( zero_initialized ) );
-  _ISR_lock_Set_name( &zero_initialized, name );
+  _ISR_lock_Set_name( &zero_initialized, "test" );
   bytes = (const uint8_t *) &zero_initialized;

   for ( i = 0; i < sizeof( container ); ++i ) {
-- 
2.17.1




On Thu, Apr 23, 2020 at 11:42 PM Gedare Bloom <gedare at rtems.org> wrote:
>
> 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 <richidubey at 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 <richidubey at 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 at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list