[flang-commits] [flang] [llvm] [flang][flang-rt][F202X][Issue #178494] Implement F202X leading-zero … (PR #183500)
via flang-commits
flang-commits at lists.llvm.org
Thu Feb 26 08:33:00 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- flang-rt/include/flang-rt/runtime/format-implementation.h flang-rt/include/flang-rt/runtime/format.h flang-rt/lib/runtime/edit-output.cpp flang/include/flang/Common/format.h flang/include/flang/Parser/format-specification.h flang/lib/Parser/io-parsers.cpp flang/lib/Parser/unparse.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang-rt/lib/runtime/edit-output.cpp b/flang-rt/lib/runtime/edit-output.cpp
index d0aa86381..fbfcef6e7 100644
--- a/flang-rt/lib/runtime/edit-output.cpp
+++ b/flang-rt/lib/runtime/edit-output.cpp
@@ -561,8 +561,7 @@ RT_API_ATTRS bool RealOutputEditing<KIND>::EditFOutput(const DataEdit &edit) {
digitsAfterPoint + trailingZeroes ==
0) {
zeroesBeforePoint = 1; // "."--> "0." (bare decimal point)
- } else if (digitsBeforePoint == 0 && zeroesBeforePoint == 0 &&
- expo <= 0) {
+ } else if (digitsBeforePoint == 0 && zeroesBeforePoint == 0 && expo <= 0) {
// Optional leading zero position (F202X leading zero control).
// Value magnitude < 1: "0.xxx" vs ".xxx"
switch (edit.modes.leadingZero) {
diff --git a/flang/include/flang/Common/format.h b/flang/include/flang/Common/format.h
index 60bcc8e81..8597c709d 100644
--- a/flang/include/flang/Common/format.h
+++ b/flang/include/flang/Common/format.h
@@ -114,7 +114,8 @@ struct FormatMessage {
// This declaration is logically private to class FormatValidator.
// It is placed here to work around a clang compilation problem.
ENUM_CLASS(TokenKind, None, A, B, BN, BZ, D, DC, DP, DT, E, EN, ES, EX, F, G, I,
- L, LZ, LZP, LZS, O, P, RC, RD, RN, RP, RU, RZ, S, SP, SS, T, TL, TR, X, Z, Colon, Slash,
+ L, LZ, LZP, LZS, O, P, RC, RD, RN, RP, RU, RZ, S, SP, SS, T, TL, TR, X, Z,
+ Colon, Slash,
Backslash, // nonstandard: inhibit newline on output
Dollar, // nonstandard: inhibit newline on output on terminals
Star, LParen, RParen, Comma, Point, Sign,
diff --git a/flang/lib/Parser/io-parsers.cpp b/flang/lib/Parser/io-parsers.cpp
index 9da8c4f01..93aa4e9d2 100644
--- a/flang/lib/Parser/io-parsers.cpp
+++ b/flang/lib/Parser/io-parsers.cpp
@@ -680,10 +680,10 @@ TYPE_PARSER(construct<format::ControlEditDesc>(
pure(format::ControlEditDesc::Kind::BZ))) ||
"L " >> ("Z " >> ("S " >> construct<format::ControlEditDesc>(
pure(format::ControlEditDesc::Kind::LZS)) ||
- "P " >> construct<format::ControlEditDesc>(
- pure(format::ControlEditDesc::Kind::LZP)) ||
- construct<format::ControlEditDesc>(
- pure(format::ControlEditDesc::Kind::LZ)))) ||
+ "P " >> construct<format::ControlEditDesc>(pure(
+ format::ControlEditDesc::Kind::LZP)) ||
+ construct<format::ControlEditDesc>(
+ pure(format::ControlEditDesc::Kind::LZ)))) ||
"R " >> ("U " >> construct<format::ControlEditDesc>(
pure(format::ControlEditDesc::Kind::RU)) ||
"D " >> construct<format::ControlEditDesc>(
``````````
</details>
https://github.com/llvm/llvm-project/pull/183500
More information about the flang-commits
mailing list