
Dear Stefano Babic,
In message 4C6557C5.4000300@denx.de you wrote:
It is ok, but it generates another new CONFIG_ switch, that is unusable for the rest of u-boot. I agree that in u-boot there is a lot of different and local functions to setup, and probably a general mechanism should be better defined. However, setting "#define DEBUG" before any include files is quite usual. I do not like to set a CONFIG_ switch only for debug purpose, as in the delivered system all debug output should be turned off.
We already have such a general mechanism, the problem is just that people ignore it and re-invent the wheel.
We have debug(), debugX(), error(), and BUG_ON().
What exactly seems to be missing?
Note that when using constants as "level" argument in debugX() the compiler can even optimize away non-relevant code.
I remember we had a similar discussion in the past, which resulted that I accepted to have debugX() added - yet how many files use it? 2 (in words: TWO)!
So before we add even more debug utilities someone has to bring up really good arguments to convince me.
Best regards,
Wolfgang Denk