8000 Shadow declaration of triceSingleBufferStartWritePosition in trice.h · Issue #526 · rokath/trice · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Shadow declaration of triceSingleBufferStartWritePosition in trice.h #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joaolehodey opened this issue Apr 29, 2025 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@joaolehodey
Copy link

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.

@rokath rokath self-assigned this May 2, 2025
@rokath rokath added the bug Something isn't working label May 2, 2025
@rokath
Copy link
Owner
rokath commented May 2, 2025

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?

@joaolehodey
Copy link
Author

Hello, thank you for your quick reply.

  • 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.

@rokath
Copy link
Owner
rokath commented May 7, 2025

-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
0