Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jul 19, 2023

This is an automatic backport of pull request #3414 done by Mergify.
Cherry-pick of 8e33a68 has failed:

On branch mergify/bp/3.6.x/pr-3414
Your branch is up to date with 'origin/3.6.x'.

You are currently cherry-picking commit 8e33a68b6.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   core/src/main/scala/chisel3/ChiselEnum.scala
	modified:   core/src/main/scala/chisel3/experimental/SourceInfo.scala
	modified:   core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
	modified:   core/src/main/scala/chisel3/internal/Builder.scala
	modified:   core/src/main/scala/chisel3/internal/Error.scala
	new file:   core/src/main/scala/chisel3/internal/Warning.scala
	modified:   core/src/main/scala/chisel3/internal/firrtl/Converter.scala
	new file:   docs/src/explanations/warnings.md
	modified:   src/main/scala/chisel3/aop/injecting/InjectingAspect.scala
	modified:   src/main/scala/chisel3/stage/ChiselOptions.scala
	modified:   src/main/scala/chisel3/stage/phases/Elaborate.scala
	modified:   src/test/scala/chisel3/testers/TestUtils.scala
	new file:   src/test/scala/chiselTests/stage/WarningConfigurationSpec.scala

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   core/src/main/scala/chisel3/Aggregate.scala
	both modified:   core/src/main/scala/chisel3/Bits.scala
	both modified:   core/src/main/scala/chisel3/internal/package.scala
	both modified:   docs/src/explanations/explanations.md
	both modified:   src/main/scala/chisel3/stage/ChiselAnnotations.scala
	both modified:   src/main/scala/chisel3/stage/package.scala
	both modified:   src/main/scala/circt/stage/ChiselStage.scala
	deleted by us:   src/test/scala/chiselTests/ConstSpec.scala
	deleted by us:   src/test/scala/chiselTests/ProbeSpec.scala
	both modified:   website/docs/src/main/resources/microsite/data/menu.yml

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com


Original PR Body

Currently opened as a draft but I would like to get the ball rolling on this.

This is heavily inspired by configurable warnings in Scala, but is a little more limited.

TODO

  • Audit warning numbering (want to backport to 3.6, so make sure warnings existing there are first in order)
  • Add warning number to warning messages
  • Make new warnings more clear that they are deprecations I'm going to do this in a follow on PR
  • Write a docs page
  • Write release notes
  • Add support for --warn-conf-file which is the same syntax but with \n separated pairs in a file rather than , separated pairs in a String.
  • Add tests mixing --warn-conf-file with --warn-conf

The commit text gives a pretty good overview:

Add support for configurable warnings

Warnings have been assigned unique integers to use as identifiers for
purposes of documentation and configuration.

New CLI option --warn-conf accepts a comma-separated sequence of
<filter>:<action> pairs for customizing warnings.

Supported filters are:
* any          - matches all warnings
* id=<integer> - matches warnings with the integer id
* src=<glob>   - matches warnings where <glob> matches the warning
                 source file

id and src filters can be combined with &.

Supported actions are:
* :s - suppress the warning
* :w - report the warning as a warning (default behavior)
* :e - error on the warning

For example, the new Vec dynamic width matching warning can be
suppressed for source files in src/main/scala while all other warnings
elevated to errors with:
  --warn-conf "id=4&src=src/main/scala/**:s,any:e"

The is also --warn-conf-file which works similarly to --warn-conf except
the <filter>:<action> pairs are newline separated in a file. # is used
for line comments.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Feature (or new API)

Desired Merge Strategy

  • Squash

Release Notes

Add support for configurable warnings, see https://www.chisel-lang.org/chisel3/docs/explanations/warnings.html

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.5.x, 3.6.x, or 5.x depending on impact, API modification or big change: 6.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash), clean up the commit message, and label with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

Warnings have been assigned unique integers to use as identifiers for
purposes of documentation and configuration.

New CLI option --warn-conf accepts a comma-separated sequence of
<filter>:<action> pairs for customizing warnings.

Supported filters are:
* any          - matches all warnings
* id=<integer> - matches warnings with the integer id
* src=<glob>   - matches warnings where <glob> matches the warning
                 source file

id and src filters can be combined with &.

Supported actions are:
* :s - suppress the warning
* :w - report the warning as a warning (default behavior)
* :e - error on the warning

For example, the new Vec dynamic width matching warning can be
suppressed for source files in src/main/scala while all other warnings
elevated to errors with:
  --warn-conf "id=4&src=src/main/scala/**:s,any:e"

The is also --warn-conf-file which works similarly to --warn-conf except
the <filter>:<action> pairs are newline separated in a file. # is used
for line comments.

(cherry picked from commit 8e33a68)

# Conflicts:
#	core/src/main/scala/chisel3/Aggregate.scala
#	core/src/main/scala/chisel3/Bits.scala
#	core/src/main/scala/chisel3/internal/package.scala
#	docs/src/explanations/explanations.md
#	src/main/scala/chisel3/stage/ChiselAnnotations.scala
#	src/main/scala/chisel3/stage/package.scala
#	src/main/scala/circt/stage/ChiselStage.scala
#	src/test/scala/chiselTests/ConstSpec.scala
#	src/test/scala/chiselTests/ProbeSpec.scala
#	website/docs/src/main/resources/microsite/data/menu.yml
@mergify mergify bot added Backport Automated backport, please consider for minor release bp-conflict labels Jul 19, 2023
@github-actions github-actions bot added the Feature New feature, will be included in release notes label Jul 19, 2023
Also make code compile with Scala 2.12
@jackkoenig
Copy link
Contributor

jackkoenig commented Apr 25, 2024

If we ever merge this, include the typo fix in #4029

Nevermind, that warning doesn't exist in 3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport Automated backport, please consider for minor release Feature New feature, will be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants