public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
@ 2015-11-16 21:04 Doug Evans
  2015-11-16 21:24 ` Jonathan Wakely
  2015-11-25 17:32 ` Alan Lawrence
  0 siblings, 2 replies; 8+ messages in thread
From: Doug Evans @ 2015-11-16 21:04 UTC (permalink / raw)
  To: gcc-patches, libstdc++

Hi.

Apologies for the delay.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440

Tested with current trunk.

2015-11-16  Doug Evans  <dje@google.com>

	PR libstdc++/67440
	* python/libstdcxx/v6/printers.py (find_type): Handle "const" in
	type name.
	* testsuite/libstdc++-prettyprinters/debug.cc: Add test for
	const set<int>.
	* testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.

Index: python/libstdcxx/v6/printers.py
===================================================================
--- python/libstdcxx/v6/printers.py	(revision 227421)
+++ python/libstdcxx/v6/printers.py	(working copy)
@@ -85,7 +85,9 @@
  def find_type(orig, name):
      typ = orig.strip_typedefs()
      while True:
-        search = str(typ) + '::' + name
+        # Use typ.name here instead of str(typ) to discard any const,etc.
+        # qualifiers.  PR 67440.
+        search = typ.name + '::' + name
          try:
              return gdb.lookup_type(search)
          except RuntimeError:
Index: testsuite/libstdc++-prettyprinters/debug.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/debug.cc	(revision 227421)
+++ testsuite/libstdc++-prettyprinters/debug.cc	(working copy)
@@ -70,6 +70,10 @@
    std::map<std::string, int>::iterator mpiter = mp.begin();
  // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }

+  // PR 67440
+  const std::set<int> const_intset = {2, 3};
+// { dg-final { note-test const_intset {std::__debug::set with 2 elements  
= {[0] = 2, [1] = 3}} } }
+
    std::set<std::string> sp;
    sp.insert("clownfish");
    sp.insert("barrel");
Index: testsuite/libstdc++-prettyprinters/simple.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/simple.cc	(revision 227421)
+++ testsuite/libstdc++-prettyprinters/simple.cc	(working copy)
@@ -73,6 +73,10 @@
    std::map<std::string, int>::iterator mpiter = mp.begin();
  // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }

+  // PR 67440
+  const std::set<int> const_intset = {2, 3};
+// { dg-final { note-test const_intset {std::set with 2 elements = {[0] =  
2, [1] = 3}} } }
+
    std::set<std::string> sp;
    sp.insert("clownfish");
    sp.insert("barrel");
Index: testsuite/libstdc++-prettyprinters/simple11.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/simple11.cc	(revision 227421)
+++ testsuite/libstdc++-prettyprinters/simple11.cc	(working copy)
@@ -73,6 +73,10 @@
    std::map<std::string, int>::iterator mpiter = mp.begin();
  // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }

