check for -traditional in FPP's behaviour

Issue #2566 wontfix
Former user created an issue

Cactus passes Fortran code (at least with extensions .F77 .F and .F90) through the C preprocessor in FPP passing FPPFLAGS.

This cpp must use traditional (pre-ANSI) behaviour, ie be string and not token based to preserve whitespace in Fortran fixed format code and handle concatenation using FOO/**/BAR correctly.

Getting this wrong by setting eg only FPP in an option list results in strange error messages.

Cactus' configure should check that FPP and FPPFLAGS behave as expected. Eg by processing:

TRAD/**/ITIONAL

which produces:

TRADITIONAL

with --traditional and

TRAD ITIONAL

without, so one can grep for the expected string.

Comments (1)

  1. Roland Haas

    Actually Cactus itself contains such a check in src/include/cctk_Types.h:

    /* Determine whether we have a traditional or an ANSI cpp. */
    #ifdef FCODE
    /* The empty
       comment in the definition of CCTK_ANSI_FPP will either turn into
       nothing or into white space.  There must not be any add spaces
       around this empty comment.
    
       A traditional cpp will turn it into nothing, an ANSI cpp will turn
       it into white space.  Depending on this, CCTK_ANSI_FPP will either
       turn into a single separate token (which lead to the value 0), or
       into two separate tokens (which lead to the value 1).
    
       This is magic.  */
    #define CCTKi_FPP_A
    #define CCTKi_FPP_B 1
    #define CCTKi_FPP_ACCTKi_FPP_B 0
    #define CCTK_ANSI_FPP CCTKi_FPP_A/**/CCTKi_FPP_B
    #endif
    

    so really it should support both. Namely if code fails if FPP is not traditional then that could should be changed so that it works both with and without traditional.

  2. Log in to comment