-
Notifications
You must be signed in to change notification settings - Fork 323
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
Fix build warnings #329
Conversation
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
By the way - with the default Clang on OS X, I get zero warnings by default. With
With |
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]
0129596
to
52a1489
Compare
Comment added.
I understand. |
Also fixed. |
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]