|> I have found some anoying bugs in the ibm's xlc cpp it cannot
|> compile this:
|>
|> #include <stdio.h>
|> #define m1(s) printf(s)
|> #define m2(a) m1(#a)
|> f() { m2(!"This should not break"); }
|>
|> Does anybody knows if there is any compiler options that or config
|> parameters that would allow me to plug in my own version of cpp ?
|>
|> Thanks,
|> Minh Tran-Le.
I agree with your frustration. I have tried to do this before without
luck. According to TFM the -B switch should do this for you. The
document says that -B allows you to construct substitute compiler
(including preprocessor), assembler, or linkage editor programs.
At first reading this gives a glimmer of hope which is later dashed.
They mean I presume that the compiler includes the preprocessor,
if you want to do both in your program feel free, otherwise leave
it all to us! If they take that attitude then THEY HAD BETTER FIX
THEIR PREPROCESSOR!
We have written a shell script to do compiling that can run the
.c file through our own cpp and then run that result through xlc
but that gets messy real fast, and would not work with standard
make files and the like.
Anyway, here is my attempt to use -B. :-(
+---------------------------------
| mkdir /tmp/cc
| ln -s ln -s /u/bin/mcc /tmp/cc/cpp
| ln -s /usr/lpp/xlc/bin/xlcentry /tmp/cc/xlcentry
| cc -B/tmp/cc/ -v /tmp/x.c
+---------------------------------
Produces:
+---------------------------------
| % cc -B/tmp/cc/ -v /tmp/x.c
| exec: /tmp/cc/xlcentry(xlcentry,/tmp/x.c,x.o,x.lst,-D_IBMR2,-D_AIX,-qlanglvl=extended,-qnoro,NULL)
| 4 | f() { printf("!"This should not break""); }
| ................a..........................
| a - 1506-046: (S) Syntax error.
| unlink: x.o
+---------------------------------
Notice that cc only invoked xlcentry, not cpp as it should.
Even:
+---------------------------------
| cc -B/tmp/cc/ -v /tmp/x.c -P
+---------------------------------
Does not force it to use cpp as it will some other brain-dead cc's.
Now, I agree with the design of xlc and other compilers that feel that
a builtin cpp will improve overall compile performance. BUT, they
should recognize that NOT everybody will want to use their preprocessor
for whatever reasons (like bugs!). In which case the -B switch
should cause cc to revert to the historical behaviour of invoking
the named cpp and piping the output directly into xlcentry.
However, you do have a legitimate preprocessor bug. You should
report that to IBM defect support line so that they can fix it for
the benefit of other users. You undoubtedly will come up with a
workaround long before they fix it. But, report it nonetheless!
--
Mgr. AIX Host Development PO Box 200075 (512)258-5171 x3264
Austin, TX 78720-0075
Optimism: That quality that allows a tea kettle to sing
though up to its nose in hot water.