mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge from gnulib
This incorporates: 2017-04-14 intprops: try to avoid tickling similar bugs 2017-04-14 intprops: port to Oracle Studio 12.3 x86 * doc/misc/texinfo.tex, lib/intprops.h: Copy from gnulib.
This commit is contained in:
parent
23d3eeb798
commit
0ef7f64407
2 changed files with 32 additions and 19 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
% Load plain if necessary, i.e., if running under initex.
|
% Load plain if necessary, i.e., if running under initex.
|
||||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||||
%
|
%
|
||||||
\def\texinfoversion{2017-03-25.14}
|
\def\texinfoversion{2017-04-14.11}
|
||||||
%
|
%
|
||||||
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
|
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
|
||||||
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||||
|
|
@ -11595,6 +11595,9 @@ directory should work if nowhere else does.}
|
||||||
@def ^^M{@let^^M@secondlinenl}%
|
@def ^^M{@let^^M@secondlinenl}%
|
||||||
% Definition for a newline in the main Texinfo file.
|
% Definition for a newline in the main Texinfo file.
|
||||||
@gdef @secondlinenl{@fixbackslash}%
|
@gdef @secondlinenl{@fixbackslash}%
|
||||||
|
% In case the first line has a whole-line command on it
|
||||||
|
@let@originalparsearg@parsearg
|
||||||
|
@def@parsearg{@fixbackslash@originalparsearg}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{@catcode`@^=7 @catcode`@^^M=13%
|
{@catcode`@^=7 @catcode`@^^M=13%
|
||||||
|
|
@ -11615,6 +11618,7 @@ directory should work if nowhere else does.}
|
||||||
@catcode13=5 % regular end of line
|
@catcode13=5 % regular end of line
|
||||||
@enableemergencynewline
|
@enableemergencynewline
|
||||||
@let@c=@texinfoc
|
@let@c=@texinfoc
|
||||||
|
@let@parsearg@originalparsearg
|
||||||
% Also turn back on active characters that might appear in the input
|
% Also turn back on active characters that might appear in the input
|
||||||
% file name, in case not using a pre-dumped format.
|
% file name, in case not using a pre-dumped format.
|
||||||
@catcode`+=@active
|
@catcode`+=@active
|
||||||
|
|
|
||||||
|
|
@ -389,10 +389,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
|
||||||
(_Generic \
|
(_Generic \
|
||||||
(*(r), \
|
(*(r), \
|
||||||
signed char: \
|
signed char: \
|
||||||
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \
|
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
||||||
signed char, SCHAR_MIN, SCHAR_MAX), \
|
signed char, SCHAR_MIN, SCHAR_MAX), \
|
||||||
short int: \
|
short int: \
|
||||||
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \
|
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
||||||
short int, SHRT_MIN, SHRT_MAX), \
|
short int, SHRT_MIN, SHRT_MAX), \
|
||||||
int: \
|
int: \
|
||||||
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
||||||
|
|
@ -406,10 +406,10 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
|
||||||
#else
|
#else
|
||||||
# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
|
# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
|
||||||
(sizeof *(r) == sizeof (signed char) \
|
(sizeof *(r) == sizeof (signed char) \
|
||||||
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \
|
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
||||||
signed char, SCHAR_MIN, SCHAR_MAX) \
|
signed char, SCHAR_MIN, SCHAR_MAX) \
|
||||||
: sizeof *(r) == sizeof (short int) \
|
: sizeof *(r) == sizeof (short int) \
|
||||||
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \
|
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
||||||
short int, SHRT_MIN, SHRT_MAX) \
|
short int, SHRT_MIN, SHRT_MAX) \
|
||||||
: sizeof *(r) == sizeof (int) \
|
: sizeof *(r) == sizeof (int) \
|
||||||
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
|
||||||
|
|
@ -431,9 +431,8 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
|
||||||
|
|
||||||
/* Store the low-order bits of A <op> B into *R, where the operation
|
/* Store the low-order bits of A <op> B into *R, where the operation
|
||||||
is given by OP. Use the unsigned type UT for calculation to avoid
|
is given by OP. Use the unsigned type UT for calculation to avoid
|
||||||
overflow problems. *R's type is T, with extremal values TMIN and
|
overflow problems. *R's type is T, with extrema TMIN and TMAX.
|
||||||
TMAX. T must be a signed integer type. Return 1 if the result
|
T must be a signed integer type. Return 1 if the result overflows. */
|
||||||
overflows. */
|
|
||||||
#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
|
#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
|
||||||
(sizeof ((a) op (b)) < sizeof (t) \
|
(sizeof ((a) op (b)) < sizeof (t) \
|
||||||
? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
|
? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
|
||||||
|
|
@ -442,17 +441,27 @@ verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
|
||||||
((overflow (a, b) \
|
((overflow (a, b) \
|
||||||
|| (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
|
|| (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
|
||||||
|| (tmax) < ((a) op (b))) \
|
|| (tmax) < ((a) op (b))) \
|
||||||
? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \
|
? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
|
||||||
: (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0))
|
: (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
|
||||||
|
|
||||||
/* Return A <op> B, where the operation is given by OP. Use the
|
/* Return the low-order bits of A <op> B, where the operation is given
|
||||||
unsigned type UT for calculation to avoid overflow problems.
|
by OP. Use the unsigned type UT for calculation to avoid undefined
|
||||||
Convert the result to type T without overflow by subtracting TMIN
|
behavior on signed integer overflow, and convert the result to type T.
|
||||||
from large values before converting, and adding it afterwards.
|
UT is at least as wide as T and is no narrower than unsigned int,
|
||||||
Compilers can optimize all the operations except OP. */
|
T is two's complement, and there is no padding or trap representations.
|
||||||
#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \
|
Assume that converting UT to T yields the low-order bits, as is
|
||||||
(((ut) (a) op (ut) (b)) <= (tmax) \
|
done in all known two's-complement C compilers. E.g., see:
|
||||||
? (t) ((ut) (a) op (ut) (b)) \
|
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html
|
||||||
: ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin)))
|
|
||||||
|
According to the C standard, converting UT to T yields an
|
||||||
|
implementation-defined result or signal for values outside T's
|
||||||
|
range. However, code that works around this theoretical problem
|
||||||
|
runs afoul of a compiler bug in Oracle Studio 12.3 x86. See:
|
||||||
|
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00049.html
|
||||||
|
As the compiler bug is real, don't try to work around the
|
||||||
|
theoretical problem. */
|
||||||
|
|
||||||
|
#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \
|
||||||
|
((t) ((ut) (a) op (ut) (b)))
|
||||||
|
|
||||||
#endif /* _GL_INTPROPS_H */
|
#endif /* _GL_INTPROPS_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue