Merge bitcoin/bitcoin#29357: test: Drop x modifier in fsbridge::fopen call for MinGW builds

d2fe90571e test: Drop `x` modifier in `fsbridge::fopen` call for mingw builds (Hennadii Stepanov)

Pull request description:

  The MinGW-w64 toolchain links executables to the old msvcrt C Runtime Library that does not support the `x` modifier for the [`_wfopen()`](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170) function.

  Fixes https://github.com/bitcoin/bitcoin/issues/29014.

ACKs for top commit:
  maflcko:
    ACK d2fe90571e
  fanquake:
    ACK d2fe90571e - the plan here should still be to migrate to the newer windows runtime.

Tree-SHA512: 0269b66531e58c093ecda3a3e355a20ee8274e165d7e010f8f125881b3c8d4cfe801abdca4605d81efd3b2dbe9a81896968971f6f53da7f6c6093b76b47c5bc9
This commit is contained in:
fanquake 2024-02-26 16:04:41 +00:00
commit 4d7d7fd123
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -29,7 +29,14 @@ BOOST_AUTO_TEST_CASE(xor_file)
BOOST_CHECK_EXCEPTION(xor_file.ignore(1), std::ios_base::failure, HasReason{"AutoFile::ignore: file handle is nullpt"}); BOOST_CHECK_EXCEPTION(xor_file.ignore(1), std::ios_base::failure, HasReason{"AutoFile::ignore: file handle is nullpt"});
} }
{ {
AutoFile xor_file{raw_file("wbx"), xor_pat}; #ifdef __MINGW64__
// Our usage of mingw-w64 and the msvcrt runtime does not support
// the x modifier for the _wfopen().
const char* mode = "wb";
#else
const char* mode = "wbx";
#endif
AutoFile xor_file{raw_file(mode), xor_pat};
xor_file << test1 << test2; xor_file << test1 << test2;
} }
{ {