As Fortran 2018 5.2.2 states, a program shall consist of exactly one
main program. Add this semantic check.
Details
Diff Detail
Event Timeline
flang/lib/Semantics/resolve-names.cpp | ||
---|---|---|
7217 | Don't use "unsigned" when "int" suffices. Please use braced initialization, not "="; it's safer. Please reference the applicable point in the Fortran standard that establishes this restriction (subclause 5.2.2) There are probably better places for this check than resolve-names.cpp -- the file is already too large and this kind of error checking is not its purpose. You could put it in the program tree constructor, or (best) in check-declarations.cpp, which is where one would expect to find it. The phrase "source file" would perhaps be more clear to the user than "program" in the error message. |
Thanks for @klausler 's comments. Doing this in check-declarations.cpp is better. Addressed the comments.
flang/lib/Semantics/check-declarations.cpp | ||
---|---|---|
1719 ↗ | (On Diff #427942) | In C++ it is best to use the prefix forms of ++ and --. It matters for many iterator types, so it's a good habit to get into. The postfix forms of ++ and -- should be used only in the context of an expression that really depends on using the "old" value of the variable. |
1721 ↗ | (On Diff #427942) | Please check that this message is associated with the right source code location. |
Don't use "unsigned" when "int" suffices.
Please use braced initialization, not "="; it's safer.
Please reference the applicable point in the Fortran standard that establishes this restriction (subclause 5.2.2)
There are probably better places for this check than resolve-names.cpp -- the file is already too large and this kind of error checking is not its purpose. You could put it in the program tree constructor, or (best) in check-declarations.cpp, which is where one would expect to find it.
The phrase "source file" would perhaps be more clear to the user than "program" in the error message.