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

Fix the option to pipe stdin to the compiler. #4367

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Jan 26, 2024

This option was never working because - was interpreted as a flag parameter. This little change fixes that. Now it is possible to directly pipe a program to the compiler instead of reading a file.

Open to suggestions on how to improve this option. The parser options in general are old and quite messy.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Jan 26, 2024
@smolkaj
Copy link
Member

smolkaj commented Jan 27, 2024

What would be a concrete example of a command that didn't work before but works now?

@fruffy
Copy link
Collaborator Author

fruffy commented Jan 27, 2024

What would be a concrete example of a command that didn't work before but works now?

Before:

echo "control dummy();" | p4c/build/p4test -
[--Werror=unknown] error: Unknown option -                                                                 

After:

echo "control dummy();" | p4c/build/p4test -
[--Wwarn=missing] warning: Program does not contain a `main' module

@smolkaj
Copy link
Member

smolkaj commented Jan 27, 2024

Thanks, I understand better now.
Perhaps worth adding a quick comment in the code about it?

Copy link
Member

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

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

Sweet!

Copy link
Contributor

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

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

LGTM

@fruffy fruffy enabled auto-merge (squash) January 29, 2024 16:44
@fruffy fruffy merged commit e52b226 into main Jan 29, 2024
16 checks passed
@fruffy fruffy deleted the fruffy/fix_stdin branch January 29, 2024 17:23
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants