-
Notifications
You must be signed in to change notification settings - Fork 446
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
Unify debug / user-side node stringification #4698
Comments
testdata/p4_16_samples_outputs/array_field.p4-stderr is a great example where we produce something internal in the warnings which might be confusing to users |
So, things are a bit messy and it manifests in different weird ways (see e.g. #4825 (comment)) In fact, we are having multiple ways to "print something" inside p4c:
User-side error reporting relies on
I am proposing the following refactoring:
This will break logger, but it seems it could be solved via creating our own logger stream and providing proper |
Seems good to me. Iirc, |
Right. In same cases (e.g. for |
btw. there is more related mess with Another problem is in use of these operators in constructs like |
Yes, exactly. .. and few other smallish cases here and there. |
It would be useful to have something like log_stream<Str> operator<<(Str &, EnterLogStreamType); so that one can enable logging into GTest asserts like this: ASSERT_EQ(...) << P4::enterLogStream() << node; This should all be well defined and findable by ADL. |
Oh, right, I completely forgot about that gtest feature with custom fail messages! |
we probably want another DBPrint flag here to disable the printing of mangled names/only print origName as we're using this for
toString
which is user facing. Improvement unrelated to this change really.Originally posted by @ChrisDodd in #4686 (comment)
The text was updated successfully, but these errors were encountered: