Define TS 18661-1 type width macros in <limits.h> and <stdint.h>

Joseph Myers joseph@codesourcery.com
Fri Sep 9 17:01:00 GMT 2016


TS 18661-1 defines <limits.h> and <stdint.h> macros for widths of
standard integer types and the typedefs defined in, or whose limits
are defined in, <stdint.h>.  (The connection to the main
floating-point subject matter of TS 18661-1 is that these are intended
to be used with the fromfp functions to convert from floating point to
integer types of any width in any rounding direction, though these
macros may be of more general use.)

This patch implements support for these macros in GCC's <limits.h> and
<stdint.h>.  To avoid needing to implement fixincludes for system
headers where GCC wraps the system libc's <stdint.h> in hosted mode,
the test for the <stdint.h> macros uses -ffreestanding (I'll add the
macros to glibc's headers separately) - but as usual for new features
in these headers, platforms (primarily OpenBSD) that use USER_H to
avoid using GCC's headers at all will have failures until the system
headers have the feature added or appropriate fixincludes are
implemented.

The header macros are implemented using appropriate new predefined
macros, with the code avoiding defining more such macros than
necessary (so one predefined macro suffices for corresponding signed
and unsigned types, while no such predefined macros are needed for the
exact-width types such as int8_t).

Bootstrapped with no regressions on x86_64-pc-linux-gnu.  Committed.

gcc:
2016-09-09  Joseph Myers  <joseph@codesourcery.com>

	* doc/cpp.texi (__SCHAR_WIDTH__, __SHRT_WIDTH__, __INT_WIDTH__)
	(__LONG_WIDTH__, __LONG_LONG_WIDTH__, __PTRDIFF_WIDTH__)
	(__SIG_ATOMIC_WIDTH__, __SIZE_WIDTH__, __WCHAR_WIDTH__)
	(__WINT_WIDTH__, __INT_LEAST8_WIDTH__, __INT_LEAST16_WIDTH__)
	(__INT_LEAST32_WIDTH__, __INT_LEAST64_WIDTH__)
	(__INT_FAST8_WIDTH__, __INT_FAST16_WIDTH__, __INT_FAST32_WIDTH__)
	(__INT_FAST64_WIDTH__, __INTPTR_WIDTH__, __INTMAX_WIDTH__):
	Document.
	* ginclude/stdint-gcc.h [__STDC_WANT_IEC_60559_BFP_EXT__]: Define
	width macros from TS 18661-1.
	* glimits.h [__STDC_WANT_IEC_60559_BFP_EXT__]: Likewise.

gcc/c-family:
2016-09-09  Joseph Myers  <joseph@codesourcery.com>

	* c-cppbuiltin.c (builtin_define_type_width): New function.
	(builtin_define_stdint_macros, c_cpp_builtins): Define type width
	macros.

gcc/testsuite:
2016-09-09  Joseph Myers  <joseph@codesourcery.com>

	* gcc.dg/limits-width-1.c, gcc.dg/stdint-width-1.c: New tests.

Index: gcc/c-family/c-cppbuiltin.c
===================================================================
--- gcc/c-family/c-cppbuiltin.c	(revision 240043)
+++ gcc/c-family/c-cppbuiltin.c	(working copy)
@@ -54,6 +54,7 @@ static void builtin_define_stdint_macros (void);
 static void builtin_define_constants (const char *, tree);
 static void builtin_define_type_max (const char *, tree);
 static void builtin_define_type_minmax (const char *, const char *, tree);
+static void builtin_define_type_width (const char *, tree, tree);
 static void builtin_define_float_constants (const char *,
 					    const char *,
 					    const char *,
@@ -435,9 +436,15 @@ builtin_define_stdint_macros (void)
   builtin_define_constants ("__INTMAX_C", intmax_type_node);
   builtin_define_type_max ("__UINTMAX_MAX__", uintmax_type_node);
   builtin_define_constants ("__UINTMAX_C", uintmax_type_node);
+  builtin_define_type_width ("__INTMAX_WIDTH__", intmax_type_node,
+			     uintmax_type_node);
   if (sig_atomic_type_node)
-    builtin_define_type_minmax ("__SIG_ATOMIC_MIN__", "__SIG_ATOMIC_MAX__",
-				sig_atomic_type_node);
+    {
+      builtin_define_type_minmax ("__SIG_ATOMIC_MIN__", "__SIG_ATOMIC_MAX__",
+				  sig_atomic_type_node);
+      builtin_define_type_width ("__SIG_ATOMIC_WIDTH__", sig_atomic_type_node,
+				 NULL_TREE);
+    }
   if (int8_type_node)
     builtin_define_type_max ("__INT8_MAX__", int8_type_node);
   if (int16_type_node)
@@ -458,21 +465,32 @@ builtin_define_stdint_macros (void)
     {
       builtin_define_type_max ("__INT_LEAST8_MAX__", int_least8_type_node);
       builtin_define_constants ("__INT8_C", int_least8_type_node);
+      builtin_define_type_width ("__INT_LEAST8_WIDTH__", int_least8_type_node,
+				 uint_least8_type_node);
     }
   if (int_least16_type_node)
     {
       builtin_define_type_max ("__INT_LEAST16_MAX__", int_least16_type_node);
       builtin_define_constants ("__INT16_C", int_least16_type_node);
+      builtin_define_type_width ("__INT_LEAST16_WIDTH__",
+				 int_least16_type_node,
+				 uint_least16_type_node);
     }
   if (int_least32_type_node)
     {
       builtin_define_type_max ("__INT_LEAST32_MAX__", int_least32_type_node);
       builtin_define_constants ("__INT32_C", int_least32_type_node);
+      builtin_define_type_width ("__INT_LEAST32_WIDTH__",
+				 int_least32_type_node,
+				 uint_least32_type_node);
     }
   if (int_least64_type_node)
     {
       builtin_define_type_max ("__INT_LEAST64_MAX__", int_least64_type_node);
       builtin_define_constants ("__INT64_C", int_least64_type_node);
+      builtin_define_type_width ("__INT_LEAST64_WIDTH__",
+				 int_least64_type_node,
+				 uint_least64_type_node);
     }
   if (uint_least8_type_node)
     {
@@ -495,13 +513,29 @@ builtin_define_stdint_macros (void)
       builtin_define_constants ("__UINT64_C", uint_least64_type_node);
     }
   if (int_fast8_type_node)
-    builtin_define_type_max ("__INT_FAST8_MAX__", int_fast8_type_node);
+    {
+      builtin_define_type_max ("__INT_FAST8_MAX__", int_fast8_type_node);
+      builtin_define_type_width ("__INT_FAST8_WIDTH__", int_fast8_type_node,
+				 uint_fast8_type_node);
+    }
   if (int_fast16_type_node)
-    builtin_define_type_max ("__INT_FAST16_MAX__", int_fast16_type_node);
+    {
+      builtin_define_type_max ("__INT_FAST16_MAX__", int_fast16_type_node);
+      builtin_define_type_width ("__INT_FAST16_WIDTH__", int_fast16_type_node,
+				 uint_fast16_type_node);
+    }
   if (int_fast32_type_node)
-    builtin_define_type_max ("__INT_FAST32_MAX__", int_fast32_type_node);
+    {
+      builtin_define_type_max ("__INT_FAST32_MAX__", int_fast32_type_node);
+      builtin_define_type_width ("__INT_FAST32_WIDTH__", int_fast32_type_node,
+				 uint_fast32_type_node);
+    }
   if (int_fast64_type_node)
-    builtin_define_type_max ("__INT_FAST64_MAX__", int_fast64_type_node);
+    {
+      builtin_define_type_max ("__INT_FAST64_MAX__", int_fast64_type_node);
+      builtin_define_type_width ("__INT_FAST64_WIDTH__", int_fast64_type_node,
+				 uint_fast64_type_node);
+    }
   if (uint_fast8_type_node)
     builtin_define_type_max ("__UINT_FAST8_MAX__", uint_fast8_type_node);
   if (uint_fast16_type_node)
@@ -511,7 +545,11 @@ builtin_define_stdint_macros (void)
   if (uint_fast64_type_node)
     builtin_define_type_max ("__UINT_FAST64_MAX__", uint_fast64_type_node);
   if (intptr_type_node)
-    builtin_define_type_max ("__INTPTR_MAX__", intptr_type_node);
+    {
+      builtin_define_type_max ("__INTPTR_MAX__", intptr_type_node);
+      builtin_define_type_width ("__INTPTR_WIDTH__", intptr_type_node,
+				 uintptr_type_node);
+    }
   if (uintptr_type_node)
     builtin_define_type_max ("__UINTPTR_MAX__", uintptr_type_node);
 }
@@ -946,6 +984,24 @@ c_cpp_builtins (cpp_reader *pfile)
   builtin_define_type_max ("__PTRDIFF_MAX__", ptrdiff_type_node);
   builtin_define_type_max ("__SIZE_MAX__", size_type_node);
 
+  /* These are needed for TS 18661-1.  */
+  builtin_define_type_width ("__SCHAR_WIDTH__", signed_char_type_node,
+			     unsigned_char_type_node);
+  builtin_define_type_width ("__SHRT_WIDTH__", short_integer_type_node,
+			     short_unsigned_type_node);
+  builtin_define_type_width ("__INT_WIDTH__", integer_type_node,
+			     unsigned_type_node);
+  builtin_define_type_width ("__LONG_WIDTH__", long_integer_type_node,
+			     long_unsigned_type_node);
+  builtin_define_type_width ("__LONG_LONG_WIDTH__",
+			     long_long_integer_type_node,
+			     long_long_unsigned_type_node);
+  builtin_define_type_width ("__WCHAR_WIDTH__", underlying_wchar_type_node,
+			     NULL_TREE);
+  builtin_define_type_width ("__WINT_WIDTH__", wint_type_node, NULL_TREE);
+  builtin_define_type_width ("__PTRDIFF_WIDTH__", ptrdiff_type_node, NULL_TREE);
+  builtin_define_type_width ("__SIZE_WIDTH__", size_type_node, NULL_TREE);
+
   if (c_dialect_cxx ())
     for (i = 0; i < NUM_INT_N_ENTS; i ++)
       if (int_n_enabled_p[i])
@@ -1693,4 +1749,15 @@ builtin_define_type_minmax (const char *min_macro,
     }
 }
 
