Demo/Posix_GCC: fix compiler flags and compiler warnings (#1351)

- Change CMakeLists.txt to set the C compiler flags instead
  of the C++ compiler flags.
- Change to compiler warnings from "gcc -Wconversion" in
  main_full.c.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
This commit is contained in:
Florian La Roche 2025-06-04 05:15:09 +02:00 committed by GitHub
parent 9d9bbd0e61
commit 67bc5a930d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -35,8 +35,8 @@ else()
set( CMAKE_BUILD_TYPE "debug" ) set( CMAKE_BUILD_TYPE "debug" )
endif() endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
if( SANITIZE_ADDRESS ) if( SANITIZE_ADDRESS )
add_compile_options( -fsanitize=address -fsanitize=alignment ) add_compile_options( -fsanitize=address -fsanitize=alignment )

View file

@ -510,7 +510,7 @@ void vFullDemoIdleFunction( void )
/* Exercise heap_5 a bit. The malloc failed hook will trap failed /* Exercise heap_5 a bit. The malloc failed hook will trap failed
* allocations so there is no need to test here. */ * allocations so there is no need to test here. */
pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 ); pvAllocated = pvPortMalloc( ( size_t ) ( ( rand() % 500 ) + 1 ) );
vPortFree( pvAllocated ); vPortFree( pvAllocated );
/* Exit after a fixed time so code coverage results are written to the /* Exit after a fixed time so code coverage results are written to the
@ -656,7 +656,8 @@ static void prvDemonstrateTimerQueryFunctions( void )
static void prvDemonstratePendingFunctionCall( void ) static void prvDemonstratePendingFunctionCall( void )
{ {
static intptr_t ulParameter1 = 1000UL, ulParameter2 = 0UL; static intptr_t ulParameter1 = 1000L;
static uint32_t ulParameter2 = 0UL;
const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */ const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */
/* prvPendedFunction() just expects the parameters to be incremented by one /* prvPendedFunction() just expects the parameters to be incremented by one