diff mbox

libstdc++: Fix static_assert.

Message ID 1452984423.26597.412.camel@localhost.localdomain
State New
Headers show

Commit Message

Torvald Riegel Jan. 16, 2016, 10:47 p.m. UTC
This adds a missing string argument to a call to static_assert, thus not
making it depend on c++1z extensions.  This fixes the build breakage on
mingw introduced in 232454.

Tested on x86_64-linux.  OK?

Comments

Jonathan Wakely Jan. 17, 2016, 5:01 p.m. UTC | #1
On 16 January 2016 at 22:47, Torvald Riegel wrote:
> This adds a missing string argument to a call to static_assert, thus not
> making it depend on c++1z extensions.  This fixes the build breakage on
> mingw introduced in 232454.
>
> Tested on x86_64-linux.  OK?

OK.
Jonathan Wakely Jan. 17, 2016, 5:03 p.m. UTC | #2
On 17 January 2016 at 17:01, Jonathan Wakely wrote:
> On 16 January 2016 at 22:47, Torvald Riegel wrote:
>> This adds a missing string argument to a call to static_assert, thus not
>> making it depend on c++1z extensions.  This fixes the build breakage on
>> mingw introduced in 232454.
>>
>> Tested on x86_64-linux.  OK?
>
> OK.

Actually please change the message, so it states the condition being
tested, not the negation.

e.g. "Pointers are 32 bits or 64 bits wide"

or state what must be true, "Pointers must be 32 bits or 64 bits wide"
Torvald Riegel Jan. 17, 2016, 5:44 p.m. UTC | #3
On Sun, 2016-01-17 at 17:03 +0000, Jonathan Wakely wrote:
> On 17 January 2016 at 17:01, Jonathan Wakely wrote:
> > On 16 January 2016 at 22:47, Torvald Riegel wrote:
> >> This adds a missing string argument to a call to static_assert, thus not
> >> making it depend on c++1z extensions.  This fixes the build breakage on
> >> mingw introduced in 232454.
> >>
> >> Tested on x86_64-linux.  OK?
> >
> > OK.
> 
> Actually please change the message, so it states the condition being
> tested, not the negation.
> 
> e.g. "Pointers are 32 bits or 64 bits wide"
> 
> or state what must be true, "Pointers must be 32 bits or 64 bits wide"

I committed the latter.
diff mbox

Patch

commit 7659ab483954a15c8143f6b1b9d135159a2ecc67
Author: Torvald Riegel <triegel@redhat.com>
Date:   Sat Jan 16 23:40:26 2016 +0100

    libstdc++: Fix static_assert.
    
    	* src/c++11/cow-stdexcept.cc (txnal_read_ptr): Fix static_assert.

diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc
index afc3f6c..375ab8b 100644
--- a/libstdc++-v3/src/c++11/cow-stdexcept.cc
+++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc
@@ -278,8 +278,8 @@  _txnal_cow_string_C1_for_exceptions(void* that, const char* s, void *exc)
 static void* txnal_read_ptr(void* const * ptr)
 {
   static_assert(sizeof(uint64_t) == sizeof(void*)
-		|| sizeof(uint32_t) == sizeof(void*));
-  // FIXME make a true compile-time choice to prevent warnings.
+		|| sizeof(uint32_t) == sizeof(void*),
+		"Pointers are neither 32 nor 64 bit wide");
 #if __UINTPTR_MAX__ == __UINT64_MAX__
   return (void*)_ITM_RU8((const uint64_t*)ptr);
 #else