This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] enum enable
- To: jimb at zwingli dot cygnus dot com
- Subject: Re: [RFA] enum enable
- From: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Date: Wed, 18 Jul 2001 10:00:49 +0300 (IDT)
- CC: msnyder at redhat dot com, gdb-patches at sources dot redhat dot com, ac131313 at cygnus dot com
- References: <Pine.SUN.3.91.1010717100642.27733G-100000@is> <nppuazwirr.fsf@zwingli.cygnus.com>
- Reply-to: Eli Zaretskii <eliz at is dot elta dot co dot il>
> From: Jim Blandy <jimb@zwingli.cygnus.com>
> Date: 17 Jul 2001 12:46:32 -0500
>
> Eli Zaretskii <eliz@is.elta.co.il> writes:
> > In addition to Andrew's request to change that, GCC 2.7.2.1 barfs if
> > it sees the declaration of a member `enable' together with a prototype
> > of a function `enable' in the same compilation unit. In my case, the
> > function is declared in one of the system headers, so I guess GCC sees
> > it first and protests when the same identifier appears in a struct.
>
> You've *got* to be kidding.
>
> So, the following program gets an error?
>
> extern int foo (void);
>
> struct bar
> {
> int foo;
> };
>
No, that one passes. But this one does not:
enum foobar
{
foo,
bar
};
int foo(void);
$ gcc2721 -c enum.c
enum.c:8: two or more data types in declaration of `foo'
enum.c:8: `foo' redeclared as different kind of symbol
enum.c:4: previous declaration of `foo'
If I switch the order of the function and enum declaration, the
resulting message might give a clue about what's going on:
int foo(void);
enum foobar
{
foo,
bar
};
$ gcc2721 -c enum.c
enum.c:6: `foo' redeclared as different kind of symbol
enum.c:2: previous declaration of `foo'
enum.c:6: warning: `foo' was declared `extern' and later `static'
Actually, now I see that even GCC 2.95.3 reports the same errors.
[Dig, dig] and it looks like this is expected: my references indicate
that enumeration constants and function names belong to the same
namespace in C programs.