New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relax the implementation of constraint C1302. #805
Conversation
When a format item list can be unambiguously partitioned into individual items even though one or more otherwise required comma separators are omitted, generate a warning rather than an error.
When a format item list can be unambiguously partitioned into individual items even though one or more otherwise required comma separators are omitted, generate a warning rather than an error. Fixes #703
lib/common/format.h
Outdated
@@ -102,6 +102,30 @@ template<typename CHAR = char> class FormatValidator { | |||
String, // char-literal-constant or Hollerith constant | |||
}; | |||
|
|||
bool mayHaveLeadingInt(TokenKind desc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically a set membership test; consider using EnumSet
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is. Doesn't EnumSet bring C++ library requirements with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether a dependence on the binary C++ runtime support library is created probably depends on what parts of EnumSet
one uses. I think you have a chance to just depend on things that are implemented in the standard headers in this case.
lib/common/format.h
Outdated
@@ -102,6 +102,30 @@ template<typename CHAR = char> class FormatValidator { | |||
String, // char-literal-constant or Hollerith constant | |||
}; | |||
|
|||
bool mayHaveLeadingInt(TokenKind desc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This member function should be marked static
or (better, if possible) static constexpr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything builds, tests, and looks correct to me.
Conflicts: lib/common/format.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I can still build this with g++ and link it to a C program without libstdc++.
* Relax the implementation of constraint C1302. When a list of format items can be unambiguously partitioned into individual items even though one or more otherwise required comma separators are omitted, generate a warning rather than an error. Fixes flang-compiler#703
…/f18#805) * Relax the implementation of constraint C1302. When a list of format items can be unambiguously partitioned into individual items even though one or more otherwise required comma separators are omitted, generate a warning rather than an error. Fixes flang-compiler/f18#703 Original-commit: flang-compiler/f18@79c0731 Reviewed-on: flang-compiler/f18#805
…/f18#805) * Relax the implementation of constraint C1302. When a list of format items can be unambiguously partitioned into individual items even though one or more otherwise required comma separators are omitted, generate a warning rather than an error. Fixes flang-compiler/f18#703 Original-commit: flang-compiler/f18@79c0731 Reviewed-on: flang-compiler/f18#805
When a format item list can be unambiguously partitioned into individual
items even though one or more otherwise required comma separators are omitted,
generate a warning rather than an error.