Description
Describe the bug
Spurious semicolons at the end of vTaskNotifyGiveFromISR and vTaskGenericNotifyGiveFromISR macro definitions.
Version: FreeRTOS Kernel V10.4.3 LTS Patch 2 (still present on latest commit)
Target
- Development board: Immaterial
- Instruction Set Architecture: Immaterial
- IDE and version: Immaterial
- Toolchain and version: llvm, clang 13.0, (immaterial)
Host
- Host OS: Any
- Version:
To Reproduce
Compile the following code as part of an ISR:
if (condition)
vTaskNotifyGiveFromISR(task, &yield);
else
xSemaphoreGiveFromISR(semaphore, &yield);
Expected behavior
Compilation should succeed.
it instead fails with:
[build] ../source/SDR/filterGeneric.c:97:9: error: expected expression
[build] else
[build] ^
[build] 1 error generated.
Additional Context
The problem is caused by extra semicolons at the end of vTaskNotifyGiveFromISR and vTaskGenericNotifyGiveFromISR macro definitions:
#define vTaskNotifyGiveFromISR( xTaskToNotify, pxHigherPriorityTaskWoken ) \
vTaskGenericNotifyGiveFromISR( ( xTaskToNotify ), ( tskDEFAULT_INDEX_TO_NOTIFY ), ( pxHigherPriorityTaskWoken ) );
#define vTaskNotifyGiveIndexedFromISR( xTaskToNotify, uxIndexToNotify, pxHigherPriorityTaskWoken ) \
vTaskGenericNotifyGiveFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( pxHigherPriorityTaskWoken ) );
The semicolons terminate the statement and make them not follow the usual convention for function-like macros of behaving like an actual function, specifically making their use in a single statement then
clause without braces unexpectedly not require a semicolon.