1
0
Эх сурвалжийг харах

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.
Brad King 16 жил өмнө
parent
commit
eff381185a

+ 10 - 2
Modules/CMakeFortranCompilerId.F.in

@@ -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