Skip to content

Comment out unused parameters#2075

Open
e-kwsm wants to merge 1 commit into
openbabel:masterfrom
e-kwsm:maybe_unused
Open

Comment out unused parameters#2075
e-kwsm wants to merge 1 commit into
openbabel:masterfrom
e-kwsm:maybe_unused

Conversation

@e-kwsm
Copy link
Copy Markdown
Contributor

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

No description provided.

@ghutchis
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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.

3 participants