-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Profiles - default defines NDEBUG macro #3280
Conversation
As only small profile defined it, default should also. Then a user can do debug msg (or other tricks) only for debug builds.
Don't we want this in the default profile? To assist developers if an assert is hit? Wouldn't this be better just to be in the small profile? |
Certainly one of |
Won't this disable all assertions outside of the debug build? I'm pretty sure we want assertions on be default to give new users the best experience. |
In my opinion |
Thanks for the inputs and the reference for mbed-cli issue.
As the commit msg says, if tests are run (with default profile), there should not be debug messages printed. How to disable them? How to write a logging library if we don't have proper flag to tell an app/library ? Do a user need to specify a specific flag? I know this has been in the code base for a while. It's confusing, now that we added NDEBUG macro there for small profile. Why default is not NDEBUG ? It's clearly not debug profile. the only exceptions I can think of are asserts. It might be better to have mbed specific macro? A user could do:
Adding @kjbracey-arm @jupe for feedback |
I would say that we should avoid compiling in |
@bulislaw has a good point, not to mention stringifying the assert arguments adds quite a bit of overhead. This behaviour seems reasonable to me:
|
We could keep the LED blinking for default profile which would indicate troubles but shouldn't be a big overhead in code size. |
Do we agree to use mbed-trace as common tracing library? If so there is proper pre-compiler variables already which can be used by application to select tracing levels or just disable all traces. Library allows to configure trace level on run time as well via c api..Only thing is that trace module doesn't affect to assert messages at all at the moment I think.
We could further develop trace library so that we could drop Anyway, I think that developing and testing builds should contains those traces because it gives a lot of valuable information about behaviors, but release build could be compiled without traces.. |
Adopting the trace library for the debug build makes a lot of sense to me. But for the default build I think we would want to avoid pulling it in for the same reason we want to avoid printf. Tangential question, the |
How big mbed-trace is? It's not that I'm suggesting mbedos is big... lets say it's a bit fluffy... but seriously we do need to watch what we integrate. |
@geky I believe I think the |
Lots of good comments here. I think there are a few things needed before making a change like this. Blinking an error pattern first would require changing what exists for 1 led boards so it doesn't look like Blinky. Blinking error patterns implies either:
If we can address some of these then lets reopen, otherwise, closing for now. Should also consider how log/info/debug fits in with the current use of assert. |
While I was adding the debug msg to some tests, I noticed default was missing NDEBUG macro, thus I am adding it here. Please review
@theotherjimmy @sg- @c1728p9 @geky @bridadan