From eff381185a1d95ba365ce7897b733af892c708d6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Jul 2009 15:16:59 -0400 Subject: 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. --- Modules/CMakeFortranCompilerId.F.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 74e2cd5..a01dc81 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -25,7 +25,11 @@ PRINT *, 'INFO:compiler[MIPSpro]' #elif defined(__hpux) || defined(__hpux__) 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[]' #endif @@ -86,7 +90,11 @@ PRINT *, 'INFO:platform[ULTRIX]' #elif defined(__XENIX__) || defined(_XENIX) || defined(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[]' #endif END -- cgit v0.12