Article View: gnu.gcc.bug
Article #1257Re: Bug (?) in gcc-2.2.2's preprocessor
From: Fergus James HENDERSON
Date: Mon, 05 Oct 1992 10:52
Date: Mon, 05 Oct 1992 10:52
30 lines
1956 bytes
1956 bytes
oliva@dcc.unicamp.br (Alexandre Oliva) writes:
>When I use the system's C compiler, the program works. When I use gcc,
>or even g++ (I began writing it in C++), it does not work any more.
[...]
>and in /usr/include/sys/ioccom.h, there is this line:
>
>#define _IOR(x,y,t) (_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
>
>I noticed that Sun's cpp changes the 'x' to 'm', but gcc's does not.
>Which one is correct? What can I do to fix the problem, so that I can
>be sure my program can by compiled in other Unix systems?
This is not a bug in gcc - gcc is following the ANSI standard here -
but instead it is a difference between ANSI C and traditional K&R C.
If you compile with -traditional, then gcc's preprocessor will
behave like Sun's.
PS. If you had compiled with -Wtraditional, gcc would have told you this
itself. I would strongly suggest that everyone compiles with all warnings
enabled unless there is a good reason to avoid this. By "all warnings",
I mean something like the following:
gcc -O -ansi -pedantic -Wall -Wshadow -Wwrite-strings -Wid-clash-31 \
-Wpointer-arith -Wcast-qual -Wtraditional -Wcast-align
--
Fergus Henderson fjh@munta.cs.mu.OZ.AU
This .signature virus is a self-referential statement that is true - but
you will only be able to consistently believe it if you copy it to your own
.signature file!
Technical Details
Message-ID:
<9227920.8590@mulga.cs.mu.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!munta.cs.mu.oz.au!fjhReferences:
<9210050009.AA01461@dcc.unicamp.br>Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!munta.cs.mu.oz.au!fjh From: fjh@munta.cs.mu.oz.au (Fergus James HENDERSON) Subject: Re: Bug (?) in gcc-2.2.2's preprocessor Message-ID: <9227920.8590@mulga.cs.mu.OZ.AU> Sender: news@cs.mu.oz.au Organization: Computer Science, University of Melbourne, Australia References: <9210050009.AA01461@dcc.unicamp.br> Distribution: gnu Date: Mon, 5 Oct 1992 10:52:38 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 31