This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix some 28_regex/ fallout


On Wed, Dec 03, 2014 at 04:03:37PM +0000, Jonathan Wakely wrote:
> On 03/12/14 16:47 +0100, Marek Polacek wrote:
> >@@ -417,7 +417,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >      typedef typename std::is_same<_CharT, char>::type _UseCache;
> >
> >      static constexpr size_t
> >-      _S_cache_size() { return 1ul << (sizeof(_CharT) * __CHAR_BIT__); }
> >+      _S_cache_size() { return 1ul << (sizeof(_CharT) * __CHAR_BIT__
> >+				       * int(_UseCache::value)); }
> 
> Please re-indent it as:
> 
>      static constexpr size_t
>      _S_cache_size()
>      {
>        return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
>      }
> 
> So the expression is all on one line. OK with that change - thanks!

Oops.  Applying the following then.

2014-12-03  Marek Polacek  <polacek@redhat.com>

	* include/bits/regex_compiler.h (_S_cache_size): Multiply the
	RHS of the shift-expression by _UseCache::value.

diff --git gcc/include/bits/regex_compiler.h gcc/include/bits/regex_compiler.h
index d8880cc..66a4483 100644
--- gcc/include/bits/regex_compiler.h
+++ gcc/include/bits/regex_compiler.h
@@ -417,7 +417,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       typedef typename std::is_same<_CharT, char>::type _UseCache;
 
       static constexpr size_t
-      _S_cache_size() { return 1ul << (sizeof(_CharT) * __CHAR_BIT__); }
+      _S_cache_size()
+      {
+	return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value));
+      }
 
       struct _Dummy { };
       typedef typename std::conditional<_UseCache::value,

	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]