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/system_error
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ struct _Constexpr_immortalize_impl {
_Constexpr_immortalize_impl(const _Constexpr_immortalize_impl&) = delete;
_Constexpr_immortalize_impl& operator=(const _Constexpr_immortalize_impl&) = delete;

[[msvc::noop_dtor]] ~_Constexpr_immortalize_impl() {
_MSVC_NOOP_DTOR ~_Constexpr_immortalize_impl() {
// do nothing, allowing _Ty to be used during shutdown
}
};
Expand Down
34 changes: 29 additions & 5 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,42 @@
#define _NODISCARD_FRIEND _NODISCARD friend
#endif // TRANSITION, VSO-568006

// Determine if we should use [[msvc::known_semantics]] to communicate to the compiler
// that certain type trait specializations have the standard-mandated semantics
#pragma push_macro("msvc")
#pragma push_macro("known_semantics")
#pragma push_macro("noop_dtor")
#undef msvc
#undef known_semantics
#undef noop_dtor

#ifndef __has_cpp_attribute
#define _MSVC_KNOWN_SEMANTICS
#define _HAS_MSVC_ATTRIBUTE(x) 0
#elif defined(__CUDACC__) // TRANSITION, CUDA - warning: attribute namespace "msvc" is unrecognized
#define _MSVC_KNOWN_SEMANTICS
#elif __has_cpp_attribute(msvc::known_semantics)
#define _HAS_MSVC_ATTRIBUTE(x) 0
#else
#define _HAS_MSVC_ATTRIBUTE(x) __has_cpp_attribute(msvc::x)
#endif

// Should we use [[msvc::known_semantics]] to tell the compiler that certain
// type trait specializations have the standard-mandated semantics?
#if _HAS_MSVC_ATTRIBUTE(known_semantics)
#define _MSVC_KNOWN_SEMANTICS [[msvc::known_semantics]]
#else
#define _MSVC_KNOWN_SEMANTICS
#endif

// Should we use [[msvc::noop_dtor]] to tell the compiler that some non-trivial
// destructors have no effects?
#if _HAS_MSVC_ATTRIBUTE(noop_dtor)
#define _MSVC_NOOP_DTOR [[msvc::noop_dtor]]
#else
#define _MSVC_NOOP_DTOR
#endif

#undef _HAS_MSVC_ATTRIBUTE
#pragma pop_macro("noop_dtor")
#pragma pop_macro("known_semantics")
#pragma pop_macro("msvc")

// Controls whether the STL uses "conditional explicit" internally
#ifndef _HAS_CONDITIONAL_EXPLICIT
#ifdef __cpp_conditional_explicit
Expand Down
2 changes: 1 addition & 1 deletion stl/src/excptptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace {
_Constexpr_excptptr_immortalize_impl(const _Constexpr_excptptr_immortalize_impl&) = delete;
_Constexpr_excptptr_immortalize_impl& operator=(const _Constexpr_excptptr_immortalize_impl&) = delete;

[[msvc::noop_dtor]] ~_Constexpr_excptptr_immortalize_impl() {
_MSVC_NOOP_DTOR ~_Constexpr_excptptr_immortalize_impl() {
// do nothing, allowing _Ty to be used during shutdown
}
};
Expand Down