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

<xlocale>: Deprecate non-Standard locale::empty() #5197

Merged
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
3 changes: 2 additions & 1 deletion stl/inc/xlocale
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ public:

static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL global(const locale&); // current locale

static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL empty(); // empty (transparent) locale
// TRANSITION, ABI: non-Standard empty() is preserved for binary compatibility
_DEPRECATE_LOCALE_EMPTY static _MRTIMP2_PURE locale __CLRCALL_PURE_OR_CDECL empty(); // empty (transparent) locale

private:
struct _Secret_locale_construct_tag {
Expand Down
12 changes: 11 additions & 1 deletion stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,17 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define _CXX20_DEPRECATE_CODECVT_CHAR8_T_FACETS
#endif // ^^^ warning disabled ^^^

// next warning number: STL4048
#if !defined(_SILENCE_LOCALE_EMPTY_DEPRECATION_WARNING) && !defined(_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS)
#define _DEPRECATE_LOCALE_EMPTY \
[[deprecated( \
"warning STL4048: locale::empty() is a non-Standard extension and will be removed in the future. A " \
"default-constructed locale can be used instead. You can define _SILENCE_LOCALE_EMPTY_DEPRECATION_WARNING or " \
"_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.")]]
#else // ^^^ warning enabled / warning disabled vvv
#define _DEPRECATE_LOCALE_EMPTY
#endif // ^^^ warning disabled ^^^

// next warning number: STL4049

// next error number: STL1006

Expand Down
2 changes: 2 additions & 0 deletions stl/src/locale0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#undef _ENFORCE_ONLY_CORE_HEADERS // TRANSITION, <xfacet> should be a core header

#define _SILENCE_LOCALE_EMPTY_DEPRECATION_WARNING

#include <crtdbg.h>
#include <internal_shared.h>
#include <xatomic.h>
Expand Down