oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA) (09/01/90)
Does anyone know why cpp on the RS6000 doesn't like the comment lines
in the file below (xanadu is an IBM RS/6000):
xanadu% cat /tmp/t
/**/# The binaries go here
BINDIR = /usr/um/math/bin
/**/# The libraries go here
LIBDIR = /usr/um/math/lib
xanadu%
xanadu% /lib/cpp /tmp/t /tmp/t.out
1 | # The binaries go here
..a....................
a - 1288-218: (W) Unknown preprocessing directive The.
3 | # The libraries go here
..a.....................
a - 1288-218: (W) Unknown preprocessing directive The.
xanadu%
xanadu% cat /tmp/t.out
# 1 "/tmp/t"
BINDIR = /usr/um/math/bin
LIBDIR = /usr/um/math/lib
As you can see, it didn't like the comment lines. On other systems, like
apollos, suns or dec3100, I would get (as the output file /tmp/t.out ):
# 1 "/tmp/t"
# The binaries go here
BINDIR = /usr/um/math/bin
# The libraries go here
LIBDIR = /usr/um/math/lib
Does anyone know if this is a bug or how I can coerce cpp to do what I want ?
Thanks.
Roque Oliveira
oliveria@caen.engin.umich.edu
Computer Aided Engineering Networkeswu@engshien.uucp (Eng-Shien Wu/16000000) (09/01/90)
The Risc System/6000 uses an ANSI-compatible cpp where the following
line is not legal:
/**/ #it thinks this is a macro statement, because they can start anywhere
The solution is to use the cpp in /usr/lpp/X11/Xamples/util/cpp/cpp.
An excerpt from the document "Porting 4.3 BSD Programs to AIX Version 3.1":
---------------------------------------------------------------------------
5.2. /lib/cpp
/lib/cpp is not the Kernighan & Ritchie cpp. In-
stead, it is the same preprocessor as the AIXv3.1
C compiler uses, but externalized, and it uses a
default language level of extended. For example,
/lib/cpp does not have to start preprocessor mac-
ros in the first column (mandated by ANSI C), but
any text after an #endif is ignored (not allowed
by ANSI C). The flags -tp -B/path/ can be used as
compiler arguments to cause /path/cpp to be used
for preprocessing the source file (see below).
For example, to compile a single C source program,
file.c, using /lib/cpp instead of the C compiler's
built-in preprocessor, use:
cc -tp -B/lib/ file.c
See the InfoExplorer documentation in Appendix A.
of the XL C Reference Manual for more information
about language levels.
5.3. Kernighan & Ritchie cpp
Because there are many programs, specifically X11
programs, that rely on the behavior of the K&R C
preprocessor, this has been provided in
/usr/lpp/X11/Xamples/util/cpp/cpp. To get this
used as the C preprocessor, you need to have the
X11 Development LPP installed and invoke it
directly, use the flags -tp
-B/usr/lpp/X11/Xamples/util/cpp/ with the com-
piler, or modify the /etc/xlc.cfg stanza as men-
tioned above.
---------------------------------------------------------------------------
-- Eng-Shien Wu, "My views only"
X Windows, IBM Advanced Workstations Div, Austin, Texas
Internet: eswu@ub.cc.umich.edu VNET: ausvmq(engshien)