Skip to content

Commit 2cdd0e5

Browse files
authored
Add -Wconversion in CMakeLists.txt (#712)
Also fix warnings generated by this flag. Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent 50b2d8f commit 2cdd0e5

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ target_compile_options(freertos_kernel PRIVATE
260260
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
261261
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
262262
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
263+
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wconversion>
263264
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
264265

265266
# Suppressions required to build clean with clang.

portable/MemMang/heap_4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
421421
/* pxEnd is used to mark the end of the list of free blocks and is inserted
422422
* at the end of the heap space. */
423423
uxAddress = ( portPOINTER_SIZE_TYPE ) ( pucAlignedHeap + xTotalHeapSize );
424-
uxAddress -= xHeapStructSize;
424+
uxAddress -= ( portPOINTER_SIZE_TYPE ) xHeapStructSize;
425425
uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
426426
pxEnd = ( BlockLink_t * ) uxAddress;
427427
pxEnd->xBlockSize = 0;

portable/MemMang/heap_5.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
508508
configASSERT( pxEnd != NULL );
509509

510510
/* Check blocks are passed in with increasing start addresses. */
511-
configASSERT( xAddress > ( size_t ) pxEnd );
511+
configASSERT( ( size_t ) xAddress > ( size_t ) pxEnd );
512512
}
513513

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

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

0 commit comments

Comments
 (0)