Skip to content

Compiler warning/error for "va_start" #12

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

Closed
lendres opened this issue Jun 27, 2021 · 6 comments · Fixed by #13
Closed

Compiler warning/error for "va_start" #12

lendres opened this issue Jun 27, 2021 · 6 comments · Fixed by #13
Labels
type: imperfection Perceived defect in any part of project type: support OT: Request for help using the project

Comments

@lendres
Copy link

lendres commented Jun 27, 2021

There is a compiler warning/error that occurs on build. It is:

...\Arduino_DebugUtils.cpp: In member function 'void Arduino_DebugUtils::print(int, const __FlashStringHelper*, ...)':
...\Arduino_DebugUtils.cpp:86:3: warning: second parameter of 'va_start' not last named argument [-Wvarargs]
va_start(args, fmt_str.c_str());

From my investigation, is seems that line 86 (of "Arduino_DebugUtils.cpp") is:

va_start(args, fmt_str.c_str());

and should instead be:

va_start(args, fmt);

I'm not overly familiar with that macro, but this version does stop the error and seems to function correctly when I run the examples.

@aentinger
Copy link
Contributor

What board are you compiling this for?

@aentinger aentinger added type: imperfection Perceived defect in any part of project type: support OT: Request for help using the project labels Jun 28, 2021
@lendres
Copy link
Author

lendres commented Jun 29, 2021

I've tried a few boards, it does not matter which board it is compiled for.

@aentinger
Copy link
Contributor

Let me ask again

What board are you compiling this for?

As a matter of fact I know that this library works just fine for all samd and mbed boards.

@lendres
Copy link
Author

lendres commented Jun 29, 2021

Nano, Uno, Mega.

Yes, it does work, but it also gives a compiler warning. A good practice is to treat warnings like errors and correct them.

@lendres
Copy link
Author

lendres commented Jun 29, 2021

Let me ask again

Also, it's not really necessary to be rude about it. I responded the way I did because I have tried several boards and suspect that this is related to misuse of a CPP library macro and not related to the particular board. If you did not try reproducing it, that would be a good place to start. If you did try to reproduce it and did not get this compiler error, then please let me know and I will assist in reproducing it.

@per1234
Copy link
Contributor

per1234 commented Jun 29, 2021

You can see warnings from the example sketch compilations for various boards in the CI logs. For example, here is the mentioned warning when compiling for the MKR Zero:
https://github.com/arduino-libraries/Arduino_DebugUtils/runs/2939909649?check_suite_focus=true#step:3:26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project type: support OT: Request for help using the project
Projects
None yet
3 participants