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

fixed/shorted-use(fix #5176) #5223

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AkarshSahlot
Copy link
Contributor

Right now, when we type a wrong command like p4c --wrong-option, the program shows a huge help message with all options. We want to make it show just a short error message that tells you to use --help.

changes needed that I have done:
Added a new function shortUser that shows a short error message (instead of the long help previous message error).
I Replaced all locations where usage() is called on errors with this new shortUser() message.
Fixes #5176

AkarshSahlot and others added 3 commits April 6, 2025 07:00
Signed-off-by: Akarsh Sahlot <akarshsahlot7@gmail.com>
Signed-off-by: Akarsh Sahlot <122122123+AkarshSahlot@users.noreply.github.com>
@AkarshSahlot
Copy link
Contributor Author

AkarshSahlot commented Apr 6, 2025

I tried to run cmake to build the updated compiler, for its building since day before yesterday,
same thing happened with tofino ,
I have tried implementing many other commands but my problem doesn't get resolve,
Is it because I'm running ubuntu on virtual on macOS silicon?

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Apr 6, 2025
@fruffy fruffy requested a review from Copilot April 6, 2025 20:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • lib/options.cpp: Language not supported

frontends/p4/p4-lex.c
frontends/p4/p4-parse.cpp
py-compile

Copy link
Contributor

Choose a reason for hiding this comment

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

You should not remove this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I will add it back

@@ -19,6 +19,10 @@ limitations under the License.
#include "lib/null.h"

namespace P4 {
void Util::Options::shortUsage() {
*outStream << binaryName << ": Error in command line options" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

There should have already been printed an error message like "Unknown option --x" or "Option --x is missing a required argument", so this line of output seems redundant.

@fruffy
Copy link
Collaborator

fruffy commented Apr 7, 2025

Is it because I'm running ubuntu on virtual on macOS silicon?

To start with you could post your error output to see what's wrong. Try to get everything working locally first.

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.

Do not print the entire help when option processing fails.
3 participants