Bug 168871

Summary: compile: syntax error before "typedef" in stddef.h
Product: [Fedora] Fedora Reporter: mcconnau
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-05 13:21:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
tar -xjf diagnose.tgz2 and examine diagnose/contents none

Description mcconnau 2005-09-20 19:25:24 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

Description of problem:
In a large project I have been working on thru several versions of GNU-Linux, I got this compiler error, for the first time:
in file included from /usr/include/bits/types.h:31,
from /usr/include/unistd.h:186,
from (my header),
/usr/lib/gcc-lib/i386-redhat-linux/3.3.4/include/stddef.h:213: syntax error before "typedef"
lines 212 and 213 of stddef.h are
#if !(defined (__GNUG__) && defined(size_t))
typedef __SIZE_TYPE__ size_t;
I got it to compile by inserting between these a line consisting of a semicolon  and a comment.


Version-Release number of selected component (if applicable):
basesystem-8.0-4

How reproducible:
Always

Steps to Reproduce:
Have only seen it with the present version of my sources, on the fc3 system; have not investigated how to isolate the problem


Additional info:

Comment 1 Bill Nottingham 2005-09-20 19:27:59 UTC
Assigning to gcc, but I suspect something is odd with your sources or your C
compiler flags.

What's the full command line?

Comment 2 Jakub Jelinek 2005-09-20 19:31:53 UTC
Can you preprocess your source with -E -dD (in place of e.g. -c) gcc command line
option and attach here?  Thanks.

Comment 3 mcconnau 2005-09-21 19:02:17 UTC
Created attachment 119090 [details]
tar -xjf diagnose.tgz2      and examine diagnose/contents

Results from compiling my command.c with -E and -dD, with and without the hack
I did on stddef.h

Comment 4 Joachim Nilsson 2005-10-05 13:11:18 UTC
Hi, I had the exact same problem -- only on Debian unstable, testing(etch) and
Sarge (3.1).

Very odd situation.  

I ended up writing small-fine.c that only included stdio.h and printed some
text. Everything worked fine until I added the search path for my project
include files, BAM!  

It turned out I had an autogenerated file called features.h in there which
screwed up stuff badly.  After I had removed it I could build with all kinds of
GCC versions.

Note: I did not add any new #include to my small-fine.c, I just added
"-I../include" to my GCC command line!

Comment 5 Jakub Jelinek 2005-10-05 13:21:35 UTC
Sorry, missed your reply.
The bug is in the source you are compiling.
command.c starts with:
x/*
EXPERIX version 4.0, Copyright (C) 2004, 2005  William Bayard McConnaughey
is a command interface for process control and data analysis.
...
*/

Note the initial x.  So you end up with
x /* comments and whitespace */ typedef unsigned int size_t;
which is obviously not a valid C source.