Skip to content

Mismatch of parameters in macro ulTaskNotifyTakeIndexed causes compilation error #175

@cobusve

Description

@cobusve

Describe the bug
This issue was first reported on the FreeRTOS forums here https://forums.freertos.org/t/task-h-error-uxindextonotify-undeclared/10689

The macro ulTaskNotifyTakeIndexed was introduced with FreeRTOS 10.4.0. The implementation of the macro had a mismatch between the named macro parameters and the use of these parameters in the macro as follows:

As this macro was only introduced in V10.4.0 and the failure is at compile time we consider the potential risk from this bug to be very limited.

The offending code is shown here

  
#define ulTaskNotifyTakeIndexed( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait )
ulTaskGenericNotifyTake( ( uxIndexToNotify ), ( xClearCountOnExit ), ( xTicksToWait ) )
  

To Reproduce

  • Use the new macro ulTaskNotifyTakeIndexed as described in the forum post and you will observe a compilation error.

Additional context

The test code for this macro unfortunately had a local variable named uxIndexToNotify which masked the error during testing. The test was using this variable to pass the value into the macro which resulted in correct behavior because the variable name in the test was an exact match to the variable name incorrectly used in the macro implementation.

See this location for the exact code
https://github.com/FreeRTOS/FreeRTOS/blob/89d475e9b112d7b52c3d16aeff97e1e8e6b95316/FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c#L954

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions