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

Comment out unused parameters #2075

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

Conversation

e-kwsm
Copy link
Contributor

@e-kwsm e-kwsm commented Nov 6, 2019

No description provided.

@ghutchis
Copy link
Member

ghutchis commented Nov 9, 2019

Sorry, I'm not going to merge anything C++17 anytime soon. C++11 is okay, though. We need to be intentionally very conservative with support.

@e-kwsm
Copy link
Contributor Author

e-kwsm commented Nov 10, 2019

The attribute is not effective unless -std=c++17 is supplied. Actually there are many unused variables.

@correaa
Copy link

correaa commented May 30, 2021

Sorry, I'm not going to merge anything C++17 anytime soon. C++11 is okay, though. We need to be intentionally very conservative with support.

Good call.

I think the fallback case should be to use nothing. (evaluate UNUSED(x) to `` --nothing--). #2376

Besides [[maybe_unused]] is only for C++17, the keyword is not for that™.
[[maybe_unused]] is mainly for generic code or macros, if constexpr, etc.

An unused variable shouldn't be named in the first place.
At most have a commented name f(double /*unused x*/) (Linters recommend that).
There is nothing wrong with not naming the unusued variable, there is no need to make acrobatics with unused attributes.

@e-kwsm e-kwsm changed the title Use [[maybe_unused]] attribute (C++17) and specify -Wunused-variable Comment out unused parameters Jun 9, 2021
@e-kwsm
Copy link
Contributor Author

e-kwsm commented Jun 9, 2021

The original motivation is to replace UNUSED macro with [[maybe_unused]] attribute, so this does not fix all of the warning on unused parameters.

@e-kwsm
Copy link
Contributor Author

e-kwsm commented Jun 16, 2021

Now the unused parameters are commented out as far as clang-tidy does.

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

Successfully merging this pull request may close these issues.

None yet

3 participants