I have been debugging this RTOS code in Coverity and ran into few small errors. The errors are self explanatory as they are format specifier errors. Both of the errors are on the main function. The first error is on the line:
RTOS_TEST(" Error = 0x%X, pool = 0x%X\n", result, (_mqx_uint)error_ptr);
Error: Invalid type in argument to printf format specifier (PRINTF_ARGS) invalid_type: Argument result to format specifier %X was expected to have type unsigned int but has type unsigned long.
The second error is on the line:
RTOS_TEST("MQX lock mutex FAILED: 0x08X\n", status);
Error: Extra argument to printf format specifier (PRINTF_ARGS) extra_argument: This argument was not used by the format string: status.
I am not sure how I am passing an extra argument as the RTOS_TEST does take one argument. Please tell me what I am doing wrong.
#if !defined(__arc__)
#define RTOS_TEST(...) printf(__VA_ARGS__)
#else
#define RTOS_TEST(...)
#endif
typedef uint_32 _mqx_uint, _PTR_ _mqx_uint_ptr;
typedef uint32_t Status_t;
void SECTION_CODE("CODE_SLOW") WrappersTest(uint_32 parameter)
{
_lwmem_pool_id lwmem_pool_id;
pointer error_ptr;
pointer error2_ptr;
Status_t status;
_mqx_uint result;
BOOL fail = FALSE;
RTOS_TEST("Start MQX integrity tests ...\n");
TestQueue();
TestLightWeightSemaphore();
TestMutexAPI();
TestLightWeightEvent();
TestFastMessageQueue();
TestLightWeightMemory();
#if defined(MQX_TEST_EVENT_TEST)
RTOS_TEST("Calling _event_test ..."); fflush(stdout);
result = _event_test(&error_ptr);
if (result != MQX_OK)
{
RTOS_TEST(" ***FAILED*** _event_test: 0x%08X\n", result);
fail = TRUE;
}
else
{
RTOS_TEST("PASSED!\n");
}
#endif // MQX_TEST_EVENT_TEST
status = RTOS_MutexInit(&testMutex, (uint8_t*)Name);
if (status != STATUS_OK)
{
RTOS_TEST("MQX init mutex FAILED: 0x%08X\n", status);
}
for (; loopCount > 0; loopCount--)
{
status = RTOS_MutexLock(&testMutex);
if (status != STATUS_OK)
{
RTOS_TEST("MQX lock mutex FAILED: 0x08X\n", status);
}
}
int main()
{
.........,
RTOS_TEST(" Error = 0x%X, pool = 0x%X\n", result, (_mqx_uint)error_ptr);
..........
if (status != STATUS_OK)
{
RTOS_TEST("MQX lock mutex FAILED: 0x08X\n", status);
}
..........
return 0;
}