Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2016 19:44:28 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        svn-src-head@freebsd.org, ache@FreeBSD.org, FreeBSD Current <freebsd-current@freebsd.org>, freebsd-stable@freebsd.org
Cc:        Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r302601 - in head/sys: arm/include arm64/include [__WCHAR_MAX definition mostly]
Message-ID:  <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net>

next in thread | raw e-mail | index | archive | help
https://lists.freebsd.org/pipermail/svn-src-head/2016-July/088998.html =
shows:
> Modified: head/sys/arm/include/_types.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/arm/include/_types.h	Mon Jul 11 23:15:54 2016	=
(r302600)
> +++ head/sys/arm/include/_types.h	Tue Jul 12 00:37:48 2016	=
(r302601)
> @@ -107,7 +107,7 @@ typedef	__uint32_t	__vm_size_t;
> =20
>  typedef	unsigned int	___wchar_t;
>  #define	__WCHAR_MIN	0		/* min value for a =
wchar_t */
> -#define	__WCHAR_MAX	__UINT_MAX	/* max value for a =
wchar_t */
> +#define	__WCHAR_MAX	__INT_MAX	/* max for a wchar_t <=3D =
WINT_MAX */
> =20
>  /*
>   * Unusual type definitions.
>=20
> Modified: head/sys/arm64/include/_types.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/arm64/include/_types.h	Mon Jul 11 23:15:54 2016	=
(r302600)
> +++ head/sys/arm64/include/_types.h	Tue Jul 12 00:37:48 2016	=
(r302601)
> @@ -95,7 +95,7 @@ typedef	__uint64_t	__vm_size_t;
>  typedef	unsigned int	___wchar_t;
> =20
>  #define	__WCHAR_MIN	0		/* min value for a =
wchar_t */
> -#define	__WCHAR_MAX	__UINT_MAX	/* max value for a =
wchar_t */
> +#define	__WCHAR_MAX	__INT_MAX	/* max for a wchar_t <=3D =
WINT_MAX */
> =20
>  /*
>   * Unusual type definitions.

My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX:

A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion of =
___wchar_t (if that is distinct).
B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; not =
necessarily a valid char value
C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; not =
necessarily a valid char value

(A) and (C) seem to be violated here for __WHAR_MAX if I'm right about =
(A)-(C). [I'm not sure sure that (A)'s violation for __WCHAR_MIN here =
matters much if I got that combination right.]

As far as I know arm FreeBSD uses unsigned character types (of whatever =
width).

There is also at least one past example of Bruce Evans not objecting to =
__UINT_MAX for __WCHAR_MAX for arm:

https://lists.freebsd.org/pipermail/freebsd-arch/2012-June/012721.html =
has his only comment being. . .
> % +#ifdef __ARM_EABI__
> % +#define	__WCHAR_MIN	(0)
>=20
> Bogus parentheses.
>=20
> % +#define	__WCHAR_MAX	__UINT_MAX

(The  definitions were in a different file back then, leading to the =
ifdef use.)

You may want to check with Bruce Evans. He has good coverage of the =
various standards to be covered (that may not all agree and how/what =
FreeBSD then picks).

=3D=3D=3D
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46153340-D2F4-48BD-B738-4792BC25FA3F>