in the RTEMS initialization procedure, I see this code below.
void boot_card(const char *cmdline) { rtems_interrupt_level bsp_isr_level; #ifdef PPC_INTERRUPT_DISABLE_MASK_DEFAULT ppc_interrupt_set_disable_mask( PPC_INTERRUPT_DISABLE_MASK_DEFAULT ); #endif (void) bsp_isr_level;
In the above code, at the beginning, bsp_isr_level is declared as the type rtems_interrupt_level (which is ultimately defined as unsigned int).
But what does the (void) bsp_isr_level; line do (void) bsp_isr_level; ? (indicated by the letter // <- above). This is not a variable passed as an argument to a function, as in here .
EDIT: I found that in my case the variable is assigned by the rtems_interrupt_disable function (in fact it is a macro C # defined), so it is not "not used". But, although assigned, the assigned values ββdo not seem to be used. I do not know if this syntax is also used for such cases (a value is assigned but not used). By the way, I found in the RTEMS source tree a function (a valid function, not #defined) rtems_interrupt_disable, having a void argument, as shown below. (in cpukit / rtems / src / intrbody.c). (#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, perhaps this syntax could be used just in case, if this is the second definition (the value is passed as a void function). I think because this second definition exists, which can be used in some assembly cases.
c rtems
Chan kim
source share