[flang][preprocessor] Directive continuation must skip empty macros (#134149)

When a compiler directive continuation line starts with keyword macro
names that have empty expansions, skip them.
This commit is contained in:
Peter Klausler 2025-04-04 08:43:56 -07:00 committed by GitHub
parent efd7caac2e
commit 507ce46b6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -1325,7 +1325,7 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) {
if (p >= limit_) {
return nullptr;
}
p = SkipWhiteSpace(p);
p = SkipWhiteSpaceIncludingEmptyMacros(p);
if (*p == '!') {
++p;
if (InCompilerDirective()) {

View File

@ -8,6 +8,7 @@
#define COMMENT !
#define OMP_START !$omp
#define OMP_CONT !$omp&
#define EMPTY
module m
contains
@ -50,6 +51,11 @@ OMP_CONT do &
OMP_CONT reduction(+:x)
do j3 = 1, n
end do
EMPTY !$omp parallel &
EMPTY !$omp do
do j4 = 1, n
end do
end
COMMENT &
@ -79,6 +85,9 @@ end module
!CHECK: !$OMP PARALLEL DO REDUCTION(+: x)
!CHECK: DO j3=1_4,n
!CHECK: END DO
!CHECK: !$OMP PARALLEL DO
!CHECK: DO j4=1_4,n
!CHECK: END DO
!CHECK: END SUBROUTINE
!CHECK: SUBROUTINE s2
!CHECK: END SUBROUTINE