+/* Define WIDTH_MACRO for the width of TYPE.  If TYPE2 is not NULL,
+   both types must have the same width.  */
+
+static void
+builtin_define_type_width (const char *width_macro, tree type, tree type2)
+{
+  if (type2 != NULL_TREE)
+    gcc_assert (TYPE_PRECISION (type) == TYPE_PRECISION (type2));
+  builtin_define_with_int_value (width_macro, TYPE_PRECISION (type));
+}
+
 #include "gt-c-family-c-cppbuiltin.h"
Index: gcc/doc/cpp.texi
===================================================================
--- gcc/doc/cpp.texi	(revision 240043)
+++ gcc/doc/cpp.texi	(working copy)
@@ -2247,6 +2247,33 @@ these macros directly; instead, include the approp
 of these macros may not be defined on particular systems if GCC does
 not provide a @file{stdint.h} header on those systems.
 
+@item __SCHAR_WIDTH__
+@itemx __SHRT_WIDTH__
+@itemx __INT_WIDTH__
+@itemx __LONG_WIDTH__
+@itemx __LONG_LONG_WIDTH__
+@itemx __PTRDIFF_WIDTH__
+@itemx __SIG_ATOMIC_WIDTH__
+@itemx __SIZE_WIDTH__
+@itemx __WCHAR_WIDTH__
+@itemx __WINT_WIDTH__
+@itemx __INT_LEAST8_WIDTH__
+@itemx __INT_LEAST16_WIDTH__
+@itemx __INT_LEAST32_WIDTH__
+@itemx __INT_LEAST64_WIDTH__
+@itemx __INT_FAST8_WIDTH__
+@itemx __INT_FAST16_WIDTH__
+@itemx __INT_FAST32_WIDTH__
+@itemx __INT_FAST64_WIDTH__
+@itemx __INTPTR_WIDTH__
+@itemx __INTMAX_WIDTH__
+Defined to the widths of the corresponding types.  They exist to make
+the implementations of @file{limits.h} and @file{stdint.h} make
+correctly.  You should not use these macros directly; instead, include
+the appropriate headers.  Some of these macros may not be defined on
+particular systems if GCC does not provide a @file{stdint.h} header on
+those systems.
+
 @item __SIZEOF_INT__
 @itemx __SIZEOF_LONG__
 @itemx __SIZEOF_LONG_LONG__
Index: gcc/ginclude/stdint-gcc.h
===================================================================
--- gcc/ginclude/stdint-gcc.h	(revision 240043)
+++ gcc/ginclude/stdint-gcc.h	(working copy)
@@ -260,4 +260,105 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 #endif /* (!defined __cplusplus || __cplusplus >= 201103L
 	   || defined __STDC_CONSTANT_MACROS) */
 
+#ifdef __STDC_WANT_IEC_60559_BFP_EXT__
+/* TS 18661-1 widths of integer types.  */
+
+#ifdef __INT8_TYPE__
+# undef INT8_WIDTH
+# define INT8_WIDTH 8
+#endif
+#ifdef __UINT8_TYPE__
+# undef UINT8_WIDTH
+# define UINT8_WIDTH 8
+#endif
+#ifdef __INT16_TYPE__
+# undef INT16_WIDTH
+# define INT16_WIDTH 16
+#endif
+#ifdef __UINT16_TYPE__
+# undef UINT16_WIDTH
+# define UINT16_WIDTH 16
+#endif
+#ifdef __INT32_TYPE__
+# undef INT32_WIDTH
+# define INT32_WIDTH 32
+#endif
+#ifdef __UINT32_TYPE__
+# undef UINT32_WIDTH
+# define UINT32_WIDTH 32
+#endif
+#ifdef __INT64_TYPE__
+# undef INT64_WIDTH
+# define INT64_WIDTH 64
+#endif
+#ifdef __UINT64_TYPE__
+# undef UINT64_WIDTH
+# define UINT64_WIDTH 64
+#endif
+
+#undef INT_LEAST8_WIDTH
+#define INT_LEAST8_WIDTH __INT_LEAST8_WIDTH__
+#undef UINT_LEAST8_WIDTH
+#define UINT_LEAST8_WIDTH __INT_LEAST8_WIDTH__
+#undef INT_LEAST16_WIDTH
+#define INT_LEAST16_WIDTH __INT_LEAST16_WIDTH__
+#undef UINT_LEAST16_WIDTH
+#define UINT_LEAST16_WIDTH __INT_LEAST16_WIDTH__
+#undef INT_LEAST32_WIDTH
+#define INT_LEAST32_WIDTH __INT_LEAST32_WIDTH__
+#undef UINT_LEAST32_WIDTH
+#define UINT_LEAST32_WIDTH __INT_LEAST32_WIDTH__
+#undef INT_LEAST64_WIDTH
+#define INT_LEAST64_WIDTH __INT_LEAST64_WIDTH__
+#undef UINT_LEAST64_WIDTH
+#define UINT_LEAST64_WIDTH __INT_LEAST64_WIDTH__
+
+#undef INT_FAST8_WIDTH
+#define INT_FAST8_WIDTH __INT_FAST8_WIDTH__
+#undef UINT_FAST8_WIDTH
+#define UINT_FAST8_WIDTH __INT_FAST8_WIDTH__
+#undef INT_FAST16_WIDTH
+#define INT_FAST16_WIDTH __INT_FAST16_WIDTH__
+#undef UINT_FAST16_WIDTH
+#define UINT_FAST16_WIDTH __INT_FAST16_WIDTH__
+#undef INT_FAST32_WIDTH
+#define INT_FAST32_WIDTH __INT_FAST32_WIDTH__
+#undef UINT_FAST32_WIDTH
+#define UINT_FAST32_WIDTH __INT_FAST32_WIDTH__
+#undef INT_FAST64_WIDTH
+#define INT_FAST64_WIDTH __INT_FAST64_WIDTH__
+#undef UINT_FAST64_WIDTH
+#define UINT_FAST64_WIDTH __INT_FAST64_WIDTH__
+
+#ifdef __INTPTR_TYPE__
+# undef INTPTR_WIDTH
+# define INTPTR_WIDTH __INTPTR_WIDTH__
+#endif
+#ifdef __UINTPTR_TYPE__
+# undef UINTPTR_WIDTH
+# define UINTPTR_WIDTH __INTPTR_WIDTH__
+#endif
+
+#undef INTMAX_WIDTH
+#define INTMAX_WIDTH __INTMAX_WIDTH__
+#undef UINTMAX_WIDTH
+#define UINTMAX_WIDTH __INTMAX_WIDTH__
+
+#undef PTRDIFF_WIDTH
+#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__
+
+#undef SIG_ATOMIC_WIDTH
+#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
+
+#undef SIZE_WIDTH
+#define SIZE_WIDTH __SIZE_WIDTH__
+
+#undef WCHAR_WIDTH
+#define WCHAR_WIDTH __WCHAR_WIDTH__
+
+#undef WINT_WIDTH
+#define WINT_WIDTH __WINT_WIDTH__
+
+#endif
+
 #endif /* _GCC_STDINT_H */
