Skip to content
  • Gábor Szeder's avatar
    compat/obstack: fix -Wcast-function-type warnings · 764473d2
    Gábor Szeder authored and Junio C Hamano's avatar Junio C Hamano committed
    GCC 8 introduced the new -Wcast-function-type warning, which is
    implied by -Wextra (which, in turn is enabled in our DEVELOPER flags).
    When building Git with GCC 8 and this warning enabled on a non-glibc
    platform [1], one is greeted with a screenful of compiler
    warnings/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_...
    764473d2