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

Replace _STATIC_UNLESS_PURE with static. #584

Merged
merged 1 commit into from
Mar 4, 2020
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
14 changes: 7 additions & 7 deletions stl/inc/regex
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ public:
template <class _Iter>
char_class_type lookup_classname(_Iter _First, _Iter _Last, bool _Icase = false) const {
// map [_First, _Last) to character class mask value
#define _REGEX_CHAR_CLASS_NAME(n, c) {n, L##n, sizeof(n) / sizeof(n[0]) - 1, c}
_STATIC_UNLESS_PURE constexpr _Cl_names _Names[] = {
#define _REGEX_CHAR_CLASS_NAME(n, c) \
{ n, L##n, sizeof(n) / sizeof(n[0]) - 1, c }
static constexpr _Cl_names _Names[] = {
// map class names to numeric constants
_REGEX_CHAR_CLASS_NAME("alnum", _Ch_alnum),
_REGEX_CHAR_CLASS_NAME("alpha", _Ch_alpha),
Expand Down Expand Up @@ -563,7 +564,7 @@ int _Iter_compare(_FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Las
// FUNCTION TEMPLATE _Is_word
inline bool _Is_word(unsigned char _UCh) {
// special casing char to avoid branches for std::regex in this path
_STATIC_UNLESS_PURE constexpr bool _Is_word_table[(numeric_limits<unsigned char>::max)() + 1] = {
static constexpr bool _Is_word_table[(numeric_limits<unsigned char>::max)() + 1] = {
// X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF
/* 0X */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 1X */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -3828,10 +3829,9 @@ bool _Parser<_FwdIt, _Elem, _RxTraits>::_Is_esc() const { // assumes _Pat != _En

template <class _FwdIt, class _Elem, class _RxTraits>
void _Parser<_FwdIt, _Elem, _RxTraits>::_Trans() { // map character to meta-character
_STATIC_UNLESS_PURE constexpr char _Meta_map[] = {_Meta_lpar, _Meta_rpar, _Meta_dlr, _Meta_caret, _Meta_dot,
_Meta_star, _Meta_plus, _Meta_query, _Meta_lsq, _Meta_rsq, _Meta_bar, _Meta_esc, _Meta_dash, _Meta_lbr,
_Meta_rbr, _Meta_comma, _Meta_colon, _Meta_equal, _Meta_exc, _Meta_nl, _Meta_cr, _Meta_bsp,
0}; // array of meta chars
static constexpr char _Meta_map[] = {_Meta_lpar, _Meta_rpar, _Meta_dlr, _Meta_caret, _Meta_dot, _Meta_star,
_Meta_plus, _Meta_query, _Meta_lsq, _Meta_rsq, _Meta_bar, _Meta_esc, _Meta_dash, _Meta_lbr, _Meta_rbr,
_Meta_comma, _Meta_colon, _Meta_equal, _Meta_exc, _Meta_nl, _Meta_cr, _Meta_bsp, 0}; // array of meta chars

if (_Pat == _End) {
_Mchar = _Meta_eos;
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/xlocmon
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ private:
const money_base::pattern _Pattern = _Ppunct_fac->neg_format();
string _Val;
size_t _Idx;
_STATIC_UNLESS_PURE constexpr char _Src[] = "0123456789-";
const ctype<_Elem>& _Ctype_fac = _STD use_facet<ctype<_Elem>>(_Iosbase.getloc());
static constexpr char _Src[] = "0123456789-";
const ctype<_Elem>& _Ctype_fac = _STD use_facet<ctype<_Elem>>(_Iosbase.getloc());
_Ctype_fac.widen(&_Src[0], &_Src[sizeof(_Src)], _Atoms);

for (size_t _Off = 0; !_Bad && _Off < 4; ++_Off) {
Expand Down Expand Up @@ -697,7 +697,7 @@ protected:

virtual _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest, bool _Intl, ios_base& _Iosbase, _Elem _Fill,
const string_type& _Val) const { // put string_type to _Dest
_STATIC_UNLESS_PURE constexpr char _Src[] = "0123456789-";
static constexpr char _Src[] = "0123456789-";
_Elem _Atoms[sizeof(_Src)];
const ctype<_Elem>& _Ctype_fac = _STD use_facet<ctype<_Elem>>(_Iosbase.getloc());
_Ctype_fac.widen(&_Src[0], &_Src[sizeof(_Src)], _Atoms);
Expand Down
20 changes: 10 additions & 10 deletions stl/inc/xlocnum
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ private:
const string _Grouping = _Punct_fac.grouping();
const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep();

constexpr int _Numget_signoff = 22;
constexpr int _Numget_xoff = 24;
_STATIC_UNLESS_PURE constexpr char _Src[] = "0123456789ABCDEFabcdef-+Xx";
constexpr int _Numget_signoff = 22;
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
constexpr int _Numget_xoff = 24;
static constexpr char _Src[] = "0123456789ABCDEFabcdef-+Xx";
_Elem _Atoms[sizeof(_Src)];
const ctype<_Elem>& _Ctype_fac = _STD use_facet<ctype<_Elem>>(_Loc);
_Ctype_fac.widen(&_Src[0], &_Src[sizeof(_Src)], _Atoms);
Expand Down Expand Up @@ -783,9 +783,9 @@ private:
bool _Bad = false;
bool _Sticky = false;

constexpr int _Numget_signoff = 10;
constexpr int _Numget_eoff = 12;
_STATIC_UNLESS_PURE constexpr char _Src[] = "0123456789-+Ee";
constexpr int _Numget_signoff = 10;
constexpr int _Numget_eoff = 12;
static constexpr char _Src[] = "0123456789-+Ee";
_Elem _Atoms[sizeof(_Src)];
const ctype<_Elem>& _Ctype_fac = _STD use_facet<ctype<_Elem>>(_Iosbase.getloc());
_Ctype_fac.widen(&_Src[0], &_Src[sizeof(_Src)], _Atoms);
Expand Down Expand Up @@ -964,10 +964,10 @@ private:
const auto& _Punct_fac = _STD use_facet<numpunct<_Elem>>(_Iosbase.getloc());
const string _Grouping = _Punct_fac.grouping();

constexpr int _Numget_signoff = 22;
constexpr int _Numget_xoff = 24;
constexpr int _Numget_poff = 26;
_STATIC_UNLESS_PURE constexpr char _Src[] = "0123456789ABCDEFabcdef-+XxPp";
constexpr int _Numget_signoff = 22;
constexpr int _Numget_xoff = 24;
constexpr int _Numget_poff = 26;
static constexpr char _Src[] = "0123456789ABCDEFabcdef-+XxPp";
_Elem _Atoms[sizeof(_Src)];
const ctype<_Elem>& _Ctype_fac = _STD use_facet<ctype<_Elem>>(_Iosbase.getloc());
_Ctype_fac.widen(&_Src[0], &_Src[sizeof(_Src)], _Atoms);
Expand Down
2 changes: 0 additions & 2 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1160,11 +1160,9 @@ compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have recei
#ifdef _M_CEE_PURE
#define _EXTERN_C_UNLESS_PURE
#define _END_EXTERN_C_UNLESS_PURE
#define _STATIC_UNLESS_PURE // Avoid warning C4640: construction of local static object is not thread-safe (/Wall)
#else // ^^^ _M_CEE_PURE / !_M_CEE_PURE vvv
#define _EXTERN_C_UNLESS_PURE _EXTERN_C
#define _END_EXTERN_C_UNLESS_PURE _END_EXTERN_C
#define _STATIC_UNLESS_PURE static
#endif // _M_CEE_PURE

#if defined(MRTDLL) && !defined(_CRTBLD)
Expand Down