Codes using traditional C preprocessors will sometimes put a keyword
macro name in a free form continuation line in order to get macro
replacement of part of an identifier, as in
call subr_&
&N&
&(1.)
where N is a keyword macro. f18 already handles this case, but not when
there is white space between the macro name and the following
continuation marker character '&'. Allow white space to appear.
Fixes https://github.com/llvm/llvm-project/issues/106931.
28 lines
375 B
Fortran
28 lines
375 B
Fortran
! RUN: %flang -E %s 2>&1 | FileCheck %s
|
|
! CHECK: print *, ADC, 1
|
|
! CHECK: print *, AD, 2
|
|
! CHECK: print *, DC, 3
|
|
! CHECK: print *, AD(1), 4
|
|
! CHECK: print *, AD
|
|
! CHECK: print *, AB
|
|
#define B D
|
|
implicit none
|
|
real ADC
|
|
print *, A&
|
|
&B&
|
|
&C, 1
|
|
print *, A&
|
|
&B&
|
|
&, 2
|
|
print *, &
|
|
&B&
|
|
&C, 3
|
|
print *, A&
|
|
&B &
|
|
&(1), 4
|
|
print *, A&
|
|
&B
|
|
print *, A&
|
|
&B ! but not this
|
|
end
|