Index: gcc/glimits.h
===================================================================
--- gcc/glimits.h	(revision 240043)
+++ gcc/glimits.h	(working copy)
@@ -123,4 +123,30 @@ see the files COPYING3 and COPYING.RUNTIME respect
 # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
 #endif
 
+#ifdef __STDC_WANT_IEC_60559_BFP_EXT__
+/* TS 18661-1 widths of integer types.  */
+# undef CHAR_WIDTH
+# define CHAR_WIDTH __SCHAR_WIDTH__
+# undef SCHAR_WIDTH
+# define SCHAR_WIDTH __SCHAR_WIDTH__
+# undef UCHAR_WIDTH
+# define UCHAR_WIDTH __SCHAR_WIDTH__
+# undef SHRT_WIDTH
+# define SHRT_WIDTH __SHRT_WIDTH__
+# undef USHRT_WIDTH
+# define USHRT_WIDTH __SHRT_WIDTH__
+# undef INT_WIDTH
+# define INT_WIDTH __INT_WIDTH__
+# undef UINT_WIDTH
+# define UINT_WIDTH __INT_WIDTH__
+# undef LONG_WIDTH
+# define LONG_WIDTH __LONG_WIDTH__
+# undef ULONG_WIDTH
+# define ULONG_WIDTH __LONG_WIDTH__
+# undef LLONG_WIDTH
+# define LLONG_WIDTH __LONG_LONG_WIDTH__
+# undef ULLONG_WIDTH
+# define ULLONG_WIDTH __LONG_LONG_WIDTH__
+#endif
+
 #endif /* _LIMITS_H___ */
