[flang-commits] [PATCH] D155973: [flang] Portability warning and documentation for an obscure extension

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 21 14:31:09 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG28eec1bd85d2: [flang] Portability warning and documentation for an obscure extension (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155973

Files:
  flang/docs/Extensions.md
  flang/lib/Parser/prescan.cpp
  flang/test/Parser/continuation-before-quote.f90


Index: flang/test/Parser/continuation-before-quote.f90
===================================================================
--- /dev/null
+++ flang/test/Parser/continuation-before-quote.f90
@@ -0,0 +1,10 @@
+! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s
+! Continuation between repeated quotation marks
+subroutine test
+!CHECK: portability: Repeated quote mark in character literal continuation line should have been preceded by '&'
+  print *, 'needs an '&
+'ampersand'''
+!CHECK-NOT: portability: Repeated quote mark in character literal continuation line should have been preceded by '&'
+  print *, 'has an '&
+&'ampersand'''
+end
Index: flang/lib/Parser/prescan.cpp
===================================================================
--- flang/lib/Parser/prescan.cpp
+++ flang/lib/Parser/prescan.cpp
@@ -726,6 +726,11 @@
         break;
       }
       inCharLiteral_ = true;
+      if (insertASpace_) {
+        Say(GetProvenanceRange(at_, end),
+            "Repeated quote mark in character literal continuation line should have been preceded by '&'"_port_en_US);
+        insertASpace_ = false;
+      }
     }
   }
   inCharLiteral_ = false;
Index: flang/docs/Extensions.md
===================================================================
--- flang/docs/Extensions.md
+++ flang/docs/Extensions.md
@@ -291,6 +291,10 @@
   numeric character literal kind prefix on the file name.
 * Intrinsic procedures TAND and ATAND. Constant folding is currently
   not supported for these procedures but this is planned.
+* When a pair of quotation marks in a character literal are split
+  by a line continuation in free form, the second quotation mark
+  may appear at the beginning of the continuation line without an
+  ampersand, althought one is required by the standard.
 
 ### Extensions supported when enabled by options
 
@@ -607,3 +611,4 @@
 * `ENCODING=` is not in the list of changeable modes on an I/O unit,
   but every Fortran compiler allows the encoding to be changed on an
   open unit.
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155973.543068.patch
Type: text/x-patch
Size: 2015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230721/6f940d98/attachment-0001.bin>


More information about the flang-commits mailing list