public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19073] New: cp_namespace_decl not returning all decls
@ 2004-12-19  0:41 sstrasser at systemhaus-gruppe dot de
  2004-12-19  0:52 ` [Bug c++/19073] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2004-12-19  0:41 UTC (permalink / raw)
  To: gcc-bugs

I'm not sure if the bug is the behaviour of the function or the documentation,
but they differ:
cp_namespace_decl(tree) is documented to return all decls of a
namespace(documented in cp/name-lookup.c and in gcc internals documentation),
but it leaves out a lot of decls, e.g. c++ classes and enums.
this is true for current CVS version(12-19-04) and for the current release(3.4.3).
but in version 3.3.4 it correctly returns at least the type_decl nodes for
enums(classes not tested).

you can easily check this with -fdump-translation-unit, which uses
cp_namespace_decl:
code: "class Abc{};"
"Abc" does not appear in the output of current versions. in 3.3.4 it does.

-- 
           Summary: cp_namespace_decl not returning all decls
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sstrasser at systemhaus-gruppe dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_namespace_decl not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
@ 2004-12-19  0:52 ` pinskia at gcc dot gnu dot org
  2004-12-19  0:53 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19  0:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-19 00:51 -------
This is definitely an expected behavior.

The struct cp_binding_level contains all the decls.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_namespace_decl not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
  2004-12-19  0:52 ` [Bug c++/19073] " pinskia at gcc dot gnu dot org
@ 2004-12-19  0:53 ` pinskia at gcc dot gnu dot org
  2004-12-19  1:04 ` sstrasser at systemhaus-gruppe dot de
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19  0:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-19 00:53 -------
Then again I don't know what you are trying to do, and why you need this function really.

I think -fdump-translation-unit should be removed, it is only useful for gcc developers even then it 
very useful any more in fact there are better ways to get the information needed.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_namespace_decl not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
  2004-12-19  0:52 ` [Bug c++/19073] " pinskia at gcc dot gnu dot org
  2004-12-19  0:53 ` pinskia at gcc dot gnu dot org
@ 2004-12-19  1:04 ` sstrasser at systemhaus-gruppe dot de
  2004-12-19  1:15 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2004-12-19  1:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sstrasser at systemhaus-gruppe dot de  2004-12-19 01:04 -------
> The struct cp_binding_level contains all the decls.
that seems to be the same thing. cp_namespace_decls uses NAMESPACE_LEVEL macro
which brings you to a cp_binding_level structure.
maybe the summary of this bug shouldn't be about "cp_namespace_decls" but I
don't see why this is expected behaviour. the behaviour is not specific to this
function.

and then again, because everybody is telling me I shouldn't use
-fdump-translation-unit: I don't. I just proposed it as a way to check this bug.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_namespace_decl not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (2 preceding siblings ...)
  2004-12-19  1:04 ` sstrasser at systemhaus-gruppe dot de
@ 2004-12-19  1:15 ` pinskia at gcc dot gnu dot org
  2004-12-19  3:35 ` [Bug c++/19073] cp_binding_level::names " sstrasser at systemhaus-gruppe dot de
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19  1:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-19 01:15 -------
The use namespace_binding instead.  That is the correct way of getting a decl.
Look at pushdecl for an example of how to use it.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (3 preceding siblings ...)
  2004-12-19  1:15 ` pinskia at gcc dot gnu dot org
@ 2004-12-19  3:35 ` sstrasser at systemhaus-gruppe dot de
  2004-12-19  3:47 ` sstrasser at systemhaus-gruppe dot de
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2004-12-19  3:35 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|cp_namespace_decl not       |cp_binding_level::names not
                   |returning all decls         |returning all decls


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (5 preceding siblings ...)
  2004-12-19  3:47 ` sstrasser at systemhaus-gruppe dot de
@ 2004-12-19  3:47 ` sstrasser at systemhaus-gruppe dot de
  2004-12-19 15:32 ` [Bug c++/19073] cp_binding_level::names not returning all decls gdr at integrable-solutions dot net
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2004-12-19  3:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|cp_binding_level::names not |cp_binding_level
                   |returning all decls         |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (4 preceding siblings ...)
  2004-12-19  3:35 ` [Bug c++/19073] cp_binding_level::names " sstrasser at systemhaus-gruppe dot de