Index: gcc/testsuite/gcc.dg/limits-width-1.c
===================================================================
--- gcc/testsuite/gcc.dg/limits-width-1.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/limits-width-1.c	(working copy)
@@ -0,0 +1,55 @@
+/* Test TS 18661-1 width macros in <limits.h>.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+#define __STDC_WANT_IEC_60559_BFP_EXT__
+#include <limits.h>
+
+#define CHECK_WIDTH(TYPE, MAX, WIDTH)					\
+  _Static_assert ((MAX >> ((TYPE) -1 < 0 ? (WIDTH - 2) : (WIDTH - 1))) == 1, \
+		  "width must match type")
+
+#ifndef CHAR_WIDTH
+# error "missing CHAR_WIDTH"
+#endif
+CHECK_WIDTH (char, CHAR_MAX, CHAR_WIDTH);
+#ifndef SCHAR_WIDTH
+# error "missing SCHAR_WIDTH"
+#endif
+CHECK_WIDTH (signed char, SCHAR_MAX, SCHAR_WIDTH);
+#ifndef UCHAR_WIDTH
+# error "missing UCHAR_WIDTH"
+#endif
+CHECK_WIDTH (unsigned char, UCHAR_MAX, UCHAR_WIDTH);
+#ifndef SHRT_WIDTH
+# error "missing SHRT_WIDTH"
+#endif
+CHECK_WIDTH (signed short, SHRT_MAX, SHRT_WIDTH);
+#ifndef USHRT_WIDTH
+# error "missing USHRT_WIDTH"
+#endif
+CHECK_WIDTH (unsigned short, USHRT_MAX, USHRT_WIDTH);
+#ifndef INT_WIDTH
+# error "missing INT_WIDTH"
+#endif
+CHECK_WIDTH (signed int, INT_MAX, INT_WIDTH);
+#ifndef UINT_WIDTH
+# error "missing UINT_WIDTH"
+#endif
+CHECK_WIDTH (unsigned int, UINT_MAX, UINT_WIDTH);
+#ifndef LONG_WIDTH
+# error "missing LONG_WIDTH"
+#endif
+CHECK_WIDTH (signed long, LONG_MAX, LONG_WIDTH);
+#ifndef ULONG_WIDTH
+# error "missing ULONG_WIDTH"
+#endif
+CHECK_WIDTH (unsigned long, ULONG_MAX, ULONG_WIDTH);
+#ifndef LLONG_WIDTH
+# error "missing LLONG_WIDTH"
+#endif
+CHECK_WIDTH (signed long long, LLONG_MAX, LLONG_WIDTH);
+#ifndef ULLONG_WIDTH
+# error "missing ULLONG_WIDTH"
+#endif
+CHECK_WIDTH (unsigned long long, ULLONG_MAX, ULLONG_WIDTH);
Index: gcc/testsuite/gcc.dg/stdint-width-1.c
===================================================================
--- gcc/testsuite/gcc.dg/stdint-width-1.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/stdint-width-1.c	(working copy)
@@ -0,0 +1,175 @@
+/* Test TS 18661-1 width macros in <stdint.h>.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -ffreestanding" } */
+
+#include <stddef.h>
+#define __STDC_WANT_IEC_60559_BFP_EXT__
+#include <stdint.h>
+#ifndef SIGNAL_SUPPRESS
+#include <signal.h>
+#endif
+typedef __WINT_TYPE__ wint_t;
+
+#define CHECK_WIDTH(TYPE, MAX, WIDTH)					\
+  _Static_assert ((MAX >> ((TYPE) -1 < 0 ? (WIDTH - 2) : (WIDTH - 1))) == 1, \
+		  "width must match type")
+
+#ifdef INT8_MAX
+# ifndef INT8_WIDTH
+#  error "missing INT8_WIDTH"
+# endif
+CHECK_WIDTH (int8_t, INT8_MAX, INT8_WIDTH);
+#endif
+#ifdef INT16_MAX
+# ifndef INT16_WIDTH
+#  error "missing INT16_WIDTH"
+# endif
+CHECK_WIDTH (int16_t, INT16_MAX, INT16_WIDTH);
+#endif
+#ifdef INT32_MAX
+# ifndef INT32_WIDTH
+#  error "missing INT32_WIDTH"
+# endif
+CHECK_WIDTH (int32_t, INT32_MAX, INT32_WIDTH);
+#endif
+#ifdef INT64_MAX
+# ifndef INT64_WIDTH
+#  error "missing INT64_WIDTH"
+# endif
+CHECK_WIDTH (int64_t, INT64_MAX, INT64_WIDTH);
+#endif
+#ifdef UINT8_MAX
+# ifndef UINT8_WIDTH
+#  error "missing UINT8_WIDTH"
+# endif
+CHECK_WIDTH (uint8_t, UINT8_MAX, UINT8_WIDTH);
+#endif
+#ifdef UINT16_MAX
+# ifndef UINT16_WIDTH
+#  error "missing UINT16_WIDTH"
+# endif
+CHECK_WIDTH (uint16_t, UINT16_MAX, UINT16_WIDTH);
+#endif
+#ifdef UINT32_MAX
+# ifndef UINT32_WIDTH
+#  error "missing UINT32_WIDTH"
+# endif
+CHECK_WIDTH (uint32_t, UINT32_MAX, UINT32_WIDTH);
+#endif
+#ifdef UINT64_MAX
+# ifndef UINT64_WIDTH
+#  error "missing UINT64_WIDTH"
+# endif
+CHECK_WIDTH (uint64_t, UINT64_MAX, UINT64_WIDTH);
+#endif
+
+#ifndef INT_LEAST8_WIDTH
+# error "missing INT_LEAST8_WIDTH"
+#endif
+CHECK_WIDTH (int_least8_t, INT_LEAST8_MAX, INT_LEAST8_WIDTH);
+#ifndef INT_LEAST16_WIDTH
+# error "missing INT_LEAST16_WIDTH"
+#endif
+CHECK_WIDTH (int_least16_t, INT_LEAST16_MAX, INT_LEAST16_WIDTH);
+#ifndef INT_LEAST32_WIDTH
+# error "missing INT_LEAST32_WIDTH"
+#endif
+CHECK_WIDTH (int_least32_t, INT_LEAST32_MAX, INT_LEAST32_WIDTH);
+#ifndef INT_LEAST64_WIDTH
+# error "missing INT_LEAST64_WIDTH"
+#endif
+CHECK_WIDTH (int_least64_t, INT_LEAST64_MAX, INT_LEAST64_WIDTH);
+#ifndef INT_LEAST8_WIDTH
+# error "missing INT_LEAST8_WIDTH"
+#endif
+CHECK_WIDTH (uint_least8_t, UINT_LEAST8_MAX, UINT_LEAST8_WIDTH);
+#ifndef UINT_LEAST16_WIDTH
+# error "missing UINT_LEAST16_WIDTH"
+#endif
+CHECK_WIDTH (uint_least16_t, UINT_LEAST16_MAX, UINT_LEAST16_WIDTH);
+#ifndef UINT_LEAST32_WIDTH
+# error "missing UINT_LEAST32_WIDTH"
+#endif
+CHECK_WIDTH (uint_least32_t, UINT_LEAST32_MAX, UINT_LEAST32_WIDTH);
+#ifndef UINT_LEAST64_WIDTH
+# error "missing UINT_LEAST64_WIDTH"
+#endif
+CHECK_WIDTH (uint_least64_t, UINT_LEAST64_MAX, UINT_LEAST64_WIDTH);
+
+#ifndef INT_FAST8_WIDTH
+# error "missing INT_FAST8_WIDTH"
+#endif
+CHECK_WIDTH (int_fast8_t, INT_FAST8_MAX, INT_FAST8_WIDTH);
+#ifndef INT_FAST16_WIDTH
+# error "missing INT_FAST16_WIDTH"
+#endif
+CHECK_WIDTH (int_fast16_t, INT_FAST16_MAX, INT_FAST16_WIDTH);
+#ifndef INT_FAST32_WIDTH
+# error "missing INT_FAST32_WIDTH"
+#endif
+CHECK_WIDTH (int_fast32_t, INT_FAST32_MAX, INT_FAST32_WIDTH);
+#ifndef INT_FAST64_WIDTH
+# error "missing INT_FAST64_WIDTH"
+#endif
+CHECK_WIDTH (int_fast64_t, INT_FAST64_MAX, INT_FAST64_WIDTH);
+#ifndef INT_FAST8_WIDTH
+# error "missing INT_FAST8_WIDTH"
+#endif
+CHECK_WIDTH (uint_fast8_t, UINT_FAST8_MAX, UINT_FAST8_WIDTH);
+#ifndef UINT_FAST16_WIDTH
+# error "missing UINT_FAST16_WIDTH"
+#endif
+CHECK_WIDTH (uint_fast16_t, UINT_FAST16_MAX, UINT_FAST16_WIDTH);
+#ifndef UINT_FAST32_WIDTH
+# error "missing UINT_FAST32_WIDTH"
+#endif
+CHECK_WIDTH (uint_fast32_t, UINT_FAST32_MAX, UINT_FAST32_WIDTH);
+#ifndef UINT_FAST64_WIDTH
+# error "missing UINT_FAST64_WIDTH"
+#endif
+CHECK_WIDTH (uint_fast64_t, UINT_FAST64_MAX, UINT_FAST64_WIDTH);
+
+#ifdef INTPTR_MAX
+# ifndef INTPTR_WIDTH
+#  error "missing INTPTR_WIDTH"
+# endif
+CHECK_WIDTH (intptr_t, INTPTR_MAX, INTPTR_WIDTH);
+#endif
+#ifdef UINTPTR_MAX
+# ifndef UINTPTR_WIDTH
+#  error "missing UINTPTR_WIDTH"
+# endif
+CHECK_WIDTH (uintptr_t, UINTPTR_MAX, UINTPTR_WIDTH);
+#endif
+
+#ifndef INTMAX_WIDTH
+# error "missing INTMAX_WIDTH"
+#endif
+CHECK_WIDTH (intmax_t, INTMAX_MAX, INTMAX_WIDTH);
+#ifndef UINTMAX_WIDTH
+# error "missing UINTMAX_WIDTH"
+#endif
+CHECK_WIDTH (uintmax_t, UINTMAX_MAX, UINTMAX_WIDTH);
+
+#ifndef PTRDIFF_WIDTH
+# error "missing PTRDIFF_WIDTH"
+#endif
+CHECK_WIDTH (ptrdiff_t, PTRDIFF_MAX, PTRDIFF_WIDTH);
+#ifndef SIGNAL_SUPPRESS
+# ifndef SIG_ATOMIC_WIDTH
+#  error "missing SIG_ATOMIC_WIDTH"
+# endif
+CHECK_WIDTH (sig_atomic_t, SIG_ATOMIC_MAX, SIG_ATOMIC_WIDTH);
+#endif
+#ifndef SIZE_WIDTH
+# error "missing SIZE_WIDTH"
+#endif
+CHECK_WIDTH (size_t, SIZE_MAX, SIZE_WIDTH);
+#ifndef WCHAR_WIDTH
+# error "missing WCHAR_WIDTH"
+#endif
+CHECK_WIDTH (wchar_t, WCHAR_MAX, WCHAR_WIDTH);
+#ifndef WINT_WIDTH
+# error "missing WINT_WIDTH"
+#endif
+CHECK_WIDTH (wint_t, WINT_MAX, WINT_WIDTH);

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list