You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/19 07:57:51 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request #5271: net/sockif: explicit the member declaration

anchao opened a new pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271


   
   
   ## Summary
   net/sockif: explicit the member declaration 
   
   To avoid the compile warning:
   
   ```
   usrsock/usrsock_sockif.c:72:3: warning:
   initialization of ‘int (*)(struct socket **)’ from incompatible pointer type
   ‘int (*)(struct socket *, int,  void *, size_t)’ {aka ‘int (*)(struct socket *, int,  void *, long unsigned int)’} [-Wincompatible-pointer-types]
      72 |   usrsock_ioctl               /* si_ioctl */
         |   ^~~~~~~~~~~~~
   
   ```
   Signed-off-by: chao.an <an...@xiaomi.com>
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ci-check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko merged pull request #5271: net/usrsock: fix build warning

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #5271: net/sockif: explicit the member declaration

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016202732


   > > We need to fix this in the way that is C89 compatible
   > 
   > This PR solves the issue of the definition mismatch, The definition here is incompatible with C89 originally, I think we can make unified changes later.
   
   I do not understand "The definition here is incompatible with C89 originally". Could you please explain more?
   I see that initialization is
   ```
   const struct sock_intf_s g_usrsock_sockif =
   {
     usrsock_sockif_setup,       /* si_setup */
     usrsock_sockif_sockcaps,    /* si_sockcaps */
     usrsock_sockif_addref,      /* si_addref */
     usrsock_bind,               /* si_bind */
     usrsock_getsockname,        /* si_getsockname */
     usrsock_getpeername,        /* si_getpeername */
     usrsock_listen,             /* si_listen */
     usrsock_connect,            /* si_connect */
     usrsock_accept,             /* si_accept */
     usrsock_poll,               /* si_poll */
     usrsock_sendmsg,            /* si_sendmsg */
     usrsock_recvmsg,            /* si_recvmsg */
     usrsock_sockif_close,       /* si_close */
   #ifdef CONFIG_NET_SENDFILE
     NULL,                       /* si_sendfile */
   #endif
     usrsock_ioctl               /* si_ioctl */
   };
   ```
   that is C89 compatible. What is needed is to change it to
   ```
   const struct sock_intf_s g_usrsock_sockif =
   {
     usrsock_sockif_setup,       /* si_setup */
     usrsock_sockif_sockcaps,    /* si_sockcaps */
     usrsock_sockif_addref,      /* si_addref */
     usrsock_bind,               /* si_bind */
     usrsock_getsockname,        /* si_getsockname */
     usrsock_getpeername,        /* si_getpeername */
     usrsock_listen,             /* si_listen */
     usrsock_connect,            /* si_connect */
     usrsock_accept,             /* si_accept */
     usrsock_poll,               /* si_poll */
     usrsock_sendmsg,            /* si_sendmsg */
     usrsock_recvmsg,            /* si_recvmsg */
     usrsock_sockif_close,       /* si_close */
     usrsock_ioctl,              /* si_ioctl */
     NULL,                /* si_socketpair */
   #ifdef CONFIG_NET_SENDFILE
     , NULL                      /* si_sendfile */
   #endif
   };
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on pull request #5271: net/sockif: explicit the member declaration

Posted by GitBox <gi...@apache.org>.
anchao commented on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016223943


   ```
   pkt/pkt_sockif.c: In function ‘pkt_bind’:
   pkt/pkt_sockif.c:331:12: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
     331 |       nerr("ERROR: Invalid address length: %d < %zu\n",
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
   
   In file included from ieee802154/ieee802154_sockif.c:33:
   ieee802154/ieee802154_sockif.c: In function ‘ieee802154_bind’:
   ieee802154/ieee802154_sockif.c:370:12: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
     370 |       nerr("ERROR: Invalid family: %u or address length: %zu < %zu\n",
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
   
   bluetooth/bluetooth_sockif.c: In function ‘bluetooth_bind’:
   bluetooth/bluetooth_sockif.c:387:20: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
     387 |               nerr("ERROR: Invalid address length: %zu < %zu\n",
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   bluetooth/bluetooth_sockif.c:387:20: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
   bluetooth/bluetooth_sockif.c:401:20: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
     401 |               nerr("ERROR: Invalid address length: %zu < %zu\n",
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   bluetooth/bluetooth_sockif.c:401:20: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
   
   
   
   local/local_sockif.c: In function ‘local_bind’:
   local/local_sockif.c:277:12: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=]
     277 |       nerr("ERROR: Invalid address length: %d < %zu\n",
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   local/local_sockif.c: In function ‘local_connect’:
   local/local_sockif.c:537:2: warning: #warning is a GCC extension
     537 | #warning Missing logic
         |  ^~~~~~~
   local/local_sockif.c:537:2: warning: #warning Missing logic [-Wcpp]
   local/local_sockif.c: In function ‘local_socketpair’:
   local/local_sockif.c:772:55: warning: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘struct socket *’ [-Wformat=]
     772 |                sizeof(conns[i]->lc_path), "socketpair%p", psocks[0]);
         |                                                      ~^   ~~~~~~~~~
         |                                                       |         |
         |                                                       void *    struct socket *
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on pull request #5271: net/sockif: explicit the member declaration

Posted by GitBox <gi...@apache.org>.
anchao commented on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016190794


   > We need to fix this in the way that is C89 compatible
   
   This PR solves the issue of the definition mismatch, The definition here is incompatible with C89 originally, I think we can make unified changes later.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #5271: net/sockif: explicit the member declaration

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016226198


   > 
   
   This is unrelated to designated initialize that you propose in your PR. Let's try not to rock the boat and keep as much compatibility so the less rework is needed in future. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko edited a comment on pull request #5271: net/sockif: explicit the member declaration

Posted by GitBox <gi...@apache.org>.
pkarashchenko edited a comment on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016202732


   > > We need to fix this in the way that is C89 compatible
   > 
   > This PR solves the issue of the definition mismatch, The definition here is incompatible with C89 originally, I think we can make unified changes later.
   
   I do not understand "The definition here is incompatible with C89 originally". Could you please explain more?
   I see that initialization is
   ```
   const struct sock_intf_s g_usrsock_sockif =
   {
     usrsock_sockif_setup,       /* si_setup */
     usrsock_sockif_sockcaps,    /* si_sockcaps */
     usrsock_sockif_addref,      /* si_addref */
     usrsock_bind,               /* si_bind */
     usrsock_getsockname,        /* si_getsockname */
     usrsock_getpeername,        /* si_getpeername */
     usrsock_listen,             /* si_listen */
     usrsock_connect,            /* si_connect */
     usrsock_accept,             /* si_accept */
     usrsock_poll,               /* si_poll */
     usrsock_sendmsg,            /* si_sendmsg */
     usrsock_recvmsg,            /* si_recvmsg */
     usrsock_sockif_close,       /* si_close */
   #ifdef CONFIG_NET_SENDFILE
     NULL,                       /* si_sendfile */
   #endif
     usrsock_ioctl               /* si_ioctl */
   };
   ```
   that is C89 compatible. What is needed is to change it to
   ```
   const struct sock_intf_s g_usrsock_sockif =
   {
     usrsock_sockif_setup,       /* si_setup */
     usrsock_sockif_sockcaps,    /* si_sockcaps */
     usrsock_sockif_addref,      /* si_addref */
     usrsock_bind,               /* si_bind */
     usrsock_getsockname,        /* si_getsockname */
     usrsock_getpeername,        /* si_getpeername */
     usrsock_listen,             /* si_listen */
     usrsock_connect,            /* si_connect */
     usrsock_accept,             /* si_accept */
     usrsock_poll,               /* si_poll */
     usrsock_sendmsg,            /* si_sendmsg */
     usrsock_recvmsg,            /* si_recvmsg */
     usrsock_sockif_close,       /* si_close */
     usrsock_ioctl,              /* si_ioctl */
     NULL,                       /* si_socketpair */
   #ifdef CONFIG_NET_SENDFILE
     , NULL                      /* si_sendfile */
   #endif
   };
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko edited a comment on pull request #5271: net/sockif: explicit the member declaration

Posted by GitBox <gi...@apache.org>.
pkarashchenko edited a comment on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016226198


   > 
   
   This is unrelated to designated initializer that you propose in your PR. Let's try not to rock the boat and keep as much compatibility so the less rework is needed in future. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org