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

Generically assume that unknown flags are PassThrough #1122

Open
mitchhentges opened this issue Feb 16, 2022 · 3 comments
Open

Generically assume that unknown flags are PassThrough #1122

mitchhentges opened this issue Feb 16, 2022 · 3 comments

Comments

@mitchhentges
Copy link
Contributor

(Disclaimer: a little more investigation is needed, this is a placeholder ticket and may not be fully accurate - please clarify misunderstandings if you notice them.)

Currently, for some compilers such as MSVC, we need to handle each flag independently. If there's an unknown flag, sccache fails, and therefore we need to do changes such as this one to teach sccache about them.

However, for at least gcc, it sounds like we default to assuming that unknown flags are PassThrough, and perhaps that approach should be applied to other compilers, such as how it's been done in this user repo.

Questions:

  • Are we indeed assuming that unknown flags are PassThrough for gcc here in the main sccache repo, or was that just applied downstream?
  • Is assuming that unknown flags are PassThrough better than failing upon encountering them? Is there a better solution?
    • Is the "better" solution different for different compilers?
@mitchhentges
Copy link
Contributor Author

I was a bit surprised to find that GCC::parse_arguments() seems to treat unknown arguments as always cacheable. Is that on purpose? It seems like a somewhat dangerous default.

~michaelwoerister in this comment

@vlad-ivanov-name
Copy link
Contributor

vlad-ivanov-name commented Mar 21, 2022

About that, I'm testing sccache with nvcc (which uses GCC argument parser) and this is not the behaviour I'm observing, at least on commit 2940944. Specifically, adding/removing flags like -lineinfo or --resource-usage results in cache misses. Or am I thinking about a different thing?

@mitchhentges
Copy link
Contributor Author

Hmm, I'm not sure Vlad, I'm still getting to terms with the project. Good question though 🤔

FWIW, a piece to add to the confusion: it seems like MSVC flags are already "cached by default"? Look at this:

  1. Unknown flags are mapped to Argument::UnknownFlag
  2. Here, arg.get_data() returns None for Argument::UnknownFlag
  3. That results in this being executed, not cannot_cache!(...).

So, perhaps we're already considering that all flags are already cacheable? More investigation is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants