[PATCH] Fix type inconsistencies in stdint.h

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Sat Apr 4 03:36:00 GMT 2009


On Sat, Apr 04, 2009 at 02:33:11AM +0100, Dave Korn wrote:
>
>    Hi team,
>
>  Upstream GCC just gained the ability to know all about the stdint.h types
>and limits internally.  If you're interested in the background, see
>
>    http://gcc.gnu.org/ml/gcc/2009-04/msg00000.html
>
>and thread for further reading.
>
>  I've submitted the necessary info for the cygwin GCC backend, and now the
>associated testcases show up a few bugs in our stdint.h declarations.
>Basically:-
>
>- uint32_t is "unsigned int", but UINT32_MAX is an unsigned long int constant
>(denoted by the 'UL' suffix).
>- int_least32_t is "long", where INT_LEAST32_MIN and INT_LEAST32_MAX are plain
>(unsuffixed) int constants.
>- int_fast16_t and int_fast32_t are both "long", where INT_FAST16/32_MIN/MAX
>are all plain (unsuffixed) ints.
>- intptr_t is "long" but INTPTR_MIN and INTPTR_MAX lack the "L" suffix and so
>are just ints.
>- size_t is "unsigned int" but the SIZE_MAX constant is unsigned long.
>
>  This is bad because if the value of one of these MIN or MAX limits is not of
>the correct integer type matching the integer type it is used in conjunction
>with, there will be an implicit cast operation anytime you assign the
>wrongly-typed value to a variable of the type for which it is supposed to be
>the limit.
>
>  The attached patch fixes all these by adjusting only the suffix letters.  OK
>for head?
>
>winsup/cygwin/ChangeLog
>
>	* include/stdint.h (UINT32_MAX, INT_LEAST32_MIN, INT_LEAST32_MAX,
>	INT_FAST16_MIN, INT_FAST32_MIN, INT_FAST16_MAX, INT_FAST32_MAX,
>	INTPTR_MIN, INTPTR_MAX, SIZE_MAX):  Fix integer constant suffixes.

Many of the changes introduce divergence from Linux.  Why is that?

cgf



More information about the Cygwin-patches mailing list