[flang-commits] [PATCH] D124278: [flang][runtime] Ignore leading spaces even in BZ mode
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Apr 22 10:39:23 PDT 2022
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
When editing numeric input, always skip leading spaces, even if
BZ mode (or BLANK='ZERO') is in effect; otherwise, a sign character
preceded by blanks will not be recognized.
https://reviews.llvm.org/D124278
Files:
flang/runtime/edit-input.cpp
flang/runtime/io-stmt.h
Index: flang/runtime/io-stmt.h
===================================================================
--- flang/runtime/io-stmt.h
+++ flang/runtime/io-stmt.h
@@ -133,8 +133,8 @@
// For fixed-width fields, initialize the number of remaining characters.
// Skip over leading blanks, then return the first non-blank character (if
// any).
- std::optional<char32_t> PrepareInput(const DataEdit &edit,
- std::optional<int> &remaining, bool skipSpaces = true) {
+ std::optional<char32_t> PrepareInput(
+ const DataEdit &edit, std::optional<int> &remaining) {
remaining.reset();
if (edit.descriptor == DataEdit::ListDirected) {
std::size_t byteCount{0};
@@ -143,9 +143,7 @@
if (edit.width.value_or(0) > 0) {
remaining = *edit.width;
}
- if (skipSpaces) {
- SkipSpaces(remaining);
- }
+ SkipSpaces(remaining);
}
return NextInField(remaining, edit);
}
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -58,15 +58,12 @@
// Returns true if there's a '-' sign.
static bool ScanNumericPrefix(IoStatementState &io, const DataEdit &edit,
std::optional<char32_t> &next, std::optional<int> &remaining) {
- bool bzMode{(edit.modes.editingFlags & blankZero) != 0};
- next = io.PrepareInput(edit, remaining, !bzMode);
+ next = io.PrepareInput(edit, remaining);
bool negative{false};
if (next) {
negative = *next == '-';
if (negative || *next == '+') {
- if (!bzMode) {
- io.SkipSpaces(remaining);
- }
+ io.SkipSpaces(remaining);
next = io.NextInField(remaining, edit);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124278.424529.patch
Type: text/x-patch
Size: 1732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220422/9daf5705/attachment.bin>
More information about the flang-commits
mailing list