@ 2004-12-19  3:47 ` sstrasser at systemhaus-gruppe dot de
  2004-12-19  3:47 ` [Bug c++/19073] cp_binding_level sstrasser at systemhaus-gruppe dot de
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2004-12-19  3:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|cp_binding_level            |cp_binding_level::names not
                   |                            |returning all decls


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (6 preceding siblings ...)
  2004-12-19  3:47 ` [Bug c++/19073] cp_binding_level sstrasser at systemhaus-gruppe dot de
@ 2004-12-19 15:32 ` gdr at integrable-solutions dot net
  2004-12-19 16:10 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-12-19 15:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-12-19 15:31 -------
Subject: Re:  cp_namespace_decl not returning all decls

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| I think -fdump-translation-unit should be removed, it is only useful

Removing -fdump-translation-unit is a good step to make GCC more
useless; it does not fix the problem.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (7 preceding siblings ...)
  2004-12-19 15:32 ` [Bug c++/19073] cp_binding_level::names not returning all decls gdr at integrable-solutions dot net
@ 2004-12-19 16:10 ` pcarlini at suse dot de
  2004-12-20  3:42 ` sstrasser at systemhaus-gruppe dot de
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pcarlini at suse dot de @ 2004-12-19 16:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-12-19 16:09 -------
> Removing -fdump-translation-unit is a good step to make GCC more
> useless;

Hey, I really hope there is a typo here, and you actually mean
"less useful" ;)

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (8 preceding siblings ...)
  2004-12-19 16:10 ` pcarlini at suse dot de
@ 2004-12-20  3:42 ` sstrasser at systemhaus-gruppe dot de
  2004-12-20  3:53 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2004-12-20  3:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sstrasser at systemhaus-gruppe dot de  2004-12-20 03:42 -------
ok, I took a closer look at this.
we all agree that type_decls(even c++ implicit ones) should be in
cp_binding_level::names, don't we?

decls get added to this list by name-lookup.c add_decl_to_level(), which gets
called by name-lookup.c:pushdecl()
pushdecl() checks if there is already a binding for the decl(via
namespace_binding()).
if there is(which is the case for the implicit type decls in current version),
it only calls add_decl_to_level() under certain circumstances, one of these is:
not being a TYPE_DECL.

in gcc version 3.3.4(which doesn't have this problem) namespace_binding()
returns 0, there is no binding, in current CVS there is.
so, why is this?

because of these lines in name-lookup.c:set_identifier_type_value_with_scope:
	  if (binding->value)
	    supplement_binding (binding, decl);
	  else
	    binding->value = decl;

I understand what they're doing but I don't understand why they are at this
point and were introduced in decl.c version 1.1114.
the cvs log message doesn't contain anything that's useful to me either.
why are these lines there? before this there was no assignment to binding->value
at all.

Thanks for your help

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (9 preceding siblings ...)
  2004-12-20  3:42 ` sstrasser at systemhaus-gruppe dot de
@ 2004-12-20  3:53 ` pinskia at gcc dot gnu dot org
  2005-05-15 11:46 ` lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-20  3:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-20 03:53 -------
