llvm-project/flang/test/Parser/pp-dir-comments.f90
peter klausler cf2274b779 [flang] Allow ! and // comments after some preprocessing directives
Old-style C /*comments*/ are omitted from preprocessor directive
token sequences by the prescanner, but line-ending C++ and Fortran
free-form comments are not since their handling might depend on
the directive.  Add code to skip these line-ending comments as
appropriate in place of existing code that just skipped blanks.

Reviewed By: sscalpone

Differential Revision: https://reviews.llvm.org/D84061
2020-07-17 15:28:22 -07:00

20 lines
339 B
Fortran

! RUN: %f18 -funparse %s 2>&1 | FileCheck %s
#define pmk
#ifdef pmk // comment
! CHECK: t1
real t1
#endif // comment
#undef pmk ! comment
#ifndef pmk ! comment
! CHECK: t2
real t2
#endif // comment
#if 0 /* C comment */ + 0
! CHECK-NOT: misinterpreted
# error misinterpreted #if
#else // comment
! CHECK: END PROGRAM
end
#endif ! comment