From: peter klausler Date: Thu, 14 Mar 2019 21:51:40 +0000 (-0700) Subject: [flang] Get clean -fparse-only pass over WRF X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df2a91063907ae160bde4e07fe0bb82f1ea9a3e1;p=platform%2Fupstream%2Fllvm.git [flang] Get clean -fparse-only pass over WRF Original-commit: flang-compiler/f18@ffe517abc6bdc481248308156dec6d48089e8269 Reviewed-on: https://github.com/flang-compiler/f18/pull/333 --- diff --git a/flang/documentation/Extensions.md b/flang/documentation/Extensions.md index 38fccff..88c0b3e3 100644 --- a/flang/documentation/Extensions.md +++ b/flang/documentation/Extensions.md @@ -56,6 +56,8 @@ Extensions, deletions, and legacy features supported by default * Character literals as elements of an array constructor without an explicit type specifier need not have the same length; the longest literal determines the length parameter of the implicit type, not the first. +* Outside a character literal, a comment after a continuation marker (&) + need not begin with a comment marker (!). Extensions supported when enabled by options -------------------------------------------- diff --git a/flang/lib/parser/features.h b/flang/lib/parser/features.h index 7b8136d..d971fdb 100644 --- a/flang/lib/parser/features.h +++ b/flang/lib/parser/features.h @@ -29,7 +29,8 @@ ENUM_CLASS(LanguageFeature, BackslashEscapes, OldDebugLines, OldStyleParameter, ComplexConstructor, PercentLOC, SignedPrimary, FileName, Convert, Dispose, IOListLeadingComma, AbbreviatedEditDescriptor, ProgramParentheses, PercentRefAndVal, OmitFunctionDummies, CrayPointer, - Hollerith, ArithmeticIF, Assign, AssignedGOTO, Pause, OpenMP) + Hollerith, ArithmeticIF, Assign, AssignedGOTO, Pause, OpenMP, + CruftAfterAmpersand) using LanguageFeatures = common::EnumSet; diff --git a/flang/lib/parser/grammar.h b/flang/lib/parser/grammar.h index c75958d..7df25e7 100644 --- a/flang/lib/parser/grammar.h +++ b/flang/lib/parser/grammar.h @@ -3092,7 +3092,8 @@ TYPE_PARSER(construct("USE" >> optionalBeforeColons(moduleNature), name, ", ONLY :" >> optionalList(Parser{})) || construct("USE" >> optionalBeforeColons(moduleNature), name, defaulted("," >> - nonemptyList("expected renamings"_err_en_US, Parser{})))) + nonemptyList("expected renamings"_err_en_US, Parser{})) / + lookAhead(endOfStmt))) // R1411 rename -> // local-name => use-name | diff --git a/flang/lib/parser/prescan.cc b/flang/lib/parser/prescan.cc index 92768fa..2e1c69e 100644 --- a/flang/lib/parser/prescan.cc +++ b/flang/lib/parser/prescan.cc @@ -853,8 +853,9 @@ bool Prescanner::FreeFormContinuation() { if (*p != '\n') { if (inCharLiteral_) { return false; - } else if (*p != '!') { - Say(GetProvenance(p), "treated as comment after &"_en_US); + } else if (*p != '!' && + features_.ShouldWarn(LanguageFeature::CruftAfterAmpersand)) { + Say(GetProvenance(p), "missing ! before comment after &"_en_US); } } do {