diff options
author | Joseph Myers <joseph@codesourcery.com> | 2016-09-19 12:25:36 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2016-09-19 12:25:36 +0000 |
commit | a292f45acdf0a35266e4f1dd1e51b95ca5325d2a (patch) | |
tree | f687d1f62b0aa8975876aae0025569e103845df1 /NEWS | |
parent | 455d6e4373c81da49892d39f33dc312b0c54097d (diff) | |
download | glibc-a292f45acdf0a35266e4f1dd1e51b95ca5325d2a.tar.gz |
Add <limits.h> integer width macros.
TS 18661-1 defines macros for the width of integer types, intended for
use with the fromfp functions to convert from floating-point types to
integer types of any width, in any rounding mode and with control over
whether "inexact" is raised. Such macros are, of course, more
generally useful than just with those functions.
Those macros are added to <limits.h> and <stdint.h>. This patch adds
the <limits.h> macros to glibc's header, with the <stdint.h> ones
intended to be added in a separate patch (which would add to the NEWS
entry created by this patch). I've also added these macros to GCC's
headers for GCC 7, but definitions in glibc's <limits.h> are still
useful for older GCC, for non-GNU compilers and for when it's
_GNU_SOURCE rather than __STDC_WANT_IEC_60559_BFP_EXT__ that implies
the macros should be defined since the GCC header only considers
__STDC_WANT_IEC_60559_BFP_EXT__ (and for glibc systems, the
definitions in GCC's <stdint.h> will only be used with
-ffreestanding).
Tested for x86_64 and x86.
* include/limits.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (CHAR_WIDTH): New macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (SCHAR_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UCHAR_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (SHRT_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (USHRT_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (LONG_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ULONG_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (LLONG_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ULLONG_WIDTH): Likewise.
* manual/lang.texi (Width of Type): Document these macros.
* stdlib/tst-width.c: New file.
* stdlib/Makefile (tests): Add tst-width.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -36,6 +36,10 @@ Version 2.25 fesetexcept, fetestexceptflag, fegetmode and fesetmode functions, the femode_t type and the FE_DFL_MODE macro. +* Integer width macros from TS 18661-1:2014 are added to <limits.h>: + CHAR_WIDTH, SCHAR_WIDTH, UCHAR_WIDTH, SHRT_WIDTH, USHRT_WIDTH, INT_WIDTH, + UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH. + * The <sys/quota.h> header now includes the <linux/quota.h> header. Support for the Linux quota interface which predates kernel version 2.4.22 has been removed. |