fjrg76 wrote on Monday, May 28, 2018:
Hi, while working on a C++ project I noticed something wrong when using the
pdPASS macro:
/home/fjrg76/git/prueba1114lap/freertos10.0.1/inc/projdefs.h:47:27: error:
ISO C++ forbids comparison between pointer and integer [-fpermissive]
#define pdPASS ( pdTRUE )
^
/home/fjrg76/git/prueba1114lap/prueba11/inc/FreeRTOSConfig.h:103:33: note:
in definition of macro ‘configASSERT’
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS();
for( ;; ); }
^
…/src/prueba11.cpp:112:39: note: in expansion of macro ‘pdPASS’
- configASSERT( myTimer.GetHandle() == pdPASS );*
But if I change pdPASS to pdFAIL, then it compiles:
configASSERT( myTimer.GetHandle() != pdFAIL );
From FreeRTOS/projdefs.h
#define pdFALSE ( ( BaseType_t ) 0 )
#define pdTRUE ( ( BaseType_t ) 1 )
#define pdPASS ( pdTRUE ) // <-- Eclipse IDE has placed an
error mark (X) in this line
#define pdFAIL ( pdFALSE )
From my file prueba11.cpp:
class Timer
{
public:
// …
- TimerHandle_t GetHandle() const*
- {*
-
return this->handle;*
- }*
protected:
TimerHandle_t handle = pdFAIL;
};
class MyTimer:public Timer {/…/};
int main(void)
{
// …
MyTimer myTimer{ pdMS_TO_TICKS( 100 ), pdTRUE, 0, 7 };
-
configASSERT( myTimer.GetHandle() == pdPASS );*
-
if ( myTimer.GetHandle() != pdPASS ) while(1);*
if( myTimer.Start() == false ) while(1);
vTaskStartScheduler();
return 0 ;
}
Any hints? Of course I can use pdFAIL instead of pdPASS throughout all my
code/project, but this situation (bug?) might be more serious than it
appears. As said, I’m using the GNU C++ 14 compiler under a Linux Box
(maybe it’s not important)
–
M.I. Fco. Javier Rodríguez G.