Skip to content

Commit 5f85f43

Browse files
authored
Posix_GCC: update compiler options (FreeRTOS#1227)
Posix_GCC: update compiler options 1. Add to CFLAGS - add -O0 optimization for debug builds. - add -O3 optimization for release builds. 2. Update signal handler `handle_sigint()` to use `_exit()` instead of `exit()`. Normal exit() is not allowed within a signal handler. Signed-off-by: Florian La Roche <[email protected]>
1 parent 995a030 commit 5f85f43

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

FreeRTOS/Demo/Posix_GCC/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ project( posix_demo )
44

55
add_compile_options( -D_WINDOWS_ )
66

7+
add_compile_options( -Wall -Wextra -Wpedantic )
8+
79
if( TRACE_ON_ENTER )
810
add_compile_options( -DTRACE_ON_ENTER=1 )
911
else()
@@ -33,6 +35,9 @@ else()
3335
set( CMAKE_BUILD_TYPE "debug" )
3436
endif()
3537

38+
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
39+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
40+
3641
if( SANITIZE_ADDRESS )
3742
add_compile_options( -fsanitize=address -fsanitize=alignment )
3843
endif()

FreeRTOS/Demo/Posix_GCC/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void handle_sigint( int signal )
455455
printf( "chdir into %s error is %d\n", BUILD, errno );
456456
}
457457

458-
exit( 2 );
458+
_exit( 2 );
459459
}
460460

461461
/*-----------------------------------------------------------*/

0 commit comments

Comments
 (0)