-
Notifications
You must be signed in to change notification settings - Fork 2k
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
gnrc/icmpv6: conditional definition of the MIN macro #14358
gnrc/icmpv6: conditional definition of the MIN macro #14358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather use #undef
?
@@ -27,7 +27,9 @@ | |||
#define ICMPV6_ERROR_SET_VALUE(data, value) \ | |||
((icmpv6_error_pkt_too_big_t *)(data))->mtu = byteorder_htonl(value) | |||
|
|||
#ifndef MIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rather use
#ifndef MIN | |
#undef MIN /* undefine common name just to be safe */ |
in case MIN
is not actually determining the minimum between two values (could also be just 60
for MINutes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
I wonder why RIOT does not have a definition of |
See discussion #13530 (comment) ff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK from my side. I agree that Murdock compilation is enough to test this. Please squash.
Since `min(a,b)` is a very frequently used function, several libraries such as ESP8266 SDK define a `MIN` macro in their header files. Therefore the `MIN` macro should be undefined before its definition to avoid compilation errors if it is defined anywhere else before.
a6e5e1f
to
a440ae7
Compare
@miri64 Thanks for reviewing and merging. |
Contribution description
While implementing the inlined version of
irq_*
functions according to PR #13999 and issue #14356, I ran into a compilation problem with theMIN
macro definition insys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
.Since
min(a,b)
is a very frequently used function, several libraries such as the ESP8266 SDK define their ownMIN
macro in their header files. Therefore theMIN
macro ingnrc/icmpv6
should only be defined if it has not been defined anywhere else before.Testing procedure
Compilation in Murdock should succeed.
Issues/PRs references