Re: [PATCH 1/5] compat/obstack: fix -Wcast-function-type warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 20 2018, SZEDER Gábor wrote:

> When building Git with GCC 8.2.0 (at least from Homebrew on macOS,
> DEVELOPER flags enabled) one is greeted with a screenful of compiler
> errors:
>
>   compat/obstack.c: In function '_obstack_begin':
>   compat/obstack.c:162:17: error: cast between incompatible function types from 'void * (*)(long int)' to 'struct _obstack_chunk * (*)(void *, long int)' [-Werror=cast-function-type]
>      h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
>                    ^
>   compat/obstack.c:163:16: error: cast between incompatible function types from 'void (*)(void *)' to 'void (*)(void *, struct _obstack_chunk *)' [-Werror=cast-function-type]
>      h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
>                   ^
>   compat/obstack.c:116:8: error: cast between incompatible function types from 'struct _obstack_chunk * (*)(void *, long int)' to 'struct _obstack_chunk * (*)(long int)' [-Werror=cast-function-type]
>       : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
>           ^
>   compat/obstack.c:168:22: note: in expansion of macro 'CALL_CHUNKFUN'
>      chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
>                         ^~~~~~~~~~~~~
>   <snip>

We originally got this from now-discontinued eglibc, but I notice that
glibc.git's malloc/obstack.[ch]'s diff also changes these lines. If you
backport those do does that fix this warning?

I.e. is this another case where we're blindly fixing bugs but should
just re-import upstream's code instead?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux