Skip to content

Commit

Permalink
Add -Wconversion in CMakeLists.txt (#712)
Browse files Browse the repository at this point in the history
Also fix warnings generated by this flag.

Signed-off-by: Gaurav Aggarwal <[email protected]>
  • Loading branch information
aggarg authored Jul 20, 2023
1 parent 50b2d8f commit 2cdd0e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ target_compile_options(freertos_kernel PRIVATE
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wconversion>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>

# Suppressions required to build clean with clang.
Expand Down
2 changes: 1 addition & 1 deletion portable/MemMang/heap_4.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
/* pxEnd is used to mark the end of the list of free blocks and is inserted
* at the end of the heap space. */
uxAddress = ( portPOINTER_SIZE_TYPE ) ( pucAlignedHeap + xTotalHeapSize );
uxAddress -= xHeapStructSize;
uxAddress -= ( portPOINTER_SIZE_TYPE ) xHeapStructSize;
uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
pxEnd = ( BlockLink_t * ) uxAddress;
pxEnd->xBlockSize = 0;
Expand Down
8 changes: 4 additions & 4 deletions portable/MemMang/heap_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
configASSERT( pxEnd != NULL );

/* Check blocks are passed in with increasing start addresses. */
configASSERT( xAddress > ( size_t ) pxEnd );
configASSERT( ( size_t ) xAddress > ( size_t ) pxEnd );
}

/* Remember the location of the end marker in the previous region, if
Expand All @@ -517,9 +517,9 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )

/* pxEnd is used to mark the end of the list of free blocks and is
* inserted at the end of the region space. */
xAddress = xAlignedHeap + xTotalRegionSize;
xAddress -= xHeapStructSize;
xAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
xAddress = xAlignedHeap + ( portPOINTER_SIZE_TYPE ) xTotalRegionSize;
xAddress -= ( portPOINTER_SIZE_TYPE ) xHeapStructSize;
xAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
pxEnd = ( BlockLink_t * ) xAddress;
pxEnd->xBlockSize = 0;
pxEnd->pxNextFreeBlock = NULL;
Expand Down

0 comments on commit 2cdd0e5

Please sign in to comment.