]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/port.c
Updates to prevent warnings when compiled with LLVM.
[freertos] / FreeRTOS / Source / portable / GCC / ARM_CM7 / r0p1 / port.c
index b80e0d0b39e2fbe54adb72e35c13f54bd9071259..07782685f0768f4e220e89dda90a5238fe950e4c 100644 (file)
@@ -252,6 +252,8 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
 \r
 static void prvTaskExitError( void )\r
 {\r
+volatile uint32_t ulDummy = 0;\r
+\r
        /* A function that implements a task must not exit or attempt to return to\r
        its caller as there is nothing to return to.  If a task wants to exit it\r
        should instead call vTaskDelete( NULL ).\r
@@ -260,7 +262,16 @@ static void prvTaskExitError( void )
        defined, then stop here so application writers can catch the error. */\r
        configASSERT( uxCriticalNesting == ~0UL );\r
        portDISABLE_INTERRUPTS();\r
-       for( ;; );\r
+       while( ulDummy == 0 )\r
+       {\r
+               /* This file calls prvTaskExitError() after the scheduler has been\r
+               started to remove a compiler warning about the function being defined\r
+               but never called.  ulDummy is used purely to quieten other warnings\r
+               about code appearing after this function is called - making ulDummy\r
+               volatile makes the compiler think the function could return and\r
+               therefore not output an 'unreachable code' warning for code that appears\r
+               after it. */\r
+       }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -403,8 +414,8 @@ BaseType_t xPortStartScheduler( void )
        functionality by defining configTASK_RETURN_ADDRESS.  Call\r
        vTaskSwitchContext() so link time optimisation does not remove the\r
        symbol. */\r
-       prvTaskExitError();\r
        vTaskSwitchContext();\r
+       prvTaskExitError();\r
 \r
        /* Should not get here! */\r
        return 0;\r