From 3d8979f769205b4ea012d7211974c88c0be34481 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 8 Sep 2025 21:22:03 +0100 Subject: [PATCH] Add -Wshadow to compiler warnings --- cmake/compilers/gnu.cmake | 2 +- code/renderergl1/tr_main.c | 6 +++--- code/renderergl2/tr_main.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/compilers/gnu.cmake b/cmake/compilers/gnu.cmake index 298712b0..f52c54f8 100644 --- a/cmake/compilers/gnu.cmake +++ b/cmake/compilers/gnu.cmake @@ -11,7 +11,7 @@ set(ASM_SOURCES ${SOURCE_DIR}/asm/snapvector.c ) -add_compile_options(-Wall -Wimplicit +add_compile_options(-Wall -Wimplicit -Wshadow -Wstrict-prototypes -Wformat=2 -Wformat-security -Wstrict-aliasing=2 -Wmissing-format-attribute -Wdisabled-optimization -Werror-implicit-function-declaration) diff --git a/code/renderergl1/tr_main.c b/code/renderergl1/tr_main.c index 473b1831..9fd2302e 100644 --- a/code/renderergl1/tr_main.c +++ b/code/renderergl1/tr_main.c @@ -1044,7 +1044,7 @@ DRAWSURF SORTING R_Radix =============== */ -static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_t *dest ) +static ID_INLINE void R_Radix( int offset, int size, drawSurf_t *source, drawSurf_t *dest ) { int count[ 256 ] = { 0 }; int index[ 256 ]; @@ -1052,7 +1052,7 @@ static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_ unsigned char *sortKey = NULL; unsigned char *end = NULL; - sortKey = ( (unsigned char *)&source[ 0 ].sort ) + byte; + sortKey = ( (unsigned char *)&source[ 0 ].sort ) + offset; end = sortKey + ( size * sizeof( drawSurf_t ) ); for( ; sortKey < end; sortKey += sizeof( drawSurf_t ) ) ++count[ *sortKey ]; @@ -1062,7 +1062,7 @@ static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_ for( i = 1; i < 256; ++i ) index[ i ] = index[ i - 1 ] + count[ i - 1 ]; - sortKey = ( (unsigned char *)&source[ 0 ].sort ) + byte; + sortKey = ( (unsigned char *)&source[ 0 ].sort ) + offset; for( i = 0; i < size; ++i, sortKey += sizeof( drawSurf_t ) ) dest[ index[ *sortKey ]++ ] = source[ i ]; } diff --git a/code/renderergl2/tr_main.c b/code/renderergl2/tr_main.c index 389659c4..df8603fa 100644 --- a/code/renderergl2/tr_main.c +++ b/code/renderergl2/tr_main.c @@ -1403,7 +1403,7 @@ DRAWSURF SORTING R_Radix =============== */ -static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_t *dest ) +static ID_INLINE void R_Radix( int offset, int size, drawSurf_t *source, drawSurf_t *dest ) { int count[ 256 ] = { 0 }; int index[ 256 ]; @@ -1411,7 +1411,7 @@ static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_ unsigned char *sortKey = NULL; unsigned char *end = NULL; - sortKey = ( (unsigned char *)&source[ 0 ].sort ) + byte; + sortKey = ( (unsigned char *)&source[ 0 ].sort ) + offset; end = sortKey + ( size * sizeof( drawSurf_t ) ); for( ; sortKey < end; sortKey += sizeof( drawSurf_t ) ) ++count[ *sortKey ]; @@ -1421,7 +1421,7 @@ static ID_INLINE void R_Radix( int byte, int size, drawSurf_t *source, drawSurf_ for( i = 1; i < 256; ++i ) index[ i ] = index[ i - 1 ] + count[ i - 1 ]; - sortKey = ( (unsigned char *)&source[ 0 ].sort ) + byte; + sortKey = ( (unsigned char *)&source[ 0 ].sort ) + offset; for( i = 0; i < size; ++i, sortKey += sizeof( drawSurf_t ) ) dest[ index[ *sortKey ]++ ] = source[ i ]; }