Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stl/inc/any
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <any> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <any> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <initializer_list>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/barrier
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endif // _M_CEE_PURE

#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <barrier> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <barrier> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/bit
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <bit> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <bit> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <intrin0.h>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/charconv
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <charconv> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <charconv> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <cstring>
#include <intrin0.h>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <compare> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <compare> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
#ifdef __cpp_lib_concepts
#include <bit>
Expand Down
3 changes: 1 addition & 2 deletions stl/inc/concepts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#ifndef __cpp_lib_concepts
#pragma message( \
_WARNING_MESSAGE("STL4038", "The contents of <concepts> are available only with C++20 concepts support."))
_EMIT_STL_WARNING(STL4038, "The contents of <concepts> are available only with C++20 concepts support.");
#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv
#include <type_traits>
#include <vcruntime_new.h>
Expand Down
13 changes: 4 additions & 9 deletions stl/inc/coroutine
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
#if _STL_COMPILER_PREPROCESSOR

#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED
#define _STL4039_COROUTINE \
"The contents of <coroutine> are not available with /await. " \
"Remove /await or use /await:strict for standard coroutines. " \
"Use <experimental/coroutine> for legacy /await support."
#pragma message(_WARNING_MESSAGE("STL4039", _STL4039_COROUTINE))
#undef _STL4039_COROUTINE // TRANSITION, DevCom-1479701
_EMIT_STL_WARNING(STL4039, "The contents of <coroutine> are not available with /await. "
"Remove /await or use /await:strict for standard coroutines. "
"Use <experimental/coroutine> for legacy /await support.");
#else // ^^^ /await ^^^ / vvv no /await vvv
#ifndef __cpp_lib_coroutine
Comment thread
strega-nil-ms marked this conversation as resolved.
#define _STL4038_COROUTINE "The contents of <coroutine> are available only with C++20 or later or /await:strict."
#pragma message(_WARNING_MESSAGE("STL4038", _STL4038_COROUTINE))
#undef _STL4038_COROUTINE // TRANSITION, DevCom-1479701
_EMIT_STL_WARNING(STL4038, "The contents of <coroutine> are available only with C++20 or later or /await:strict.");
#else // ^^^ <coroutine> is not available / <coroutine> is available vvv
#ifndef _ALLOW_COROUTINE_ABI_MISMATCH
#pragma detect_mismatch("_COROUTINE_ABI", "2")
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <execution> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <execution> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <algorithm>
#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/expected
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#ifndef __cpp_lib_expected
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <expected> are available only with C++23 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <expected> are available only with C++23 or later.");
#else // ^^^ !__cpp_lib_expected / __cpp_lib_expected vvv
#include <exception>
#include <initializer_list>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <filesystem> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <filesystem> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <algorithm>
#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#ifndef __cpp_lib_format
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <format> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <format> are available only with C++20 or later.");
#else // ^^^ !defined(__cpp_lib_format) / defined(__cpp_lib_format) vvv

#include <__msvc_format_ucd_tables.hpp>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/latch
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endif // _M_CEE_PURE

