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

[cling] Ignore -Wunused-result in wrapped code #12654

Merged

Commits on Apr 12, 2023

  1. [cling] Ignore -Wunused-result in wrapped code

    Make `FilteringDiagConsumer` also ignore -Wunused-result. Whether or not
    such diagnostic is filtered depends on `CompilationOptions::IgnorePromptDiags`.
    
    In particular, `IgnorePromptDiags` should _only_ be enabled for code parsed
    via `Interpreter::EvaluateInternal()`.  Thus, as of this commit `IgnorePromptDiags`
    defaults to 0 in `makeDefaultCompilationOpts()`
    
    The observable effect of this change is ignoring `-Wunused-result` for
    wrapped code, e.g.
    ```c++
    [[nodiscard]] int f() { return 0; }
    
    // This yields `warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]`
    void g() { f(); }
    
    f(); // but this should not
    ```
    jalopezg-git committed Apr 12, 2023
    Configuration menu
    Copy the full SHA
    4045776 View commit details
    Browse the repository at this point in the history