Skip to content

Avoid false Fortran dependencies in comments - #4942

Merged
bdbaddog merged 3 commits into
SCons:masterfrom
Boulea7:fix-fortran-comment-dependencies-4454
Oct 28, 2026
Merged

bdbaddog merged 3 commits into
SCons:masterfrom
Boulea7:fix-fortran-comment-dependencies-4454

Conversation

@Boulea7

@Boulea7 Boulea7 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Refs #4454

Ignore USE and INCLUDE text inside ! comments so changes to commented-out dependencies no longer trigger a rebuild. Preserve quoted include paths and continued character literals while retaining module filtering and cached dependencies.

The scanner still cannot reliably distinguish fixed and free source forms. A possible fixed-form continuation marker in column 6 is preserved, so the column-6 ! ambiguity remains.

Validation: python runtest.py SCons/Scanner/FortranTests.py test/Fortran/scan-comments.py passes (24 unit tests and the incremental rebuild regression). The rebuild regression fails on the unmodified scanner. Compiler-backed Fortran tests and ruff were not run locally because neither is installed.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation (scanner limitations and release notes).

Assisted-by: OpenAI Codex (GPT-6.1)

Refs SCons#4454

Assisted-by: OpenAI Codex (GPT-6.1)
Signed-off-by: boulea7 <zln1905391059@163.com>
Keep synthetic output byte-for-byte on Windows, where text writes
translate LF to CRLF and fail binary content checks.

Refs SCons#4454

Assisted-by: OpenAI Codex (GPT-6.1)
Signed-off-by: boulea7 <zln1905391059@163.com>
@mwichmann

Copy link
Copy Markdown
Collaborator

This seems to be about #4454

@mwichmann mwichmann added the Fortran Fortran support issues label Oct 27, 2026
The scanner ran its USE and MODULE regexes over the raw source, so a
literal such as PRINT *, 'x; USE foo' produced a false dependency on
foo.mod. _strip_comments() can now mask the contents of character
literals. USE and MODULE are matched against the masked text, while
INCLUDE still uses the literal contents for its quoted filenames.

The masked pass is skipped when the stripped text has no quote
characters, since masking would change nothing. A fixed-form C, c or *
comment line inside a continued literal is now dropped instead of being
kept raw.

Refs SCons#4454

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@bdbaddog

Copy link
Copy Markdown
Contributor

claude found a few more corner cases and suggested knocking this one off.

@bdbaddog
bdbaddog merged commit 1532535 into SCons:master Oct 28, 2026
12 checks passed
@mwichmann mwichmann added this to the NextRelease milestone Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fortran Fortran support issues

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants