Skip to content

Fix unsafe comment - #562

Merged
apcraig merged 1 commit into
CICE-Consortium:mainfrom
E3SM-Project:jgfouca/remove_unsafe_comment
Jul 9, 2026
Merged

Fix unsafe comment#562
apcraig merged 1 commit into
CICE-Consortium:mainfrom
E3SM-Project:jgfouca/remove_unsafe_comment

Conversation

@jgfouca

@jgfouca jgfouca commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Having a comment that ends in \ is not portable across different build systems due to the order and manner in which preprocessing is done. In some cases, like when using ninja, the \ can be interpreted as a line continuation which can silently remove the following line of code.

In this case, the line trndir(k+1) = trndir(k)*trnlay(k) was being commented out in the preprocessed file, leading to a very subtle runtime difference in results that took days to track down.

For detailed information about submitting Pull Requests (PRs) to the CICE-Consortium,
please refer to: https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers

PR checklist

  • Short (1 sentence) summary of your PR:
    Fix unsafe comment with trailing \
  • Developer(s):
    @jgfouca
  • Suggest PR reviewers from list in the column to the right.
  • Please copy the PR test results link or provide a summary of testing completed below.
    Only changes a comment, no testing should be necessary
  • How much do the PR code changes differ from the unmodified code?
    • bit for bit
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on CICE or any other models?
    • Yes
    • No
  • Does this PR add any new test cases?
    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/.)
    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please document the changes in detail, including why the changes are made. This will become part of the PR commit log.

Having a comment that ends in \ is not portable across different build systems
due to the order and manner in which preprocessing is done. In some cases,
like when using ninja, the \ can be interpreted as a line continuation which
can silently remove the following line of code.

@apcraig apcraig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to implement this change, thanks @jgfouca.

@apcraig
apcraig merged commit ad89637 into CICE-Consortium:main Jul 9, 2026
2 checks passed
@jgfouca
jgfouca deleted the jgfouca/remove_unsafe_comment branch July 10, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants