Skip to content
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

makedep: Support externals alongside program units #479

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

marshallward
Copy link
Member

The current version of makedep uses the existence of program units (module or program) to determine whether a file contains globally accessible external functions. It incorrectly ignores files with externals it happens to contain both externals and a program unit.

We resolve this by tracking whether we are inside or outside of a program unit while parsing each line. We ignore keywords which may appear in comments, as well as tokens which may contain function or subroutine as substrings. This method is not perfect; there are cases which will incorrectly report entering a block, but this method appears sufficient for all of our known codebases.

This issue was detected when attempting to parse the AM2 source. While still far from a general solution, it is sufficient to handle a few of the more challenging cases encountered in AM2.

The current version of makedep uses the existence of program units
(module or program) to determine whether a file contains globally
accessible external functions.  It incorrectly ignores files with
externals it happens to contain both externals and a program unit.

We resolve this by tracking whether we are inside or outside of a
program unit while parsing each line.  We ignore keywords which may
appear in comments, as well as tokens which may contain `function` or
`subroutine` as substrings.  This method is not perfect; there are cases
which will incorrectly report entering a block, but this method appears
sufficient for all of our known codebases.

This issue was detected when attempting to parse the AM2 source.  While
still far from a general solution, it is sufficient to handle a few of
the more challenging cases encountered in AM2.
@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #479 (edcda6f) into dev/gfdl (9de6ce7) will not change coverage.
The diff coverage is n/a.

❗ Current head edcda6f differs from pull request most recent head 2f1a100. Consider uploading reports for the commit 2f1a100 to get more accurate results

@@            Coverage Diff            @@
##           dev/gfdl     #479   +/-   ##
=========================================
  Coverage     38.01%   38.01%           
=========================================
  Files           270      270           
  Lines         77771    77771           
  Branches      14323    14323           
=========================================
  Hits          29566    29566           
  Misses        42878    42878           
  Partials       5327     5327           

see 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@marshallward
Copy link
Member Author

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/20588 ✔️

@marshallward marshallward merged commit 25b57f4 into NOAA-GFDL:dev/gfdl Sep 11, 2023
10 checks passed
@marshallward marshallward deleted the makedep_ext_with_prog branch May 8, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants