BUG: Avoid SGI preprocessor bug for Fortran Id

The SGI preprocessor /usr/lib/cpp produces bad output on this code:

  #if 1
  A
  #elif 1
  B
  #else
  C
  #endif

Both 'A' and 'C' appear in the output!  We work around the problem by
using '#elif 1' instead of '#else'.

This fixes detection of the SGI Fortran compiler id in -o32 mode.
This commit is contained in:
Brad King 2009-07-14 15:16:59 -04:00
parent 1e20be319f
commit eff381185a
1 changed files with 10 additions and 2 deletions

View File

@ -25,7 +25,11 @@
PRINT *, 'INFO:compiler[MIPSpro]' PRINT *, 'INFO:compiler[MIPSpro]'
#elif defined(__hpux) || defined(__hpux__) #elif defined(__hpux) || defined(__hpux__)
PRINT *, 'INFO:compiler[HP]' PRINT *, 'INFO:compiler[HP]'
#else #elif 1
# if 0
! The above 'elif 1' instead of 'else' is to work around a bug in the
! SGI preprocessor which produces both the __sgi and else blocks.
# endif
PRINT *, 'INFO:compiler[]' PRINT *, 'INFO:compiler[]'
#endif #endif
@ -86,7 +90,11 @@
PRINT *, 'INFO:platform[ULTRIX]' PRINT *, 'INFO:platform[ULTRIX]'
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
PRINT *, 'INFO:platform[Xenix]' PRINT *, 'INFO:platform[Xenix]'
#else #elif 1
# if 0
! The above 'elif 1' instead of 'else' is to work around a bug in the
! SGI preprocessor which produces both the __sgi and else blocks.
# endif
PRINT *, 'INFO:platform[]' PRINT *, 'INFO:platform[]'
#endif #endif
END END