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

`warning: unused parameter` when -Wextra is set to CFLAGS #39

kubo opened this Issue Oct 15, 2017 · 1 comment


None yet
2 participants
Copy link

kubo commented Oct 15, 2017

When -Wextra is added to CFLAGS, gcc complains many unused parameter warnings on Linux.

$ make
mkdir build
mkdir lib
gcc -c -Iinclude -O2 -g -Wall -fPIC -Wextra src/dpiConn.c -obuild/dpiConn.o
src/dpiConn.c: In function ‘dpiConn__decrementOpenChildCount’:
src/dpiConn.c:222:63: warning: unused parameter ‘error’ [-Wunused-parameter]
 int dpiConn__decrementOpenChildCount(dpiConn *conn, dpiError *error)
gcc -c -Iinclude -O2 -g -Wall -fPIC -Wextra src/dpiContext.c -obuild/dpiContext.o
src/dpiContext.c: In function ‘dpiContext__initCommonCreateParams’:
src/dpiContext.c:33:58: warning: unused parameter ‘context’ [-Wunused-parameter]
 int dpiContext__initCommonCreateParams(const dpiContext *context,
src/dpiContext.c:34:50: warning: unused parameter ‘error’ [-Wunused-parameter]
         dpiCommonCreateParams *params, dpiError *error)

Could you suppress these warnings?

Add the following macro to src/dpiImpl.h.

#ifdef __GNUC__
#define UNUSED __attribute((unused))
#define UNUSED

And then use the macro after unused parameters as follows:

int dpiConn__decrementOpenChildCount(dpiConn *conn, dpiError *error UNUSED)

anthony-tuininga added a commit that referenced this issue Oct 16, 2017

Remove unused parameters and add __atribute((unused)) for mandatory p…

in callbacks which are unused (for the gcc compiler), as requested

This comment has been minimized.

Copy link

anthony-tuininga commented Oct 16, 2017

Thanks for the suggestion. I removed the unused parameters where I could do so and added the UNUSED directive where I couldn't (callbacks, for example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.