🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.sgi.bugs
1 messages
1 total messages Started by Ray Butterworth [MFCF] Wed, 23 Dec 1992 20:47
Recognizing which cc is being used.
#23
Author: Ray Butterworth [MFCF]
Date: Wed, 23 Dec 1992 20:47
48 lines
2320 bytes
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.)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads