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

--- Comment #2 from janus at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #1)
> It should not.

Well, why not? 

If you say that the preprocessor is meant only for C/C++, then it shouldn't be
used with Fortran at all.

If one uses it with Fortran, it should also understand the specifics of Fortran
syntax, no?

Would it make sense to have a "Fortran mode" or something like that? Right now
gfortran is using 'traditional' mode IIUC.


> Use /* ... */ or // comments instead if you don't want expansion in them.

Using // actually does not work for me:

comment.F90:5:0:

 // _ASSERT_() is a nice macro :)
 ^
Error: macro "_ASSERT_" requires 2 arguments, but only 1 given
comment.F90:5:1:

 // _ASSERT_() is a nice macro :)
 1
Error: Invalid character in name at (1)


Using /* ... */ does work, but it's strange to do that in Fortran code (plus it
breaks if the code is not preprocessed; preprocessing is 'optional' for
Fortran).

!/* ... */ is a reasonable workaround for now.



> The preprocessor doesn't know anything about Fortran parsing and changing
> this would e.g. break OpenMP or OpenACC, where we do want normal
> preprocessing in !$omp and !$acc comments.

That's true (and it's different from C/C++ where OpenMP uses pragmas, not
comment-like directive).
One could still teach the preprocessor to discard !... , but not !$..., in a
Fortran context.

Reply via email to