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

Unused argument variable in header file #2376

Open
1 of 2 tasks
correaa opened this issue May 30, 2021 · 2 comments
Open
1 of 2 tasks

Unused argument variable in header file #2376

correaa opened this issue May 30, 2021 · 2 comments

Comments

@correaa
Copy link

correaa commented May 30, 2021

  • I believe this to be a bug with Open Babel
  • This is a feature request

Environment Information

Open Babel version: 3.1
Operating system and version: Ubuntu 20.04

Expected Behavior

Code using reasonable warning level should not warn on header code

Actual Behavior

Code including directly or indirectly openbabel/base.h warns about unused

Steps to Reproduce

Compile any example code with -Wall -Wextra (or anything including -Wunused-parameters).

Proposed fix

I think there is a detail in the definition of the macro UNUSED in the same file.

#ifdef UNUSED
#elif (__GNUC__ == 4)
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
#elif defined(__LCLINT__)
# define UNUSED(x) /*@unused@*/ x
#else
# define UNUSED(x) x  // <<<<<<<<<<<<<<<< PROBLEM HERE
#endif

The fallback case should be to define UNUSED(x) as empty

# define UNUSED(x)

or

# define UNUSED(x) /**/
@e-kwsm
Copy link
Contributor

e-kwsm commented May 30, 2021

In #2075 I use [[maybe_unused]] attribute if available.

@correaa
Copy link
Author

correaa commented Jun 9, 2021

I think this change makes a lot of sense: fb7d831

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

No branches or pull requests

2 participants