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

search for includes in share/p4c #4978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChrisDodd
Copy link
Contributor

Generally the compiler is run via the p4c driver which sets up the include path properly, but sometimes one wants to run the executable directly. If it is installed in a bin directory somewhere, the standard include files will likely be in share/p4c/p4include, so this change looks there as well as where it was looking.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Oct 24, 2024
@@ -395,10 +395,13 @@ bool ParserOptions::searchForIncludePath(const char *&includePathOut,
}

std::vector<const char *> *ParserOptions::process(int argc, char *const argv[]) {
searchForIncludePath(p4includePath, {"p4include"_cs, "../p4include"_cs, "../../p4include"_cs},
searchForIncludePath(p4includePath,
{"p4include"_cs, "../p4include"_cs, "../../p4include"_cs,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe create a virtual function that returns this list? Then the list can be overridden by other back ends.

Signed-off-by: Chris Dodd <cdodd@nvidia.com>
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.

2 participants