Describe the bug
The definition of function-like macro vTaskDelayUntil does not follow usual conventions.
Target
- Development board: Irrelevant
- Instruction Set Architecture: Immaterial
- IDE and version: Any
- Toolchain and version: Any C standard compliant compiler
Host
To Reproduce
Compile any code of the following form:
if (condition)
vTaskDelayUntil(&prevTime, delay);
else
/* Any statement or block */
It will fail with a message similar to:
[build] ../source/main.c:521:5: error: expected expression
[build] else
[build] ^
[build] 1 error generated.
Expected behavior
Compilation should succeed.
Additional context
The problem lies in the definition of vTaskDelayUntil() function-like macro:
#define vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) \
{ \
( void ) xTaskDelayUntil( ( pxPreviousWakeTime ), ( xTimeIncrement ) ); \
}
The block surrounding the call to xTaskDelayUntil makes the macro a complete and terminated statement, needing omission of the terminating semicolon when used in a non-block, single statement then clause of an if statement.
The usual way to avoid this is surrounding the block in the macro with a do {...} while(0) to form a non terminated statement.
See also #553 .
Describe the bug
The definition of function-like macro vTaskDelayUntil does not follow usual conventions.
Target
Host
To Reproduce
Compile any code of the following form:
It will fail with a message similar to:
Expected behavior
Compilation should succeed.
Additional context
The problem lies in the definition of
vTaskDelayUntil()function-like macro:The block surrounding the call to
xTaskDelayUntilmakes the macro a complete and terminated statement, needing omission of the terminating semicolon when used in a non-block, single statementthenclause of an if statement.The usual way to avoid this is surrounding the block in the macro with a
do {...} while(0)to form a non terminated statement.See also #553 .