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

Build warnings with Gcc8 #2560

Closed
rikardfalkeborn opened this Issue May 11, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@rikardfalkeborn
Contributor

rikardfalkeborn commented May 11, 2018

I did this

Built curl with Gcc 8.

$ ./buildconf
$ ./configure --enable-debug --enable-warnings --enable-werror CC=gcc
$ make

I expected the following

Successful build, instead I got this:

md5.c:489:5: error: cast between incompatible function types from ‘int (*)(MD5_CTX *)’ {aka ‘int (*)(struct MD5state_st *)’} to ‘void (*)(void *)’ [-Werror=cast-function-type]
     (HMAC_hinit_func) MD5_Init,           /* Hash initialization function. */
     ^
md5.c:490:5: error: cast between incompatible function types from ‘int (*)(MD5_CTX *, const void *, size_t)’ {aka ‘int (*)(struct MD5state_st *, const void *, long unsigned int)’} to ‘void (*)(void *, const unsigned char *, unsigned int)’ [-Werror=cast-function-type]
     (HMAC_hupdate_func) MD5_Update,       /* Hash update function. */
     ^
md5.c:491:5: error: cast between incompatible function types from ‘int (*)(unsigned char *, MD5_CTX *)’ {aka ‘int (*)(unsigned char *, struct MD5state_st *)’} to ‘void (*)(unsigned char *, void *)’ [-Werror=cast-function-type]
     (HMAC_hfinal_func) MD5_Final,         /* Hash computation end function. */
     ^
md5.c:500:5: error: cast between incompatible function types from ‘int (*)(MD5_CTX *)’ {aka ‘int (*)(struct MD5state_st *)’} to ‘void (*)(void *)’ [-Werror=cast-function-type]
     (Curl_MD5_init_func) MD5_Init,      /* Digest initialization function */
     ^
md5.c:501:5: error: cast between incompatible function types from ‘int (*)(MD5_CTX *, const void *, size_t)’ {aka ‘int (*)(struct MD5state_st *, const void *, long unsigned int)’} to ‘void (*)(void *, const unsigned char *, unsigned int)’ [-Werror=cast-function-type]
     (Curl_MD5_update_func) MD5_Update,  /* Digest update function */
     ^
md5.c:502:5: error: cast between incompatible function types from ‘int (*)(unsigned char *, MD5_CTX *)’ {aka ‘int (*)(unsigned char *, struct MD5state_st *)’} to ‘void (*)(unsigned char *, void *)’ [-Werror=cast-function-type]
     (Curl_MD5_final_func) MD5_Final,    /* Digest computation end function */
     ^
cc1: all warnings being treated as errors
make[2]: *** [Makefile:1558: libcurl_la-md5.lo] Error 1
http2.c: In function ‘http2_connisdead’:
http2.c:208:18: error: cast between incompatible function types from ‘recving’ {aka ‘int (*)(void)’} to ‘ssize_t (*)(struct connectdata *, int,  char *, size_t,  CURLcode *)’ {aka ‘long int (*)(struct connectdata *, int,  char *, long unsigned int,  enum <anonymous> *)’} [-Werror=cast-function-type]
         nread = ((Curl_recv *)httpc->recv_underlying)(
                  ^
http2.c: In function ‘send_callback’:
http2.c:368:14: error: cast between incompatible function types from ‘sending’ {aka ‘int (*)(void)’} to ‘ssize_t (*)(struct connectdata *, int,  const void *, size_t,  CURLcode *)’ {aka ‘long int (*)(struct connectdata *, int,  const void *, long unsigned int,  enum <anonymous> *)’} [-Werror=cast-function-type]
   written = ((Curl_send*)c->send_underlying)(conn, FIRSTSOCKET,
              ^
http2.c: In function ‘http2_recv’:
http2.c:1604:16: error: cast between incompatible function types from ‘recving’ {aka ‘int (*)(void)’} to ‘ssize_t (*)(struct connectdata *, int,  char *, size_t,  CURLcode *)’ {aka ‘long int (*)(struct connectdata *, int,  char *, long unsigned int,  enum <anonymous> *)’} [-Werror=cast-function-type]
       nread = ((Curl_recv *)httpc->recv_underlying)(
                ^
http2.c: In function ‘Curl_http2_switched’:
http2.c:2141:28: error: cast between incompatible function types from ‘ssize_t (*)(struct connectdata *, int,  char *, size_t,  CURLcode *)’ {aka ‘long int (*)(struct connectdata *, int,  char *, long unsigned int,  enum <anonymous> *)’} to ‘int (*)(void)’ [-Werror=cast-function-type]
   httpc->recv_underlying = (recving)conn->recv[FIRSTSOCKET];
                            ^
http2.c:2142:28: error: cast between incompatible function types from ‘ssize_t (*)(struct connectdata *, int,  const void *, size_t,  CURLcode *)’ {aka ‘long int (*)(struct connectdata *, int,  const void *, long unsigned int,  enum <anonymous> *)’} to ‘int (*)(void)’ [-Werror=cast-function-type]
   httpc->send_underlying = (sending)conn->send[FIRSTSOCKET];
                            ^
cc1: all warnings being treated as errors
make[2]: *** [Makefile:2874: libcurlu_la-http2.lo] Error 1
make[1]: *** [Makefile:746: all] Error 2
make: *** [Makefile:924: all-recursive] Error 1

This seems to be a new warning in Gcc 8 (https://gcc.gnu.org/gcc-8/changes.html)

-Wcast-function-type warns when a function pointer is cast to an incompatible function pointer. This warning is enabled by -Wextra.

curl/libcurl version

$ git rev-parse HEAD
c3d7db4ecb2f8a0b22bd7cdf54ef10c119ebcc48

operating system

Linux (Arch Linux)

@bagder bagder added the build label May 11, 2018

bagder added a commit that referenced this issue May 14, 2018

http2: use the correct function pointer typedef
Fixes gcc-8 picky compiler warnings
Reported-by: Rikard Falkeborn
Bug: #2560

bagder added a commit that referenced this issue May 14, 2018

http2: use the correct function pointer typedef
Fixes gcc-8 picky compiler warnings
Reported-by: Rikard Falkeborn
Bug: #2560

bagder added a commit that referenced this issue May 14, 2018

bagder added a commit that referenced this issue May 14, 2018

http2: use the correct function pointer typedef
Fixes gcc-8 picky compiler warnings
Reported-by: Rikard Falkeborn
Bug: #2560
Closes #2568

bagder added a commit that referenced this issue May 14, 2018

bagder added a commit that referenced this issue May 14, 2018

gcc: disable picky gcc-8 function pointer warnings in two places
Reported-by: Rikard Falkeborn
Bug: #2560
Closes #2569
@bagder

This comment has been minimized.

Member

bagder commented May 14, 2018

I believe they're all fixed now. Can you confirm?

@rikardfalkeborn

This comment has been minimized.

Contributor

rikardfalkeborn commented May 15, 2018

I can confirm no warnings.

@bagder

This comment has been minimized.

Member

bagder commented May 15, 2018

Thanks @rikardfalkeborn! Case closed.

@bagder bagder closed this May 15, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.