+  // PR 67440
+  const std::set<int> const_intset = {2, 3};
+// { dg-final { note-test const_intset {std::set with 2 elements = {[0] =  
2, [1] = 3}} } }
+
    std::set<std::string> sp;
    sp.insert("clownfish");
    sp.insert("barrel");

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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-16 21:04 [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails Doug Evans
@ 2015-11-16 21:24 ` Jonathan Wakely
  2015-11-25 17:32 ` Alan Lawrence
  1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Wakely @ 2015-11-16 21:24 UTC (permalink / raw)
  To: Doug Evans; +Cc: gcc-patches, libstdc++

On 16/11/15 21:04 +0000, Doug Evans wrote:
>Hi.
>
>Apologies for the delay.
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>
>Tested with current trunk.
>
>2015-11-16  Doug Evans  <dje@google.com>
>
>	PR libstdc++/67440
>	* python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>	type name.
>	* testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>	const set<int>.
>	* testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>	* testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
>
>Index: python/libstdcxx/v6/printers.py
>===================================================================
>--- python/libstdcxx/v6/printers.py	(revision 227421)
>+++ python/libstdcxx/v6/printers.py	(working copy)
>@@ -85,7 +85,9 @@
> def find_type(orig, name):
>     typ = orig.strip_typedefs()
>     while True:
>-        search = str(typ) + '::' + name
>+        # Use typ.name here instead of str(typ) to discard any const,etc.
>+        # qualifiers.  PR 67440.
>+        search = typ.name + '::' + name

Oh, that's surprisingly simple! :-)

This only affects the printers, so although we're in stage 3 this is
OK for trunk and gcc-5-branch, thanks.


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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-16 21:04 [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails Doug Evans
  2015-11-16 21:24 ` Jonathan Wakely
@ 2015-11-25 17:32 ` Alan Lawrence
  2015-11-25 18:57   ` Doug Evans
  2015-11-25 19:59   ` Jonathan Wakely
  1 sibling, 2 replies; 8+ messages in thread
From: Alan Lawrence @ 2015-11-25 17:32 UTC (permalink / raw)
  To: Doug Evans, gcc-patches, libstdc++

On 16/11/15 21:04, Doug Evans wrote:
> Hi.
>
> Apologies for the delay.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>
> Tested with current trunk.
>
> 2015-11-16  Doug Evans  <dje@google.com>
>
>      PR libstdc++/67440
>      * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>      type name.
>      * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>      const set<int>.
>      * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>      * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.

On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on 
either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:

/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc: In 
function 'int main()':
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43: 
error: in C++98 'const_intset' must be initialized by constructor, not by '{...}'
    const std::set<int> const_intset = {2, 3};
                                            ^
In file included from 
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/map:60:0,
                  from 
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:31:
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_tree.h: 
In instantiation of 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, 
_Alloc>::_M_insert_unique(_II, _II) [with _InputIterator = int; _Key = int; _Val 
= int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = 
std::allocator<int>]':
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_set.h:171:4: 
   required from 'std::set<_Key, _Compare, _Alloc>::set(_InputIterator, 
_InputIterator) [with _InputIterator = int; _Key = int; _Compare = 
std::less<int>; _Alloc = std::allocator<int>]'
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43: 
   required from here
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_tree.h:2224:29: 
error: invalid type argument of unary '*' (have 'int')
     _M_insert_unique_(end(), *__first, __an);
                              ^
compiler exited with status 1
UNRESOLVED: libstdc++-prettyprinters/simple.cc compilation failed to produce 
executable
Spawning: gdb -nw -nx -quiet -batch -ex "python print(gdb.type_printers)"
spawn gdb -nw -nx -quiet -batch -ex python print(gdb.type_printers)
[]
spawn gdb -nx -nw -quiet -batch -x simple.gdb
simple.gdb:2: Error in sourced command file:
./simple.exe: No such file or directory.
skipping: simple.gdb:2: Error in sourced command file:
skipping: ./simple.exe: No such file or directory.
UNSUPPORTED: libstdc++-prettyprinters/simple.cc

I also see signs of the same on powerpc64le 
(https://gcc.gnu.org/ml/gcc-testresults/2015-11/msg02699.html), the test looks 
to be passing on trunk on all three platforms.

Thanks, Alan

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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-25 17:32 ` Alan Lawrence
@ 2015-11-25 18:57   ` Doug Evans
  2015-11-25 19:59   ` Jonathan Wakely
  1 sibling, 0 replies; 8+ messages in thread
From: Doug Evans @ 2015-11-25 18:57 UTC (permalink / raw)
  To: Alan Lawrence, Jonathan Wakely; +Cc: gcc-patches, libstdc++

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

On Wed, Nov 25, 2015 at 9:29 AM, Alan Lawrence <alan.lawrence@arm.com> wrote:
> On 16/11/15 21:04, Doug Evans wrote:
>>
>> Hi.
>>
>> Apologies for the delay.
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>>
>> Tested with current trunk.
>>
>> 2015-11-16  Doug Evans  <dje@google.com>
>>
>>      PR libstdc++/67440
>>      * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>>      type name.
>>      * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>>      const set<int>.
>>      * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>>      * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
>
>
> On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on
> either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:
>
> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:
> In function 'int main()':
> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
> error: in C++98 'const_intset' must be initialized by constructor, not by
> '{...}'
>    const std::set<int> const_intset = {2, 3};
>                                            ^
> In file included from
> /work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/map:60:0,
>                  from
> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:31:
> /work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_tree.h:
> In instantiation of 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
> _Alloc>::_M_insert_unique(_II, _II) [with _InputIterator = int; _Key = int;
> _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>;
> _Alloc = std::allocator<int>]':
> /work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_set.h:171:4:
> required from 'std::set<_Key, _Compare, _Alloc>::set(_InputIterator,
> _InputIterator) [with _InputIterator = int; _Key = int; _Compare =
> std::less<int>; _Alloc = std::allocator<int>]'
> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
> required from here
> /work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_tree.h:2224:29:
> error: invalid type argument of unary '*' (have 'int')
>     _M_insert_unique_(end(), *__first, __an);
>                              ^
> compiler exited with status 1
> UNRESOLVED: libstdc++-prettyprinters/simple.cc compilation failed to produce
> executable
> Spawning: gdb -nw -nx -quiet -batch -ex "python print(gdb.type_printers)"
> spawn gdb -nw -nx -quiet -batch -ex python print(gdb.type_printers)
> []
> spawn gdb -nx -nw -quiet -batch -x simple.gdb
> simple.gdb:2: Error in sourced command file:
> ./simple.exe: No such file or directory.
> skipping: simple.gdb:2: Error in sourced command file:
> skipping: ./simple.exe: No such file or directory.
> UNSUPPORTED: libstdc++-prettyprinters/simple.cc
>
> I also see signs of the same on powerpc64le
> (https://gcc.gnu.org/ml/gcc-testresults/2015-11/msg02699.html), the test
> looks to be passing on trunk on all three platforms.
>
> Thanks, Alan

Bleah, mea culpa.

While we might be able to revise the testcase and keep the fix,
I think a good first step is to just revert.

[-- Attachment #2: 67440-2-revert.patch.txt --]
[-- Type: text/plain, Size: 2861 bytes --]

2015-11-25  Doug Evans  <dje@google.com>

	Revert:
	PR libstdc++/67440
	* python/libstdcxx/v6/printers.py (find_type): Handle "const" in
	type name.
	* testsuite/libstdc++-prettyprinters/debug.cc: Add test for
	const set<int>.
	* testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.

Index: python/libstdcxx/v6/printers.py
===================================================================
--- python/libstdcxx/v6/printers.py	(revision 230895)
+++ python/libstdcxx/v6/printers.py	(working copy)
@@ -85,9 +85,7 @@
 def find_type(orig, name):
     typ = orig.strip_typedefs()
     while True:
-        # Use typ.name here instead of str(typ) to discard any const,etc.
-        # qualifiers.  PR 67440.
-        search = typ.name + '::' + name
+        search = str(typ) + '::' + name
         try:
             return gdb.lookup_type(search)
         except RuntimeError:
Index: testsuite/libstdc++-prettyprinters/debug.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/debug.cc	(revision 230895)
+++ testsuite/libstdc++-prettyprinters/debug.cc	(working copy)
@@ -70,10 +70,6 @@
   std::map<std::string, int>::iterator mpiter = mp.begin();
 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
 
-  // PR 67440
-  const std::set<int> const_intset = {2, 3};
-// { dg-final { note-test const_intset {std::__debug::set with 2 elements = {[0] = 2, [1] = 3}} } }
-
   std::set<std::string> sp;
   sp.insert("clownfish");
   sp.insert("barrel");
Index: testsuite/libstdc++-prettyprinters/simple.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/simple.cc	(revision 230895)
+++ testsuite/libstdc++-prettyprinters/simple.cc	(working copy)
@@ -73,10 +73,6 @@
   std::map<std::string, int>::iterator mpiter = mp.begin();
 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
 
-  // PR 67440
-  const std::set<int> const_intset = {2, 3};
-// { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } }
-
   std::set<std::string> sp;
   sp.insert("clownfish");
   sp.insert("barrel");
Index: testsuite/libstdc++-prettyprinters/simple11.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/simple11.cc	(revision 230895)
+++ testsuite/libstdc++-prettyprinters/simple11.cc	(working copy)
@@ -73,10 +73,6 @@
   std::map<std::string, int>::iterator mpiter = mp.begin();
 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
 
-  // PR 67440
-  const std::set<int> const_intset = {2, 3};
-// { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } }
-
   std::set<std::string> sp;
   sp.insert("clownfish");
   sp.insert("barrel");

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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-25 17:32 ` Alan Lawrence
  2015-11-25 18:57   ` Doug Evans
@ 2015-11-25 19:59   ` Jonathan Wakely
  2015-11-26 15:55     ` Jonathan Wakely
  1 sibling, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2015-11-25 19:59 UTC (permalink / raw)
  To: Alan Lawrence; +Cc: Doug Evans, gcc-patches, libstdc++

On 25 November 2015 at 17:29, Alan Lawrence <alan.lawrence@arm.com> wrote:
> On 16/11/15 21:04, Doug Evans wrote:
>>
>> Hi.
>>
>> Apologies for the delay.
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>>
>> Tested with current trunk.
>>
>> 2015-11-16  Doug Evans  <dje@google.com>
>>
>>      PR libstdc++/67440
>>      * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>>      type name.
>>      * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>>      const set<int>.
>>      * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>>      * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
>
>
> On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on
> either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:
>
> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:
> In function 'int main()':
> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
> error: in C++98 'const_intset' must be initialized by constructor, not by
> '{...}'
>    const std::set<int> const_intset = {2, 3};
>                                            ^

Which should have failed to compile on trunk as well, but we're
missing a -std=gnu++98 in the simple.cc testcase, so on trunk it uses
the -std=gnu++14 default. I'll add -std=gnu++98 to the test.

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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-25 19:59   ` Jonathan Wakely
@ 2015-11-26 15:55     ` Jonathan Wakely
  2015-11-26 16:10       ` Jonathan Wakely
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2015-11-26 15:55 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Alan Lawrence, Doug Evans, gcc-patches, libstdc++

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

On 25/11/15 19:55 +0000, Jonathan Wakely wrote:
>On 25 November 2015 at 17:29, Alan Lawrence <alan.lawrence@arm.com> wrote:
>> On 16/11/15 21:04, Doug Evans wrote:
>>>
>>> Hi.
>>>
>>> Apologies for the delay.
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>>>
>>> Tested with current trunk.
>>>
>>> 2015-11-16  Doug Evans  <dje@google.com>
>>>
>>>      PR libstdc++/67440
>>>      * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>>>      type name.
>>>      * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>>>      const set<int>.
>>>      * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>>>      * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
>>
>>
>> On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on
>> either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:
>>
>> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:
>> In function 'int main()':
>> /work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
>> error: in C++98 'const_intset' must be initialized by constructor, not by
>> '{...}'
>>    const std::set<int> const_intset = {2, 3};
>>                                            ^
>
>Which should have failed to compile on trunk as well, but we're
>missing a -std=gnu++98 in the simple.cc testcase, so on trunk it uses
>the -std=gnu++14 default. I'll add -std=gnu++98 to the test.

I've committed this to trunk, and will apply it to gcc-5-branch after
I finish testing it on the branch.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1234 bytes --]

commit 0ee15827a1132aeb960ff613ecafd8351a2535e0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 26 15:10:15 2015 +0000

    Ensure pretty-printer test uses C++98 mode
    
    	* testsuite/libstdc++-prettyprinters/simple.cc: Add -std=gnu++98 to
    	dg-options and avoid use of uniform-init.

diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
index 68c4d83..e1956bf 100644
--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc
@@ -1,7 +1,7 @@
 // If you modify this, please update simple11.cc and debug.cc as well.
 
 // { dg-do run }
-// { dg-options "-g -O0" }
+// { dg-options "-g -O0 -std=gnu++98" }
 
 // Copyright (C) 2011-2015 Free Software Foundation, Inc.
 //
@@ -74,7 +74,10 @@ main()
 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
 
   // PR 67440
-  const std::set<int> const_intset = {2, 3};
+  std::set<int> intset;
+  intset.insert(2);
+  intset.insert(3);
+  const std::set<int> const_intset = intset;
 // { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } }
 
   std::set<std::string> sp;

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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-26 15:55     ` Jonathan Wakely
@ 2015-11-26 16:10       ` Jonathan Wakely
  2015-11-26 16:36         ` Jonathan Wakely
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2015-11-26 16:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Alan Lawrence, Doug Evans, gcc-patches, libstdc++

On 26/11/15 15:42 +0000, Jonathan Wakely wrote:
>On 25/11/15 19:55 +0000, Jonathan Wakely wrote:
>>On 25 November 2015 at 17:29, Alan Lawrence <alan.lawrence@arm.com> wrote:
>>>On 16/11/15 21:04, Doug Evans wrote:
>>>>
>>>>Hi.
>>>>
>>>>Apologies for the delay.
>>>>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>>>>
>>>>Tested with current trunk.
>>>>
>>>>2015-11-16  Doug Evans  <dje@google.com>
>>>>
>>>>     PR libstdc++/67440
>>>>     * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>>>>     type name.
>>>>     * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>>>>     const set<int>.
>>>>     * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>>>>     * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
>>>
>>>
>>>On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on
>>>either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:
>>>
>>>/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:
>>>In function 'int main()':
>>>/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
>>>error: in C++98 'const_intset' must be initialized by constructor, not by
>>>'{...}'
>>>   const std::set<int> const_intset = {2, 3};
>>>                                           ^
>>
>>Which should have failed to compile on trunk as well, but we're
>>missing a -std=gnu++98 in the simple.cc testcase, so on trunk it uses
>>the -std=gnu++14 default. I'll add -std=gnu++98 to the test.
>
>I've committed this to trunk, and will apply it to gcc-5-branch after
>I finish testing it on the branch.

Doh, but I need to fix debug.cc as well, another patch coming ...

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

* Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
  2015-11-26 16:10       ` Jonathan Wakely
@ 2015-11-26 16:36         ` Jonathan Wakely
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Wakely @ 2015-11-26 16:36 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Alan Lawrence, Doug Evans, gcc-patches, libstdc++

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

On 26/11/15 16:10 +0000, Jonathan Wakely wrote:
>On 26/11/15 15:42 +0000, Jonathan Wakely wrote:
>>On 25/11/15 19:55 +0000, Jonathan Wakely wrote:
>>>On 25 November 2015 at 17:29, Alan Lawrence <alan.lawrence@arm.com> wrote:
>>>>On 16/11/15 21:04, Doug Evans wrote:
>>>>>
>>>>>Hi.
>>>>>
>>>>>Apologies for the delay.
>>>>>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>>>>>
>>>>>Tested with current trunk.
>>>>>
>>>>>2015-11-16  Doug Evans  <dje@google.com>
>>>>>
>>>>>    PR libstdc++/67440
>>>>>    * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>>>>>    type name.
>>>>>    * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>>>>>    const set<int>.
>>>>>    * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>>>>>    * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
>>>>
>>>>
>>>>On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on
>>>>either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:
>>>>
>>>>/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:
>>>>In function 'int main()':
>>>>/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
>>>>error: in C++98 'const_intset' must be initialized by constructor, not by
>>>>'{...}'
>>>>  const std::set<int> const_intset = {2, 3};
>>>>                                          ^
>>>
>>>Which should have failed to compile on trunk as well, but we're
>>>missing a -std=gnu++98 in the simple.cc testcase, so on trunk it uses
>>>the -std=gnu++14 default. I'll add -std=gnu++98 to the test.
>>
>>I've committed this to trunk, and will apply it to gcc-5-branch after
>>I finish testing it on the branch.
>
>Doh, but I need to fix debug.cc as well, another patch coming ...

Same change for debug.cc, committing on trunk and gcc-5-branch.

[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1172 bytes --]

commit 9cfee9f413f80091d03f2483697f95316a785354
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 26 16:11:37 2015 +0000

    Ensure another pretty-printer test uses C++98 mode
    
    	* testsuite/libstdc++-prettyprinters/debug.cc: Add -std=gnu++98 to
    	dg-options and avoid use of uniform-init.

diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
index 8d40f17..046888f 100644
--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
@@ -1,5 +1,5 @@
 // { dg-do run }
-// { dg-options "-g -O0" }
+// { dg-options "-g -O0 -std=gnu++98" }
 
 // Copyright (C) 2011-2015 Free Software Foundation, Inc.
 //
@@ -71,7 +71,10 @@ main()
 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
 
   // PR 67440
-  const std::set<int> const_intset = {2, 3};
+  std::set<int> intset;
+  intset.insert(2);
+  intset.insert(3);
+  const std::set<int> const_intset = intset;
 // { dg-final { note-test const_intset {std::__debug::set with 2 elements = {[0] = 2, [1] = 3}} } }
 
   std::set<std::string> sp;

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

end of thread, other threads:[~2015-11-26 16:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 21:04 [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails Doug Evans
2015-11-16 21:24 ` Jonathan Wakely
2015-11-25 17:32 ` Alan Lawrence
2015-11-25 18:57   ` Doug Evans
2015-11-25 19:59   ` Jonathan Wakely
2015-11-26 15:55     ` Jonathan Wakely
2015-11-26 16:10       ` Jonathan Wakely
2015-11-26 16:36         ` 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).