Bug 11853 - long enum constant name results in an error
Summary: long enum constant name results in an error
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-08 10:47 UTC by Agri
Modified: 2003-08-08 15:46 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
the preprocessed file (20.85 KB, application/octet-stream)
2003-08-08 12:51 UTC, Agri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agri 2003-08-08 10:47:36 UTC
i'm trying to compile libpcap by gcc-3.3
i got this problem
there is a file <netinet/in.h> which contains
IPPROTO_HOPOPTS = 0 /* long constant name */

that results in
/usr/include/netinet/in.h:34: error: parse error before numeric constant

stripping the name by few characters resolve the problem
Comment 1 Andrew Pinski 2003-08-08 12:13:05 UTC
We need the preprocessed file?
Read http://gcc.gnu.org/bugs.html.
Comment 2 Agri 2003-08-08 12:51:17 UTC
Created attachment 4579 [details]
the preprocessed file
Comment 3 Agri 2003-08-08 12:57:12 UTC
the options given when GCC was configured/built:
#!/bin/sh
# This file was generated automatically by configure.  Do not edit.
# This directory was configured as follows:
./configure --with-gcc-version-trigger=/home/agri/cmpl/gcc-3.3/gcc/version.c
--host=i686-pc-linux-gnu --prefix=/usr --enable-threads --with-cpu=i686
--disable-nls --norecursion 
#  using "mt-frag"

the complete command line that triggers the bug and output:
> gcc -O2 -I.  -DHAVE_CONFIG_H -c ./pcap-snoop.c
In file included from pcap-snoop.c:40:
/usr/include/netinet/in.h:70: error: parse error before numeric constant
pcap-snoop.c: In function `pcap_read':
pcap-snoop.c:88: error: dereferencing pointer to incomplete type
pcap-snoop.c:90: error: invalid use of undefined type `struct snoopheader'
pcap-snoop.c:96: error: dereferencing pointer to incomplete type
pcap-snoop.c:97: error: dereferencing pointer to incomplete type
pcap-snoop.c: In function `pcap_stats':
pcap-snoop.c:110: error: storage size of `rawstats' isn't known
pcap-snoop.c:113: error: dereferencing pointer to incomplete type
pcap-snoop.c:113: error: dereferencing pointer to incomplete type
pcap-snoop.c:113: error: dereferencing pointer to incomplete type
pcap-snoop.c:113: error: dereferencing pointer to incomplete type
pcap-snoop.c:113: error: dereferencing pointer to incomplete type
pcap-snoop.c:113: error: dereferencing pointer to incomplete type
pcap-snoop.c:114: error: `SIOCRAWSTATS' undeclared (first use in this function)
pcap-snoop.c:114: error: (Each undeclared identifier is reported only once
pcap-snoop.c:114: error: for each function it appears in.)
pcap-snoop.c:134: error: dereferencing pointer to incomplete type
pcap-snoop.c:134: error: dereferencing pointer to incomplete type
pcap-snoop.c:135: error: dereferencing pointer to incomplete type
pcap-snoop.c:135: error: dereferencing pointer to incomplete type
pcap-snoop.c: In function `pcap_open_live':
pcap-snoop.c:151: error: storage size of `sr' isn't known
pcap-snoop.c:152: error: storage size of `sf' isn't known
pcap-snoop.c:166: error: `PF_RAW' undeclared (first use in this function)
pcap-snoop.c:166: error: `RAWPROTO_SNOOP' undeclared (first use in this function)
pcap-snoop.c:174: error: `AF_RAW' undeclared (first use in this function)
pcap-snoop.c:182: error: `SIOCADDSNOOP' undeclared (first use in this function)
pcap-snoop.c:267: error: `SIOCSNOOPLEN' undeclared (first use in this function)
pcap-snoop.c:274: error: `SIOCSNOOPING' undeclared (first use in this function)
Comment 4 Andrew Pinski 2003-08-08 14:12:46 UTC
The code is defining IPPROTO_HOPOPTS as 59 so the preprocessor is replacing IPPROTO_HOPOPTS 
with 59 so in the enum you get:
59 = 59,
and that is an invalid for an enum.  The code is wrong find out where IPPROTO_HOPOPTS is being 
defined and why (might have been a configuring of libpcap wrong).
Closing as this is not a GCC bug.
Comment 5 Agri 2003-08-08 15:05:20 UTC
:-) i never though that even developers doesn't know what do gcc do

now... let me try again

let me cat part of netinet/in.h

enum {
IPPROTO_IP = 0,
#define IPPROTO_IP              IPPROTO_IP

oopps it's already has such a define.... it doesn't complain about it

it complains on the line (one line before define)
IPPROTO_HOPOPTS = 0
not on the line
#define IPPROTO_HOPOPTS         IPPROTO_HOPOPTS

and if i edit that line as
    IPPROTO_HOPO = 0,
#define IPPROTO_HOPO            IPPROTO_HOPO
it won't complain about at all
Comment 6 Andrew Pinski 2003-08-08 15:46:36 UTC
Not a GCC bug but a problem in a conflict in the glibc and Linux kernel headers, report it to both 
of them and let them deiced whos problem it is.