Skip to content

Conversation

@mdavidsaver
Copy link
Contributor

@mdavidsaver mdavidsaver commented Jul 25, 2023

_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined before windows.h is included for the first time. This PR avoids the confusion of indirect #include by defining before any headers are included.

Also fix the K&R style prototype of evutil_check_working_afunix_(). GCC 12 now complains by default (cf. -Wstrict-prototype).

Fixes: #1497

_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined
before the windows.h is included for the first time.
Avoid the confusion of indirect #include by defining
before any.
mingw w/ gcc 12 defaults to -Wstrict-prototype which complains
about K&R style argument lists.
@azat
Copy link
Member

azat commented Jul 25, 2023

Thank you for the patch!

cf. #1497

cf. means it will fix this issue, right? Then you can use Fixes: #ISSUE_NUMBER notation and github will close the referenced issue automatically once this PR will be merged.

@mdavidsaver
Copy link
Contributor Author

"cf." is meant to indicate a cross-link. For my own projects I prefer to ask reporters to close issues manually after confirming a fix, so I don't think about this github.com feature. Of course, this is not one of my own projects :) I have added the Fixes: and will try to remember your preference in future.

@azat
Copy link
Member

azat commented Jul 28, 2023

Interesting, now in mingw build one test started to fail -http/data_length_constraints

@mdavidsaver
Copy link
Contributor Author

I think this CI failure is due to moving the #define _WIN32_WINNT 0x0501 up in evutil.c. Now it actually has effect. Including to hide AI_NUMERICSERV. Increasing to 0x600 avoids this.

While it seems outside the scope of this PR, I wonder about the variety of values for _WIN32_WINNT found around libevent. Particularly CMakeLists.txt vs. configure.ac, which might result in different EVENT__HAVE_*.

$ git grep _WIN32_WINNT
CMakeLists.txt:    set(CMAKE_REQUIRED_DEFINITIONS -FIwinsock2.h -FIws2tcpip.h -D_WIN32_WINNT=0x0600)
ChangeLog-2.0: o InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403. (816115a Peter Rosin)
ChangeLog-2.1: o InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403. (816115a Peter Rosin)
configure.ac:#define _WIN32_WINNT 0x400
configure.ac:#define _WIN32_WINNT 0x400
event_iocp.c:#ifndef _WIN32_WINNT
event_iocp.c:#define _WIN32_WINNT 0x0403
evthread_win32.c:#ifndef _WIN32_WINNT
evthread_win32.c:#define _WIN32_WINNT 0x0403
evutil.c:#ifndef _WIN32_WINNT
evutil.c:#define _WIN32_WINNT 0x0501
listener.c:#ifndef _WIN32_WINNT
listener.c:#define _WIN32_WINNT 0x0403
wepoll.c:#ifndef _WIN32_WINNT
wepoll.c:#define _WIN32_WINNT 0x0600

@azat azat merged commit 66b3904 into libevent:master Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Compile error in wepoll.c with mingw from ubuntu-22.04.2

2 participants