Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use consistent phrasing of required standard mode #252

Merged
merged 5 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions stl/inc/any
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am usually the person who hates inverted conditionals with else, but I think this is the exception that proves the rule :) Thanks!

#pragma message("The contents of <any> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <initializer_list>
#include <type_traits>
#include <typeinfo>
Expand Down Expand Up @@ -441,8 +443,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("class any is only available with C++17 or later.")
#endif // _HAS_CXX17

#endif // _STL_COMPILER_PREPROCESSOR
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/charconv
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("The contents of <charconv> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <float.h>
#include <intrin0.h>
#include <string.h>
Expand Down Expand Up @@ -3097,8 +3099,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("The contents of <charconv> are only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _CHARCONV_
6 changes: 3 additions & 3 deletions stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX20
#if !_HAS_CXX20
#pragma message("The contents of <compare> are available only with C++20 or later.")
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv
#include <xtr1common>

#pragma pack(push, _CRT_PACKING)
Expand Down Expand Up @@ -475,8 +477,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ C++20 / not C++20 vvv
#pragma message("The contents of <compare> are only available with C++20 or later.")
#endif // _HAS_CXX20

#endif // _STL_COMPILER_PREPROCESSOR
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/concepts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#ifdef __cpp_lib_concepts
#ifndef __cpp_lib_concepts
#pragma message("The contents of <concepts> are available only with C++20 concepts support.")
#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv
#if defined(__clang__) && !defined(_SILENCE_CLANG_CONCEPTS_MESSAGE)
#error Despite the presence of some Clang-related bits, this header currently does not support Clang. \
You can define _SILENCE_CLANG_CONCEPTS_MESSAGE to silence this message and acknowledge that this is unsupported.
Expand Down Expand Up @@ -364,8 +366,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ <concepts> supported / <concepts> not supported vvv
#pragma message("The contents of <concepts> are only available with C++20 concepts support.")
#endif // __cpp_lib_concepts
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _CONCEPTS_
6 changes: 3 additions & 3 deletions stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("The contents of <execution> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <algorithm>
#include <atomic>
#include <memory>
Expand Down Expand Up @@ -5137,8 +5139,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("Parallel algorithms are only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _EXECUTION_
6 changes: 3 additions & 3 deletions stl/inc/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("The contents of <filesystem> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <algorithm>
#include <chrono>
#include <cwchar>
Expand Down Expand Up @@ -4330,8 +4332,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("The contents of <filesystem> are only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _FILESYSTEM_
6 changes: 3 additions & 3 deletions stl/inc/memory_resource
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("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>
#include <xpolymorphic_allocator.h>
Expand Down Expand Up @@ -755,8 +757,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("The contents of <memory_resource> are only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _MEMORY_RESOURCE_
6 changes: 3 additions & 3 deletions stl/inc/optional
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#define _OPTIONAL_
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("The contents of <optional> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <exception>
#include <initializer_list>
#include <type_traits>
Expand Down Expand Up @@ -637,8 +639,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("class template optional is only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _OPTIONAL_
6 changes: 3 additions & 3 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#define _RANGES_
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#ifdef __cpp_lib_concepts
#ifndef __cpp_lib_concepts
#pragma message("The contents of <ranges> are available only with C++20 concepts support.")
#else // ^^^ !defined(__cpp_lib_concepts) / defined(__cpp_lib_concepts) vvv
#include <iterator>

#pragma pack(push, _CRT_PACKING)
Expand All @@ -34,8 +36,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#else // ^^^ Concepts support / no Concepts vvv
#pragma message("The contents of <ranges> are only available with C++20 concepts support.")
#endif // __cpp_lib_concepts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be defined(__cpp_lib_concepts)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Our current practice is inconsistent (because we've added arrow comments over the years). Your PR currently follows one of our patterns - repeating the macro name as the #endif comment, despite the arrow comment on the #else. So this would be fine to leave as-is. You could also consistently use a matching arrow, which would be // ^^^ defined(__cpp_lib_concepts) ^^^ here. (The one thing we don't do is pair #ifndef MEOW with #endif // defined(MEOW).)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I assume they would eventually be replaced with _HAS_CXX20 at some point. So I guess It would eventually solve itself?

#endif // _STL_COMPILER_PREPROCESSOR
#endif // _RANGES_
6 changes: 3 additions & 3 deletions stl/inc/string_view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("The contents of <string_view> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <xstring>
#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv
#pragma message("string_view is only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _STRING_VIEW_
7 changes: 3 additions & 4 deletions stl/inc/variant
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR

#if _HAS_CXX17
#if !_HAS_CXX17
#pragma message("The contents of <variant> are available only with C++17 or later.")
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <exception>
#include <initializer_list>
#include <type_traits>
Expand Down Expand Up @@ -1749,9 +1751,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)

#else // ^^^ _HAS_CXX17 ^^^ / vvv !_HAS_CXX17 vvv
#pragma message("class template variant is only available with C++17 or later.")
#endif // _HAS_CXX17
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _VARIANT_