Skip to content

Commit dc29e30

Browse files
fsb4000AdamBuciorStephanTLavavej
authored
add STL4038 prefix to "requires C++NN or later" messages (#2061)
Co-authored-by: Adam Bucior <35536269+AdamBucior@users.noreply.github.com> Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
1 parent 04ee878 commit dc29e30

28 files changed

+44
-32
lines changed

stl/inc/any

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#if !_HAS_CXX17
13-
#pragma message("The contents of <any> are available only with C++17 or later.")
13+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <any> are available only with C++17 or later."))
1414
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
1515
#include <initializer_list>
1616
#include <type_traits>

stl/inc/barrier

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#endif // _M_CEE_PURE
1515

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

2020
#include <atomic>

stl/inc/bit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <yvals_core.h>
1010
#if _STL_COMPILER_PREPROCESSOR
1111
#if !_HAS_CXX20
12-
#pragma message("The contents of <bit> are available only with C++20 or later.")
12+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <bit> are available only with C++20 or later."))
1313
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
1414

1515
#include <intrin0.h>

stl/inc/charconv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#if !_HAS_CXX17
13-
#pragma message("The contents of <charconv> are available only with C++17 or later.")
13+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <charconv> are available only with C++17 or later."))
1414
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
1515
#include <cstring>
1616
#include <intrin0.h>

stl/inc/compare

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#if !_HAS_CXX20
13-
#pragma message("The contents of <compare> are available only with C++20 or later.")
13+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <compare> are available only with C++20 or later."))
1414
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
1515
#ifdef __cpp_lib_concepts
1616
#include <bit>

stl/inc/concepts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#ifndef __cpp_lib_concepts
13-
#pragma message("The contents of <concepts> are available only with C++20 concepts support.")
13+
#pragma message( \
14+
_WARNING_MESSAGE("STL4038", "The contents of <concepts> are available only with C++20 concepts support."))
1415
#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv
1516
#include <type_traits>
1617
#include <vcruntime_new.h>

stl/inc/coroutine

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED
13-
#pragma message("The contents of <coroutine> are not available with /await.")
14-
#pragma message("Remove /await or use /await:strict for standard coroutines.")
15-
#pragma message("Use <experimental/coroutine> for legacy /await support.")
13+
#define _STL4039_COROUTINE \
14+
"The contents of <coroutine> are not available with /await. " \
15+
"Remove /await or use /await:strict for standard coroutines. " \
16+
"Use <experimental/coroutine> for legacy /await support."
17+
#pragma message(_WARNING_MESSAGE("STL4039", _STL4039_COROUTINE))
18+
#undef _STL4039_COROUTINE // TRANSITION, DevCom-1479701
1619
#else // ^^^ /await ^^^ / vvv no /await vvv
1720
#ifndef __cpp_lib_coroutine
18-
#pragma message("The contents of <coroutine> are available only with C++20 or later or /await:strict.")
21+
#define _STL4038_COROUTINE "The contents of <coroutine> are available only with C++20 or later or /await:strict."
22+
#pragma message(_WARNING_MESSAGE("STL4038", _STL4038_COROUTINE))
23+
#undef _STL4038_COROUTINE // TRANSITION, DevCom-1479701
1924
#else // ^^^ <coroutine> is not available / <coroutine> is available vvv
2025
#ifndef _ALLOW_COROUTINE_ABI_MISMATCH
2126
#pragma detect_mismatch("_COROUTINE_ABI", "2")

stl/inc/execution

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#if !_HAS_CXX17
13-
#pragma message("The contents of <execution> are available only with C++17 or later.")
13+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <execution> are available only with C++17 or later."))
1414
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
1515
#include <algorithm>
1616
#include <atomic>

stl/inc/expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <yvals.h>
1010
#if _STL_COMPILER_PREPROCESSOR
1111
#ifndef __cpp_lib_expected
12-
#pragma message("The contents of <expected> are available only with C++23 or later.")
12+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <expected> are available only with C++23 or later."))
1313
#else // ^^^ !__cpp_lib_expected / __cpp_lib_expected vvv
1414
#include <exception>
1515
#include <initializer_list>

stl/inc/filesystem

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if _STL_COMPILER_PREPROCESSOR
1111

1212
#if !_HAS_CXX17
13-
#pragma message("The contents of <filesystem> are available only with C++17 or later.")
13+
#pragma message(_WARNING_MESSAGE("STL4038", "The contents of <filesystem> are available only with C++17 or later."))
1414
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
1515
#include <algorithm>
1616
#include <chrono>

0 commit comments

Comments
 (0)