home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi.bugs
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sdd.hp.com!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watmath!rbutterw
- From: "Ray Butterworth [MFCF]" <rbutterw@math.uwaterloo.ca>
- Subject: Recognizing which cc is being used.
- Message-ID: <BzqCEy.HG9@math.uwaterloo.ca>
- Sender: rbutterw@math.uwaterloo.ca (Ray Butterworth [MFCF])
- Organization: Math Faculty Computing Facility, University of Waterloo
- Date: Wed, 23 Dec 1992 20:47:22 GMT
- Lines: 48
-
- The cc(1) on IRIX 4.0.5f seems to operate in 3 different modes:
- -cckr, -ansi, and -xansi.
-
- -ansi defines __STDC__
- -xansi doesn't, but does define __EXTENSIONS__
- -cckr also doesn't define __STDC__, and it also defines __EXTENSIONS__.
-
- How is one supposed to test (in the source) which of the
- last two modes the compiler is running under?
- (I suggest that -cckr should set some symbol to indicate this.)
-
- In particular, does one use token/**/token or token##token
- to join two cpp tokens in a macro?
-
-
- I checked various stock header files for examples of how
- it is supposed to be done, but with no luck.
-
- The header file <sys/termio.h> contains:
- #define CTRL(c) ('c'&037)
- which only works with -cckr, so this header file is in fact broken
- since it needs a test for what kind of cpp is being used too.
-
- And the header file <gl/dgl.h> has code like this:
- #ifdef __STDC__
- #define SIZEOF(x) size_##x
- #else
- #define SIZEOF(x) size_/**/x
- #endif /*__STDC__*/
-
- But this particular section never gets looked at on IRIX,
- so it doesn't matter that it doesn't work.
-
-
- But I have my own header files that need to do something similar,
- and I can't find any #if test that will determine which form of
- token joining should be used.
-
- Note that suggestions of the form "put -D__ANSI__" on the command
- line are of no help to me. These header files must be used by
- different people and Makefiles that might be calling different
- versions of cc. I can't expect everyone to change what they
- are doing; in fact one of the purposes of the header files is
- that they won't have to. i.e. the solution has to be done
- entirely within my header file(s).
-
- (Please email any responses, since your article will probably
- expire over the holidays before I get a chance to read it.)
-