llvm-project/flang/test/Preprocessing/disable-expansion.F90
Peter Klausler f2bf44b6ec
[flang][preprocessor] Finesse disabling of function-like macros (#71589)
During function-like macro expansion in a standard C/C++ preprocessor,
the macro being expanded is disabled from recursive macro expansion. The
implementation in this compiler's preprocessor, however, was too broad;
the macro expansion needs to be disabled for the "rescanning" phase
only, not for actual argument expansion.

(Also corrects an obsolete comment elsewhere that was noticed during
reduction of an original test case.)
2023-11-13 15:25:10 -08:00

15 lines
298 B
Fortran

! RUN: %flang -E %s | FileCheck %s
#define KWM a
#define FLM(x) b FLM2(x) KWM c
#define FLM2(x) d FLM(x) e
! CHECK: a
KWM
! CHECK: b d FLM(y) e a c
FLM(y)
! CHECK: b d FLM(a) e a c
FLM(KWM)
! CHECK: b d FLM(b d FLM(y) e a c) e a c
FLM(FLM(y))
! CHECK: b d FLM(b d FLM(a) e a c) e a c
FLM(FLM(KWM))