Conversation
|
Ooops, I put meessage "test for mingw" but currently t/cli is not possible to build on mingw since ns_msg is not found on Windows. So I did lies. 🤔 |
huitema
left a comment
There was a problem hiding this comment.
This PR will break the existing builds of Picotls using Visual Studio. It replaces occurrences of #ifdef _WINDOWS by #ifdef _WIN32, presumably because _WIN32 is already defined in the Min GW environment, but at the cost of breaking the Visual Studio builds. You could achieve the same results while keeping compatibility with the Visual Studio builds if you replace #ifdef _WINDOWS by:
#if defined(_WINDOWS) || defined(_WIN32)
Also, I do not see the results of the CI checks for this PR. Did they run?
| make all VERBOSE=1 | ||
| make check | ||
| windows: | ||
| name: "${{ matrix.name }}" |
There was a problem hiding this comment.
The name "windows" is a bit confusing, as we also have a direct port on Windows relying on Visual Studio. Maybe use "mingw" for clarity?
There was a problem hiding this comment.
I think that this change broke the CI tests -- they did not run at all after that.
There was a problem hiding this comment.
Current implementation of t/cli.c have many UNIX-ish codes. So we can not run it. But this can be useful to check build error for future's changes at least.
| ADD_EXECUTABLE(cli t/cli.c lib/pembase64.c) | ||
| TARGET_LINK_LIBRARIES(cli picotls-openssl picotls-core) | ||
| ENDIF () | ||
| ADD_EXECUTABLE(picotls-esni src/esni.c) |
There was a problem hiding this comment.
I am not sure why you need to exclude "pembase64.c" on Windows builds. It works well with the direct Windows port, with one caveat: you have to define the preprocessor flag "_WINDOWS".
There was a problem hiding this comment.
No. t/cli is not possible to build on Visual Studio.
Lines 27 to 41 in 7e97d3e
|
|
||
| #ifdef _WINDOWS | ||
| #ifdef _WIN32 | ||
| #include <intrin.h> |
There was a problem hiding this comment.
Please do not change this code, that would break the native Visual Studio implementation.
If you really prefer using the string "_WIN32", then you could write:
#if defined(_WIN32) || defined(_WINDOWS)
There was a problem hiding this comment.
You don't need to define _WINDOWS since _WIN32 is always set on Windows. (even if Windows 64 bit)
| { | ||
| #ifdef _WINDOWS | ||
| #ifdef _WIN32 | ||
| uint32_t r = 0; |
There was a problem hiding this comment.
I replaced all _WINDOWS to _WIN32 since _WINDOWS is not required for mingw and Visual Studio both.
There was a problem hiding this comment.
I am dubious about this because the CI checks are not running after your changes in ci.yml. I see that the appveyor tests were succeeding before the commit test for mingw, which implies that the Visual Studio build was verified, so we may well be good. But we will not know until we have CI tests working gain...
There was a problem hiding this comment.
The reason the ci didn't run after this change is because I merged this change from another branch.
https://github.com/mattn/picotls/actions
@kazuho could you please re-run the action for latest changes ?
There was a problem hiding this comment.
@mattn Mind pushing an empty commit? I think @huitema is wondering if we could rerun CI on appveyor.
Regarding _WIN32 vs. _WINDOWS, to me it seems we can switch to _WIN32.
Official documentation does state that _WIN32 will always be defined by MSVC compiler (https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170). OTOH, _WINDOWS does not appear in the list. I wonder if it is something Vistual Studio sets (or if it is a convention in the project-level setting).
There was a problem hiding this comment.
No, it is not something that Visual Studio sets. It is something that I kind of invented 5 years ago as I was trying to make things work. I think that to be complete, we should also edit the Visual Studio projects that use the _WINDOWS and _WINDOWS64 macros. But I could do that in a different PR.
As soon as I see a correct test run, I will approve the changes.
There was a problem hiding this comment.
AFAIK, _WIN32 can be used for checking Windows OS from 12 years ago at least. For example, I used _WIN32 in 2010 that works with both compilers.
There was a problem hiding this comment.
@mattn I do realize that I made a mistake 5 years ago. As I said, I just need to see the test run...
huitema
left a comment
There was a problem hiding this comment.
All tests are passing, including the appveyor tests. Looks good.
|
We just have to resolve the merging conflicts! Maybe merge the latest "main" into this branch? |
|
@huitema Thank you. Fixed. |
kazuho
left a comment
There was a problem hiding this comment.
Thank you for the changes. I'll take a look, make necessary changes and merge.
t/cli ignored on mingw build.