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

RemoveUnusedDeclarations: inconsistency in when warnings are produced #4439

Closed
grg opened this issue Feb 20, 2024 · 1 comment
Closed

RemoveUnusedDeclarations: inconsistency in when warnings are produced #4439

grg opened this issue Feb 20, 2024 · 1 comment
Labels
bug This behavior is unintended and should be fixed. core Topics concerning the core segments of the compiler (frontend, midend, parser)

Comments

@grg
Copy link
Contributor

grg commented Feb 20, 2024

RemovedUnusedDeclarations will remove unused P4Control, P4Parser, and P4Table objects.

When it removes a P4Table object, it produces a warning with:

        if (giveWarning(getOriginal()))
            warn(ErrorType::WARN_UNUSED, "Table %1% is not used; removing", table);

But when it removes P4Control/P4Parser objects, it silently removes them without reporting a warning.

Is there a reason why warnings are not reported for P4Control/P4Parser objects? If not, I would like to add similar warnings for those two objet types.

grg added a commit that referenced this issue Feb 20, 2024
Add warnings for unused P4Control and P4Parser objects to match P4Table
warnings. Addresses issue #4439.
grg added a commit that referenced this issue Feb 21, 2024
Add warnings for unused P4Control and P4Parser objects to match P4Table
warnings. Addresses issue #4439.
@fruffy fruffy added bug This behavior is unintended and should be fixed. core Topics concerning the core segments of the compiler (frontend, midend, parser) labels Feb 24, 2024
github-merge-queue bot pushed a commit that referenced this issue Mar 3, 2024
* warn on unused controls/parsers

Add warnings for unused P4Control and P4Parser objects to match P4Table
warnings. Addresses issue #4439.

* remove redundant control/parser

Call externalName() to get the control/parser block name without
"control"/"parser" prepended to the front.

* update expected test output
@grg
Copy link
Contributor Author

grg commented Mar 4, 2024

Closing as fixed. Merged #4440. (No objections here or in 4440.)

@grg grg closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed. core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

No branches or pull requests

2 participants