Skip to content

Commit 0801c91

Browse files
Add Noreturn attribute in template port for static analysis (FreeRTOS#1060)
* Add _Noreturn attribute in the template function to fix MISRA 17.11 advisory warnings * Add _Noreturn attribute in function declaration * Code review suggestions
1 parent c9e3949 commit 0801c91

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
@@ -45,7 +45,7 @@
4545

4646
/*-----------------------------------------------------------*/
4747

48-
static void exampleTask( void * parameters );
48+
static void exampleTask( void * parameters ) __attribute__( ( noreturn ) );
4949

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

@@ -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 ) void vFunction( void * pvParameters ) __attribute__( ( noreturn ) )
109109
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
110110

111111
#if ( configNUMBER_OF_CORES > 1 )

0 commit comments

Comments
 (0)