Merge from gnulib.

This incorporates:
2015-10-30 intprops: add WRAPV and const flavors for GCC 5
2015-10-25 stdalign: port to Sun C 5.9
* doc/misc/texinfo.tex, lib/intprops.h, lib/stdalign.in.h:
Copy from gnulib.
This commit is contained in:
Paul Eggert 2015-10-30 19:21:29 -07:00
parent e11aaee266
commit b059c6b584
3 changed files with 417 additions and 77 deletions

View file

@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2015-10-17.11}
\def\texinfoversion{2015-10-29.16}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@ -4685,7 +4685,6 @@
% The space after the comma will end up in the temporary definition
% that we make for arg2 (see \parsemargdef ff.). We want all this to be
% expanded for the sake of the index, so we end up just seeing "bar".
\let\xeatspaces = \eatspaces
\let\xprocessmacroarg\eatspaces
}
@ -5229,7 +5228,7 @@
}
\def\entrybreak{\unskip\space\ignorespaces}%
\def\doentry{%
% Save the text of the entry in a \vtop.
% Save the text of the entry
\global\setbox\boxA=\hbox\bgroup
\bgroup % Instead of the swallowed brace.
\noindent
@ -5245,10 +5244,9 @@
\global\setbox\boxA=\hbox\bgroup\unhbox\boxA
% #1 is the page number.
%
% The following is kludged to not output a line of dots in the index if
% there are no page numbers. The next person who breaks this will be
% cursed by a Unix daemon.
\setbox\boxB = \hbox{#1}%
% Get the width of the page numbers, and only use
% leaders if they are present.
\global\setbox\boxB = \hbox{#1}%
\ifdim\wd\boxB = 0pt
\null\nobreak\hfill\ %
\else
@ -5263,56 +5261,67 @@
\fi
\fi
\egroup % end \boxA
\global\setbox\entryindexbox=\vtop\bgroup\noindent
% We want the text of the entries to be aligned to the left, and the
% page numbers to be aligned to the right.
%
\advance\leftskip by 0pt plus 1fil
\advance\leftskip by 0pt plus -1fill
\rightskip = 0pt plus -1fil
\advance\rightskip by 0pt plus 1fill
% Cause last line, which could consist of page numbers on their own if the
% list of page numbers is long, to be aligned to the right.
\parfillskip=0pt plus -1fill
%
\hangindent=1em
%
\advance\rightskip by \entryrightmargin
% Determine how far we can stretch into the margin.
% This allows, e.g., "Appendix H GNU Free Documentation License" to fit
% on one line.
\advance \parfillskip by 0pt minus .6\entryrightmargin
%
\ifdim\wd\boxA > \hsize % If the entry doesn't fit in one line
\ifdim\dimen@ > 0.9\hsize % due to long index text
\dimen@ = 0.6\dimen@ % Try to split the text roughly evenly
\dimen@ii = \hsize
\advance \dimen@ii by -1em
\ifnum\dimen@>\dimen@ii
% If the entry is too long, use the whole line
\dimen@ = \dimen@ii
\ifdim\wd\boxB = 0pt
\global\setbox\entryindexbox=\box\boxA
\else
\global\setbox\entryindexbox=\vbox\bgroup\noindent
% We want the text of the entries to be aligned to the left, and the
% page numbers to be aligned to the right.
%
\advance\leftskip by 0pt plus 1fil
\advance\leftskip by 0pt plus -1fill
\rightskip = 0pt plus -1fil
\advance\rightskip by 0pt plus 1fill
% Cause last line, which could consist of page numbers on their own
% if the list of page numbers is long, to be aligned to the right.
\parfillskip=0pt plus -1fill
%
\hangindent=1em
%
\advance\rightskip by \entryrightmargin
% Determine how far we can stretch into the margin.
% This allows, e.g., "Appendix H GNU Free Documentation License" to
% fit on one line in @letterpaper format.
\ifdim\entryrightmargin>2.1em
\dimen@i=2.1em
\else
% Cause stretch of 1fill at the end of the first line, to avoid
% extra spacing in a short first line.
\hskip 0pt plus 1fill
\dimen@i=0em
\fi
\parshape = 2 0pt \dimen@ 1em \dimen@ii
% Ideally we'd add a finite glue at the end of the first line only, but
% TeX doesn't seem to provide a way to do such a thing.
\fi\fi
\unhbox\boxA
%
% Do not prefer a separate line ending with a hyphen to fewer lines.
\finalhyphendemerits = 0
%
% Word spacing - no stretch
\spaceskip=\fontdimen2\font minus \fontdimen4\font
%
\linepenalty=1000 % Discourage line breaks.
\hyphenpenalty=10000 % Discourage hyphenation.
%
\par % format the paragraph
\egroup % The \vtop
\advance \parfillskip by 0pt minus 1\dimen@i
%
\dimen@ii = \hsize
\advance\dimen@ii by -1\leftskip
\advance\dimen@ii by -1\entryrightmargin
\advance\dimen@ii by 1\dimen@i
\ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
\ifdim\dimen@ > 0.8\dimen@ii % due to long index text
\dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
\dimen@ii = \hsize
\advance \dimen@ii by -1em
\ifnum\dimen@>\dimen@ii
% If the entry is too long, use the whole line
\dimen@ = \dimen@ii
\fi
\advance\leftskip by 0pt plus 1fill % ragged right
\advance \dimen@ by 1\rightskip
\parshape = 2 0pt \dimen@ 1em \dimen@ii
% Ideally we'd add a finite glue at the end of the first line only, but
% TeX doesn't seem to provide a way to do such a thing.
\fi\fi
\unhbox\boxA
%
% Do not prefer a separate line ending with a hyphen to fewer lines.
\finalhyphendemerits = 0
%
% Word spacing - no stretch
\spaceskip=\fontdimen2\font minus \fontdimen4\font
%
\linepenalty=1000 % Discourage line breaks.
\hyphenpenalty=5000 % Discourage hyphenation.
%
\par % format the paragraph
\egroup % The \vbox
\fi
\endgroup
% delay text of entry until after penalty
\bgroup\aftergroup\insertindexentrybox
@ -5324,8 +5333,8 @@
\newbox\entryindexbox
\def\insertindexentrybox{%
\lineskip=.8ex plus .6ex % This comes into effect when the \vtop has a large
% depth due to the paragraph in it having several
\lineskip=.7ex plus .5ex % This comes into effect when the \vbox has a large
% height due to the paragraph in it having several
% lines.
\box\entryindexbox}
@ -5382,6 +5391,8 @@
\newbox\partialpage
\newdimen\doublecolumnhsize
\newdimen\doublecolumntopgap
\doublecolumntopgap = 0pt
\newtoks\savedtopmark % Used in \begindoublecolumns
\newtoks\savedfirstmark
@ -5449,7 +5460,11 @@
%
% Double the \vsize as well. (We don't need a separate register here,
% since nobody clobbers \vsize.)
\global\doublecolumntopgap = \topskip
\global\advance\doublecolumntopgap by -1\baselineskip
\global\advance\vsize by -1\doublecolumntopgap
\vsize = 2\vsize
\topskip=0pt
}
% The double-column output routine for all double-column pages except
@ -5478,10 +5493,13 @@
%
\hsize = \doublecolumnhsize
\wd0=\hsize \wd2=\hsize
\hbox to\pagewidth{\box0\hfil\box2}%
\vbox{%
\vskip\doublecolumntopgap
\hbox to\pagewidth{\box0\hfil\box2}}%
}
%
% All done with double columns.
% Finished with with double columns.
\def\enddoublecolumns{%
% The following penalty ensures that the page builder is exercised
% _before_ we change the output routine. This is necessary in the
@ -7594,7 +7612,6 @@
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
\let\xeatspaces\eatspaces
% Reduce doubled backslashes to one
\def\xprocessmacroarg{\passargtomacro\eatspaces}%
%
@ -9758,7 +9775,7 @@
\gdef\UTFviiiTmp{#2}%
%
\expandafter\ifx\csname uni:#1\endcsname \relax \else
\errmessage{Internal error, already defined: #1}%
\message{Internal error, already defined: #1}%
\fi
%
% define an additional control sequence for this code point.
@ -10108,8 +10125,82 @@
\DeclareUnicodeCharacter{02DB}{\ogonek{ }}
% Greek letters
% Greek letters upper case
\DeclareUnicodeCharacter{0391}{{\it A}}
\DeclareUnicodeCharacter{0392}{{\it B}}
\DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}
\DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}
\DeclareUnicodeCharacter{0395}{{\it E}}
\DeclareUnicodeCharacter{0396}{{\it Z}}
\DeclareUnicodeCharacter{0397}{{\it H}}
\DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}
\DeclareUnicodeCharacter{0399}{{\it I}}
\DeclareUnicodeCharacter{039A}{{\it K}}
\DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}
\DeclareUnicodeCharacter{039C}{{\it M}}
\DeclareUnicodeCharacter{039D}{{\it N}}
\DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}
\DeclareUnicodeCharacter{039F}{{\it O}}
\DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}
\DeclareUnicodeCharacter{03A1}{{\it P}}
%\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
\DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}
\DeclareUnicodeCharacter{03A4}{{\it T}}
\DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}
\DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}
\DeclareUnicodeCharacter{03A7}{{\it X}}
\DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}
\DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}
% Vowels with accents
\DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}
\DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}
\DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}
\DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}
\DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}
\DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}
% Standalone accent
\DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}
% Greek letters lower case
\DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}
\DeclareUnicodeCharacter{03B2}{\ensuremath\beta}
\DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}
\DeclareUnicodeCharacter{03B4}{\ensuremath\delta}
\DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}
\DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}
\DeclareUnicodeCharacter{03B7}{\ensuremath\eta}
\DeclareUnicodeCharacter{03B8}{\ensuremath\theta}
\DeclareUnicodeCharacter{03B9}{\ensuremath\iota}
\DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}
\DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}
\DeclareUnicodeCharacter{03BC}{\ensuremath\mu}
\DeclareUnicodeCharacter{03BD}{\ensuremath\nu}
\DeclareUnicodeCharacter{03BE}{\ensuremath\xi}
\DeclareUnicodeCharacter{03BF}{{\it o}} % omicron
\DeclareUnicodeCharacter{03C0}{\ensuremath\pi}
\DeclareUnicodeCharacter{03C1}{\ensuremath\rho}
\DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}
\DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}
\DeclareUnicodeCharacter{03C4}{\ensuremath\tau}
\DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}
\DeclareUnicodeCharacter{03C6}{\ensuremath\phi}
\DeclareUnicodeCharacter{03C7}{\ensuremath\chi}
\DeclareUnicodeCharacter{03C8}{\ensuremath\psi}
\DeclareUnicodeCharacter{03C9}{\ensuremath\omega}
% More Greek vowels with accents
\DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}
\DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}
\DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}
\DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}
\DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}
% Variant Greek letters
\DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}
\DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}
\DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}
\DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
\DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
@ -10265,7 +10356,7 @@
\DeclareUnicodeCharacter{2203}{\ensuremath\exists}
\DeclareUnicodeCharacter{2208}{\ensuremath\in}
\DeclareUnicodeCharacter{2212}{\minus}
\DeclareUnicodeCharacter{2217}{\point}
\DeclareUnicodeCharacter{2217}{\ast}
\DeclareUnicodeCharacter{221E}{\ensuremath\infty}
\DeclareUnicodeCharacter{2225}{\ensuremath\parallel}
\DeclareUnicodeCharacter{2227}{\ensuremath\wedge}
@ -10276,6 +10367,138 @@
\DeclareUnicodeCharacter{2282}{\ensuremath\subset}
\DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}
\DeclareUnicodeCharacter{2016}{\ensuremath\Vert}
\DeclareUnicodeCharacter{2032}{\ensuremath\prime}
\DeclareUnicodeCharacter{210F}{\ensuremath\hbar}
\DeclareUnicodeCharacter{2111}{\ensuremath\Im}
\DeclareUnicodeCharacter{2113}{\ensuremath\ell}
\DeclareUnicodeCharacter{2118}{\ensuremath\wp}
\DeclareUnicodeCharacter{211C}{\ensuremath\Re}
\DeclareUnicodeCharacter{2127}{\ensuremath\mho}
\DeclareUnicodeCharacter{2135}{\ensuremath\aleph}
\DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}
\DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}
\DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}
\DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}
\DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}
\DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}
\DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}
\DeclareUnicodeCharacter{2198}{\ensuremath\searrow}
\DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}
\DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}
\DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}
\DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}
\DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}
\DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}
\DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}
\DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}
\DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}
\DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}
\DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}
\DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}
\DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}
\DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}
\DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}
\DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}
\DeclareUnicodeCharacter{2201}{\ensuremath\complement}
\DeclareUnicodeCharacter{2202}{\ensuremath\partial}
\DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}
\DeclareUnicodeCharacter{2207}{\ensuremath\nabla}
\DeclareUnicodeCharacter{2209}{\ensuremath\notin}
\DeclareUnicodeCharacter{220B}{\ensuremath\owns}
\DeclareUnicodeCharacter{220F}{\ensuremath\prod}
\DeclareUnicodeCharacter{2210}{\ensuremath\coprod}
\DeclareUnicodeCharacter{2211}{\ensuremath\sum}
\DeclareUnicodeCharacter{2213}{\ensuremath\mp}
\DeclareUnicodeCharacter{2218}{\ensuremath\circ}
\DeclareUnicodeCharacter{221A}{\ensuremath\surd}
\DeclareUnicodeCharacter{221D}{\ensuremath\propto}
\DeclareUnicodeCharacter{2220}{\ensuremath\angle}
\DeclareUnicodeCharacter{2223}{\ensuremath\mid}
\DeclareUnicodeCharacter{2228}{\ensuremath\vee}
\DeclareUnicodeCharacter{222A}{\ensuremath\cup}
\DeclareUnicodeCharacter{222B}{\ensuremath\smallint}
\DeclareUnicodeCharacter{222E}{\ensuremath\oint}
\DeclareUnicodeCharacter{223C}{\ensuremath\sim}
\DeclareUnicodeCharacter{2240}{\ensuremath\wr}
\DeclareUnicodeCharacter{2243}{\ensuremath\simeq}
\DeclareUnicodeCharacter{2245}{\ensuremath\cong}
\DeclareUnicodeCharacter{2248}{\ensuremath\approx}
\DeclareUnicodeCharacter{224D}{\ensuremath\asymp}
\DeclareUnicodeCharacter{2250}{\ensuremath\doteq}
\DeclareUnicodeCharacter{2260}{\ensuremath\neq}
\DeclareUnicodeCharacter{226A}{\ensuremath\ll}
\DeclareUnicodeCharacter{226B}{\ensuremath\gg}
\DeclareUnicodeCharacter{227A}{\ensuremath\prec}
\DeclareUnicodeCharacter{227B}{\ensuremath\succ}
\DeclareUnicodeCharacter{2283}{\ensuremath\supset}
\DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}
\DeclareUnicodeCharacter{228E}{\ensuremath\uplus}
\DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}
\DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}
\DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}
\DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}
\DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}
\DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}
\DeclareUnicodeCharacter{2295}{\ensuremath\oplus}
\DeclareUnicodeCharacter{2296}{\ensuremath\ominus}
\DeclareUnicodeCharacter{2297}{\ensuremath\otimes}
\DeclareUnicodeCharacter{2298}{\ensuremath\oslash}
\DeclareUnicodeCharacter{2299}{\ensuremath\odot}
\DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}
\DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}
\DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}
\DeclareUnicodeCharacter{22A5}{\ensuremath\bot}
\DeclareUnicodeCharacter{22A8}{\ensuremath\models}
\DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}
\DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}
\DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}
\DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}
\DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}
\DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}
\DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}
\DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}
\DeclareUnicodeCharacter{22C6}{\ensuremath\star}
\DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}
\DeclareUnicodeCharacter{2308}{\ensuremath\lceil}
\DeclareUnicodeCharacter{2309}{\ensuremath\rceil}
\DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}
\DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}
\DeclareUnicodeCharacter{2322}{\ensuremath\frown}
\DeclareUnicodeCharacter{2323}{\ensuremath\smile}
\DeclareUnicodeCharacter{25A1}{\ensuremath\Box}
\DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}
\DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}
\DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}
\DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}
\DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}
\DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}
\DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}
\DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}
\DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}
\DeclareUnicodeCharacter{266D}{\ensuremath\flat}
\DeclareUnicodeCharacter{266E}{\ensuremath\natural}
\DeclareUnicodeCharacter{266F}{\ensuremath\sharp}
\DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}
\DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}
\DeclareUnicodeCharacter{27C2}{\ensuremath\perp}
\DeclareUnicodeCharacter{27E8}{\ensuremath\langle}
\DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}
\DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}
\DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}
\DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}
\DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}
\DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}
\DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}
\DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}
\DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}
\DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}
\DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}
\DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}
\DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}
\DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}
\global\mathchardef\checkmark="1370 % actually the square root sign
\DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}
}% end of \utfeightchardefs

