[PCBC-241] compilation warnings on extension Created: 24/Jul/13  Updated: 26/Aug/13  Resolved: 26/Aug/13

Status: Resolved
Project: Couchbase PHP client library
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2.0
Security Level: Public

Type: Task Priority: Minor
Reporter: Matt Ingenthron Assignee: Trond Norbye
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: git describe:
1.1.5-8-gf7b3b70

cc --version:
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.0
Thread model: posix


 Description   
With my nice new compiler, we now get some compilation warnings on php-ext-couchbase. None look critical, but should be reviewed.

 cc -I. -I/Users/ingenthr/src/php-ext-couchbase -DPHP_ATOM_INC -I/Users/ingenthr/src/php-ext-couchbase/include -I/Users/ingenthr/src/php-ext-couchbase/main -I/Users/ingenthr/src/php-ext-couchbase -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/ingenthr/src/php-ext-couchbase/replica.c -fno-common -DPIC -o .libs/replica.o
/Users/ingenthr/src/php-ext-couchbase/replica.c:41:9: warning: passing 'const void *' to parameter of type 'void *'
      discards qualifiers [-Wincompatible-pointer-types]
                        free(ret->data.v.v0.key);
                             ^~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:160:18: note: passing argument to parameter here
void free(void *);
                    ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:42:9: warning: passing 'const void *' to parameter of type 'void *'
      discards qualifiers [-Wincompatible-pointer-types]
                        free(ret->data.v.v0.bytes);
                             ^~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:160:18: note: passing argument to parameter here
void free(void *);
                    ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:46:10: warning: passing 'const void *' to parameter of type 'void *'
      discards qualifiers [-Wincompatible-pointer-types]
                memcpy(ret->data.v.v0.key, r->v.v0.key, ret->data.v.v0.nkey);
                       ^~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:55:30: note: expanded from macro 'memcpy'
   ? __builtin___memcpy_chk (dest, src, len, __darwin_obsz0 (dest)) \
                             ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:46:10: warning: passing 'const void *' to parameter of type 'void *'
      discards qualifiers [-Wincompatible-pointer-types]
                memcpy(ret->data.v.v0.key, r->v.v0.key, ret->data.v.v0.nkey);
                       ^~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:56:27: note: expanded from macro 'memcpy'
   : __inline_memcpy_chk (dest, src, len))
                          ^
/usr/include/secure/_string.h:59:28: note: passing argument to parameter '__dest' here
__inline_memcpy_chk (void *__dest, const void *__src, size_t __len)
                           ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:47:10: warning: passing 'const void *' to parameter of type 'void *'
      discards qualifiers [-Wincompatible-pointer-types]
                memcpy(ret->data.v.v0.bytes, r->v.v0.bytes, ret->data.v.v0.nbytes);
                       ^~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:55:30: note: expanded from macro 'memcpy'
   ? __builtin___memcpy_chk (dest, src, len, __darwin_obsz0 (dest)) \
                             ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:47:10: warning: passing 'const void *' to parameter of type 'void *'
      discards qualifiers [-Wincompatible-pointer-types]
                memcpy(ret->data.v.v0.bytes, r->v.v0.bytes, ret->data.v.v0.nbytes);
                       ^~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:56:27: note: expanded from macro 'memcpy'
   : __inline_memcpy_chk (dest, src, len))
                          ^
/usr/include/secure/_string.h:59:28: note: passing argument to parameter '__dest' here
__inline_memcpy_chk (void *__dest, const void *__src, size_t __len)
                           ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:142:32: warning: passing 'const char *' to parameter of type 'char *'
      discards qualifiers [-Wincompatible-pointer-types]
                add_assoc_string(r, "error", lcb_strerror(NULL, e->error), 1);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_API.h:371:111: note: expanded from macro 'add_assoc_string'
  ...__key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
                                                                                   ^
/usr/include/php/Zend/zend_API.h:362:82: note: passing argument to parameter 'str' here
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
                                                                                 ^
/Users/ingenthr/src/php-ext-couchbase/replica.c:358:56: warning: passing 'lcb_get_replica_cmd_t **'
      (aka 'struct lcb_get_replica_cmd_st **') to parameter of type 'const lcb_get_replica_cmd_t *const *' (aka 'const
      struct lcb_get_replica_cmd_st *const *') discards qualifiers in nested pointer types [-Wincompatible-pointer-types]
        retval = lcb_get_replica(instance, &cookie, num_docs, commands);
                                                              ^~~~~~~~
/usr/local/include/libcouchbase/couchbase.h:314:69: note: passing argument to parameter 'commands' here
                                const lcb_get_replica_cmd_t *const *commands);
                                                                    ^


 Comments   
Comment by Trond Norbye [ 23/Aug/13 ]
http://review.couchbase.org/28531
Generated at Sun Apr 20 01:55:19 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.