-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Adds empty dbg calls #67
Conversation
Thank you very much for your contribution! I didn't know that this would require us to add a lot of preprocessor macro code 🙁. If we decide to add all of these tricks, (just) to support empty |
@sharkdp I will change the print function to remove that duplication. As for the macro, there really is not a way to do this with pre-processor statements other than to count the VA. Though adding other number of variables should be trivial. I.E.
This should not greatly affect the ability to implement #2 but I can attempt to look into it more. The only possible "snag" I see is needing defining a |
d2c7f62
to
4a77805
Compare
Alright @sharkdp the duplicate code is gone. Let me know if you have more questions or concerns. |
To be honest, for me, the multiple-arguments- We did have an implementation for multiple arguments in #8 (which I needed to roll back because it broke some tests). It's not pretty, but I as you also said, there is no other way apparently. Ideally, this preprocessor code will not have to be touched in the future, as soon as we have support for 0 or more arguments. The limitation to a certain maximum number of arguments wouldn't be any problem, in my point of view. Thank you very much for looking into this! |
@sharkdp Would you like me to try and put multiple arguments onto this as #64 and #2 do go hand in hand? Or is there another issue / feature that'd be a better use of time here? I'm asking because I really enjoy this repo and would love to start actually working on repos other than mine :) |
That would be fantastic.
I would hope that if 0, 1 and 2 are possible, we could also add a few more lines to support 5 or 10.
One line for each argument. Just as if the user had called |
66a8a49
to
6cca11a
Compare
Here is the error:
Looks like this doesn't work on MSVC. |
dbg can now be called like dbg() with no arguments. Works by using the VA_ARGS to determine how many arguements have been passed in via dbg_x. Also works just fine if DBG_MACRO_DISABLE is defined.
Seeing as the dbg(...) was the same whether disabled or not I've moved it beside the dbg_x() definition outside of the disable if.
Simply put some empty calls onto tests/tests.cpp an tests/example.cpp. Also for consistency I've updated the README.md to have the empty call in it. This should be all that is needed to implement empty calls. :)
6cca11a
to
6e1c0dd
Compare
(I fixed some merge conflicts) With
|
On
I'm beginning to think that we should simply omit this feature 🙁 |
Let me keep at her a bit longer, don't lose hope. A lot of warnings are because compilers do not like |
Any update on this? Otherwise, I'd like to close it. |
Sadly no, been neglecting this : (. I'd say keep the issue open though. |
No worries, thank you for the update. We'll keep the issue open, yes. The PR here is not lost either. |
This allows users to call
dbg()
with no arguments to print out dummy text "dbg call reached".Works with or without
DBG_MACRO_DISABLE
being defined.Closes #64