Skip to content
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

tests/server/util: remove in6addr_any for recent MinGW #1379

Merged
merged 1 commit into from Apr 3, 2017

Conversation

MarcelRaad
Copy link
Member

@MarcelRaad MarcelRaad commented Apr 2, 2017

In ancient MinGW versions, in6addr_any was declared as extern, but not
defined. Because of that, 22a0c57 added
definitions for in6addr_any when compiling with MinGW. The bug was fixed in
w32api version 3.6 from 2006, so this workaround is not needed anymore for
recent versions.

This fixes the following MinGW-w64 warnings because the MinGW-w64 version of
IN6ADDR_ANY_INIT has the two additional braces inside the macro:
util.c:59:14: warning: braces around scalar initializer
util.c:59:40: warning: excess elements in scalar initializer

Ref: https://sourceforge.net/p/mingw/mingw-org-wsl/ci/e4803e0da25c57ae1ad0fa75ae2b7182ff7fa339/tree/w32api/ChangeLog

An alternative would be to remove support for these ancient MinGW versions
and just remove the redefinition of inaddr_any, of course.

@mention-bot
Copy link

@MarcelRaad, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yangtse, @bagder and @gknauf to be potential reviewers.

#if defined(ENABLE_IPV6) && defined(__MINGW32__)
#if (__W32API_MAJOR_VERSION < 3) || \
((__W32API_MAJOR_VERSION == 3) && (__W32API_MINOR_VERSION < 6))
const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mingw-w64 mingw-w64-headers/include/ws2tcpip.h:

#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }

libcurl tests/server/util.c:

const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }};

The extra braces appear to have been added to util.c in 14424f7. Original mingw defines that macro as {0} and it has to be {{{0}}} to avoid a missing braces warning at some levels.

Re fix, it's fine but the comment is superfluous since the check makes it obvious.

In ancient MinGW versions, in6addr_any was declared as extern, but not
defined. Because of that, 22a0c57 added
definitions for in6addr_any when compiling with MinGW. The bug was fixed in
w32api version 3.6 from 2006, so this workaround is not needed anymore for
recent versions.

This fixes the following MinGW-w64 warnings because the MinGW-w64 version of
IN6ADDR_ANY_INIT has the two additional braces inside the macro:
util.c:59:14: warning: braces around scalar initializer
util.c:59:40: warning: excess elements in scalar initializer

Ref: https://sourceforge.net/p/mingw/mingw-org-wsl/ci/e4803e0da25c57ae1ad0fa75ae2b7182ff7fa339/tree/w32api/ChangeLog
Closes curl#1379
@MarcelRaad MarcelRaad merged commit 55f4aba into curl:master Apr 3, 2017
@MarcelRaad MarcelRaad deleted the util_initializer branch April 3, 2017 09:22
@MarcelRaad
Copy link
Member Author

Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators May 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants