You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While compiling a project that uses the Trice logging system, the following compiler warning (or error, depending on flags) is raised:
warning: declaration of 'triceSingleBufferStartWritePosition' shadows a global declaration [-Wshadow]
(error: declaration of 'triceSingleBufferStartWritePosition' shadows a global declaration [-Werror=shadow])
File: trice.h
Symbol: triceSingleBufferStartWritePosition Issue: The variable is declared locally in a scope that conflicts with a global declaration of the same name.
This may cause unexpected behavior or confusion during development, especially with strict compiler flags enabled. It would be helpful to rename the local declaration or refactor to avoid the shadowing.
The text was updated successfully, but these errors were encountered:
Thanks for reporting! Strange, that the ./testAll.sh script did not detect that. May I ask for your triceConfig.h file and your compiler settings? You are on the latest release, right?
The trice config (in zip as issues do not allow .h files): triceConfig.zip
Compiller settings: I believe all you need to cause the error is: -Wshadow -Werror ,however here you have the full ones: -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -O0 -g -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -march=armv7e-m+fp.dp -mtune=cortex-m7 -mthumb -O2 -g3 -DNDEBUG -Wall -Wextra -Wpedantic -Werror -Wdouble-promotion -Wfloat-equal -Wredundant-decls -Wshadow -Wswitch-default -Wno-packed-bitfield-compat -funsigned-char -ffunction-sections -fdata-sections
I have tested it using the latest release yes.
Thank you. In case you need anything else, just tell me.
-Wshadow is indeed causing error messages. Please be patient - it will take a while to fix that and, maybe, other warnings as well. My assumption is, that these warnings are not a sign of hidden bugs - but who knows. Inbetween you could compare the triceConfig.h files in the examples against your triceConfig.h and reduce it to the essentials. Many (default) settings are in the triceDefaultConfig.h now, only different settings are needed in the project specific triceConfig.h and for example TRICE_MODE is not used anymore.
Description:
While compiling a project that uses the Trice logging system, the following compiler warning (or error, depending on flags) is raised:
warning: declaration of 'triceSingleBufferStartWritePosition' shadows a global declaration [-Wshadow]
(error: declaration of 'triceSingleBufferStartWritePosition' shadows a global declaration [-Werror=shadow])
File: trice.h
Symbol: triceSingleBufferStartWritePosition
Issue: The variable is declared locally in a scope that conflicts with a global declaration of the same name.
This may cause unexpected behavior or confusion during development, especially with strict compiler flags enabled. It would be helpful to rename the local declaration or refactor to avoid the shadowing.
The text was updated successfully, but these errors were encountered: