[all-commits] [llvm/llvm-project] c5a74c: [libcxx] [test] Simplify get_temp_file_name() for ...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Wed Sep 8 00:25:26 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c5a74c0890f41e339c13e2a32cc89828c1451768
      https://github.com/llvm/llvm-project/commit/c5a74c0890f41e339c13e2a32cc89828c1451768
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-09-08 (Wed, 08 Sep 2021)

  Changed paths:
    M libcxx/test/support/platform_support.h

  Log Message:
  -----------
  [libcxx] [test] Simplify get_temp_file_name() for mingw

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.

This reduces the risk of temp name collisions between processes (when
running multiple tests in parallel); the path returned by
GetTempFileName can easily collide with other similar paths.
(_mktemp_s on the other hand tries to avoid such clashes by using
the process id as part of the uniqueness seed.)

This avoids stray random failures in fstreams tests in mingw configurations.

Differential Revision: https://reviews.llvm.org/D98526




More information about the All-commits mailing list