-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
cmake: Fix passing _WINSOCKAPI_ macro for Open Watcom tools #1195
Conversation
@jmalak, thanks for your PR! By analyzing the history of the files in this pull request, we identified @billhoffman, @snikulov and @Sukender to be potential reviewers. |
What do you mean? Why would there be a problem with other compilers? Which compilers? |
Because macro defined from command line is different kind then what is defined in headers. |
No, they're not. You can define a define to a value or just to "defined status" both on command line and in code. |
At minimum Visual C++ and gcc define macro from command line by option -Dmacro as |
bellow is copy of issue from Visual C++ configuration log
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock2.h(17): warning C4005: 'WINSOCKAPI' : macro redefinition
|
I still don't understand what other compilers may have problems or with what. |
No it is not true.
|
Yes that's right. But is -DFOO= format accepted by all compilers? If it is we don't need a special WATCOM block for that, we can just do it that way. I'm not sure why we have the winsock api define like this, probably to prevent regular winsock from interfering if it's somehow included before winsock2. Also what's with the other two line changes you made, they don't seem to change anything but they show up in github as changes. Did you change the line endings or something |
I can not guarantee that it is accepted by all compilers. At minimum gcc and Visual C and probably clang compilers support it. -D name[=value] Sorry, the two other changes was created by github editor (end-of-line changes) from Web interface. |
I tried to resubmit it from local git, with same result. |
@jay: indeed, The other option would be to test headers in proper order. winsock2.h and ws2tcpip.h should be included before windows.h and winsock.h (note that windows.h includes winsock.h if WIN32_LEAN_AND_MEAN is not defined). |
Correct compiler option must be -D_WINSOCKAPI_= to define _WINSOCKAPI_ macro as blank text (same value as in Microsoft Winsock header files).
Changes just landed, thanks. If a compiler used by cmake doesn't support FOO= we'll wait until we hear about it and react from that.
I looked into this and it seems what happened is your editor (or github's editor?) converts the file to UTF-8 encoding from extended ascii. Since those two lines contain extended ascii characters they differ, so I ignored those changes.
Yes, I believe this came up before and some other thing we were testing for like OpenSSL included something that included something that included the first version of Winsock instead of the second, and so someone decided to just define |
Open Watcom pass
-D_WINSOCKAPI_
option as
#define _WINSOCKAPI_ 1
, but proper definition must be
#define _WINSOCKAPI_
Correct compiler option must be
-D_WINSOCKAPI_=
The problem must be with other compilers too.
Fix is only for Open Watcom tools but should be extend to other compilers.