[flang-commits] [PATCH] D155499: [flang] Stricter "implicit continuation" in preprocessing

Roger Ferrer Ibanez via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jul 18 02:09:10 PDT 2023


rogfer01 added a comment.

Hi @klausler can you upload a patch with context. I left a few initial comments though.

Thanks!



================
Comment at: flang/docs/Preprocessing.md:77
   continuation should be assumed.
+  This includes the case of a keyword-like macro that expands to
+  the name of a function-like macro.
----------------
I'm not sure there is a test already for this case, is there?

Just to confirm I understand this correctly, this new paragraph covers this case below:

```lang=fortran
subroutine sub(a)
  implicit none
  integer :: a

#define foo(x) ((x) + 1)
#define bar foo

  a = bar  (
a
)

end subroutine sub
```

that should be preprocessed something similar to:

```lang=fortran
subroutine sub(a)
  implicit none
  integer :: a

  a = (( a ) + 1)

end subroutine sub
```


================
Comment at: flang/include/flang/Parser/char-block.h:67
 
+  char OnlyNonBlank() const {
+    char result{' '};
----------------
I'm confused by this function. I've tested it with several inputs and it always seems to return `' '`?

My tests here: https://www.godbolt.org/z/af9oc74aE

Maybe I'm missing something. Can you add a comment about its purpose?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155499/new/

https://reviews.llvm.org/D155499



More information about the flang-commits mailing list