<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 14, 2015 at 6:31 AM, Ronny Chevalier <span dir="ltr"><<a href="mailto:chevalier.ronny@gmail.com" target="_blank">chevalier.ronny@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2015-03-11 4:42 GMT+01:00 Shawn Landden <<a href="mailto:shawn@churchofgit.com">shawn@churchofgit.com</a>>:<br>
> warning: pointer/integer type mismatch in conditional expression<br>
> ---<br>
> src/shared/socket-util.c | 4 ++--<br>
> 1 file changed, 2 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c<br>
> index 5820279..73e1177 100644<br>
> --- a/src/shared/socket-util.c<br>
> +++ b/src/shared/socket-util.c<br>
> @@ -475,8 +475,8 @@ int sockaddr_port(const struct sockaddr *_sa) {<br>
> return -EAFNOSUPPORT;<br>
><br>
> return ntohs(sa->sa.sa_family == AF_INET6 ?<br>
> - sa->in6.sin6_port :<br>
> - sa->in.sin_port);<br>
> + (uint16_t)sa->in6.sin6_port :<br>
> + (uint16_t)sa->in.sin_port);<br>
> }<br>
><br>
<br>
</span>Hi,<br>
<br>
I don't see any warning, and the man (man netinet_in.h) says that<br>
sin_port and sin6_port are of type in_port_t which is equivalent to<br>
uint16_t.<br></blockquote><div><br></div><div>in_port_t and in6_port_t. If the type returned by a ternary operator is not identical gcc-5 warns, even though they are both backed by uint16_t and thus there is no violation.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Maybe I'm missing something?<br>
<br>
Ronny<br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Shawn Landden</div>
</div></div>