Small doubt in a build time warning of sp test of leon3
Joel Sherrill
joel at rtems.org
Wed Apr 22 14:12:20 UTC 2020
On Wed, Apr 22, 2020 at 8:06 AM Richi Dubey <richidubey at gmail.com> wrote:
> Dear Dr. Joel,
>
> Thank you for your reply. I did a grep on the root rtems folder and I came
> to know that ISR_LOCK_INITIALIZER is being used by intr.h and isrlock.h
> inside leon3's include directory. It includes various macros like :
>
> #if defined( RTEMS_SMP )
> #define ISR_LOCK_INITIALIZER( _name ) \
>
> and
>
> #define RTEMS_INTERRUPT_LOCK_INITIALIZER( _name ) ISR_LOCK_INITIALIZER(
> _name )
>
> I couldn't find the implementation of the function ISR_LOCK_INITIALIZER(
> ) anywhere. Is there a isrlock.c present somewhere? I couldn't find any
> helpful references for RTEMS_INTERRUPT_LOCK_INITIALIZER too. Am i missing
> something?
>
If you are building without SMP enabled, then this should fix it. The
parameter _name is clearly not used unless you have SMP enabled. the code I
added is an accepted idiom for telling the compiler a variable or parameter
is used for its analysis purposes. Does this make sense?
diff --git a/cpukit/include/rtems/score/isrlock.h
b/cpukit/include/rtems/score/i
index 14ea88b..52645a3 100644
--- a/cpukit/include/rtems/score/isrlock.h
+++ b/cpukit/include/rtems/score/isrlock.h
@@ -147,7 +147,7 @@ typedef struct {
{ SMP_LOCK_INITIALIZER( _name ) }
#else
#define ISR_LOCK_INITIALIZER( _name ) \
- { }
+ { (void) (_name); }
#endif
/**
>
> Please let me know.
>
> Thanks,
> Richi.
>
>
>
> On Sun, Apr 19, 2020 at 10:52 PM Joel Sherrill <joel at rtems.org> wrote:
>
>>
>>
>> On Sun, Apr 19, 2020, 9:59 AM Richi Dubey <richidubey at gmail.com> wrote:
>>
>>> Hey everyone,
>>>
>>> In the Covid Code-in update by Dr. Joel, he mentioned that the RTEMS
>>> could use some help to remove warnings from the code. In the link(
>>> https://ftp.rtems.org/pub/rtems/people/joel/warnings/warnings-5-20200408/warnings-all-5-20200408.txt)
>>> of warnings for RTEMS 5, one of the warning is:
>>>
>>> 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=]
>>>
>>>
>>> On opening init.c from ~/quick-start/src/rtems/testsuites/sptests/sp37/.
>>> Lines 172 to 175 are:
>>>
>>> static const char name[] = "test";
>>> ISR_Level normal_interrupt_level = _ISR_Get_level();
>>> ISR_lock_Control initialized = ISR_LOCK_INITIALIZER( name );
>>> ISR_lock_Control zero_initialized;
>>>
>>> We can see that the name variable is being used in line 174(and later on
>>> 3 more times, outside any conditional blocks). Why would Dr. Joel get such
>>> a warning then?
>>>
>>
>> Does ISR_LOCK_INITIALIZER actually use the name? It possibly only uses
>> it when RTEMS_DEBUG is enabled. Check that.
>>
>>>
>>> Thanks,
>>> Richi.
>>> _______________________________________________
>>> devel mailing list
>>> devel at rtems.org
>>> http://lists.rtems.org/mailman/listinfo/devel
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200422/7bf448ae/attachment.html>
More information about the devel
mailing list