Date: Sat, 2 Jun 2007 14:17:12 GMT From: Kiyoshi Matsui<kmatsui@t3.rim.or.jp> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/113256: _limits.h for some CPU has wrong definitions of __UCHAR_MAX and __USHRT_MAX Message-ID: <200706021417.l52EHCdo097895@www.freebsd.org> Resent-Message-ID: <200706021420.l52EKIG7003322@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 113256 >Category: misc >Synopsis: _limits.h for some CPU has wrong definitions of __UCHAR_MAX and __USHRT_MAX >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jun 02 14:20:18 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Kiyoshi Matsui >Release: none (I use FreeBSD 6.2 on i386) >Organization: none >Environment: none >Description: /usr/src/sys/amd64/include/_limits.h and www.freebsd.org/cgi/cvsweb.cgi/src/sys/amd64/include/_limits.h have wrong definitions of __UCHAR_MAX and __USHRT_MAX as: #define __UCHAR_MAX 0xffU #define __USHRT_MAX 0xffffU The following header files also have the same wrong definitions. /usr/src/sys/alpha/include/_limits.h /usr/src/sys/ia64/include/_limits.h /usr/src/sys/sparc64/include/_limits.h and www.freebsd.org/cgi/cvsweb.cgi/src/sys/ia64/include/_limits.h www.freebsd.org/cgi/cvsweb.cgi/src/sys/sparc64/include/_limits.h (alpha support was removed) These definitions may be used to define UCHAR_MAX and USHRT_MAX respectively, in /usr/include/limits.h, on the FreeBSD system of the corresponding CPU, hence UCHAR_MAX and USHRT_MAX are wrongly defined. My port devel/mcpp (mcpp-2.6.4) was reported to fail to be built on amd64: http://pointyhat.freebsd.org This is not a bug of mcpp, it is a bug of _limits.h of amd64 and others. >How-To-Repeat: >Fix: __UCHAR_MAX and __USHRT_MAX should be defined as: #define __UCHAR_MAX 0xff #define __USHRT_MAX 0xffff In other words, 'U' suffix of '0xffU' and '0xffffU' should be removed. On the other hand, the following headers have right definitions. /usr/include/machine/_limits.h on i386 system /usr/src/sys/i386/include/_limits.h and www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/include/_limits.h Also _limits.h for arm and sparc64 have right definitions of these macros as well as the one for i386. UCHAR_MAX and USHRT_MAX should be defined so as to be promoted to 'int', if 'int' can represent all the values of 'unsigned char' and 'unsigned short' respectively. These should not be promoted to 'unsigned int'. For further informations see the following document of mine. http://mcpp.svn.sourceforge.net/viewvc/*checkout*/mcpp/trunk/doc/cpp-test.html#5.1.3 >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706021417.l52EHCdo097895>