View file

@ -263,22 +263,31 @@
: (a) % - (b)) \
== 0)
/* Integer overflow checks.
/* Check for integer overflow, and report low order bits of answer.
The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
might not yield numerically correct answers due to arithmetic overflow.
They work correctly on all known practical hosts, and do not rely
The INT_<op>_WRAPV macros return the low-order bits of the answer.
For example, INT_ADD_WRAPV (INT_MAX, 1) returns INT_MIN on a two's
complement host, even if INT_MAX + 1 would trap.
These macros work correctly on all known practical hosts, and do not rely
on undefined behavior due to signed arithmetic overflow.
Example usage:
long int i = ...;
long int j = ...;
if (INT_MULTIPLY_OVERFLOW (i, j))
printf ("multiply would overflow");
else
printf ("product is %ld", i * j);
long int a = ...;
long int b = ...;
long int result = INT_MULTIPLY_WRAPV (a, b);
printf ("result is %ld (%s)\n", result,
INT_MULTIPLY_OVERFLOW (a, b) ? "after overflow" : "no overflow");
enum {
INT_PRODUCTS_FIT_IN_LONG
= ! INT_CONST_MULTIPLY_OVERFLOW ((long int) INT_MIN, INT_MIN)
};
Restrictions on these macros:
These macros do not check for all possible numerical problems or
undefined or unspecified behavior: they do not check for division
@ -287,18 +296,35 @@
These macros may evaluate their arguments zero or multiple times, so the
arguments should not have side effects.
On non-GCC-compatible compilers that do not support C11, the type
of INT_<op>_WRAPV (A, B) might differ from the native type of (A op
B), so it is wise to convert the result to the native type. Such a
conversion is safe and cannot trap.
For runtime efficiency GCC 5 and later has builtin functions for +,
-, * when doing integer overflow checking or wraparound arithmetic.
Unfortunately, these builtins require nonnull pointer arguments and
so cannot be used in constant expressions; see GCC bug 68120
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68120>. In constant
expressions, use the macros INT_CONST_ADD_OVERFLOW and
INT_CONST_ADD_WRAPV instead, and similarly for SUBTRACT and
MULTIPLY; these macros avoid the builtins and are slower in
non-constant expressions. Perhaps someday GCC's API for overflow
checking will be improved and we can remove the need for the
INT_CONST_ variants.
These macros are tuned for their last argument being a constant.
Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
A % B, and A << B would overflow, respectively. */
#define INT_ADD_OVERFLOW(a, b) \
#define INT_CONST_ADD_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
#define INT_SUBTRACT_OVERFLOW(a, b) \
#define INT_CONST_SUBTRACT_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
#define INT_NEGATE_OVERFLOW(a) \
INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
#define INT_MULTIPLY_OVERFLOW(a, b) \
#define INT_CONST_MULTIPLY_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
#define INT_DIVIDE_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
@ -317,4 +343,95 @@
_GL_INT_MINIMUM (0 * (b) + (a)), \
_GL_INT_MAXIMUM (0 * (b) + (a)))
/* Return the low order bits of the integer expressions
A * B, A - B, -A, A * B, A / B, A % B, and A << B, respectively.
See above for restrictions. */
#define INT_CONST_ADD_WRAPV(a, b) _GL_INT_OP_WRAPV (a, b, +)
#define INT_CONST_SUBTRACT_WRAPV(a, b) _GL_INT_OP_WRAPV (a, b, -)
#define INT_NEGATE_WRAPV(a) INT_CONST_SUBTRACT_WRAPV (0, a)
#define INT_CONST_MULTIPLY_WRAPV(a, b) _GL_INT_OP_WRAPV (a, b, *)
#define INT_DIVIDE_WRAPV(a, b) \
(INT_DIVIDE_OVERFLOW(a, b) ? INT_NEGATE_WRAPV (a) : (a) / (b))
#define INT_REMAINDER_WRAPV(a, b) \
(INT_REMAINDER_OVERFLOW(a, b) ? 0 : (a) % (b))
#define INT_LEFT_SHIFT_WRAPV(a, b) _GL_INT_OP_WRAPV (a, b, <<)
/* Return the low order bits of A <op> B, where OP specifies the operation.
See above for restrictions. */
#if !_GL_HAVE___TYPEOF__ && 201112 <= __STDC_VERSION__
# define _GL_INT_OP_WRAPV(a, b, op) \
_Generic ((a) op (b), \
int: _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, int), \
long int: _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, long int), \
long long int: _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, \
long long int), \
default: (a) op (b))
#else
# define _GL_INT_OP_WRAPV(a, b, op) \
(! _GL_INT_SIGNED ((0 * (a)) op (0 * (b))) \
? ((a) op (b)) \
: _GL_EXPR_CAST ((a) op (b), \
(sizeof ((a) op (b)) <= sizeof (int) \
? _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, int) \
: _GL_INT_OP_WRAPV_LONGISH (a, b, op))))
/* Cast to E's type the value of V if possible. Yield V as-is otherwise. */
# if _GL_HAVE___TYPEOF__
# define _GL_EXPR_CAST(e, v) ((__typeof__ (e)) (v))
# else
# define _GL_EXPR_CAST(e, v) (v)
# endif
# ifdef LLONG_MAX
# define _GL_INT_OP_WRAPV_LONGISH(a, b, op) \
(sizeof ((a) op (b)) <= sizeof (long int) \
? _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, long int) \
: _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, long long int))
# else
# define _GL_INT_OP_WRAPV_LONGISH(a, b, op) \
_GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, long int)
# endif
#endif
/* Return A <op> B, where the operation is given by OP and the result
type is T. T is a signed integer type that is at least as wide as int.
Do arithmetic using 'unsigned T' to avoid signed integer overflow.
Subtract TYPE_MINIMUM (T) before converting back to T, and add it
back afterwards, to avoid signed overflow during conversion. */
#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, t) \
((unsigned t) (a) op (unsigned t) (b) <= TYPE_MAXIMUM (t) \
? (t) ((unsigned t) (a) op (unsigned t) (b)) \
: ((t) ((unsigned t) (a) op (unsigned t) (b) - TYPE_MINIMUM (t)) \
+ TYPE_MINIMUM (t)))
/* Calls to the INT_<op>_<result> macros are like their INT_CONST_<op>_<result>
counterparts, except they are faster with GCC 5 or later, and they
are not constant expressions due to limitations in the GNU C API. */
#define INT_ADD_OVERFLOW(a, b) \
_GL_OP_OVERFLOW (a, b, INT_CONST_ADD_OVERFLOW, __builtin_add_overflow)
#define INT_SUBTRACT_OVERFLOW(a, b) \
_GL_OP_OVERFLOW (a, b, INT_CONST_SUBTRACT_OVERFLOW, __builtin_sub_overflow)
#define INT_MULTIPLY_OVERFLOW(a, b) \
_GL_OP_OVERFLOW (a, b, INT_CONST_MULTIPLY_OVERFLOW, __builtin_mul_overflow)
#define INT_ADD_WRAPV(a, b) \
_GL_OP_WRAPV (a, b, INT_CONST_ADD_WRAPV, __builtin_add_overflow)
#define INT_SUBTRACT_WRAPV(a, b) \
_GL_OP_WRAPV (a, b, INT_CONST_SUBTRACT_WRAPV, __builtin_sub_overflow)
#define INT_MULTIPLY_WRAPV(a, b) \
_GL_OP_WRAPV (a, b, INT_CONST_MULTIPLY_WRAPV, __builtin_mul_overflow)
#if __GNUC__ < 5
# define _GL_OP_OVERFLOW(a, b, portable, builtin) portable (a, b)
# define _GL_OP_WRAPV(a, b, portable, builtin) portable (a, b)
#else
# define _GL_OP_OVERFLOW(a, b, portable, builtin) \
builtin (a, b, &(__typeof__ ((a) + (b))) {0})
# define _GL_OP_WRAPV(a, b, portable, builtin) \
_GL_OP_WRAPV_GENSYM(a, b, builtin, __gl_wrapv##__COUNTER__)
# define _GL_OP_WRAPV_GENSYM(a, b, builtin, r) \
({__typeof__ ((a) + (b)) r; builtin (a, b, &r); r; })
#endif
#endif /* _GL_INTPROPS_H */

View file

@ -104,7 +104,7 @@
? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
: __GNUC__) \
|| __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
|| __ICC || 0x5110 <= __SUNPRO_C)
|| __ICC || 0x590 <= __SUNPRO_C)
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
# elif 1300 <= _MSC_VER
# define _Alignas(a) __declspec (align (a))