in RTEMS initialization routine, I see this code below.
void boot_card(const char *cmdline)
{
rtems_interrupt_level bsp_isr_level;
/*
* Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
* It must be valid before we can use rtems_interrupt_disable().
*/
#ifdef PPC_INTERRUPT_DISABLE_MASK_DEFAULT
ppc_interrupt_set_disable_mask( PPC_INTERRUPT_DISABLE_MASK_DEFAULT );
#endif /* PPC_INTERRUPT_DISABLE_MASK_DEFAULT */
/*
* Make sure interrupts are disabled.
*/
(void) bsp_isr_level; // <---
rtems_interrupt_disable( bsp_isr_level );
-- continues--
In the code above, at the beginning, bsp_isr_level is declared as of type rtems_interrupt_level (which is ultimately type defined as unsigned int).
But, what is the line (void) bsp_isr_level;
doing? (marked with //<-- above). It's not a variable passed in as the function argument as in here.
EDIT : I found in my case the variable is being assigned by the rtems_interrupt_disable function (actually it is a macro #defined) so it's not 'not being used'. But though assigned, the assigned values seems to be not used. I don't know if this syntax is used also for cases like this(value assigned but not used). By the way, I found in the RTEMS source tree there is a function(real function, not #defined) rtems_interrupt_disable having void argument like below. (in cpukit/rtems/src/intrbody.c). (The #defined version is in cpukit/rtems/include/rtems/rtems/intr.h)
rtems_interrupt_level rtems_interrupt_disable( void )
{
rtems_interrupt_level previous_level;
_ISR_Disable( previous_level );
return previous_level;
}
So Maybe this syntax might have been used just in case this second definition(the value is passed as void to a function). I guess because this second definition exist, that can be used in some build cases.
rtems_interrupt_disable
can get#defined
away to nothing? (Although it that case maybe it ought to be#defined
to the(void)
pattern.) But I'm guessing, I don't know RTEMS. – Wattle