Posix_GCC: update compiler options (#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 <Florian.LaRoche@gmail.com>
pull/1228/head^2
Florian La Roche 8 months ago committed by GitHub
parent 995a030a92
commit 5f85f43c39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,6 +4,8 @@ project( posix_demo )
add_compile_options( -D_WINDOWS_ )
add_compile_options( -Wall -Wextra -Wpedantic )
if( TRACE_ON_ENTER )
add_compile_options( -DTRACE_ON_ENTER=1 )
else()
@ -33,6 +35,9 @@ else()
set( CMAKE_BUILD_TYPE "debug" )
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
if( SANITIZE_ADDRESS )
add_compile_options( -fsanitize=address -fsanitize=alignment )
endif()

@ -455,7 +455,7 @@ void handle_sigint( int signal )
printf( "chdir into %s error is %d\n", BUILD, errno );
}
exit( 2 );
_exit( 2 );
}
/*-----------------------------------------------------------*/

Loading…
Cancel
Save