#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <latch> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <latch> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <atomic>
Expand Down
3 changes: 1 addition & 2 deletions stl/inc/memory_resource
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message( \
_WARNING_MESSAGE("STL4038", "The contents of <memory_resource> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <memory_resource> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <vector>
#include <xbit_ops.h>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/numbers
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <numbers> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <numbers> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
#ifdef __cpp_lib_concepts
#include <concepts>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/optional
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <optional> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <optional> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#if _HAS_CXX20
#include <compare>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#ifndef __cpp_lib_ranges
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <ranges> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <ranges> are available only with C++20 or later.");
#else // ^^^ !defined(__cpp_lib_ranges) / defined(__cpp_lib_ranges) vvv
#include <__msvc_int128.hpp>
#include <iosfwd>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/semaphore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endif // _M_CEE_PURE

#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <semaphore> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <semaphore> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <__msvc_chrono.hpp>
Expand Down
3 changes: 1 addition & 2 deletions stl/inc/source_location
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#ifndef __cpp_consteval
#pragma message( \
_WARNING_MESSAGE("STL4038", "The contents of <source_location> are available only with C++20 consteval support."))
_EMIT_STL_WARNING(STL4038, "The contents of <source_location> are available only with C++20 consteval support.");
#else // ^^^ !defined(__cpp_consteval) / defined(__cpp_consteval) vvv

#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/span
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <span> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <span> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
#include <compare>
#include <cstddef>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/spanstream
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#if !_HAS_CXX23
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <spanstream> are available only with C++23 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <spanstream> are available only with C++23 or later.");
#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv
#ifdef __cpp_lib_concepts
#include <concepts>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/stacktrace
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX23
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <stacktrace> are available only with C++23 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <stacktrace> are available only with C++23 or later.");
#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv

#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#endif // _M_CEE_PURE

#if !_HAS_CXX23
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <stdatomic.h> are available only with C++23 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <stdatomic.h> are available only with C++23 or later.");
#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv

#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/stop_token
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <stop_token> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <stop_token> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/string_view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <string_view> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <string_view> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <xstring>
#endif // _HAS_CXX17
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/syncstream
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#if !_HAS_CXX20
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <syncstream> are available only with C++20 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <syncstream> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
#include <memory>
#include <ostream>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/variant
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX17
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <variant> are available only with C++17 or later."))
_EMIT_STL_WARNING(STL4038, "The contents of <variant> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <exception>
#include <initializer_list>
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/yvals.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ _STL_DISABLE_CLANG_WARNINGS
#ifdef _STATIC_CPPLIB
#ifndef _DISABLE_DEPRECATE_STATIC_CPPLIB
#ifdef _DLL
#pragma message(_WARNING_MESSAGE("STL4000", "_STATIC_CPPLIB is deprecated and will be REMOVED."))
_EMIT_STL_WARNING(STL4000, "_STATIC_CPPLIB is deprecated and will be REMOVED.");
#endif
#ifdef _M_CEE_MIXED
#error _STATIC_CPPLIB is not supported while building with /clr
Expand All @@ -245,7 +245,7 @@ _STL_DISABLE_CLANG_WARNINGS
#endif // _STATIC_CPPLIB

#if defined(_M_CEE_PURE) && !defined(_SILENCE_CLR_PURE_DEPRECATION_WARNING)
#pragma message(_WARNING_MESSAGE("STL4001", "/clr:pure is deprecated and will be REMOVED."))
_EMIT_STL_WARNING(STL4001, "/clr:pure is deprecated and will be REMOVED.");
#endif

#ifndef _MRTIMP2_PURE
Expand Down
36 changes: 30 additions & 6 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@

#if _STL_COMPILER_PREPROCESSOR

// This does not use `_EMIT_STL_ERROR`, as it needs to be checked before we include anything else.
// However, `_EMIT_STL_ERROR` has a dependency on `_CRT_STRINGIZE`, defined in `<vcruntime.h>`.
// Here, we employ the same technique as `_CRT_STRINGIZE` in order to avoid needing to update the line number.
#ifndef __cplusplus
#error STL1003: Unexpected compiler, expected C++ compiler.
#define _STL_STRINGIZE_(S) #S
#define _STL_STRINGIZE(S) _STL_STRINGIZE_(S)
#pragma message(__FILE__ "(" _STL_STRINGIZE(__LINE__) "): STL1003: Unexpected compiler, expected C++ compiler.")
#error Error in C++ Standard Library usage
#endif // __cplusplus

// Implemented unconditionally:
Expand Down Expand Up @@ -417,7 +423,25 @@
#include <vcruntime.h>
#include <xkeycheck.h> // The _HAS_CXX tags must be defined before including this.

#define _WARNING_MESSAGE(NUMBER, MESSAGE) __FILE__ "(" _CRT_STRINGIZE(__LINE__) "): warning " NUMBER ": " MESSAGE
// Note that _STL_PRAGMA is load-bearing;
// it still needs to exist even once CUDA and ICC support _Pragma.
#if defined(__CUDACC__) || defined(__INTEL_COMPILER)
#define _STL_PRAGMA(PRAGMA) __pragma(PRAGMA)
#else
#define _STL_PRAGMA(PRAGMA) _Pragma(#PRAGMA)
#endif

#define _STL_PRAGMA_MESSAGE(MESSAGE) _STL_PRAGMA(message(MESSAGE))
#define _EMIT_STL_MESSAGE(MESSAGE) _STL_PRAGMA_MESSAGE(__FILE__ "(" _CRT_STRINGIZE(__LINE__) "): " MESSAGE)

// clang-format off
Comment thread
CaseyCarter marked this conversation as resolved.
#define _EMIT_STL_WARNING(NUMBER, MESSAGE) \
Comment thread
CaseyCarter marked this conversation as resolved.
_EMIT_STL_MESSAGE("warning " #NUMBER ": " MESSAGE) \
Comment thread
CaseyCarter marked this conversation as resolved.
static_assert(true, "")
#define _EMIT_STL_ERROR(NUMBER, MESSAGE) \
_EMIT_STL_MESSAGE("error " #NUMBER ": " MESSAGE) \
static_assert(false, "Error in C++ Standard Library usage.")
// clang-format on

#ifndef _STL_WARNING_LEVEL
#if defined(_MSVC_WARNING_LEVEL) && _MSVC_WARNING_LEVEL >= 4
Expand Down Expand Up @@ -620,17 +644,17 @@
#ifndef _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
#if defined(__CUDACC__) && defined(__CUDACC_VER_MAJOR__)
#if __CUDACC_VER_MAJOR__ < 11 || (__CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ < 6)
#error STL1002: Unexpected compiler version, expected CUDA 11.6 or newer.
_EMIT_STL_ERROR(STL1002, "Unexpected compiler version, expected CUDA 11.6 or newer.");
#endif // ^^^ old CUDA ^^^
#elif defined(__EDG__)
// not attempting to detect __EDG_VERSION__ being less than expected
#elif defined(__clang__)
#if __clang_major__ < 14
#error STL1000: Unexpected compiler version, expected Clang 14.0.0 or newer.
_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 14.0.0 or newer.");
#endif // ^^^ old Clang ^^^
#elif defined(_MSC_VER)
#if _MSC_VER < 1933 // Coarse-grained, not inspecting _MSC_FULL_VER
#error STL1001: Unexpected compiler version, expected MSVC 19.33 or newer.
_EMIT_STL_ERROR(STL1001, "Unexpected compiler version, expected MSVC 19.33 or newer.");
#endif // ^^^ old MSVC ^^^
#else // vvv other compilers vvv
// not attempting to detect other compilers
Expand Down Expand Up @@ -687,7 +711,7 @@
#endif // _HAS_UNEXPECTED

#if _HAS_UNEXPECTED && _HAS_CXX23
#error STL1004: C++98 unexpected() is incompatible with C++23 unexpected<E>.
_EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpected<E>.");
#endif // _HAS_UNEXPECTED && _HAS_CXX23

// P0004R1 Removing Deprecated Iostreams Aliases
Expand Down