Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Nov 2014 11:37:15 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Andrew Turner <andrew@freebsd.org>
Cc:        svn-src-projects@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r274428 - projects/arm64/sys/arm64/include
Message-ID:  <20141113111122.O1052@besplex.bde.org>
In-Reply-To: <201411121319.sACDJJhI070308@svn.freebsd.org>
References:  <201411121319.sACDJJhI070308@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 12 Nov 2014, Andrew Turner wrote:

> Log:
>  Fix the values for __WCHAR_{MIN,MAX}
>
> Modified:
>  projects/arm64/sys/arm64/include/_types.h
>
> Modified: projects/arm64/sys/arm64/include/_types.h
> ==============================================================================
> --- projects/arm64/sys/arm64/include/_types.h	Wed Nov 12 12:46:57 2014	(r274427)
> +++ projects/arm64/sys/arm64/include/_types.h	Wed Nov 12 13:19:18 2014	(r274428)
> @@ -94,8 +94,8 @@ typedef	__uint64_t	__vm_pindex_t;
> typedef	__uint64_t	__vm_size_t;
> typedef	unsigned int	___wchar_t;
>
> -#define	__WCHAR_MIN	__INT_MIN	/* min value for a wchar_t */
> -#define	__WCHAR_MAX	__INT_MAX	/* max value for a wchar_t */
> +#define	__WCHAR_MIN	__UINT_MIN	/* min value for a wchar_t */
> +#define	__WCHAR_MAX	__UINT_MAX	/* max value for a wchar_t */
>
> /*
>  * Unusual type definitions.

This looks bad.

3 underscores for ___wchar_t is execessive.  All arches have this bug.  It
is not even needed to give an extra level of obfuscation below __wchar_t,
since the usual spelling __wchar_t is never used.

UINT_MIN doesn't exist.  The minimum for any unsigned type is 0, so there
is no need for a macro giving it.  __UINT_MIN shouldn't exist either.  It
doesn't exist for any other arch.

The comments on the limits are duplicated ad nauseum, except in the one
place where they might be useful -- they are duplicated for each arch
in the implementation-detail header <machine/_types.h>, but not in the
application header <wchar.h>.
   (The application header has no comments useful to users at all.  All
   of its comments are for implementation details:
   - First coptright comment
   - Second copyright comment (not properly merged)
   - 2 LONGLONG comments (markup for lint)
   - One comment on an #endif.)

In <limits.h>, the spam is a little more uniform.  Most definitions at the
top level have no comments.  However, most definitions aren't at the top
level.  Most of the STDC definitions are in the included file
<sys/limits.h>.  This has the duplicated comments, except of course it
has no comments for nonstandard macros that need comments most (LONG_BIT,
WORD_BIT and MQ_PRIO_MAX; the placement of MQ_PRIO_MAX there is just a
bug -- all other POSIX limits are in either <limits.h> or <sys/syslimits.h>,
depending on whether they are implemented used in the kernel; MQ_PRIO_MAX
is also under a broken visibility ifdef that makes it visible to all
versions of POSIX).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141113111122.O1052>