public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Dylan Yudaken <[email protected]>
Cc: Jens Axboe <[email protected]>,
	Pavel Begunkov <[email protected]>,
	Facebook Kernel Team <[email protected]>,
	io-uring Mailing List <[email protected]>,
	Ammar Faizi <[email protected]>
Subject: Re: [PATCH liburing 0/5] multishot recvmsg docs and example
Date: Wed, 27 Jul 2022 16:59:10 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 7/27/22 2:57 PM, Dylan Yudaken wrote:
> Interestingly it did not show up on the Github CI either. What flags
> are you setting for this? Maybe the CI can be expanded to include those
> flags.
> As you say its not the first time you've fixed this, or that I've done
> this.

I use the same flag with the GitHub CI. Just a small experiment here...

I compile this with default compilation flags:

#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>

int main(void)
{
         struct sockaddr_in addr = { };
         return bind(0, &addr, sizeof(addr));
}

===============================================================================

ammarfaizi2@integral2:/tmp$ gcc test.c -o test
test.c: In function ‘main’:
test.c:9:24: warning: passing argument 2 of ‘bind’ from incompatible pointer type [-Wincompatible-pointer-types]
     9 |         return bind(0, &addr, sizeof(addr));
       |                        ^~~~~
       |                        |
       |                        struct sockaddr_in *
In file included from /usr/include/netinet/in.h:23,
                  from /usr/include/arpa/inet.h:22,
                  from test.c:2:
/usr/include/x86_64-linux-gnu/sys/socket.h:112:49: note: expected ‘const struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’
   112 | extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
       |

===============================================================================

ammarfaizi2@integral2:/tmp$ clang test.c -o test
test.c:9:17: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
         return bind(0, &addr, sizeof(addr));
                        ^~~~~
/usr/include/x86_64-linux-gnu/sys/socket.h:112:49: note: passing argument to parameter '__addr' here
extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
                                                 ^
1 warning generated.

===============================================================================

Interestingly GCC also complains here, but it doesn't complain when
compiling your code. Your code only breaks my clang-13.

What is the magic behind this?

We never disable -Wincompatible-pointer-types in liburing either.
It's enabled by default.

-- 
Ammar Faizi

  reply	other threads:[~2022-07-27  9:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 12:14 [PATCH liburing 0/5] multishot recvmsg docs and example Dylan Yudaken
2022-07-26 12:14 ` [PATCH liburing 1/5] more consistent multishot recvmsg API parameter names Dylan Yudaken
2022-07-26 12:14 ` [PATCH liburing 2/5] order like functions together in liburing.h Dylan Yudaken
2022-07-26 12:15 ` [PATCH liburing 3/5] change io_uring_recvmsg_payload_length return type Dylan Yudaken
2022-07-26 12:15 ` [PATCH liburing 4/5] add documentation for multishot recvmsg Dylan Yudaken
2022-07-26 12:15 ` [PATCH liburing 5/5] add an example for a UDP server Dylan Yudaken
2022-07-26 16:23 ` [PATCH liburing 0/5] multishot recvmsg docs and example Jens Axboe
2022-07-26 16:32   ` Ammar Faizi
2022-07-26 16:40     ` Jens Axboe
2022-07-26 16:48       ` Ammar Faizi
2022-07-26 16:49         ` Jens Axboe
2022-07-27  7:57           ` Dylan Yudaken
2022-07-27  9:59             ` Ammar Faizi [this message]
2022-07-27 10:11               ` Ammar Faizi
2022-07-27 10:19                 ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox