Skip to content

Commit

Permalink
Add optional attribute to varaible declarations in caps
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Jan 30, 2024
1 parent 224fad3 commit aa652cd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/metavar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ def write_def(self, outfile, indent, wdict, allocatable=False,
raise CCPPError(errmsg.format(name))
# end if
# end if
optional = self.get_prop_value('optional')
if protected and dummy:
intent_str = 'intent(in) '
elif allocatable:
Expand All @@ -1091,6 +1092,9 @@ def write_def(self, outfile, indent, wdict, allocatable=False,
alloval = self.get_prop_value('allocatable')
if (intent.lower()[-3:] == 'out') and alloval:
intent_str = f"allocatable, intent({intent})"
elif optional:
intent_str = f"intent({intent}),{' '*(5 - len(intent))}"
intent_str += 'optional '
else:
intent_str = f"intent({intent}){' '*(5 - len(intent))}"
# end if
Expand Down

0 comments on commit aa652cd

Please sign in to comment.