]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - include/limits.h
Further harden glibc malloc metadata against 1-byte overflows.
[thirdparty/glibc.git] / include / limits.h
index 3e9a5df88a54412c2d09eab895493b06b9b762fe..f2868b4d2f2cb6506d153e0c4c88edaef22ccce3 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2005
-   Free Software Foundation, Inc.
+/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /*
  *     ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h>
@@ -24,7 +22,8 @@
 #ifndef _LIBC_LIMITS_H_
 #define _LIBC_LIMITS_H_        1
 
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
 
 
 /* Maximum length of any multibyte character in any locale.
 # endif
 #endif
 
+/* The integer width macros are not defined by GCC's <limits.h> before
+   GCC 7, or if _GNU_SOURCE rather than
+   __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature.  */
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+# ifndef CHAR_WIDTH
+#  define CHAR_WIDTH 8
+# endif
+# ifndef SCHAR_WIDTH
+#  define SCHAR_WIDTH 8
+# endif
+# ifndef UCHAR_WIDTH
+#  define UCHAR_WIDTH 8
+# endif
+# ifndef SHRT_WIDTH
+#  define SHRT_WIDTH 16
+# endif
+# ifndef USHRT_WIDTH
+#  define USHRT_WIDTH 16
+# endif
+# ifndef INT_WIDTH
+#  define INT_WIDTH 32
+# endif
+# ifndef UINT_WIDTH
+#  define UINT_WIDTH 32
+# endif
+# ifndef LONG_WIDTH
+#  define LONG_WIDTH __WORDSIZE
+# endif
+# ifndef ULONG_WIDTH
+#  define ULONG_WIDTH __WORDSIZE
+# endif
+# ifndef LLONG_WIDTH
+#  define LLONG_WIDTH 64
+# endif
+# ifndef ULLONG_WIDTH
+#  define ULLONG_WIDTH 64
+# endif
+#endif /* Use IEC_60559_BFP_EXT.  */
+
 #ifdef __USE_POSIX
 /* POSIX adds things to <limits.h>.  */
 # include <bits/posix1_lim.h>