Re: comment and IBM xlf



On Thu, 28 Sep 2006 18:04:39 +0000 (UTC), glen herrmannsfeldt wrote:
Markus Franke <Markus-Franke@xxxxxx> wrote:

I have Fortran 90 code and want to include a file (config.h) with
C-style comments, like /* */. When I try compile the file with IBM XLF
10.1 Compiler I get the following error messages:

I am pretty sure that the C preprocessor processes C comments, so it
seems that the compiler is looking at it before passing it to cpp.

You might try running cpp separately, and then sending the output
to XLF. I don't know if Fortran continuation lines will survive cpp,
though.

Try man cpp on a unix system.

The problem is that when xlf invokes cpp, it specifies the -C option,
which means "do not discard comments." This is controlled by the file
/etc/xlf.cfg, which contains the line

cppoptions = -C

among its default settings. Don't ask me why that was thought to be a
good idea.

I don't see a way to turn that option off on the command line, once it
has been enabled, but you can specify a different config file if you
like, perhaps something like:

grep -v cppoptions /etc/xlf.cfg >myconfig
xlf -Fmyconfig foo.F

Of course, you can also use

cpp -P foo.F foo.f
xlf foo.f

My experiments indicate that you need the -P option here, even though
it's not specified in /etc/xlf.cfg.



--
Dave Seaman
U.S. Court of Appeals to review three issues
concerning case of Mumia Abu-Jamal.
<http://www.mumia2000.org/>
.



Relevant Pages

  • Re: comment and IBM xlf
    ... (snip on using cpp with XLF) ... which means "do not discard comments." ... but you can specify a different config file if you ...
    (comp.lang.fortran)
  • Re: Cpp Considered Harmful
    ... programming language, the compiler, the IDE, the libraries, etc. ... WRT exceptions, the fact of the matter is that placing certain ... >> regarding the CPP. ...
    (comp.lang.cpp)
  • Re: MPI/Fortran95 incompatibility? Was - Re: Pass by reference in Fortran77 standard?
    ... The IBM xlf compiler comes to mind -- but I still haven't managed to get a definitive answer on this from an "official" source. ... generates array copies for both array subsets and array triplets. ... tassumption that the argument passing mechanism is always pass-by-reference. ...
    (comp.lang.fortran)
  • Re: can preprocessor automatically make N array elements?
    ... # Can m4 statements be inserted into C code, like cpp statements? ... A C compiler traditionally includes a cpp step, ... although the loader is not traditionally part of the compiler. ... I don't if/where the ATT documentation is. ...
    (comp.lang.c)
  • Re: Compiling -- gcc -- Lex & Yacc
    ... cpp, was CREATED using lex and yacc (or more correctly, their Gnu ... It does eventually call the assembler and the ... the gnu site offers me the same 'info gcc' document that I ... of your compiler knowledge I am trying to find. ...
    (Fedora)