Skip to content

Enable ArgumentParser to handle custom compilers #176

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

Merged
merged 8 commits into from
Apr 3, 2025

Conversation

Pennycook
Copy link
Contributor

Related issues

Proposed changes

  • Remove ClangArgumentParser, GnuArgumentParser, etc in favor of a single, configurable, ArgumentParser.
  • Read configurations for the new ArgumentParser from the compilers/*.toml files and .cbi/config file.
  • Add a lot of tests for weird corner-cases, including checks that we generate the correct warnings and errors.

This replaces the original ArgumentParser class and subclasses with a single
ArgumentParser that reads a configuration from the compiler TOML files.

Signed-off-by: John Pennycook <[email protected]>
The new ArgumentParser interface is slightly different to the old one, and
doesn't require a call to a recognize_compiler() function to construct.

Signed-off-by: John Pennycook <[email protected]>
Replaces the original _importcfg with support for completely user-defined
compilers (and argument parsers).

Signed-off-by: John Pennycook <[email protected]>
Using the new user-defined compiler functionality for these tests allows us to
test both the ability to define specific compiler behaviors, and our ability to
detect incorrectly defined compilers.

Signed-off-by: John Pennycook <[email protected]>
Every update to a PreprocessorConfiguration extends the same three lists,
resulting in quite a lot of duplicated code in the original implementation.

Signed-off-by: John Pennycook <[email protected]>
These tests only check whether we correctly detect cases where a user-defined
parser references a custom action. They do not check the parser behavior,
because this is covered by existing tests.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added enhancement New feature or request refactor Improvements to code structure labels Mar 20, 2025
@Pennycook Pennycook added this to the 2.0.0 milestone Mar 20, 2025
@Pennycook Pennycook requested a review from laserkelvin March 20, 2025 16:54
@Pennycook Pennycook mentioned this pull request Mar 20, 2025
10 tasks
@Pennycook
Copy link
Contributor Author

The three uncovered lines are:

except ValueError as e:
    log.error(str(e))
    return

I'd like to defer resolution of these until later. We should really have a utility function that checks these errors for TOML files, and I don't think it's worth introducing tests for each individual location in the code where we read a TOML file.

@Pennycook Pennycook merged commit d606624 into P3HPC:main Apr 3, 2025
3 of 4 checks passed
@Pennycook Pennycook deleted the feature/argument-parser branch April 3, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Improvements to code structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support custom compiler arguments
2 participants