-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Incorrect expansion of ,##__VA_ARGS__ in macro #4639
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
Comments
IIRc, this is a GNU extension. In this project C++ code is compiled with |
Yup, that'd be the cause. Here is G++ 5.4 under Linux, same behavior.
|
It is a GNU extension, but AVR and ESP32 boards are compiled with those extensions enabled. And I can find no resolution to this without those options. This breaks ArduinoUnit on the ESP 8266. c++20 seems to finally have a fix; but until then the standard is broken. (see VA_OPT in https://en.cppreference.com/w/cpp/compiler_support). How horrible is it to compile with -std=gnu++11, which is what the other systems ArduinoUnit supports does? See https://github.com/mmurdoch/arduinounit/blob/pr65/README.md#known-bugs |
Looking at other projects, they're all building using gnu extensions (-std=gnu++11). We're already embedding gnu-specific pragmas for compile options, so I see no reason not to fall in line w/others on this. Fixes esp8266#4639
Looking at other projects, they're all building using gnu extensions (-std=gnu++11). We're already embedding gnu-specific pragmas for compile options, so I see no reason not to fall in line w/others on this. Fixes esp8266#4639
Basic Infos
Latest build from README docs build failed (Mac OS 10.12.6) on python get.py with:
> cd esp8266/tools
> python get.py
IOError: [Errno socket error] [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
Platform
Settings in IDE
Problem Description
g++ supports variadic macros which cleanly reduces to 0 arguments with the notation
The
,##__VA_ARGS__
notation expands to nothing if no arguments are given (the leading comma is removed), while the comma remains for 1 or more arguments.This works correctly on uno, mega and esp32 boards, but fails to expand correctly on esp8266. This notation is important for variable parameter macros. Here is a sketch that compiles under uno, mega, esp32, but has a compile-time-error for esp8266, with log files for uno, mega, esp32 (correct) and esp8266 (compile time error):
https://github.com/mmurdoch/arduinounit/tree/pr65/va_args
Debug Messages
The text was updated successfully, but these errors were encountered: