-
Notifications
You must be signed in to change notification settings - Fork 455
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
[#5152] Write preprocessed P4 to repro.p4
file when -P
option is provided
#5153
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Kyle Cripps <[email protected]>
Not sure why the output should be named
|
Sure, that sounds reasonable to me. |
Isn't there already a |
@ChrisDodd Yes, but the compiler exits immediately after doing so - the purpose of this option is to be able to save the preprocessed P4 and continue with compilation instead of exiting. |
Not sure if it matters, but the existing Tofino implementation names this file as |
The other thing I'd strongly recommend if you want to do it in the frontend: sanitize the preprocessed file by not including the standard system includes (i.e. This will allow to reproduce old issues much easier or notice compatibility issues whenever you change your arch files. Believe me, you'd like you did it. |
Giving the generated preprocessed file a
I currently have no strong motivation to do that, but I am not opposed if someone else wants to add an option to do that in the future. |
My opinion is that I have no strong opinion about leaving system includes, although having it configurable (maybe with default being "leaving" |
newName += baseSuffix; | ||
newName += name.extension(); | ||
if (savePreprocessed) { | ||
std::filesystem::path fileName = makeFileName(dumpFolder, "repro.p4", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that using <program_name>.p4pp
would be better, compared to having a fairly arbitrary fixed name.
@@ -81,6 +81,8 @@ class ParserOptions : public Util::Options { | |||
std::filesystem::path file; | |||
/// if true preprocess only | |||
bool doNotCompile = false; | |||
/// if true save preprocessed P4 to repro.p4 | |||
bool savePreprocessed = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you decide to address my first comment, then, obviously, this comment needs to be changed too.
Closes #5152.
Marking as draft until we decide:
-P
(for "Preprocessed") for now, but @asl also suggested--save-temps
.repro.p4
(short for "reproducer"), but maybe there is a better name.