Re: child-wait.c and [-Wnull-pointer-arithmetic]

2019-03-18 Thread Rupert Gallagher via dovecot
Thanks! It solved problems also with str-table.c, test-hash.c, test-mempool.c, 
auth-server-connection.c, master-auth.c, master-login-auth.c, 
mail-cache-fields.c, mail-index.c, mailbox-list-index.c, 
mailbox-list-index-sync.c, maildir-keywords.c, mdbox-purge.c, connect-limit.c, 
auth-request-handler.c, db-checkpassword.c, service-monitor.c, 
service-process.c, pop3-commands.c, log-connection.c, doveconf.c, 
user-directory.c, replicator-connection.c, dsync-mailbox-import.c, 
dsync-mailbox-export.c, dsync-transaction-log-scan.c, doveadm-director.c, 
doveadm-kick.c, acl-cache.c, doveadm-expire.c and push-notification-txn-msg.c.

‐‐‐ Original Message ‐‐‐
On Monday, March 18, 2019 10:50 AM, Aki Tuomi  
wrote:

> On 18.3.2019 12.48, Rupert Gallagher via dovecot wrote:
>
>> Attached warnings from clang 7.0 when compiling child-wait.c from dovecot 
>> 2.3.5:
>>
>> "arithmetic on a null pointer treated as a cast from integer to pointer is a 
>> GNU extension
>> [-Wnull-pointer-arithmetic]".
>
> This is fixed in master with
>
> https://github.com/dovecot/core/commit/ac7aa955db4c77bbb169baa5d104a4c128674646.patch
>
> Aki

Re: child-wait.c and [-Wnull-pointer-arithmetic]

2019-03-18 Thread Aki Tuomi via dovecot

On 18.3.2019 12.48, Rupert Gallagher via dovecot wrote:
> Attached warnings from clang 7.0 when compiling child-wait.c from
> dovecot 2.3.5:
>
> "arithmetic on a null pointer treated as a cast from integer to
> pointer is a GNU extension
> [-Wnull-pointer-arithmetic]".
>
>
>
This is fixed in master with

https://github.com/dovecot/core/commit/ac7aa955db4c77bbb169baa5d104a4c128674646.patch

Aki


child-wait.c and [-Wnull-pointer-arithmetic]

2019-03-18 Thread Rupert Gallagher via dovecot
Attached warnings from clang 7.0 when compiling child-wait.c from dovecot 2.3.5:

"arithmetic on a null pointer treated as a cast from integer to pointer is a 
GNU extension
[-Wnull-pointer-arithmetic]".child-wait.c:66:32: warning: arithmetic on a null pointer treated as a cast 
from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
hash_table_insert(child_pids, POINTER_CAST(pid), wait);
~~^~~~
./macros.h:42:27: note: expanded from macro 'POINTER_CAST'
((void *) ((char *) NULL + (i)))
 ^
./hash.h:111:20: note: expanded from macro 'hash_table_insert'
(void *)((char*)(key) + 
COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._key, key)), \
 ^~~
child-wait.c:66:32: warning: arithmetic on a null pointer treated as a cast 
from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
hash_table_insert(child_pids, POINTER_CAST(pid), wait);
~~^~~~
./macros.h:42:27: note: expanded from macro 'POINTER_CAST'
((void *) ((char *) NULL + (i)))
 ^
./hash.h:111:79: note: expanded from macro 'hash_table_insert'
(void *)((char*)(key) + 
COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._key, key)), \

^~~~
./macros.h:178:52: note: expanded from macro 
'COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE'
!__builtin_types_compatible_p(typeof(_a), typeof(_b)))
~^
./macros.h:170:25: note: expanded from macro 'COMPILE_ERROR_IF_TRUE'
(sizeof(char[1 - 2 * ((condition) ? 1 : 0)]) - 1)
   ^
child-wait.c:72:32: warning: arithmetic on a null pointer treated as a cast 
from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
hash_table_remove(child_pids, POINTER_CAST(pid));
~~^~
./macros.h:42:27: note: expanded from macro 'POINTER_CAST'
((void *) ((char *) NULL + (i)))
 ^
./hash.h:124:46: note: expanded from macro 'hash_table_remove'
if (unlikely(!hash_table_try_remove(table, key))) \
~~~^
./hash.h:121:33: note: expanded from macro 'hash_table_try_remove'
(const void *)((const char *)(key) + 
COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, key)))
  ^
./macros.h:189:45: note: expanded from macro 'unlikely'
#  define unlikely(expr) (__builtin_expect((expr) ? 1 : 0, 0) != 0)
^~~~
child-wait.c:72:32: warning: arithmetic on a null pointer treated as a cast 
from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
hash_table_remove(child_pids, POINTER_CAST(pid));
~~^~
./macros.h:42:27: note: expanded from macro 'POINTER_CAST'
((void *) ((char *) NULL + (i)))
 ^
./hash.h:124:46: note: expanded from macro 'hash_table_remove'
if (unlikely(!hash_table_try_remove(table, key))) \
~~~^
./hash.h:121:113: note: expanded from macro 'hash_table_try_remove'
(const void *)((const char *)(key) + 
COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, key)))

  ^
./macros.h:181:53: note: expanded from macro 
'COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE'
!__builtin_types_compatible_p(typeof(_a1), typeof(_b)) && \
  ^
./macros.h:170:25: note: expanded from macro 'COMPILE_ERROR_IF_TRUE'
(sizeof(char[1 - 2 * ((condition) ? 1 : 0)]) - 1)
   ^
./macros.h:189:45: note: expanded from macro 'unlikely'
#  define unlikely(expr) (__builtin_expect((expr) ? 1 : 0, 0) != 0)
^~~~
child-wait.c:72:32: warning: arithmetic on a null pointer treated as a cast 
from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
hash_table_remove(child_pids, POINTER_CAST(pid));
~~^~
./macros.h:42:27: note: expanded from macro 'POINTER_CAST'
((void *) ((char *) NULL + (i)))
 ^
./hash.h:124:46: note: expanded from macro 'hash_table_remove'
if (unlikely(!hash_table_try_remove(table, key))) \
~~~