-
Notifications
You must be signed in to change notification settings - Fork 34
Improve mocks of builtin macros #133
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
Labels
Comments
matthijskooijman
added a commit
to matthijskooijman/arduino_ci
that referenced
this issue
Aug 26, 2020
This replaces the macros in AvrMath.h with template functions when included from C++. This prevents name clashes with e.g. the `std::min` function or similar methods or namespace-local functions. For C, this still uses a macro (lacking templates), but an improved version that prevents double evaluation of arguments. This code is based on the ArduinoCore-API repository, which is in the process of become the single source of all non-architecture-specific Arduino API code: https://github.com/arduino/ArduinoCore-API/blob/master/api/Common.h There, only `min` and `max` have been replaced by template functions, but others will probably follow as well: arduino/ArduinoCore-API#85 This fixes Arduino-CI#133.
Closed
matthijskooijman
added a commit
to matthijskooijman/arduino_ci
that referenced
this issue
Nov 6, 2020
This replaces the macros in AvrMath.h with template functions when included from C++. This prevents name clashes with e.g. the `std::min` function or similar methods or namespace-local functions. For C, this still uses a macro (lacking templates), but an improved version that prevents double evaluation of arguments. This code is based on the ArduinoCore-API repository, which is in the process of become the single source of all non-architecture-specific Arduino API code: https://github.com/arduino/ArduinoCore-API/blob/master/api/Common.h There, only `min` and `max` have been replaced by template functions, but others will probably follow as well: arduino/ArduinoCore-API#85 This fixes Arduino-CI#133.
matthijskooijman
added a commit
to matthijskooijman/arduino_ci
that referenced
this issue
Nov 6, 2020
This replaces the macros in AvrMath.h with template functions when included from C++. This prevents name clashes with e.g. the `std::min` function or similar methods or namespace-local functions. For C, this still uses a macro (lacking templates), but an improved version that prevents double evaluation of arguments. This code is based on the ArduinoCore-API repository, which is in the process of become the single source of all non-architecture-specific Arduino API code: https://github.com/arduino/ArduinoCore-API/blob/master/api/Common.h There, only `min` and `max` have been replaced by template functions, but others will probably follow as well: arduino/ArduinoCore-API#85 This fixes Arduino-CI#133.
matthijskooijman
added a commit
to matthijskooijman/arduino_ci
that referenced
this issue
Nov 6, 2020
This replaces the macros in AvrMath.h with template functions when included from C++. This prevents name clashes with e.g. the `std::min` function or similar methods or namespace-local functions. For C, this still uses a macro (lacking templates), but an improved version that prevents double evaluation of arguments. This code is based on the ArduinoCore-API repository, which is in the process of become the single source of all non-architecture-specific Arduino API code: https://github.com/arduino/ArduinoCore-API/blob/master/api/Common.h There, only `min` and `max` have been replaced by template functions, but others will probably follow as well: arduino/ArduinoCore-API#85 This fixes Arduino-CI#133.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A post to the arduino developers' mailing list suggests a smarter way to do macros for (e.g.)
max
using "statement expressions":Adopting this will prevent double-evaluating
a
andb
if for some reason they themselves are expressions with side effects.The text was updated successfully, but these errors were encountered: