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

Fix build warnings #329

Merged
merged 2 commits into from
Feb 22, 2017
Merged

Conversation

remicollet
Copy link
Collaborator

just to make gcc happy

1/ variable « memc_user_data » set but not used [-Wunused-but-set-variable]

(void)memc_user_data only to avoid the warning (removed later by optimizer)

Another solution (but probably a bit ugly) is to have 1 set of macros without data, and 1 set with.

2/ « status » may be used uninitialized in this function [-Wmaybe-uninitialized]

3/ pointer targets in passing argument 2 of « smart_str_appendl_ex » differ in signedness [-Wpointer-sign]

php_memcached.c Outdated
@@ -194,7 +194,8 @@ static inline php_memc_object_t *php_memc_fetch_object(zend_object *obj) {
php_error_docref(NULL, E_WARNING, "Memcached constructor was not called"); \
return; \
} \
memc_user_data = (php_memc_user_data_t *) memcached_get_user_data(intern->memc);
memc_user_data = (php_memc_user_data_t *) memcached_get_user_data(intern->memc); \
(void)memc_user_data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will result in a different warning on newer clang compilers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, ok let's do this, maybe add a comment like /* avoid unused variable warning */ in the macro above the void line?

@sodabrew
Copy link
Contributor

By the way - with the default Clang on OS X, I get zero warnings by default.

With -Wall I get one warning (and only because I'm building without SASL):

php_memcached.c:3914:21: warning: unused variable 'arginfo_setSaslAuthData' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO(arginfo_setSaslAuthData, 0)

With -Wall -Wextra I get a laundry list of warnings. Mostly unused parameters, such as from PHP macros that are used by extensions to register themselves with the interpreter. I wouldn't spend much time trying to chase these down.

just to make gcc happy

1/ variable « memc_user_data » set but not used [-Wunused-but-set-variable]

(void)memc_user_data only to avoid the warning (removed later by optimizer)

2/  « status » may be used uninitialized in this function [-Wmaybe-uninitialized]

3/ pointer targets in passing argument 2 of « smart_str_appendl_ex » differ in signedness [-Wpointer-sign]
@remicollet
Copy link
Collaborator Author

Comment added.

I wouldn't spend much time trying to chase these down.

I understand.
Btw, with this, I got a warning free build with "gcc -Wall", having a warning flood is not ideal, as it may hide "real" issues.

@remicollet
Copy link
Collaborator Author

With -Wall I get one warning (and only because I'm building without SASL):

Also fixed.

@sodabrew sodabrew added this to the 3.0.4 milestone Feb 21, 2017
@sodabrew sodabrew merged commit 037ed57 into php-memcached-dev:master Feb 22, 2017
@remicollet remicollet deleted the issue-warnings branch February 22, 2017 05:18
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.

2 participants