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

Workaround for non-_Ugly attribute tokens #3760

Merged
merged 4 commits into from
Jun 15, 2023
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
8 changes: 8 additions & 0 deletions stl/inc/memory
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#undef msvc

_STD_BEGIN
#if _HAS_CXX17
#define _REQUIRE_PARALLEL_LVALUE_ITERATOR(_Iter) \
Expand Down Expand Up @@ -4357,6 +4361,10 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 {
#endif // _HAS_TR1_NAMESPACE

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
10 changes: 10 additions & 0 deletions stl/inc/system_error
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("noop_dtor")
#undef msvc
#undef noop_dtor

_STD_BEGIN
_EXPORT_STD enum class io_errc { // error codes for ios_base::failure
stream = 1
Expand Down Expand Up @@ -728,6 +734,10 @@ _NODISCARD inline error_code _Make_ec(__std_win_error _Errno) noexcept { // make
_STD_END
#endif // _HAS_CXX17

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("noop_dtor")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
13 changes: 13 additions & 0 deletions stl/inc/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("intrinsic")
#pragma push_macro("known_semantics")
#undef msvc
#undef intrinsic
#undef known_semantics

_STD_BEGIN
template <class>
// TRANSITION, CWG-2518: false value attached to a dependent name (for static_assert)
Expand Down Expand Up @@ -2582,6 +2590,11 @@ _STL_RESTORE_DEPRECATED_WARNING

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("known_semantics")
#pragma pop_macro("intrinsic")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
13 changes: 13 additions & 0 deletions stl/inc/utility
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("intrinsic")
#pragma push_macro("known_semantics")
#undef msvc
#undef intrinsic
#undef known_semantics

_STD_BEGIN
_EXPORT_STD template <class _Ty, _Ty... _Vals>
struct integer_sequence { // sequence of integer parameters
Expand Down Expand Up @@ -956,6 +964,11 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 {

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("known_semantics")
#pragma pop_macro("intrinsic")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
11 changes: 11 additions & 0 deletions stl/inc/xtr1common
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("known_semantics")
#undef msvc
#undef known_semantics

_STD_BEGIN
_EXPORT_STD template <class _Ty, _Ty _Val>
struct integral_constant {
Expand Down Expand Up @@ -237,6 +243,11 @@ struct remove_cvref {
#endif // _HAS_CXX20

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("known_semantics")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
8 changes: 8 additions & 0 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#undef msvc

#if defined(_CRTBLD) && defined(CRTDLL2)
// TRANSITION, ABI: The vector algorithms are compiled into the import lib, so we disable their usage when building
// the DLL. (We could additionally link them into the DLL - not as exports, just for internal usage - but we
Expand Down Expand Up @@ -7236,6 +7240,10 @@ _NODISCARD constexpr bool _Mul_overflow(const _Int _Left, const _Int _Right, _In
#endif // _HAS_CXX23 && defined(__cpp_lib_concepts)

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,31 @@
#define xtime delete
#define xtime_get delete

// Also test GH-2645: <yvals_core.h>: Conformance issue on [[msvc::known_semantics]]
#define msvc 1
#define known_semantics 2
#define intrinsic 3
#define lifetimebound 4
#define noop_dtor 5

#include <__msvc_all_public_headers.hpp>

#if msvc != 1
#error bad macro expansion
#endif // msvc != 1

#if known_semantics != 2
#error bad macro expansion
#endif // known_semantics != 2

#if intrinsic != 3
#error bad macro expansion
#endif // intrinsic != 3

#if lifetimebound != 4
#error bad macro expansion
#endif // lifetimebound != 4

#if noop_dtor != 5
#error bad macro expansion
#endif // noop_dtor != 5