🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1252

Bug (?) in gcc-2.2.2's preprocessor

#1252
From: Alexandre Oliva
Date: Mon, 05 Oct 1992 02:09
29 lines
1410 bytes
I am using gcc 2.2.2 in a SPARC Station running SunOS 4.1.1, writing a
program which needs some ioctl commands for magnetic tape control.

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.

I found the reason. The constant MTIOCGET, which is defined in a
system include file, is understood differently by gcc's cpp and Sun's
cpp.

in /usr/include/sys/mtio.h, there is this line:

#define	MTIOCGET	_IOR(m, 2, struct mtget)	/* get tape status */

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?

Thanks in advance.

Alexandre Oliva
oliva@dcc.unicamp.br
Depto de Ciencia da Computacao
DCC - IMECC - UNICAMP
Campinas SP Brazil
Technical Details
Message-ID: <9210050009.AA01461@dcc.unicamp.br>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!dcc.unicamp.br!oliva

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!dcc.unicamp.br!oliva
From: oliva@dcc.unicamp.br (Alexandre Oliva)
Subject: Bug (?) in gcc-2.2.2's preprocessor
Message-ID: <9210050009.AA01461@dcc.unicamp.br>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 5 Oct 1992 02:09:38 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 32