-
Notifications
You must be signed in to change notification settings - Fork 65
Check Fortran imports to locate unknown DDT #684
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
Conversation
Added UseStatement type, test for unknown DDT Add space between --verbose inputs Check for imported type before raising an invalid Fortran type error
|
Alternative to #673 |
| else: | ||
| scheme_args = list() | ||
| # End if | ||
| # end if |
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.
Given that the changes in this file are mostly unrelated to this PR, I am wondering if we should do one pass of the codebase to convert all these "end block" comments to lowercase in its own PR.
| emsg = "{}: {}" | ||
| raise ParseSyntaxError(emsg.format(lname, cperr), | ||
| context=self.context) from cperr | ||
| # Raise this error unless it represents an imported DDT type |
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.
Do I understand correctly that this will allow us to import DDTs from some other module if we use
use mpi_f08, only : mpi_comm
but it will still fail if we do
use mpi_f08
?
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.
my understanding is that
use mpi_f08
is still allowed, but if you're trying to do something like:
use ddt_library
type(ty_ddt_from_ddt_library) :: ddt_from_ddt_library
you'll get a parsing error because the framework has no way of knowing if "ty_ddt_from_ddt_library" is defined within "ddt_library"
peverwhee
left a comment
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.
one small request
| emsg = "{}: {}" | ||
| raise ParseSyntaxError(emsg.format(lname, cperr), | ||
| context=self.context) from cperr | ||
| # Raise this error unless it represents an imported DDT type |
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.
my understanding is that
use mpi_f08
is still allowed, but if you're trying to do something like:
use ddt_library
type(ty_ddt_from_ddt_library) :: ddt_from_ddt_library
you'll get a parsing error because the framework has no way of knowing if "ty_ddt_from_ddt_library" is defined within "ddt_library"
|
I am wondering if a different approach altogether would be better, not just but also given the limitations that we can't use In the metadata header for a scheme: |
This could be an additional method for models that allow naked |
I would be ok with requiring this, but I didn't expect CESM/CAM to be on board with that. Some models end up with long use statements, though. Real world example: |
Some times the long statements are a pain but in CAM, another SHOULD rule (see the same link) tries to help: "use statements should be brought in at the smallest scope possible (e.g. inside individual subroutines instead of at the module level)". |
Not possible in this case, unfortunately. Support for Fortran submodules is limited with certain compilers. |
|
Coming back to this, if we decide that we require named |
|
@mkavulich @climbfuji can this be merged or do we need to update the documentation first? |
mkavulich
left a comment
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.
I'll go ahead and merge this PR...the documentation/rule changes will need some more discussion (i.e. I'll need help from more knowledgeable people) since, from a brief review of the ccpp-physics code, there are many examples of these bare use statements, not just use mpi_f08.
User interface changes?: No
Testing:
vmr_typein capgen_test.