Skip to content

Commit b38b2dd

Browse files
committed
Add _Noreturn attribute in the template function to fix MISRA 17.11 advisory warnings
1 parent c9e3949 commit b38b2dd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/cmake_example/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void exampleTask( void * parameters );
4949

5050
/*-----------------------------------------------------------*/
5151

52-
static void exampleTask( void * parameters )
52+
static _Noreturn void exampleTask( void * parameters )
5353
{
5454
/* Unused parameters. */
5555
( void ) parameters;
@@ -62,7 +62,7 @@ static void exampleTask( void * parameters )
6262
}
6363
/*-----------------------------------------------------------*/
6464

65-
void main( void )
65+
int main( void )
6666
{
6767
static StaticTask_t exampleTaskTCB;
6868
static StackType_t exampleTaskStack[ configMINIMAL_STACK_SIZE ];
@@ -84,6 +84,8 @@ void main( void )
8484
{
8585
/* Should not reach here. */
8686
}
87+
88+
return 0;
8789
}
8890
/*-----------------------------------------------------------*/
8991

portable/template/portmacro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ extern void vPortYield( void );
105105
#define portYIELD() vPortYield()
106106

107107
/* Task function macros as described on the FreeRTOS.org WEB site. */
108-
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
108+
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) __attribute__( ( noreturn ) ) void vFunction( void * pvParameters )
109109
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
110110

111111
#if ( configNUMBER_OF_CORES > 1 )

0 commit comments

Comments
 (0)