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

Code causes some warnings under -Wall -Wextra #2

Open
sgielen opened this issue Feb 19, 2013 · 1 comment
Open

Code causes some warnings under -Wall -Wextra #2

sgielen opened this issue Feb 19, 2013 · 1 comment

Comments

@sgielen
Copy link

sgielen commented Feb 19, 2013

When building dotconf under -Wall -Wextra, there are some warnings caused by dotconf.h:

/Users/sjors/Projecten/dazeus/dotconfbug/main.cpp:10:2: warning: missing field 'context' initializer [-Wmissing-field-initializers]
        LAST_OPTION
        ^
/Users/sjors/Projecten/dazeus/dotconfbug/dotconf/src/dotconf.h:42:49: note: expanded from macro 'LAST_OPTION'
#define LAST_OPTION                                             { "", 0, NULL, NULL    }
                                                                                       ^
/Users/sjors/Projecten/dazeus/dotconfbug/main.cpp:13:1: warning: unused parameter 'configfile' [-Wunused-parameter]
FUNC_ERRORHANDLER(error_handler) {
^
/Users/sjors/Projecten/dazeus/dotconfbug/dotconf/src/dotconf.h:47:59: note: expanded from macro 'FUNC_ERRORHANDLER'
#define FUNC_ERRORHANDLER(_name) int _name(configfile_t * configfile,             \
                                                          ^
/Users/sjors/Projecten/dazeus/dotconfbug/main.cpp:13:1: warning: unused parameter 'type' [-Wunused-parameter]
FUNC_ERRORHANDLER(error_handler) {
^
/Users/sjors/Projecten/dazeus/dotconfbug/dotconf/src/dotconf.h:48:16: note: expanded from macro 'FUNC_ERRORHANDLER'
                                                                                        int type, long dc_errno, const char *msg)
                                                                                            ^
/Users/sjors/Projecten/dazeus/dotconfbug/main.cpp:13:1: warning: unused parameter 'dc_errno' [-Wunused-parameter]
FUNC_ERRORHANDLER(error_handler) {
^
/Users/sjors/Projecten/dazeus/dotconfbug/dotconf/src/dotconf.h:48:27: note: expanded from macro 'FUNC_ERRORHANDLER'
                                                                                        int type, long dc_errno, const char *msg)
                                                                                                       ^
/Users/sjors/Projecten/dazeus/dotconfbug/main.cpp:13:1: warning: unused parameter 'msg' [-Wunused-parameter]
FUNC_ERRORHANDLER(error_handler) {
^
/Users/sjors/Projecten/dazeus/dotconfbug/dotconf/src/dotconf.h:48:49: note: expanded from macro 'FUNC_ERRORHANDLER'
                                                                                        int type, long dc_errno, const char *msg)
                                                                                                                             ^
/Users/sjors/Projecten/dazeus/dotconfbug/main.cpp:35:8: warning: unused parameter 'ctx' [-Wunused-parameter]
static DOTCONF_CB(option) {
       ^
/Users/sjors/Projecten/dazeus/dotconfbug/dotconf/src/dotconf.h:46:62: note: expanded from macro 'DOTCONF_CB'
                                                  context_t *ctx)
                                                             ^
6 warnings generated.

The main.cpp file is listed in #1 (first comment).

There are some other warnings in dotconf.c itself under both -Wall and -Wall -Wextra, that might need to be looked at/fixed too.

@sgielen
Copy link
Author

sgielen commented Feb 19, 2013

As for the unused parameter references expanded from function macros, these are possibly best fixed by adding some useless variable use in the function, such as adding (void)configfile to the start of the FUNC_ERRORHANDLER. Maybe that can be its own macro: one that "uses" all parameters so that this warning is suppressed if the parameter is not useful.

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

1 participant