(In reply to comment #7)
> I understand what they're doing but I don't understand why they are at this
> point and were introduced in decl.c version 1.1114.
> the cvs log message doesn't contain anything that's useful to me either.
> why are these lines there? before this there was no assignment to binding->value
> at all.

http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01155.html
"  The bug report had to do with allowing invalid elaborated type
  specifiers.  The root cause was that we were treating
  namespace-scope bindings differently from local and class bindings;
  this patch makes things more uniform."

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (10 preceding siblings ...)
  2004-12-20  3:53 ` pinskia at gcc dot gnu dot org
@ 2005-05-15 11:46 ` lerdsuwa at gcc dot gnu dot org
  2005-05-15 16:21 ` sstrasser at systemhaus-gruppe dot de
  2005-05-15 16:47 ` gdr at integrable-solutions dot net
  13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2005-05-15 11:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2005-05-15 11:46 -------
Some comment: This cp_binding_level::names and how it is used are internal to GCC.  
Too bad -fdump-translation-unit relies on it.  Names are placed in
cp_binding_level::names
only if it may be needed there in the future.  Perhaps a solution would be
adding every name there when -fdump-translation-unit is given (at the expense of
some extra memory consumption, slower compilation).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-15 11:46:40
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (11 preceding siblings ...)
  2005-05-15 11:46 ` lerdsuwa at gcc dot gnu dot org
@ 2005-05-15 16:21 ` sstrasser at systemhaus-gruppe dot de
  2005-05-15 16:47 ` gdr at integrable-solutions dot net
  13 siblings, 0 replies; 15+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2005-05-15 16:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sstrasser at systemhaus-gruppe dot de  2005-05-15 16:17 -------
(In reply to comment #9)
> only if it may be needed there in the future.  Perhaps a solution would be
> adding every name there when -fdump-translation-unit is given (at the 
expense of
> some extra memory consumption, slower compilation).

in case you plan to to this: the above mentioned case seems to be the only one.
I've fixed this in my project MetaC++ by just commenting out the 4 lines above.
which probably introduces other bugs and so is no solution for -fdump..., but 
what I'm trying to say is that this is the only case where GCC does not add a 
name to cp_binding_level::names


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

* [Bug c++/19073] cp_binding_level::names not returning all decls
  2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
                   ` (12 preceding siblings ...)
  2005-05-15 16:21 ` sstrasser at systemhaus-gruppe dot de
@ 2005-05-15 16:47 ` gdr at integrable-solutions dot net
  13 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-05-15 16:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2005-05-15 16:47 -------
Subject: Re:  cp_binding_level::names not returning all decls

"sstrasser at systemhaus-gruppe dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| (In reply to comment #9)
| > only if it may be needed there in the future.  Perhaps a solution would be
| > adding every name there when -fdump-translation-unit is given (at the 
| expense of
| > some extra memory consumption, slower compilation).
| 
| in case you plan to to this: the above mentioned case seems to be the only one.
| I've fixed this in my project MetaC++ by just commenting out the 4 lines above.
| which probably introduces other bugs and so is no solution for -fdump..., but 
| what I'm trying to say is that this is the only case where GCC does not add a 
| name to cp_binding_level::names

The more I think about this, the more I'm wondering whether
cp_binding_level::names is the proper way to get the real functionality. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19073


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

end of thread, other threads:[~2005-05-15 16:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-19  0:41 [Bug c++/19073] New: cp_namespace_decl not returning all decls sstrasser at systemhaus-gruppe dot de
2004-12-19  0:52 ` [Bug c++/19073] " pinskia at gcc dot gnu dot org
2004-12-19  0:53 ` pinskia at gcc dot gnu dot org
2004-12-19  1:04 ` sstrasser at systemhaus-gruppe dot de
2004-12-19  1:15 ` pinskia at gcc dot gnu dot org
2004-12-19  3:35 ` [Bug c++/19073] cp_binding_level::names " sstrasser at systemhaus-gruppe dot de
2004-12-19  3:47 ` sstrasser at systemhaus-gruppe dot de
2004-12-19  3:47 ` [Bug c++/19073] cp_binding_level sstrasser at systemhaus-gruppe dot de
2004-12-19 15:32 ` [Bug c++/19073] cp_binding_level::names not returning all decls gdr at integrable-solutions dot net
2004-12-19 16:10 ` pcarlini at suse dot de
2004-12-20  3:42 ` sstrasser at systemhaus-gruppe dot de
2004-12-20  3:53 ` pinskia at gcc dot gnu dot org
2005-05-15 11:46 ` lerdsuwa at gcc dot gnu dot org
2005-05-15 16:21 ` sstrasser at systemhaus-gruppe dot de
2005-05-15 16:47 ` gdr at integrable-solutions dot net

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).