> Date: Thu, 16 Jan 2020 10:52:06 +0100
> From: Martin Pieuchot <[email protected]>
> 
> Found while compiling sgi kernel:
> 
> /sys/netinet/igmp.c:140:22: error: implicit conversion from 'int' to 'int8_t'
>       (aka 'signed char') changes value from 148 to -108
>       [-Werror,-Wconstant-conversion]
>         ra->ipopt_list[0] = IPOPT_RA;
>                           ~ ^~~~~~~~
> /sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA'
> 
> Use an unsigned type in this case:

We sidestepped this issue by adding -Wno-constant-conversion to
CWARNFLAGS for targets that were switched to clang.  That happened for
octeon, but not for sgi and loongson.  Something needs to be fixed
there (although we may simply give up on those platforms).

Actually since loongson is mips64el, it stall has gcc as the default
compiler, so the issue won't show up there (yet).

As for your suggestion.  I think it is a bit of a mess.  I wasn't
entirely sure about the consequences of such a change for ports.
However, "Stevens" has this as "char ipopt_list[]" which means that it
was signed on some platforms and unsigned on others.  Interestingly
enough it has been int8_t since 1.1 in out tree...

> Index: netinet/ip_var.h
> ===================================================================
> RCS file: /cvs/src/sys/netinet/ip_var.h,v
> retrieving revision 1.86
> diff -u -p -r1.86 ip_var.h
> --- netinet/ip_var.h  8 Dec 2019 11:08:22 -0000       1.86
> +++ netinet/ip_var.h  16 Jan 2020 09:48:41 -0000
> @@ -92,7 +92,7 @@ struct      ipstat {
>  
>  struct ipoption {
>       struct  in_addr ipopt_dst;      /* first-hop dst if source routed */
> -     int8_t  ipopt_list[MAX_IPOPTLEN];       /* options proper */
> +     uint8_t ipopt_list[MAX_IPOPTLEN];       /* options proper */
>  };
>  
>  #ifdef _KERNEL
> 
> 

Reply via email to