https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95146

            Bug ID: 95146
           Summary: gfortran -cpp – leading spaces before '#'
                    preprocessing directive not handled
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Found when looking at the build results for
  meson (Python-based build system)
which fail like:

[  384s] Command line:  gfortran /home/abuild/rpmbuild/BUILD/meson-0.54.1/b
536484cc32/meson-private/tmpp6hst_hh/testfile.f90 -pipe -cpp -E -P
-D_FILE_OFFSET_BITS=64 -cpp -P -O0 
[  384s] 
[  384s] Code:
[  385s]  
[  385s]         #ifdef __has_include
[  385s]          #if !__has_include("omp.h")
[  385s]           #error "Header 'omp.h' could not be found"
[  385s]          #endif
[  385s]         #else
[  385s]          #include <omp.h>
[  385s]         #endif
...
[  385s] Error: "__has_include" used outside of preprocessing directive

The problem is that the leading spaces before the '#' are not properly handled.

Simpler example ' #define A 5'. Without space, "gfortran -E" removes that line,
with space, the line remains after preprocessing.

Reply via email to