C preprocessor

David Strubbe dstrubbe at mit.edu
Wed Sep 4 09:57:04 PDT 2013


Hi all,

I am wondering what choices we have available in MacPorts for a C
preprocessor, which I am using for preprocessing Fortran in some ports.

The gccXX ports provide cpp-mp-X.X. clang, with -E, can be used to
preprocess, but has some weird properties. /usr/bin/cpp (or equivalently
/usr/bin/gcc -E) is i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 on my
machine, and doesn't quite do what I need either. Linux machines usually
have /lib/cpp which works fine, but we don't have it. "g95 -cpp -E
-nontraditional" does almost what I need, but deletes whitespace before
replaced tokens, which can cause syntax errors.

Are there any other cpp's available to be used in MacPorts? Basically,
cpp-mp-X.X does what I want, but I would rather not require gccXX as a
dependency if the port is using clang/g95 for compilation and only using
cpp from gccXX.

My requirement for a cpp in Fortran is:

The file below, when named conftest.f90, and preprocessed as "$FCCPP
conftest.f90", will contain "hi" and "rout // ine" (no space between //).

=======
#define ADD_I(x) x ## i
ADD_I(h)
#define PUSH_SUB(x) x // ine
PUSH_SUB(rout)
=======

For example, with "cpp-mp-4.5 -ansi conftest.F90", I get:

=======
# 1 "conftest.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "conftest.F90"

hi

rout // ine
=======

I get the same with "clang -E -ansi" if the file is named conftest.f90 but
not if named conftest.F90. Jeremy told me that on his machine even
conftest.f90 does not work.

Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130904/2ea0d22d/attachment.html>


More information about the macports-dev mailing list