public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [v3] PATCH to make _BracketMatcher::_S_cache_size a variable
@ 2018-05-10 17:59 Jason Merrill
  2018-05-10 19:08 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Merrill @ 2018-05-10 17:59 UTC (permalink / raw)
  To: libstdc++; +Cc: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

There doesn't seem to be any reason for _S_cache_size to be a function
rather than a variable.  OK for trunk?

[-- Attachment #2: regex-cache.diff --]
[-- Type: text/x-patch, Size: 1080 bytes --]

commit bf6843a87d3f64c9ffa29ce8d50aaa6fe8aabcfa
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Mar 14 21:39:06 2018 -0400

            * include/bits/regex_compiler.h (_S_cache_size): Change from
            function to variable.

diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index 7e5c2073554..6eee9cb9072 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -527,14 +527,12 @@ namespace __detail
       typedef typename std::is_same<_CharT, char>::type _UseCache;
 
       static constexpr size_t
-      _S_cache_size()
-      {
-	return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
-      }
+      _S_cache_size =
+	1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
 
       struct _Dummy { };
       typedef typename std::conditional<_UseCache::value,
-					std::bitset<_S_cache_size()>,
+					std::bitset<_S_cache_size>,
 					_Dummy>::type _CacheT;
       typedef typename std::make_unsigned<_CharT>::type _UnsignedCharT;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [v3] PATCH to make _BracketMatcher::_S_cache_size a variable
  2018-05-10 17:59 [v3] PATCH to make _BracketMatcher::_S_cache_size a variable Jason Merrill
@ 2018-05-10 19:08 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2018-05-10 19:08 UTC (permalink / raw)
  To: Jason Merrill; +Cc: libstdc++, gcc-patches List

On 10/05/18 13:59 -0400, Jason Merrill wrote:
>There doesn't seem to be any reason for _S_cache_size to be a function
>rather than a variable.  OK for trunk?

I vaguely recall some problem with that constant, maybe it didn't work
as a variable once upon a time. If that was ever true it was fixed
long ago so the change is OK, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-10 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 17:59 [v3] PATCH to make _BracketMatcher::_S_cache_size a variable Jason Merrill
2018-05-10 19:08 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).