Skip to content

WARNING pragma - #452

Open
lwaern-intel wants to merge 4 commits into
intel:mainfrom
lwaern-intel:lw/enable-werror
Open

WARNING pragma#452
lwaern-intel wants to merge 4 commits into
intel:mainfrom
lwaern-intel:lw/enable-werror

Conversation

@lwaern-intel

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread RELEASENOTES.md Outdated
- `note 6` Warning and error messages reported by DMLC now display the tag for
the warning/error kind by default. The old behavior of having the tag
be omitted now requires passing `--no-tags` to DMLC. With this change, the
`-T` flag has become a no-op and will be removed in a future version. No newline at end of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping -T around is a spitball on my part; I'm interested in your opinion. Also instead of vaguely saying "a future version" we could tie it to the specified --simics-api and not accept -T when used with API version 8 or above.

Comment thread doc/1.4/language.md
/*% WARNING WREDUNDANTLEVEL %*/
/*% WARNING WNEGCONSTCOMP %*/
log info, 1 then then_level: "%s", i == special ? "special" : "regular";
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You have no idea how difficult it was to concoct a semi-realistic case where applying a WARNING pragma twice on the same line would be warranted. We don't have enough warning kinds ;)

Comment thread py/dml/dmlc.py
# the <tt>-\-nowarn</tt> and <tt>-\-warn</tt> options.</dd>
# <dt>-\-no-tags</dt>
# <dd>Disables showing the tag associated with each error or warning
# message.</dd>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should we even bother?

Comment thread py/dml/dmlparse.py Outdated
+ "warning, specify "
+ "'provisional simics_util_vect;' at "
+ "the top of the file, after"
+ 'dml 1.4;'))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this as I was concerned about the novel WARNING pragma being used instead of the much more preferable option to leverage provisional simics_util_vect;

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds granular DML 1.4 WARNING pragmas, line-based suppression, and diagnostic-tag updates.

Changes:

  • Adds warning parsing, validation, suppression, and tests.
  • Refactors shared pragma and cached-AST handling.
  • Updates CLI behavior, documentation, and release notes.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Summary
test/1.4/pragmas/T_WARNING.dml Tests warning suppression.
test/1.4/errors/T_EWARNING.dml Tests invalid warning tags.
RELEASENOTES.md Documents pragma and tag changes.
py/dml/toplevel.py Parses and processes pragmas. Critical: legacy .dmlast pragma tuples can cause an unpacking failure.
py/dml/output.py Applies Coverity pragmas.
py/dml/messages.py Adds invalid-tag diagnostics.
py/dml/logging.py Implements line-based warning suppression. Nit: rename the misspelled occurence helper.
py/dml/globals.py Stores line-based pragmas.
py/dml/dmlparse.py Expands vect warning guidance. Nit: add the missing space in after dml.
py/dml/dmlc.py Updates diagnostic-tag options. Moderate: --no-tags does not disable tags.
doc/1.4/language.md Documents WARNING pragmas. Nit: correct subject–verb agreement.
Suppressed comments (2)

py/dml/dmlc.py:372

  • The command-line reference still documents -T as the switch that enables tags and does not document the new --no-tags option. Since this hunk makes -T a no-op, update doc/1.4/running-dmlc.md (and any generated copy) so users are not directed to an obsolete behavior.
    # <dt>-\-no-tags</dt>
    # <dd>Disables showing the tag associated with each error or warning
    # message.</dd>
    parser.add_argument(
        '--no-tags', dest='include_tag', action='store_false',
        help='disable tags on error and warning messages')

py/dml/toplevel.py:245

  • produce_dmlast() stores the result of parse_pragmas() but does not call process_pragma() before parsing or saving the AST. Consequently, an invalid WARNING tag is accepted while generating a .dmlast cache (and any parse-time warning is not suppressed), whereas direct source parsing reports/handles it. Validate and register the pragmas during cache production as well, before parse().
    return (pragma, filename, start_lineno, end_lineno + 1, data)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread doc/1.4/language.md Outdated
Comment thread py/dml/dmlc.py
Comment thread py/dml/dmlparse.py Outdated
Comment thread py/dml/logging.py Outdated
Comment thread py/dml/toplevel.py
@syssimics

Copy link
Copy Markdown
Contributor

PR Verification: ❌ failure

@syssimics

Copy link
Copy Markdown
Contributor

PR Verification: ❌ failure

@lwaern-intel

Copy link
Copy Markdown
Contributor Author

Verification failure is unrelated.

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.

3 participants