This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory
On Thu, 22 Feb 2007, Jan Hubicka wrote:
> > Hi,
> >
> > On Wed, 21 Feb 2007, Mark Mitchell wrote:
> >
> > > Please spell that as TFF_UNQUALIFIED_NAME, and document as "do not print
> > > the qualifying scope of the top-level entity".
> >
> > Done.
> >
> > > Since Daniel has signed off on the GDB impact, this patch is OK if it
> > > passes the testsuites.
> >
> > It does, hence committed.
>
> Hi,
> is this yours?
> It indeed saves a lot of memory but it seems to be due to:
> /sw/gcc-current/include/c++/3.4/bits/stl_tree.h:592: error: declaration
> of 'typedef struct std::_Rb_tree_node<_Val> std::_Rb_tree<_Key, _Val,
> _KeyOfValue, _Compare, _Alloc>::_Rb_tree_node'
> /sw/gcc-current/include/c++/3.4/bits/stl_tree.h:121: error: changes
> meaning of '_Rb_tree_node' from 'struct std::_Rb_tree_node<_Val>'
>
> These errors didn't appeared previously on the preprocessed file.
> Perhaps I just need to regenerate, if making compiler more restrictive
> was intended.
Yes, that's an error in libstdc++. I have the following pending patch
which allows -fpermissive to make this a warning.
Richard.
2007-02-20 Richard Guenther <rguenther@suse.de>
* class.c (note_name_declared_in_class): Make declaration
changes meaning a pedwarn.
* g++.dg/warn/changes-meaning.C: New testcase.
Index: cp/class.c
===================================================================
--- cp/class.c (revision 121946)
+++ cp/class.c (working copy)
@@ -6299,9 +6299,9 @@ note_name_declared_in_class (tree name,
A name N used in a class S shall refer to the same declaration
in its context and when re-evaluated in the completed scope of
S. */
- error ("declaration of %q#D", decl);
- error ("changes meaning of %qD from %q+#D",
- DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
+ pedwarn ("declaration of %q#D", decl);
+ pedwarn ("changes meaning of %qD from %q+#D",
+ DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
}
}
Index: testsuite/g++.dg/warn/changes-meaning.C
===================================================================
*** testsuite/g++.dg/warn/changes-meaning.C (revision 0)
--- testsuite/g++.dg/warn/changes-meaning.C (revision 0)
***************
*** 0 ****
--- 1,11 ----
+ /* { dg-do compile } */
+ /* { dg-options "-fpermissive" } */
+
+ template <class _Tp> class auto_ptr {}; /* { dg-warning "changes meaning" } */
+ template <class _Tp>
+ class counted_ptr
+ {
+ public:
+ auto_ptr<_Tp> auto_ptr(); /* { dg-warning "" } */
+ };
+