score: Improve _ISR_lock_Initialize()

Use do {} while (0) approach to avoid stray ';'.

Update #4957 and #5038.
This commit is contained in:
Sebastian Huber
2024-06-18 11:56:09 +02:00
parent b48166b9b6
commit 26a0bfcbc2
2 changed files with 7 additions and 5 deletions

View File

@@ -200,7 +200,8 @@ static inline void _ISR_lock_Context_set_level(
#define _ISR_lock_Initialize( _lock, _name ) \
_SMP_lock_Initialize( &( _lock )->Lock, _name )
#else
#define _ISR_lock_Initialize( _lock, _name ) (void) _name;
#define _ISR_lock_Initialize( _lock, _name ) \
do { (void) _name; } while (0)
#endif
/**

View File

@@ -82,8 +82,8 @@
* - Check that RTEMS_INTERRUPT_LOCK_INITIALIZER() expands to an empty
* structure initializer.
*
* - Check that rtems_interrupt_lock_initialize() expands to white space
* only.
* - Check that rtems_interrupt_lock_initialize() expands to a code block
* which marks the second parameter as used.
*
* - Check that rtems_interrupt_lock_acquire_isr() expands to a code block
* which marks the second parameter as used.
@@ -139,10 +139,11 @@ static void RtemsIntrValIntrNonSmp_Action_0( void )
T_true( IsEqualIgnoreWhiteSpace( s, "{}" ) );
/*
* Check that rtems_interrupt_lock_initialize() expands to white space only.
* Check that rtems_interrupt_lock_initialize() expands to a code block which
* marks the second parameter as used.
*/
s = RTEMS_XSTRING( rtems_interrupt_lock_initialize( x, y ) );
T_true( IsEqualIgnoreWhiteSpace( s, "(void)y;" ) );
T_true( IsEqualIgnoreWhiteSpace( s, "do{(void)y;}while(0)" ) );
/*
* Check that rtems_interrupt_lock_acquire_isr() expands to a code block