blackmagic-debug / blackmagic

In application debugger for ARM Cortex microcontrollers.
GNU General Public License v3.0
3.13k stars 759 forks source link

target: Fix compiler error when define DEBUG_PROTO_IS_NOOP #1838

Closed iysheng closed 1 month ago

iysheng commented 1 month ago

Detailed description

Fix compile error when define DEBUG_PROTO_IS_NOOP like below Screenshot from 2024-05-29 21-33-42

Your checklist for this pull request

Closing issues

dragonmux commented 1 month ago

We're unsure what your build environment is doing there.. it is doing something fantastically wrong with BMDA.. but the guards this removes are not wrong. Removing them is very much wrong.

The way this mechanism is designed to work and indeed does work in-tree, is that the _IS_NOOP macros determine if that log level is a no-operation via the DEBUG_<level> macro being defined to do nothing and discard the logged information. See: https://github.com/blackmagic-debug/blackmagic/blob/e4da644bb8c0c81498a0f3819bbd99fd6627cd8e/src/include/general.h#L99-L120

The idea being that the _IS_NOOP macros can then be used to guard data used only for logging statements (like these data pointers) and not define them when the statements do nothing, resulting in unused variable warnings that are then errors via -Werror.

Your build environment is mistakenly defining DEBUG_PROTO_IS_NOOP here when building BMDA, and all of the logging levels are never no-ops for BMDA - all of them always resolve to debug_* calls.

iysheng commented 1 month ago

ok,I just force design DEBUG_PROTO_IS_NOOP in my Makefile to triger this error.😅