[all-commits] [llvm/llvm-project] 3aee4a: [libc++] Update <source_location> and msvc_stdlib_...

Stephan T. Lavavej via All-commits all-commits at lists.llvm.org
Wed Dec 6 06:04:21 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3aee4a96289b32386d1a6ccda9bc6bf4fff40e13
      https://github.com/llvm/llvm-project/commit/3aee4a96289b32386d1a6ccda9bc6bf4fff40e13
  Author: Stephan T. Lavavej <stl at nuwen.net>
  Date:   2023-12-06 (Wed, 06 Dec 2023)

  Changed paths:
    M libcxx/include/source_location
    M libcxx/include/version
    M libcxx/test/std/language.support/support.limits/support.limits.general/source_location.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
    M libcxx/test/support/msvc_stdlib_force_include.h
    M libcxx/utils/generate_feature_test_macro_components.py

  Log Message:
  -----------
  [libc++] Update <source_location> and msvc_stdlib_force_include.h (#74266)

This makes libc++'s <filesystem> tests compatible with MSVC's STL.

In msvc_stdlib_force_include.h, we need to define 3 more macros:

- _CRT_DECLARE_NONSTDC_NAMES activates the POSIX names of
  `getcwd` etc. As the comment explains, we need this because
  we test with Clang `-fno-ms-compatibility`, which defines 
  `__STDC__` to `1`, which causes the UCRT headers to disable 
  the POSIX names by default.
- Then we need _CRT_NONSTDC_NO_WARNINGS to avoid emitting
  deprecation warnings about the POSIX names.
- Finally, we need `NOMINMAX` to seal away the ancient evil.

These macros are documented in https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility?view=msvc-170.

As a drive-by change, the patch adds a "simulated" macro for 
__has_feature(hwaddress_sanitizer). It also clang-formats all
of msvc_stdlib_force_include.h and removes guards for
__has_builtin(__builtin_source_location) in <source_location>,
since those are not needed anymore.




More information about the All-commits mailing list