This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Simplify get_temp_file_name() for mingw
ClosedPublic

Authored by mstorsjo on Mar 12 2021, 9:39 AM.

Details

Summary

Use the same codepaths as for MSVC. Mingw-w64 does have the _mktemp_s
function; on Vista and newer, msvcrt.dll does contain the function,
which ends up called. (Same thing in the UCRT.) In older versions of
msvcrt.dll (older than what libc++ supports), mingw-w64 provides a
fallback implementation.

This effectively reverts 23323e25f896cf44e6d4519ef38f066e45fe408f (and
d07e5c23b40078dcae13f76b091c9e18763ae44a). That commit tried to fix
unspecified MinGW build breakage. The commit added calls to GetTempPath
and GetTempFileName, but those functions weren't declared unless windows.h
was included implicitly via some other header.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Mar 12 2021, 9:39 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 9:39 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

I let @EricWF have a look at it as he was the author of this MinGW specific code. No particular remarks from my side anyway.

I let @EricWF have a look at it as he was the author of this MinGW specific code. No particular remarks from my side anyway.

@curdeius What would you think of first landing D97456 (to unbreak things), and then rebasing this on top of that (to clean things up more properly), with this one waiting a bit more on feedback from @EricWF?

That sounds good for me. Actually I had an impression that D97456 already landed.

That sounds good for me. Actually I had an impression that D97456 already landed.

Well I was just about to land it last week, when I realized that this approach might be a better fix, but I'll land the other one for now.

mstorsjo updated this revision to Diff 330703.Mar 15 2021, 9:55 AM

Rebased after landing D97456

mstorsjo retitled this revision from [libcxx] [test] Fix the get_temp_file_name() function for mingw (alternative implementation) to [libcxx] [test] Simplify get_temp_file_name() for mingw.Mar 15 2021, 9:57 AM
mstorsjo edited the summary of this revision. (Show Details)
mstorsjo updated this revision to Diff 370882.Sep 6 2021, 3:17 AM

Rebased; I noticed that mingw configurations could have frequent stray failures in tests that are fixed by this, so it'd be good to get it landed.

ldionne accepted this revision.Sep 7 2021, 9:45 AM
This revision is now accepted and ready to land.Sep 7 2021, 9:45 AM
This revision was automatically updated to reflect the committed changes.