Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jan 2011 11:13:34 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217145 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include
Message-ID:  <201101081113.p08BDYhP089410@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tijl
Date: Sat Jan  8 11:13:34 2011
New Revision: 217145
URL: http://svn.freebsd.org/changeset/base/217145

Log:
  Fix types of some values in machine/_limits.h.
  
  On some architectures UCHAR_MAX and USHRT_MAX had type unsigned int.
  However, lacking integer suffixes for types smaller than int, their type
  should correspond to that of an object of type unsigned char (or short)
  when used in an expression with objects of type int. In that case unsigned
  char (short) are promoted to int (i.e. signed) so the type of UCHAR_MAX and
  USHRT_MAX should also be int.
  
  Where MIN/MAX constants implicitly have the correct type the suffix has
  been removed.
  
  While here, correct some comments.
  
  Reviewed by:	bde
  Approved by:	kib (mentor)

Modified:
  head/sys/amd64/include/_limits.h
  head/sys/arm/include/_limits.h
  head/sys/i386/include/_limits.h
  head/sys/ia64/include/_limits.h
  head/sys/mips/include/_limits.h
  head/sys/powerpc/include/_limits.h
  head/sys/sparc64/include/_limits.h
  head/sys/sun4v/include/_limits.h

Modified: head/sys/amd64/include/_limits.h
==============================================================================
--- head/sys/amd64/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/amd64/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -40,8 +40,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -49,19 +47,19 @@
 #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
 #define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
 
-#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
+#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
 
-#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
+#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 
-#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
-#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
-#define	__LONG_MIN	(-0x7fffffffffffffffL - 1) /* min for a long */
+#define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
+#define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
+#define	__LONG_MIN	(-0x7fffffffffffffff - 1) /* min for a long */
 
 			/* max value for an unsigned long long */
 #define	__ULLONG_MAX	0xffffffffffffffffULL
@@ -83,10 +81,7 @@
 #define	__LONG_BIT	64
 #define	__WORD_BIT	32
 
-/*
- * Minimum signal stack size. The current signal frame
- * for i386 is 408 bytes large.
- */
+/* Minimum signal stack size. */
 #define	__MINSIGSTKSZ	(512 * 4)
 
 #endif /* !_MACHINE__LIMITS_H_ */

Modified: head/sys/arm/include/_limits.h
==============================================================================
--- head/sys/arm/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/arm/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -40,8 +40,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -55,7 +53,7 @@
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 

Modified: head/sys/i386/include/_limits.h
==============================================================================
--- head/sys/i386/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/i386/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -40,8 +40,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -55,7 +53,7 @@
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 
@@ -83,10 +81,7 @@
 #define	__LONG_BIT	32
 #define	__WORD_BIT	32
 
-/*
- * Minimum signal stack size. The current signal frame
- * for i386 is 408 bytes large.
- */
+/* Minimum signal stack size. */
 #define	__MINSIGSTKSZ	(512 * 4)
 
 #endif /* !_MACHINE__LIMITS_H_ */

Modified: head/sys/ia64/include/_limits.h
==============================================================================
--- head/sys/ia64/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/ia64/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -42,8 +42,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -51,21 +49,21 @@
 #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
 #define	__SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
 
-#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
+#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
 
-#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
+#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff-1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff-1)	/* min value for an int */
 
-#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
-#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
-#define	__LONG_MIN	(-0x7fffffffffffffffL-1) /* min for a long */
+#define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
+#define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
+#define	__LONG_MIN	(-0x7fffffffffffffff-1) /* min for a long */
 
-/* Long longs and longs are the same size on the IA-64. */
+/* Long longs have the same size but not the same type as longs. */
 					/* max for an unsigned long long */
 #define	__ULLONG_MAX	0xffffffffffffffffULL
 #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max for a long long */

Modified: head/sys/mips/include/_limits.h
==============================================================================
--- head/sys/mips/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/mips/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -41,8 +41,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -56,14 +54,14 @@
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 
 #ifdef __LP64__
-#define	__ULONG_MAX	0xffffffffffffffffUL
-#define	__LONG_MAX	0x7fffffffffffffffL
-#define	__LONG_MIN	(-0x7fffffffffffffffL - 1)
+#define	__ULONG_MAX	0xffffffffffffffff
+#define	__LONG_MAX	0x7fffffffffffffff
+#define	__LONG_MIN	(-0x7fffffffffffffff - 1)
 #define	__LONG_BIT	64
 #else
 #define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */

Modified: head/sys/powerpc/include/_limits.h
==============================================================================
--- head/sys/powerpc/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/powerpc/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -40,8 +40,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -55,14 +53,14 @@
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 
 #ifdef __LP64__
-#define	__ULONG_MAX	0xffffffffffffffffUL
-#define	__LONG_MAX	0x7fffffffffffffffL
-#define	__LONG_MIN	(-0x7fffffffffffffffL - 1)
+#define	__ULONG_MAX	0xffffffffffffffff
+#define	__LONG_MAX	0x7fffffffffffffff
+#define	__LONG_MIN	(-0x7fffffffffffffff - 1)
 #define	__LONG_BIT	64
 #else
 #define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */

Modified: head/sys/sparc64/include/_limits.h
==============================================================================
--- head/sys/sparc64/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/sparc64/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -37,8 +37,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -46,21 +44,21 @@
 #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
 #define	__SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
 
-#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
+#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
 
-#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
+#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff-1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff-1)	/* min value for an int */
 
-#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
-#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
-#define	__LONG_MIN	(-0x7fffffffffffffffL-1) /* min for a long */
+#define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
+#define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
+#define	__LONG_MIN	(-0x7fffffffffffffff-1) /* min for a long */
 
-/* Long longs and longs are the same size on sparc64. */
+/* Long longs have the same size but not the same type as longs. */
 					/* max for an unsigned long long */
 #define	__ULLONG_MAX	0xffffffffffffffffULL
 #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max for a long long */

Modified: head/sys/sun4v/include/_limits.h
==============================================================================
--- head/sys/sun4v/include/_limits.h	Sat Jan  8 11:04:30 2011	(r217144)
+++ head/sys/sun4v/include/_limits.h	Sat Jan  8 11:13:34 2011	(r217145)
@@ -37,8 +37,6 @@
  * type converted according to the integral promotions.  The subtraction for
  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers are for the default configuration of gcc.  They work for
- * some other compilers as well, but this should not be depended on.
  */
 
 #define	__CHAR_BIT	8		/* number of bits in a char */
@@ -46,21 +44,21 @@
 #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
 #define	__SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
 
-#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
+#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
 
-#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
+#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
 #define	__SHRT_MAX	0x7fff		/* max value for a short */
 #define	__SHRT_MIN	(-0x7fff-1)	/* min value for a short */
 
-#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
+#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff-1)	/* min value for an int */
 
-#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
-#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
-#define	__LONG_MIN	(-0x7fffffffffffffffL-1) /* min for a long */
+#define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
+#define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
+#define	__LONG_MIN	(-0x7fffffffffffffff-1) /* min for a long */
 
-/* Long longs and longs are the same size on sparc64. */
+/* Long longs have the same size but not the same type as longs. */
 					/* max for an unsigned long long */
 #define	__ULLONG_MAX	0xffffffffffffffffULL
 #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max for a long long */



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