8000 [core] Try out a boost::format replacement. by fruffy · Pull Request #5234 · p4lang/p4c · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[core] Try out a boost::format replacement. #5234

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

fruffy
Copy link
Collaborator
@fruffy fruffy commented Apr 12, 2025

No description provided.

Signed-off-by: fruffy <fruffy@nyu.edu>
@github-actions github-actions bot added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Apr 12, 2025
@fruffy fruffy force-pushed the fruffy/boost_format branch from f974dc3 to 5e2c1f2 Compare April 12, 2025 19:26
@fruffy fruffy added the run-sanitizer Use this tag to run a Clang+Sanitzers CI run. label Apr 12, 2025
@fruffy fruffy force-pushed the fruffy/boost_format branch from 5e2c1f2 to ad0acb0 Compare April 12, 2025 19:35
Signed-off-by: fruffy <fruffy@nyu.edu>
@@ -77,7 +77,7 @@ int parseConstantChecked(const Util::SourceInfo &srcInfo, const UnparsedConstant
auto cst = parseConstant(srcInfo, constant, 0);
if (!cst->fitsInt()) {
::P4::error(ErrorType::ERR_OVERLIMIT,
"%1$x: this implementation does not support bitstrings this large", cst);
"%1%: this implementation does not support bitstrings this large", cst);
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes from printing the bitstring a hex to printing it as decimal, which seems less useful. Is there a way to have boost::formatter print in hex?

Copy link
Collaborator Author
@fruffy fruffy Apr 13, 2025

Choose a reason for hiding this comment

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

%x should give hex printing if using the abseil formatter. Not quite clear how to migrate smoothly here...

The problem here in particular is that cst is a IR::Constant pointer and the operator<< for it doesn't generate hex. And, according to the reference files, this output already generated decimal format: https://github.com/p4lang/p4c/blob/main/testdata/p4_16_errors_outputs/width_e.p4-stderr#L1

@fruffy fruffy force-pushed the fruffy/boost_format branch from ad0acb0 to a961fbf Compare April 13, 2025 12:04
@fruffy fruffy added p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run. run-ubuntu18 Use this tag to trigger a Ubuntu-18 CI run. run-validation Use this tag to trigger a Validation CI run. run-static Use this tag to trigger static build CI run. labels Apr 13, 2025
@fruffy fruffy force-pushed the fruffy/boost_format branch from a961fbf to 8a65ab7 Compare April 13, 2025 13:48
@fruffy fruffy changed the title [core] Try out an exception formatter replacement. [core] Try out a boost::format replacement. Apr 13, 2025
@fruffy fruffy force-pushed the fruffy/boost_format branch from 8a65ab7 to a1c3278 Compare April 13, 2025 14:08
Signed-off-by: fruffy <fruffy@nyu.edu>
@fruffy fruffy force-pushed the fruffy/boost_format branch from a1c3278 to 221f1eb Compare April 13, 2025 18:19
Signed-off-by: fruffy <fruffy@nyu.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser) p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run. run-sanitizer Use this tag to run a Clang+Sanitzers CI run. run-static Use this tag to trigger static build CI run. run-ubuntu18 Use this tag to trigger a Ubuntu-18 CI run. run-validation Use this tag to trigger a Validation CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0