From: rtel Date: Sat, 30 Aug 2014 20:18:18 +0000 (+0000) Subject: Correct potential compiler warning when configUSE_MUTEXES is set to 0. X-Git-Tag: V8.1.1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=21bb47499bbc4d4741662efbd5a7ad63d72158ce;p=freertos Correct potential compiler warning when configUSE_MUTEXES is set to 0. Add comments. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2297 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index 95f020142..8e70fc8bc 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -1103,7 +1103,7 @@ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvPar * * @return The name assigned to the timer specified by the xTimer parameter. */ -const char * pcTimerGetTimerName( TimerHandle_t xTimer ); +const char * pcTimerGetTimerName( TimerHandle_t xTimer ); /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /* * Functions beyond this part are not part of the public API and are intended diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index c4c131a87..e82a22685 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -461,7 +461,7 @@ QueueHandle_t xReturn = NULL; taskEXIT_CRITICAL(); return pxReturn; - } + } /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */ #endif /*-----------------------------------------------------------*/ @@ -1122,7 +1122,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; { if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) { - /* The task waiting has a higher priority so + /* The task waiting has a higher priority so record that a context switch is required. */ if( pxHigherPriorityTaskWoken != NULL ) { @@ -1247,7 +1247,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; mtCOVERAGE_TEST_MARKER(); } } - #endif + #endif /* configUSE_MUTEXES */ if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) { @@ -1695,7 +1695,7 @@ BaseType_t xReturn = pdFALSE; static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ) { - if( pxQueue->uxItemSize != 0 ) + if( pxQueue->uxItemSize != ( UBaseType_t ) 0 ) { pxQueue->u.pcReadFrom += pxQueue->uxItemSize; if( pxQueue->u.pcReadFrom >= pxQueue->pcTail ) /*lint !e946 MISRA exception justified as use of the relational operator is the cleanest solutions. */ diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index a9abc0980..4e2f8a7fc 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -328,12 +328,12 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t /* A port optimised version is provided, call it only if the TCB being reset is being referenced from a ready list. If it is referenced from a delayed or suspended list then it won't be in a ready list. */ - #define taskRESET_READY_PRIORITY( uxPriority ) \ - { \ - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ ( uxPriority ) ] ) ) == 0 ) \ - { \ - portRESET_READY_PRIORITY( ( uxPriority ), ( uxTopReadyPriority ) ); \ - } \ + #define taskRESET_READY_PRIORITY( uxPriority ) \ + { \ + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ ( uxPriority ) ] ) ) == ( UBaseType_t ) 0 ) \ + { \ + portRESET_READY_PRIORITY( ( uxPriority ), ( uxTopReadyPriority ) ); \ + } \ } #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ @@ -1000,7 +1000,7 @@ TCB_t * pxNewTCB; } return eReturn; - } + } /*lint !e818 xTask cannot be a pointer to const because it is a typedef. */ #endif /* INCLUDE_eTaskGetState */ /*-----------------------------------------------------------*/ @@ -1728,7 +1728,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) #if ( INCLUDE_pcTaskGetTaskName == 1 ) - char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) + char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ { TCB_t *pxTCB; @@ -3039,13 +3039,13 @@ TCB_t *pxNewTCB; { uint32_t ulCount = 0U; - while( *pucStackByte == tskSTACK_FILL_BYTE ) + while( *pucStackByte == ( uint8_t ) tskSTACK_FILL_BYTE ) { pucStackByte -= portSTACK_GROWTH; ulCount++; } - ulCount /= ( uint32_t ) sizeof( StackType_t ); + ulCount /= ( uint32_t ) sizeof( StackType_t ); /*lint !e961 Casting is not redundant on smaller architectures. */ return ( uint16_t ) ulCount; } @@ -3252,7 +3252,7 @@ TCB_t *pxTCB; if( pxTCB->uxPriority != pxTCB->uxBasePriority ) { /* Only disinherit if no other mutexes are held. */ - if( pxTCB->uxMutexesHeld == 0 ) + if( pxTCB->uxMutexesHeld == ( UBaseType_t ) 0 ) { /* The holding task must be the running task to be able to give the mutex back. Remove the holding task from the ready list. */ @@ -3587,9 +3587,9 @@ TickType_t uxReturn; } /*-----------------------------------------------------------*/ -void *pvTaskIncrementMutexHeldCount( void ) -{ - #if ( configUSE_MUTEXES == 1 ) +#if ( configUSE_MUTEXES == 1 ) + + void *pvTaskIncrementMutexHeldCount( void ) { /* If xSemaphoreCreateMutex() is called before any tasks have been created then pxCurrentTCB will be NULL. */ @@ -3600,8 +3600,9 @@ void *pvTaskIncrementMutexHeldCount( void ) return pxCurrentTCB; } - #endif -} + +#endif /* configUSE_MUTEXES */ + /*-----------------------------------------------------------*/ #ifdef FREERTOS_MODULE_TEST diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index 029cda4ee..9ce9acb24 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -591,7 +591,7 @@ TickType_t xTimeNow; { /* Negative commands are pended function calls rather than timer commands. */ - if( xMessage.xMessageID < 0 ) + if( xMessage.xMessageID < ( BaseType_t ) 0 ) { const CallbackParameters_t * const pxCallback = &( xMessage.u.xCallbackParameters ); @@ -843,7 +843,7 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer; xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2; xReturn = xQueueSendFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken ); - + tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, xReturn ); return xReturn; @@ -869,7 +869,7 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer; xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait ); tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, xReturn ); - + return xReturn; }