mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 13:26:09 +00:00
[flang] Address review comments. Add note to style guide condemning if((x=y)).
Original-commit: flang-compiler/f18@4ca8b8e514 Reviewed-on: https://github.com/flang-compiler/f18/pull/25 Tree-same-pre-rewrite: false
This commit is contained in:
parent
46c3538c7a
commit
b28ea527b4
@ -85,6 +85,9 @@ an `if` that doesn't have a following `else`.
|
|||||||
Don't waste space on the screen with needless blank lines or elaborate block
|
Don't waste space on the screen with needless blank lines or elaborate block
|
||||||
commentary (lines of dashes, boxes of asterisks, &c.). Write code so as to be
|
commentary (lines of dashes, boxes of asterisks, &c.). Write code so as to be
|
||||||
easily read and understood with a minimum of scrolling.
|
easily read and understood with a minimum of scrolling.
|
||||||
|
|
||||||
|
Avoid using assignments in controlling expressions of `if()` &c., even with
|
||||||
|
the idiom of wrapping them with extra parentheses.
|
||||||
### C++ language
|
### C++ language
|
||||||
Use *C++17*, unless some compiler to which we must be portable lacks a feature
|
Use *C++17*, unless some compiler to which we must be portable lacks a feature
|
||||||
you are considering.
|
you are considering.
|
||||||
|
@ -379,19 +379,19 @@ struct HollerithLiteral {
|
|||||||
int bytes{1};
|
int bytes{1};
|
||||||
const char *p{state->GetLocation()};
|
const char *p{state->GetLocation()};
|
||||||
if (state->encoding() == Encoding::EUC_JP) {
|
if (state->encoding() == Encoding::EUC_JP) {
|
||||||
if (std::optional<int> chBytes{EUC_JPCharacterBytes(p)}) {
|
std::optional<int> chBytes{EUC_JPCharacterBytes(p)};
|
||||||
bytes = *chBytes;
|
if (!chBytes.has_value()) {
|
||||||
} else {
|
|
||||||
state->PutMessage(at, "bad EUC_JP characters in Hollerith"_en_US);
|
state->PutMessage(at, "bad EUC_JP characters in Hollerith"_en_US);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
bytes = *chBytes;
|
||||||
} else if (state->encoding() == Encoding::UTF8) {
|
} else if (state->encoding() == Encoding::UTF8) {
|
||||||
if (std::optional<int> chBytes{UTF8CharacterBytes(p)}) {
|
std::optional<int> chBytes{UTF8CharacterBytes(p)};
|
||||||
bytes = *chBytes;
|
if (!chBytes.has_value()) {
|
||||||
} else {
|
|
||||||
state->PutMessage(at, "bad UTF-8 characters in Hollerith"_en_US);
|
state->PutMessage(at, "bad UTF-8 characters in Hollerith"_en_US);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
bytes = *chBytes;
|
||||||
}
|
}
|
||||||
if (bytes == 1) {
|
if (bytes == 1) {
|
||||||
std::optional<char> ch{nextChar.Parse(state)};
|
std::optional<char> ch{nextChar.Parse(state)};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user