[flang] Portability warning and documentation for an obscure extension
authorPeter Klausler <pklausler@nvidia.com>
Thu, 20 Jul 2023 17:39:04 +0000 (10:39 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Fri, 21 Jul 2023 21:30:40 +0000 (14:30 -0700)
commit28eec1bd85d2a0eb342fbad8fb2cace389e772d5
tree5b387277fe2a690d7ff0481766385dfb29afceb0
parent290a98c7b00899b6aba0fc892e8f29fecc00a82e
[flang] Portability warning and documentation for an obscure extension

A quotation mark can appear in a Fortran character literal by doubling
it; for example, PRINT *, "'""'" prints '"'.  When those doubled
quotation marks are split by a free form line continuation, the
continuation line should have an ampersand before the second quotation
mark.  But most compilers, including this one, allow the second
quotation mark to appear as the first character on the continuation
line, too.

So this works:

  print *, "'"&
"'"

but it really should be written as:

  print *, "'"&
&"'"

Emit a portability warning and document that we support this near-universal
extension.

Differential Revision: https://reviews.llvm.org/D155973
flang/docs/Extensions.md
flang/lib/Parser/prescan.cpp
flang/test/Parser/continuation-before-quote.f90 [new file with mode: 0644]