diff options
author | Peter Klausler <pklausler@nvidia.com> | 2023-07-20 14:44:46 -0700 |
---|---|---|
committer | Peter Klausler <pklausler@nvidia.com> | 2023-07-21 15:16:59 -0700 |
commit | cfa032cea0a165ad803fbfdd17e805052e2f3640 (patch) | |
tree | 393506d4f1417fcb7bf1840f77dffb645a5df96b /flang | |
parent | b2d76a063dd7fb681c98a10d8e7f54fd6d25dd27 (diff) | |
download | llvm-cfa032cea0a165ad803fbfdd17e805052e2f3640.zip llvm-cfa032cea0a165ad803fbfdd17e805052e2f3640.tar.gz llvm-cfa032cea0a165ad803fbfdd17e805052e2f3640.tar.bz2 |
[flang] Emit just one warning for a bad format edit descriptor
An attempt to use an edit descriptor (other than A or L) in a FORMAT
statement without arequired 'w' width will elicit warnings from both
the parser and the I/O checker in semantics. Remove the warning from
the parser.
Differential Revision: https://reviews.llvm.org/D155977
Diffstat (limited to 'flang')
-rw-r--r-- | flang/include/flang/Common/format.h | 2 | ||||
-rw-r--r-- | flang/lib/Parser/io-parsers.cpp | 42 |
2 files changed, 21 insertions, 23 deletions
diff --git a/flang/include/flang/Common/format.h b/flang/include/flang/Common/format.h index 0137da5..2374ff6 100644 --- a/flang/include/flang/Common/format.h +++ b/flang/include/flang/Common/format.h @@ -471,7 +471,7 @@ template <typename CHAR> bool FormatValidator<CHAR>::check_w() { NextToken(); return true; } - if (*argString_ != 'A') { + if (*argString_ != 'A' && *argString_ != 'L') { ReportWarning("Expected '%s' edit descriptor 'w' value"); // C1306 } return false; diff --git a/flang/lib/Parser/io-parsers.cpp b/flang/lib/Parser/io-parsers.cpp index 8c08281..ca0dbed 100644 --- a/flang/lib/Parser/io-parsers.cpp +++ b/flang/lib/Parser/io-parsers.cpp @@ -601,28 +601,26 @@ TYPE_PARSER(construct<format::IntrinsicTypeDataEditDesc>( "A " >> pure(format::IntrinsicTypeDataEditDesc::Kind::A), maybe(width), noInt, noInt) || // PGI/Intel extension: omitting width (and all else that follows) - extension<LanguageFeature::AbbreviatedEditDescriptor>( - "nonstandard usage: abbreviated edit descriptor"_port_en_US, - construct<format::IntrinsicTypeDataEditDesc>( - "I " >> pure(format::IntrinsicTypeDataEditDesc::Kind::I) || - ("B "_tok / !letter /* don't occlude BN & BZ */) >> - pure(format::IntrinsicTypeDataEditDesc::Kind::B) || - "O " >> pure(format::IntrinsicTypeDataEditDesc::Kind::O) || - "Z " >> pure(format::IntrinsicTypeDataEditDesc::Kind::Z) || - "F " >> pure(format::IntrinsicTypeDataEditDesc::Kind::F) || - ("D "_tok / !letter /* don't occlude DT, DC, & DP */) >> - pure(format::IntrinsicTypeDataEditDesc::Kind::D) || - "E " >> - ("N " >> - pure(format::IntrinsicTypeDataEditDesc::Kind::EN) || - "S " >> - pure(format::IntrinsicTypeDataEditDesc::Kind::ES) || - "X " >> - pure(format::IntrinsicTypeDataEditDesc::Kind::EX) || - pure(format::IntrinsicTypeDataEditDesc::Kind::E)) || - "G " >> pure(format::IntrinsicTypeDataEditDesc::Kind::G) || - "L " >> pure(format::IntrinsicTypeDataEditDesc::Kind::L), - noInt, noInt, noInt))) + // Parse them just to get them to the I/O checker in semantics; + // they are not supported by the runtime. + extension<LanguageFeature::AbbreviatedEditDescriptor>(construct< + format::IntrinsicTypeDataEditDesc>( + "I " >> pure(format::IntrinsicTypeDataEditDesc::Kind::I) || + ("B "_tok / !letter /* don't occlude BN & BZ */) >> + pure(format::IntrinsicTypeDataEditDesc::Kind::B) || + "O " >> pure(format::IntrinsicTypeDataEditDesc::Kind::O) || + "Z " >> pure(format::IntrinsicTypeDataEditDesc::Kind::Z) || + "F " >> pure(format::IntrinsicTypeDataEditDesc::Kind::F) || + ("D "_tok / !letter /* don't occlude DT, DC, & DP */) >> + pure(format::IntrinsicTypeDataEditDesc::Kind::D) || + "E " >> + ("N " >> pure(format::IntrinsicTypeDataEditDesc::Kind::EN) || + "S " >> pure(format::IntrinsicTypeDataEditDesc::Kind::ES) || + "X " >> pure(format::IntrinsicTypeDataEditDesc::Kind::EX) || + pure(format::IntrinsicTypeDataEditDesc::Kind::E)) || + "G " >> pure(format::IntrinsicTypeDataEditDesc::Kind::G) || + "L " >> pure(format::IntrinsicTypeDataEditDesc::Kind::L), + noInt, noInt, noInt))) // R1307 data-edit-desc (part 2 of 2) // R1312 v -> [sign] digit-string |