[comp.unix.aix] Help with CPP woes

carl@probitas.cs.utas.edu.au (Carl Lewis) (04/12/91)

I am trying to port a fairly large piece of software (postgres)
which tries to be very clever with it's #define's, causing
the evaluation of a macro to yield yet another macro etc.
Unfortunately I can't get past the pre-processing to see if it'll 
compile ! Does anyone know if there are any undocumented flags for
AIX's version of cpp which make it behave in a reasonable manner ?

AIX's poor old cpp gives up the ghost about three macro levels down.
Unfortuantely I cannot repeat the bug with a simple test case.
xlc, bsdcc , cc all fail at various stages with both the inbuilt
and external cpp (/lib/). I've even tried /usr/lpp/X11/Xamples/util/cpp !
, further than that I've tried porting BSD4.3 cpp which doesn't
work either. (it doesn't understand #elif :-( ).

Does anyone have a solution in the way of flags or non brain dead cpp
source ?

Thanks
Carl, Programmer (etc) with University of Tasmania
AARN : C.S.Lewis@cs.utas.edu.au
       || carl@cs.utas.edu.au 
       || carl@probitas.cs.utas.edu.au
--
Carl, Programmer (etc) with University of Tasmania
Snail:  Computer Science Dept., University of Tasmania,
        GPO Box 252C, Hobart, TAS, 7001, Australia.
AARN : carl@cs.utas.edu.au

blaise@sparc1.uhcc.Hawaii.Edu (Blaise Haae) (04/24/91)

In article <carl.671430432@probitas> carl@probitas.cs.utas.edu.au (Carl Lewis) writes:
>
>AIX's poor old cpp gives up the ghost about three macro levels down.
>Unfortuantely I cannot repeat the bug with a simple test case.
>xlc, bsdcc , cc all fail at various stages with both the inbuilt
>and external cpp (/lib/). I've even tried /usr/lpp/X11/Xamples/util/cpp !
>, further than that I've tried porting BSD4.3 cpp which doesn't
>work either. (it doesn't understand #elif :-( ).
>
>Does anyone have a solution in the way of flags or non brain dead cpp
>source ?
>
>Thanks
>Carl, Programmer (etc) with University of Tasmania
>
Carl,
	You might want to try out the cpp from GCC 1.39.  The only
changes you'll have to make to the code involve adding the following
lines to cccp.c and cexp.c:

	#ifdef _IBMR2
	#pragma alloca
	#endif

Probably best to insert the lines just after the initial comments.
Typing 'make cpp' should create cpp (and cccp unless you change the
makefile).

Hope this helps
-Blaise, University of Hawaii Computing Center

----------------------------------------------------------------
Blaise Haae, blaise@uhunix.uhcc.hawaii.edu, blaise@uhunix.BITNET
--
----------------------------------------------------------------
Blaise Haae, blaise@uhunix.uhcc.hawaii.edu, blaise@uhunix.BITNET

gt3852a@prism.gatech.EDU (MY NAME) (05/03/91)

In article <carl.671430432@probitas> carl@probitas.cs.utas.edu.au (Carl Lewis) writes:
>
>AIX's poor old cpp gives up the ghost about three macro levels down.
>Unfortuantely I cannot repeat the bug with a simple test case.
>xlc, bsdcc , cc all fail at various stages with both the inbuilt
>and external cpp (/lib/). I've even tried /usr/lpp/X11/Xamples/util/cpp !
>, further than that I've tried porting BSD4.3 cpp which doesn't
>work either. (it doesn't understand #elif :-( ).
>
>Does anyone have a solution in the way of flags or non brain dead cpp
>source ?
>
>Thanks
>Carl, Programmer (etc) with University of Tasmania
>
Carl,

        AIX does not support more than 16 nested #include and 32 nested 
        #infdef.  This may sound reasonable for a human programmer. It's
        very hard to imagine an average human mind going for that many
        levels of nested  operations. Unfortunately, some of the programs
        are created by generators, that's the case of object-oriented
        programs with inheritance. In such programs, it's easy to end up
        generating programs with VERY deep nested levels. 

        The way to solve this problem is to modify your CPP. To do that 
        you need to get the source for a CPP (I suggest the one that comes
        with MOTIF 1.1) and change the constants of NESTED_IFDEF and
        NESTED_INCLUDE to a large value (I suggest 64). Then remake CPP
        and use the new copy of CPP to preprocess your programs.
         

Hope this helps
-Nasr Belkeir, Georgia Institute of Technology

----------------------------------------------------------------
Nasr E. Belkeir, belk@sybil.gatech.edu
----------------------------------------------------------------


-- 
NASR BELKEIR
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:     ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!gt3852a
Internet: gt3852a@prism.gatech.edu