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

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jul 18 06:37:06 PDT 2023


klausler added inline comments.


================
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.
----------------
rogfer01 wrote:
> 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
> ```
Yes.


================
Comment at: flang/include/flang/Parser/char-block.h:67
 
+  char OnlyNonBlank() const {
+    char result{' '};
----------------
rogfer01 wrote:
> 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?
It returns the only non-blank character, if it is the only non-blank character.


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

https://reviews.llvm.org/D155499



More information about the flang-commits mailing list