Update from Gnulib by running admin/merge-gnulib

This commit is contained in:
Paul Eggert 2025-04-19 12:18:28 -07:00
parent 30335bb734
commit 71ee484cac
37 changed files with 723 additions and 343 deletions

View file

@ -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{2025-01-31.21} \def\texinfoversion{2025-03-22.08}
% %
% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc. % Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
% %
@ -287,7 +287,6 @@
% Avoid "undefined control sequence" errors. % Avoid "undefined control sequence" errors.
\def\currentchapterdefs{} \def\currentchapterdefs{}
\def\currentsectiondefs{} \def\currentsectiondefs{}
\def\currentsection{}
\def\prevchapterdefs{} \def\prevchapterdefs{}
\def\prevsectiondefs{} \def\prevsectiondefs{}
\def\currentcolordefs{} \def\currentcolordefs{}
@ -980,18 +979,51 @@
\newif\ifpdf \newif\ifpdf
\newif\ifpdfmakepagedest \newif\ifpdfmakepagedest
% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
% can be set). So we test for \relax and 0 as well as being undefined.
\ifx\pdfoutput\thisisundefined
\else
\ifx\pdfoutput\relax
\else
\ifcase\pdfoutput
\else
\pdftrue
\fi
\fi
\fi
\newif\ifxetex
\ifx\XeTeXrevision\thisisundefined\else
\xetextrue
\fi
\newif\ifluatex \newif\ifluatex
\ifx\luatexversion\thisisundefined\else \ifx\luatexversion\thisisundefined\else
\luatextrue \luatextrue
\ifnum\luatexversion>84
\pdftrue
\fi
\fi \fi
\newif\ifpdforxetex
\ifpdf
\pdforxetextrue
\fi
\ifxetex
\pdforxetextrue
\fi
% Whether to use non-ASCII bytes in internal link targets. Presently this
% is almost always on.
\newif\iftxiuseunicodedestname
\txiuseunicodedestnametrue
% %
% For LuaTeX % For LuaTeX
% %
\newif\iftxiuseunicodedestname
\txiuseunicodedestnamefalse % For pdfTeX etc.
\ifluatex \ifluatex
% Use Unicode destination names % Use Unicode destination names
\txiuseunicodedestnametrue \txiuseunicodedestnametrue
@ -1045,7 +1077,7 @@
% %
\endgroup \endgroup
\def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
\ifnum\luatexversion>84 \ifpdf
% For LuaTeX >= 0.85 % For LuaTeX >= 0.85
\def\pdfdest{\pdfextension dest} \def\pdfdest{\pdfextension dest}
\let\pdfoutput\outputmode \let\pdfoutput\outputmode
@ -1068,33 +1100,6 @@
\fi \fi
\fi \fi
% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
% can be set). So we test for \relax and 0 as well as being undefined.
\ifx\pdfoutput\thisisundefined
\else
\ifx\pdfoutput\relax
\else
\ifcase\pdfoutput
\else
\pdftrue
\fi
\fi
\fi
\newif\ifxetex
\ifx\XeTeXrevision\thisisundefined\else
\xetextrue
\fi
\newif\ifpdforxetex
\pdforxetexfalse
\ifpdf
\pdforxetextrue
\fi
\ifxetex
\pdforxetextrue
\fi
% Output page labels information. % Output page labels information.
% See PDF reference v.1.7 p.594, section 8.3.1. % See PDF reference v.1.7 p.594, section 8.3.1.
@ -1388,9 +1393,6 @@
\safewhatsit{\pdfdest name{\pdfdestname} xyz}% \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
} }
% %
% used to mark target names; must be expandable.
\def\pdfmkpgn#1{#1}
%
% Adding outlines to PDF; macros for calculating structure of outlines % Adding outlines to PDF; macros for calculating structure of outlines
% come from Petr Olsak % come from Petr Olsak
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
@ -1416,7 +1418,7 @@
\def\pdfdestname{#4}% \def\pdfdestname{#4}%
\fi \fi
% %
\pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% \pdfoutline goto name{\pdfdestname}#2{\pdfoutlinetext}%
} }
% %
\def\pdfmakeoutlines{% \def\pdfmakeoutlines{%
@ -1427,15 +1429,18 @@
\def\thischapnum{##2}% \def\thischapnum{##2}%
\def\thissecnum{0}% \def\thissecnum{0}%
\def\thissubsecnum{0}% \def\thissubsecnum{0}%
\def\indexlastsec{chap\thischapnum}%
}% }%
\def\numsecentry##1##2##3##4{% \def\numsecentry##1##2##3##4{%
\advancenumber{chap\thischapnum}% \advancenumber{chap\thischapnum}%
\def\thissecnum{##2}% \def\thissecnum{##2}%
\def\thissubsecnum{0}% \def\thissubsecnum{0}%
\def\indexlastsec{sec\thissecnum}%
}% }%
\def\numsubsecentry##1##2##3##4{% \def\numsubsecentry##1##2##3##4{%
\advancenumber{sec\thissecnum}% \advancenumber{sec\thissecnum}%
\def\thissubsecnum{##2}% \def\thissubsecnum{##2}%
\def\indexlastsec{subsec\thissecnum}%
}% }%
\def\numsubsubsecentry##1##2##3##4{% \def\numsubsubsecentry##1##2##3##4{%
\advancenumber{subsec\thissubsecnum}% \advancenumber{subsec\thissubsecnum}%
@ -1443,7 +1448,13 @@
\def\thischapnum{0}% \def\thischapnum{0}%
\def\thissecnum{0}% \def\thissecnum{0}%
\def\thissubsecnum{0}% \def\thissubsecnum{0}%
\let\indexlastsec\empty
% %
% Index initials are subsidiary to whatever sectioning command just
% occurred, usually @appendix or @chapter but occasionally a lower level.
\def\idxinitialentry##1##2##3##4{%
\expandafter\advancenumber\expandafter{\indexlastsec}%
}%
% use \def rather than \let here because we redefine \chapentry et % use \def rather than \let here because we redefine \chapentry et
% al. a second time, below. % al. a second time, below.
\def\appentry{\numchapentry}% \def\appentry{\numchapentry}%
@ -1455,9 +1466,6 @@
\def\unnsubsecentry{\numsubsecentry}% \def\unnsubsecentry{\numsubsecentry}%
\def\unnsubsubsecentry{\numsubsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}%
% %
% Treat index initials like @section. Note that this is the wrong
% level if the index is not at the level of @appendix or @chapter.
\def\idxinitialentry{\numsecentry}%
\readdatafile{toc}% \readdatafile{toc}%
% %
% Read toc second time, this time actually producing the outlines. % Read toc second time, this time actually producing the outlines.
@ -1482,18 +1490,6 @@
\def\idxinitialentry##1##2##3##4{% \def\idxinitialentry##1##2##3##4{%
\dopdfoutline{##1}{}{idx.##1.##2}{##4}}% \dopdfoutline{##1}{}{idx.##1.##2}{##4}}%
% %
% PDF outlines are displayed using system fonts, instead of
% document fonts. Therefore we cannot use special characters,
% since the encoding is unknown. For example, the eogonek from
% Latin 2 (0xea) gets translated to a | character. Info from
% Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
%
% TODO this right, we have to translate 8-bit characters to
% their "best" equivalent, based on the @documentencoding. Too
% much work for too little return. Just use the ASCII equivalents
% we use for the index sort strings.
%
\indexnofonts
\ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
\setupdatafile \setupdatafile
% We can have normal brace characters in the PDF outlines, unlike % We can have normal brace characters in the PDF outlines, unlike
@ -1501,9 +1497,9 @@
\def\{{\lbracecharliteral}% \def\{{\lbracecharliteral}%
\def\}{\rbracecharliteral}% \def\}{\rbracecharliteral}%
\catcode`\\=\active \otherbackslash \catcode`\\=\active \otherbackslash
\input \tocreadfilename \input \tocreadfilename\relax
\ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
\endgroup \endgroup
\ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
} }
\def\dopdfoutlinecontents{% \def\dopdfoutlinecontents{%
\expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}% \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}%
@ -1541,7 +1537,7 @@
% %
\def\pdflink#1{\pdflinkpage{#1}{#1}}% \def\pdflink#1{\pdflinkpage{#1}{#1}}%
\def\pdflinkpage#1#2{% \def\pdflinkpage#1#2{%
\startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \startlink attr{/Border [0 0 0]} goto name{#1}
\setcolor{\linkcolor}#2\endlink} \setcolor{\linkcolor}#2\endlink}
\else \else
% non-pdf mode % non-pdf mode
@ -1644,18 +1640,20 @@
% horizontal space being required in the PDF viewer. % horizontal space being required in the PDF viewer.
\def\partentry##1##2##3##4{}% ignore parts in the outlines \def\partentry##1##2##3##4{}% ignore parts in the outlines
\def\numchapentry##1##2##3##4{% \def\numchapentry##1##2##3##4{%
\dopdfoutline{##2 ##1}{1}{##3}{##4}}% \dopdfoutline{##2 ##1}{1}{##3}{##4}%
\def\indexseclevel{2}}%
\def\numsecentry##1##2##3##4{% \def\numsecentry##1##2##3##4{%
\dopdfoutline{##1}{2}{##3}{##4}}% \dopdfoutline{##1}{2}{##3}{##4}%
\def\indexseclevel{3}}%
\def\numsubsecentry##1##2##3##4{% \def\numsubsecentry##1##2##3##4{%
\dopdfoutline{##1}{3}{##3}{##4}}% \dopdfoutline{##1}{3}{##3}{##4}%
\def\indexseclevel{4}}%
\def\numsubsubsecentry##1##2##3##4{% \def\numsubsubsecentry##1##2##3##4{%
\dopdfoutline{##1}{4}{##3}{##4}}% \dopdfoutline{##1}{4}{##3}{##4}%
\def\indexseclevel{5}}%
% %
% Note this is at the wrong level unless the index is in an @appendix
% or @chapter.
\def\idxinitialentry##1##2##3##4{% \def\idxinitialentry##1##2##3##4{%
\dopdfoutline{##1}{2}{idx.##1.##2}{##4}}% \dopdfoutline{##1}{\indexseclevel}{idx.##1.##2}{##4}}%
% %
\let\appentry\numchapentry% \let\appentry\numchapentry%
\let\appsecentry\numsecentry% \let\appsecentry\numsecentry%
@ -1680,7 +1678,9 @@
\def\{{\lbracecharliteral}% \def\{{\lbracecharliteral}%
\def\}{\rbracecharliteral}% \def\}{\rbracecharliteral}%
\catcode`\\=\active \otherbackslash \catcode`\\=\active \otherbackslash
\xetexpreauxfile
\input \tocreadfilename\relax \input \tocreadfilename\relax
\xetexpostauxfile
\ifnodeseen \dopdfoutlinecontents \fi % for @contents at end \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
\endgroup \endgroup
} }
@ -5177,8 +5177,8 @@
% %
\uccode`\1=`\{ \uppercase{\def\{{1}}% \uccode`\1=`\{ \uppercase{\def\{{1}}%
\uccode`\1=`\} \uppercase{\def\}{1}}% \uccode`\1=`\} \uppercase{\def\}{1}}%
\let\lbracechar\{% \def\lbracechar##1{\{}%
\let\rbracechar\}% \def\rbracechar##1{\}}%
% %
% %
% We need to get rid of all macros, leaving only the arguments (if present). % We need to get rid of all macros, leaving only the arguments (if present).
@ -5523,6 +5523,8 @@
\tolerance = 9500 \tolerance = 9500
\plainfrenchspacing \plainfrenchspacing
\everypar = {}% don't want the \kern\-parindent from indentation suppression. \everypar = {}% don't want the \kern\-parindent from indentation suppression.
\let\entry\indexentry
\ifxetex\xetexpreauxfile\fi
% %
% See comment in \requireopenindexfile. % See comment in \requireopenindexfile.
\def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
@ -5548,6 +5550,7 @@
\fi \fi
\fi \fi
\closein 1 \closein 1
\ifxetex\xetexpostauxfile\fi
\endgroup} \endgroup}
% Checked in @bye % Checked in @bye
@ -5583,7 +5586,9 @@
}% }%
\else \else
\begindoublecolumns \begindoublecolumns
\ifxetex\xetexpreauxfile\fi
\input \jobname.\indexname s \input \jobname.\indexname s
\ifxetex\xetexpostauxfile\fi
\enddoublecolumns \enddoublecolumns
\fi \fi
}{% }{%
@ -5594,11 +5599,39 @@
% should work because we (hopefully) don't otherwise use @ in index files. % should work because we (hopefully) don't otherwise use @ in index files.
%\catcode`\@=12\relax %\catcode`\@=12\relax
\catcode`\@=0\relax \catcode`\@=0\relax
\ifxetex\xetexpreauxfile\fi
\input \jobname.\indexname s \input \jobname.\indexname s
\ifxetex\xetexpostauxfile\fi
\enddoublecolumns \enddoublecolumns
}% }%
} }
\def\indexentry#1#2{%
\let\entrypagetarget\empty
\ifpdforxetex
% only link the index text to the page if no comma appears in the
% list of pages, i.e. there is only one page
\checkpagelistcomma{#2}\pagelistcomma
\expandafter\ifcase\pagelistcomma
\def\entrypagetarget{#2}%
\fi
\fi%
\entryinternal{#1}{#2}%
}
\def\checkpagelistcomma#1#2{%
\checkpagelistcommaxx#2#1,\finish
}
\def\checkpagelistcommaxx#1#2,#3\finish{%
\def\tmp{#3}%
\ifx\tmp\empty
\def#1{0\relax}
\else
\def#1{1\relax}
\fi
}
% These macros are used by the sorted index file itself. % These macros are used by the sorted index file itself.
% Change them to control the appearance of the index. % Change them to control the appearance of the index.
@ -5673,18 +5706,14 @@
\def\doindexinitialentry#1{% \def\doindexinitialentry#1{%
\ifpdforxetex \ifpdforxetex
\global\advance\idxinitialno by 1 \global\advance\idxinitialno by 1
\def\indexlbrace{\{} \def\indexlbrace{\{}%
\def\indexrbrace{\}} \def\indexrbrace{\}}%
\def\indexbackslash{\realbackslash} \def\indexbackslash{\realbackslash}%
\def\indexatchar{\@} \def\indexatchar{\@}%
\writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}% \writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}%
% The @asis removes a pair of braces around e.g. {@indexatchar} that % The @asis removes a pair of braces around e.g. {@indexatchar} that
% are output by texindex. % are output by texindex.
% %
\vbox to 0pt{}%
% This vbox fixes the \pdfdest location for double column formatting.
% Without it, the \pdfdest is output above topskip glue at the top
% of a column as this glue is not added until the first box.
\pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}% \pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}%
\fi \fi
} }
@ -5704,16 +5733,18 @@
\newdimen\entrycontskip \newdimen\entrycontskip
\entrycontskip=1em \entrycontskip=1em
% for PDF output, whether to make the text of the entry a link to the page % for PDF output, whether to make the text of the entry a link to the section.
% number. set for @contents and @shortcontents where there is only one % set for @contents and @shortcontents.
% page number.
\newif\iflinkentrytext \newif\iflinkentrytext
% \entry typesets a paragraph consisting of the text (#1), dot leaders, and % \entryinternal typesets a paragraph consisting of the text (#1), dot
% then page number (#2) flushed to the right margin. It is used for index % leaders, and then page number (#2) flushed to the right margin. It is
% and table of contents entries. The paragraph is indented by \leftskip. % used for index and table of contents entries. The paragraph is indented
% If \tocnodetarget is set, link text to the referenced node. % by \leftskip.
\def\entry{% % For PDF output, if \linkentrytexttrue and \tocnodetarget is set, link text
% to the referenced node. Else if \entrypagetarget is set, link text to the
% page.
\def\entryinternal{%
\begingroup \begingroup
% %
% Start a new paragraph if necessary, so our assignments below can't % Start a new paragraph if necessary, so our assignments below can't
@ -5761,7 +5792,11 @@
\endlink \endlink
\fi \fi
\else \else
\unhbox\boxA \ifx\entrypagetarget\empty
\unhbox\boxA
\else
\pdflinkpage{\entrypagetarget}{\unhbox\boxA}%
\fi
\fi \fi
\else \else
\unhbox\boxA \unhbox\boxA
@ -6433,6 +6468,10 @@
\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
\suppressfirstparagraphindent} \suppressfirstparagraphindent}
% @xrefname - give text with printed name for linking to node and allow
% referencing node, but do not print any heading.
\parseargdef\xrefname{\donoderef{Yomitfromtoc}{#1}}%
% These macros generate a chapter, section, etc. heading only % These macros generate a chapter, section, etc. heading only
% (including whitespace, linebreaking, etc. around it), % (including whitespace, linebreaking, etc. around it),
% given all the information in convenient, parsed form. % given all the information in convenient, parsed form.
@ -6554,11 +6593,6 @@
\chapfonts \rm \chapfonts \rm
\let\footnote=\errfootnoteheading % give better error message \let\footnote=\errfootnoteheading % give better error message
% %
% Have to define \currentsection before calling \donoderef, because the
% xref code eventually uses it. On the other hand, it has to be called
% after \pchapsepmacro, or the headline will change too soon.
\gdef\currentsection{#1}%
%
% Only insert the separating space if we have a chapter/appendix % Only insert the separating space if we have a chapter/appendix
% number, and don't print the unnumbered ``number''. % number, and don't print the unnumbered ``number''.
\ifx\temptype\Ynothingkeyword \ifx\temptype\Ynothingkeyword
@ -6585,7 +6619,7 @@
% been typeset. If the destination for the pdf outline is after the % been typeset. If the destination for the pdf outline is after the
% text, then jumping from the outline may wind up with the text not % text, then jumping from the outline may wind up with the text not
% being visible, for instance under high magnification. % being visible, for instance under high magnification.
\donoderef{#2}% \donoderef{#2}{#1}%
% %
% Typeset the actual heading. % Typeset the actual heading.
\nobreak % Avoid page breaks at the interline glue. \nobreak % Avoid page breaks at the interline glue.
@ -6701,21 +6735,17 @@
\ifx\temptype\Ynothingkeyword \ifx\temptype\Ynothingkeyword
\setbox0 = \hbox{}% \setbox0 = \hbox{}%
\def\toctype{unn}% \def\toctype{unn}%
\gdef\currentsection{#1}%
\else\ifx\temptype\Yomitfromtockeyword \else\ifx\temptype\Yomitfromtockeyword
% for @headings -- no section number, don't include in toc, % for @headings -- no section number, don't include in toc.
% and don't redefine \currentsection.
\setbox0 = \hbox{}% \setbox0 = \hbox{}%
\def\toctype{omit}% \def\toctype{omit}%
\let\sectionlevel=\empty \let\sectionlevel=\empty
\else\ifx\temptype\Yappendixkeyword \else\ifx\temptype\Yappendixkeyword
\setbox0 = \hbox{#4\enspace}% \setbox0 = \hbox{#4\enspace}%
\def\toctype{app}% \def\toctype{app}%
\gdef\currentsection{#1}%
\else \else
\setbox0 = \hbox{#4\enspace}% \setbox0 = \hbox{#4\enspace}%
\def\toctype{num}% \def\toctype{num}%
\gdef\currentsection{#1}%
\fi\fi\fi \fi\fi\fi
% %
% Write the toc entry (before \donoderef). See comments in \chapmacro. % Write the toc entry (before \donoderef). See comments in \chapmacro.
@ -6723,7 +6753,7 @@
% %
% Write the node reference (= pdf destination for pdftex). % Write the node reference (= pdf destination for pdftex).
% Again, see comments in \chapmacro. % Again, see comments in \chapmacro.
\donoderef{#3}% \donoderef{#3}{#1}%
% %
% Interline glue will be inserted when the vbox is completed. % Interline glue will be inserted when the vbox is completed.
% That glue will be a valid breakpoint for the page, since it'll be % That glue will be a valid breakpoint for the page, since it'll be
@ -6955,6 +6985,7 @@
% %
\def\contents{% \def\contents{%
\startcontents{\putwordTOC}{\contentsmkdest}% \startcontents{\putwordTOC}{\contentsmkdest}%
\ifxetex\xetexpreauxfile\fi
\openin 1 \tocreadfilename\space \openin 1 \tocreadfilename\space
\ifeof 1 \else \ifeof 1 \else
\findsecnowidths \findsecnowidths
@ -6966,6 +6997,7 @@
\pdfmakeoutlines \pdfmakeoutlines
\fi \fi
\closein 1 \closein 1
\ifxetex\xetexpostauxfile\fi
\endgroup \endgroup
\contentsendroman \contentsendroman
} }
@ -6999,11 +7031,13 @@
\let\numsubsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry
\let\appsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry
\let\unnsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry
\ifxetex\xetexpreauxfile\fi
\openin 1 \tocreadfilename\space \openin 1 \tocreadfilename\space
\ifeof 1 \else \ifeof 1 \else
\readtocfile \readtocfile
\fi \fi
\closein 1 \closein 1
\ifxetex\xetexpostauxfile\fi
\vfill \eject \vfill \eject
\contentsalignmacro % in case @setchapternewpage odd is in effect \contentsalignmacro % in case @setchapternewpage odd is in effect
\endgroup \endgroup
@ -7167,6 +7201,7 @@
\extrasecnoskip=0pt \extrasecnoskip=0pt
\let\tocnodetarget\empty \let\tocnodetarget\empty
\let\entrypagetarget\empty
% \tocentry{TITLE}{SEC NO}{NODE}{PAGE} % \tocentry{TITLE}{SEC NO}{NODE}{PAGE}
% %
@ -7174,7 +7209,7 @@
\def\tocnodetarget{#3}% \def\tocnodetarget{#3}%
\def\secno{#2}% \def\secno{#2}%
\ifx\empty\secno \ifx\empty\secno
\entry{#1}{#4}% \entryinternal{#1}{#4}%
\else \else
\ifdim 0pt=\secnowidth \ifdim 0pt=\secnowidth
\setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}% \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
@ -7185,7 +7220,7 @@
#2\hskip\labelspace\hskip\extrasecnoskip\hfill}% #2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
\fi \fi
\entrycontskip=\wd0 \entrycontskip=\wd0
\entry{\box0 #1}{#4}% \entryinternal{\box0 #1}{#4}%
\fi \fi
} }
\newdimen\labelspace \newdimen\labelspace
@ -8170,18 +8205,11 @@
} }
\fi \fi
\let\E=\expandafter
% Used at the time of macro expansion. % Used at the time of macro expansion.
% Argument is macro body with arguments substituted % Argument is macro body with arguments substituted
\def\scanmacro#1{% \def\scanmacro#1{%
\newlinechar`\^^M \newlinechar`\^^M
% expand the expansion of \eatleadingcr twice to maybe remove a leading \def\xeatspaces##1{\eatleadingcrthen\eatspaces{##1}}%
% newline (and \else and \fi tokens), then call \eatspaces on the result.
\def\xeatspaces##1{%
\E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
}}%
\def\xempty##1{}%
% %
% Process the macro body under the current catcode regime. % Process the macro body under the current catcode regime.
\scantokens{#1@comment}% \scantokens{#1@comment}%
@ -8234,10 +8262,12 @@
\unbrace{\gdef\trim@@@ #1 } #2@{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1}
} }
{\catcode`\^^M=\other% % Trim a single leading ^^M off a string, then call #1
\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}% {\catcode`\^^M=\active \catcode`\Q=3%
% Warning: this won't work for a delimited argument \gdef\eatleadingcrthen #1#2{\eatlcra #1Q#2Q^^MQ}%
% or for an empty argument \gdef\eatlcra #1#2Q^^M{\eatlcrb #1#2Q}%
\gdef\eatlcrb #1Q#2Q#3Q{#1{#2}}%
}
% Trim a single trailing ^^M off a string. % Trim a single trailing ^^M off a string.
{\catcode`\^^M=\other \catcode`\Q=3% {\catcode`\^^M=\other \catcode`\Q=3%
@ -8373,6 +8403,10 @@
% <parameter list> is #, then the preceding argument is delimited by % <parameter list> is #, then the preceding argument is delimited by
% an opening brace, and that opening brace is not consumed. % an opening brace, and that opening brace is not consumed.
% Make @ a letter, so that we can make private-to-Texinfo macro names.
\edef\texiatcatcode{\the\catcode`\@}
\catcode `@=11\relax
% Parse the optional {params} list to @macro or @rmacro. % Parse the optional {params} list to @macro or @rmacro.
% Set \paramno to the number of arguments, % Set \paramno to the number of arguments,
% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
@ -8385,14 +8419,13 @@
% That gets used by \mbodybackslash (above). % That gets used by \mbodybackslash (above).
% %
% If there are 10 or more arguments, a different technique is used: see % If there are 10 or more arguments, a different technique is used: see
% \parsemmanyargdef. % \parsemmanyargdef@@.
% %
\def\parsemargdef#1;{% \def\parsemargdef#1;{%
\paramno=0\def\paramlist{}% \paramno=0\def\paramlist{}%
\let\hash\relax \let\hash\relax
% \hash is redefined to `#' later to get it into definitions % \hash is redefined to `#' later to get it into definitions
\let\xeatspaces\relax \let\xeatspaces\relax
\let\xempty\relax
\parsemargdefxxx#1,;,% \parsemargdefxxx#1,;,%
\ifnum\paramno<10\relax\else \ifnum\paramno<10\relax\else
\paramno0\relax \paramno0\relax
@ -8404,11 +8437,9 @@
\else \let\next=\parsemargdefxxx \else \let\next=\parsemargdefxxx
\advance\paramno by 1 \advance\paramno by 1
\expandafter\edef\csname macarg.\eatspaces{#1}\endcsname \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
{\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}% {\xeatspaces{\hash\the\paramno}}%
\edef\paramlist{\paramlist\hash\the\paramno,}% \edef\paramlist{\paramlist\hash\the\paramno,}%
\fi\next} \fi\next}
% the \xempty{} is to give \eatleadingcr an argument in the case of an
% empty macro argument.
% \parsemacbody, \parsermacbody % \parsemacbody, \parsermacbody
% %
@ -8419,14 +8450,12 @@
% body to be transformed. % body to be transformed.
% Set \macrobody to the body of the macro, and call \macrodef. % Set \macrobody to the body of the macro, and call \macrodef.
% %
\catcode `\@\texiatcatcode
{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}% \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}% \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
\catcode `\@=11\relax
% Make @ a letter, so that we can make private-to-Texinfo macro names.
\edef\texiatcatcode{\the\catcode`\@}
\catcode `@=11\relax
%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
@ -8687,15 +8716,13 @@
\noexpand\expandafter \noexpand\expandafter
\expandafter\noexpand\csname\the\macname @@\endcsname}% \expandafter\noexpand\csname\the\macname @@\endcsname}%
\expandafter\xdef\csname\the\macname @@\endcsname##1{% \expandafter\xdef\csname\the\macname @@\endcsname##1{%
\noexpand\passargtomacro \noexpand\passargtomacro
\expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
\expandafter\xdef\csname\the\macname @@@\endcsname##1{% \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
\expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
\expandafter\expandafter \expandaftergroup{\expandafter\xdef\csname\the\macname @@@@\endcsname}%
\expandafter\xdef \paramlist{%
\expandafter\expandafter \endgroup\noexpand\scanmacro{\macrobody}}%
\csname\the\macname @@@@\endcsname\paramlist{%
\endgroup\noexpand\scanmacro{\macrobody}}%
\else % 10 or more: \else % 10 or more:
\expandafter\xdef\csname\the\macname\endcsname{% \expandafter\xdef\csname\the\macname\endcsname{%
\noexpand\getargvals@{\the\macname}{\argl}% \noexpand\getargvals@{\the\macname}{\argl}%
@ -8707,6 +8734,16 @@
\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
% utility definition to avoid excessive use of \expandafter. call
% as \expandaftergroup{CONTENT}\WORD to expand \WORD exactly once and remove
% braces around CONTENT.
\def\expandaftergroup#1#2{%
\expandafter\expandaftergroupx\expandafter{#2}{#1}%
}
\def\expandaftergroupx#1#2{%
#2#1%
}
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
@ -8876,9 +8913,8 @@
\expandafter\noexpand \expandafter\noexpand
\csname\the\macname @@@\endcsname##1\noexpand\endlinemacro \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
} }
\expandafter\expandafter \expandaftergroup{\expandafter\xdef\csname\the\macname @@@\endcsname}%
\expandafter\xdef \paramlist{%
\expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
\newlinechar=13 % split \macrobody into lines \newlinechar=13 % split \macrobody into lines
\noexpand\scantokens{\macrobody}% \noexpand\scantokens{\macrobody}%
} }
@ -8953,11 +8989,11 @@
\let\lastnode=\empty \let\lastnode=\empty
% Write a cross-reference definition for the current node. #1 is the % Write a cross-reference definition for the current node. #1 is the
% type (Ynumbered, Yappendix, Ynothing). % type (Ynumbered, Yappendix, Ynothing). #2 is the section title.
% %
\def\donoderef#1{% \def\donoderef#1#2{%
\ifx\lastnode\empty\else \ifx\lastnode\empty\else
\setref{\lastnode}{#1}% \setref{\lastnode}{#1}{#2}%
\global\let\lastnode=\empty \global\let\lastnode=\empty
\setnodeseenonce \setnodeseenonce
\fi \fi
@ -8978,21 +9014,28 @@
% %
\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} \def\anchor#1{%
\savesf \setref{#1}{Yanchor}{#1}\restoresf \ignorespaces
}
% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % @namedanchor{NAME, XREFNAME} -- define xref target at arbitrary point
% anchor), which consists of three parts: % with label text for cross-references to it.
% 1) NAME-title - the current sectioning name taken from \currentsection, \def\namedanchor#1{\donamedanchor#1\finish}%
% or the anchor name. \def\donamedanchor#1,#2\finish{%
% 2) NAME-snt - section number and type, passed as the SNT arg, or \savesf \setref{#1}{Yanchor}{\ignorespaces #2\unskip}\restoresf \ignorespaces
% empty for anchors. }
% \setref{NAME}{SNT}{TITLE} defines a cross-reference point NAME (a node
% or an anchor), which consists of three parts:
% 1) NAME-title - the current sectioning name
% 2) NAME-snt - section number and type, passed as the SNT arg.
% 3) NAME-pg - the page number. % 3) NAME-pg - the page number.
% %
% This is called from \donoderef, \anchor, and \dofloat. In the case of % This is called from \donoderef, \anchor, and \dofloat. In the case of
% floats, there is an additional part, which is not written here: % floats, there is an additional part, which is not written here:
% 4) NAME-lof - the text as it should appear in a @listoffloats. % 4) NAME-lof - the text as it should appear in a @listoffloats.
% %
\def\setref#1#2{% \def\setref#1#2#3{%
\pdfmkdest{#1}% \pdfmkdest{#1}%
\iflinks \iflinks
{% {%
@ -9004,7 +9047,7 @@
\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
##1}{##2}}% these are parameters of \writexrdef ##1}{##2}}% these are parameters of \writexrdef
}% }%
\toks0 = \expandafter{\currentsection}% \toks0 = {#3}%
\immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{title}{\the\toks0 }%
\immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
\safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
@ -9058,15 +9101,7 @@
\setbox\infofilenamebox = \hbox{\infofilename\unskip}% \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
% %
\startxreflink{#1}{#4}% \startxreflink{#1}{#4}%
{% \getrefx{#1-title}\Xthisreftitle
% Have to otherify everything special to allow the \csname to
% include an _ in the xref name, etc.
\indexnofonts
\turnoffactive
\def\value##1{##1}%
\expandafter\global\expandafter\let\expandafter\Xthisreftitle
\csname XR#1-title\endcsname
}%
% %
% Float references are printed completely differently: "Figure 1.2" % Float references are printed completely differently: "Figure 1.2"
% instead of "[somenode], p.3". \iffloat distinguishes them by % instead of "[somenode], p.3". \iffloat distinguishes them by
@ -9099,21 +9134,23 @@
% Cross-manual reference with a printed manual name. % Cross-manual reference with a printed manual name.
% %
\crossmanualxref{\cite{\printedmanual\unskip}}% \crossmanualxref{\cite{\printedmanual\unskip}}%
%
\else\ifdim \wd\infofilenamebox > 0pt \else\ifdim \wd\infofilenamebox > 0pt
% Cross-manual reference with only an info filename (arg 4), no % Cross-manual reference with only an info filename (arg 4), no
% printed manual name (arg 5). This is essentially the same as % printed manual name (arg 5). This is essentially the same as
% the case above; we output the filename, since we have nothing else. % the case above; we output the filename, since we have nothing else.
% %
\crossmanualxref{\code{\infofilename\unskip}}% \crossmanualxref{\code{\infofilename\unskip}}%
%
\else \else
% Reference within this manual. % Reference within this manual.
% %
% Only output a following space if the -snt ref is nonempty, as the ref % Only output a following space if the -snt ref is nonempty, as is
% will be empty for @unnumbered and @anchor. % the case for @unnumbered and @anchor.
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}}% \getrefx{#1-snt}\tmp
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi \ifx\tmp\empty\else
\ifx\tmp\Yanchor\else
\tmp\space
\fi
\fi
% %
% output the `[mynode]' via the macro below so it can be overridden. % output the `[mynode]' via the macro below so it can be overridden.
\xrefprintnodename\printedrefname \xrefprintnodename\printedrefname
@ -9169,7 +9206,7 @@
\else \else
% Otherwise just copy the Info node name. % Otherwise just copy the Info node name.
\def\printedrefname{\ignorespaces #1}% \def\printedrefname{\ignorespaces #1}%
\fi% \fi
\fi \fi
\fi \fi
\fi \fi
@ -9201,7 +9238,7 @@
\ifnum\filenamelength>0 \ifnum\filenamelength>0
goto file{\the\filename.pdf} name{\pdfdestname}% goto file{\the\filename.pdf} name{\pdfdestname}%
\else \else
goto name{\pdfmkpgn{\pdfdestname}}% goto name{\pdfdestname}%
\fi \fi
\else % XeTeX \else % XeTeX
\ifnum\filenamelength>0 \ifnum\filenamelength>0
@ -9281,6 +9318,7 @@
% %
\def\Ynothing{} \def\Ynothing{}
\def\Yomitfromtoc{} \def\Yomitfromtoc{}
\def\Yanchor{\isanchor} \let\isanchor\relax
\def\Ynumbered{% \def\Ynumbered{%
\ifnum\secno=0 \ifnum\secno=0
\putwordChapter@tie \the\chapno \putwordChapter@tie \the\chapno
@ -9307,14 +9345,7 @@
% \refx{NAME} - reference a cross-reference string named NAME. % \refx{NAME} - reference a cross-reference string named NAME.
\def\refx#1{% \def\refx#1{%
\requireauxfile \getrefx{#1}\thisrefX
{%
\indexnofonts
\turnoffactive
\def\value##1{##1}%
\expandafter\global\expandafter\let\expandafter\thisrefX
\csname XR#1\endcsname
}%
\ifx\thisrefX\relax \ifx\thisrefX\relax
% If not defined, say something at least. % If not defined, say something at least.
\angleleft un\-de\-fined\angleright \angleleft un\-de\-fined\angleright
@ -9335,6 +9366,17 @@
\fi \fi
} }
% Set #2 to xref string #1
\def\getrefx#1#2{%
\requireauxfile
{%
\indexnofonts
\turnoffactive
\def\value##1{##1}%
\expandafter\global\expandafter\let\expandafter#2\csname XR#1\endcsname
}%
}
% This is the macro invoked by entries in the aux file. Define a control % This is the macro invoked by entries in the aux file. Define a control
% sequence for a cross-reference target (we prepend XR to the control sequence % sequence for a cross-reference target (we prepend XR to the control sequence
% name to avoid collisions). The value is the page number. If this is a float % name to avoid collisions). The value is the page number. If this is a float
@ -9399,12 +9441,14 @@
% Read the last existing aux file, if any. No error if none exists. % Read the last existing aux file, if any. No error if none exists.
% %
\def\tryauxfile{% \def\tryauxfile{%
\ifxetex\xetexpreauxfile\fi
\openin 1 \jobname.aux \openin 1 \jobname.aux
\ifeof 1 \else \ifeof 1 \else
\readdatafile{aux}% \readdatafile{aux}%
\global\havexrefstrue \global\havexrefstrue
\fi \fi
\closein 1 \closein 1
\ifxetex\xetexpostauxfile\fi
} }
\def\setupdatafile{% \def\setupdatafile{%
@ -9790,14 +9834,15 @@
\global\advance\floatno by 1 \global\advance\floatno by 1
% %
{% {%
% This magic value for \currentsection is output by \setref as the % This magic value for the third argument of \setref is output as
% XREFLABEL-title value. \xrefX uses it to distinguish float % the XREFLABEL-title value. \xrefX uses it to distinguish float
% labels (which have a completely different output format) from % labels (which have a completely different output format) from
% node and anchor labels. And \xrdef uses it to construct the % node and anchor labels. And \xrdef uses it to construct the
% lists of floats. % lists of floats.
% %
\edef\currentsection{\floatmagic=\safefloattype}% \edef\tmp{\noexpand\setref{\floatlabel}{Yfloat}%
\setref{\floatlabel}{Yfloat}% {\floatmagic=\safefloattype}}%
\tmp
}% }%
\fi \fi
% %
@ -9919,7 +9964,7 @@
% #1 is the control sequence we are passed; we expand into a conditional % #1 is the control sequence we are passed; we expand into a conditional
% which is true if #1 represents a float ref. That is, the magic % which is true if #1 represents a float ref. That is, the magic
% \currentsection value which we \setref above. % value which we passed to \setref above.
% %
\def\iffloat#1{\expandafter\doiffloat#1==\finish} \def\iffloat#1{\expandafter\doiffloat#1==\finish}
% %
@ -9976,6 +10021,7 @@
\toksA = \expandafter{\csname XR#1-lof\endcsname}% \toksA = \expandafter{\csname XR#1-lof\endcsname}%
% %
% use the same \entry macro we use to generate the TOC and index. % use the same \entry macro we use to generate the TOC and index.
\let\entry\entryinternal
\edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
\writeentry \writeentry
}} }}
@ -10071,17 +10117,24 @@
\fi \fi
\fi \fi
\let\xetexpreauxfile\relax
\let\xetexpostauxfile\relax
% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
% for non-UTF-8 (byte-wise) encodings. % for non-UTF-8 (byte-wise) encodings.
% %
\def\setbytewiseio{% \def\setbytewiseio{%
\ifxetex \ifxetex
\XeTeXdefaultencoding "bytes" % For subsequent files to be read % For document root file
\XeTeXinputencoding "bytes" % For document root file \XeTeXinputencoding "bytes"
% Unfortunately, there seems to be no corresponding XeTeX command for %
% output encoding. This is a problem for auxiliary index and TOC files. % Setting for subsequent files to be read with @include.
% The only solution would be perhaps to write out @U{...} sequences in \XeTeXdefaultencoding "bytes"
% place of non-ASCII characters. %
% Use UTF-8 for reading auxiliary index and TOC files, which are
% always output in UTF-8 with XeTeX.
\def\xetexpreauxfile{\XeTeXdefaultencoding "UTF-8"}%
\def\xetexpostauxfile{\XeTeXdefaultencoding "bytes"}%
\fi \fi
\ifluatex \ifluatex
@ -10713,12 +10766,12 @@
% Suppress ligature creation from adjacent characters. % Suppress ligature creation from adjacent characters.
\ifluatex \ifluatex
\def\nolig{{}}
\else
% Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice
% to suppress the "ff" ligature. Using a kern appears to be the only % to suppress the "ff" ligature. Using a kern appears to be the only
% workaround. % workaround.
\def\nolig{\kern0pt{}} \def\nolig{\kern0pt{}}
\else
\def\nolig{{}}
\fi \fi
% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M

View file

@ -31,7 +31,7 @@
# include <string.h> # include <string.h>
#endif #endif
#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ #if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ # if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
@ -45,7 +45,7 @@ acl_extended_nontrivial (acl_t acl)
return (acl_entries (acl) > 0); return (acl_entries (acl) > 0);
} }
# else /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */ # else /* Linux, FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS. /* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
Return 1 if the given ACL is non-trivial. Return 1 if the given ACL is non-trivial.
@ -59,7 +59,7 @@ acl_access_nontrivial (acl_t acl)
at least, allowing us to write at least, allowing us to write
return (3 < acl_entries (acl)); return (3 < acl_entries (acl));
but the following code is more robust. */ but the following code is more robust. */
# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Cygwin >= 2.5 */ # if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
acl_entry_t ace; acl_entry_t ace;
int got_one; int got_one;
@ -548,7 +548,7 @@ void
free_permission_context (struct permission_context *ctx) free_permission_context (struct permission_context *ctx)
{ {
#if USE_ACL #if USE_ACL
# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ # if HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
if (ctx->acl) if (ctx->acl)
acl_free (ctx->acl); acl_free (ctx->acl);
# if !HAVE_ACL_TYPE_EXTENDED # if !HAVE_ACL_TYPE_EXTENDED

View file

@ -52,10 +52,7 @@ extern int aclsort (int, int, struct acl *);
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <stdint.h>
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#ifndef HAVE_FCHMOD #ifndef HAVE_FCHMOD
# define HAVE_FCHMOD false # define HAVE_FCHMOD false
@ -121,8 +118,13 @@ rpl_acl_set_fd (int fd, acl_t acl)
# endif # endif
/* Linux-specific */ /* Linux-specific */
/* Cygwin >= 2.5 implements this function, but it returns 1 for all /* Cygwin >= 2.5 implements acl_extended_file(), but it returns 1 for nearly all
directories, thus is unusable. */ directories for reasons explained in
<https://sourceware.org/pipermail/cygwin/2025-March/257762.html> —, thus is
unusable. For the user, 'ls' should not print a '+' sign, indicating the
presence of an ACL, for 99,9% of the files; this would not be useful.
Therefore, on Cygwin, we ignore the acl_extended_file function and instead
use our own acl_access_nontrivial function. */
# if !defined HAVE_ACL_EXTENDED_FILE || defined __CYGWIN__ # if !defined HAVE_ACL_EXTENDED_FILE || defined __CYGWIN__
# undef HAVE_ACL_EXTENDED_FILE # undef HAVE_ACL_EXTENDED_FILE
# define HAVE_ACL_EXTENDED_FILE false # define HAVE_ACL_EXTENDED_FILE false

View file

@ -22,7 +22,7 @@
#include "acl-internal.h" #include "acl-internal.h"
/* This file assumes POSIX-draft like ACLs /* This file assumes POSIX-draft like ACLs
(Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */ (Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */
/* Return the number of entries in ACL. /* Return the number of entries in ACL.
Return -1 and set errno upon failure to determine it. */ Return -1 and set errno upon failure to determine it. */
@ -34,7 +34,7 @@ acl_entries (acl_t acl)
if (acl != NULL) if (acl != NULL)
{ {
#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */ #if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ # if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
/* acl_get_entry returns 0 when it successfully fetches an entry, /* acl_get_entry returns 0 when it successfully fetches an entry,
and -1/EINVAL at the end. */ and -1/EINVAL at the end. */
@ -45,7 +45,7 @@ acl_entries (acl_t acl)
got_one >= 0; got_one >= 0;
got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
count++; count++;
# else /* Linux, FreeBSD, Cygwin >= 2.5 */ # else /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
/* acl_get_entry returns 1 when it successfully fetches an entry, /* acl_get_entry returns 1 when it successfully fetches an entry,
and 0 at the end. */ and 0 at the end. */
acl_entry_t ace; acl_entry_t ace;

View file

@ -22,8 +22,12 @@
#endif #endif
@PRAGMA_COLUMNS@ @PRAGMA_COLUMNS@
#if defined __need_system_fcntl_h #if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
/* Special invocation convention. */ /* Special invocation convention:
- On Haiku we have a sequence of nested includes
<fcntl.h> -> <unistd.h> -> <fcntl.h>
In this situation, GNULIB_defined_O_NONBLOCK gets defined before the
system's definition of O_NONBLOCK is processed. */
/* Needed before <sys/stat.h>. /* Needed before <sys/stat.h>.
May also define off_t to a 64-bit type on native Windows. */ May also define off_t to a 64-bit type on native Windows. */
@ -50,6 +54,8 @@
#ifndef _@GUARD_PREFIX@_FCNTL_H #ifndef _@GUARD_PREFIX@_FCNTL_H
#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
/* Needed before <sys/stat.h>. /* Needed before <sys/stat.h>.
May also define off_t to a 64-bit type on native Windows. May also define off_t to a 64-bit type on native Windows.
Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
@ -72,6 +78,8 @@
# include <io.h> # include <io.h>
#endif #endif
#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
#ifndef _@GUARD_PREFIX@_FCNTL_H #ifndef _@GUARD_PREFIX@_FCNTL_H
#define _@GUARD_PREFIX@_FCNTL_H #define _@GUARD_PREFIX@_FCNTL_H

View file

@ -50,7 +50,6 @@ static char const UNKNOWN_SECURITY_CONTEXT[] = "?";
# include <selinux/selinux.h> # include <selinux/selinux.h>
# endif # endif
# include <stdckdint.h> # include <stdckdint.h>
# include <stdint.h>
# include <string.h> # include <string.h>
# include <arpa/inet.h> # include <arpa/inet.h>
# include <sys/xattr.h> # include <sys/xattr.h>
@ -363,6 +362,29 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
} }
#endif #endif
#if (!USE_LINUX_XATTR && USE_ACL && HAVE_ACL_GET_FD \
&& !HAVE_ACL_EXTENDED_FILE && !HAVE_ACL_TYPE_EXTENDED \
&& !HAVE_ACL_GET_LINK_NP)
# include <fcntl.h>
# ifdef O_PATH
/* Like acl_get_file, but do not follow symbolic links. */
static acl_t
acl_get_link_np (char const *name, acl_type_t type)
{
int fd = open (name, O_PATH | O_NOFOLLOW);
if (fd < 0)
return NULL;
acl_t r = acl_get_fd (fd);
int err = errno;
close (fd);
errno = err;
return r;
}
# define HAVE_ACL_GET_LINK_NP 1
# endif
#endif
/* Return 1 if NAME has a nontrivial access control list, /* Return 1 if NAME has a nontrivial access control list,
0 if ACLs are not supported, or if NAME has no or only a base ACL, 0 if ACLs are not supported, or if NAME has no or only a base ACL,
and -1 (setting errno) on error. Note callers can determine and -1 (setting errno) on error. Note callers can determine
@ -468,7 +490,7 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
ret = -1; ret = -1;
# else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */ # else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
acl_t (*acl_get_file_or_link) (char const *, acl_type_t) = acl_get_file; acl_t (*acl_get_file_or_link) (char const *, acl_type_t) = acl_get_file;
# if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10 */ # if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
if (! (flags & ACL_SYMLINK_FOLLOW)) if (! (flags & ACL_SYMLINK_FOLLOW))
acl_get_file_or_link = acl_get_link_np; acl_get_file_or_link = acl_get_link_np;
# endif # endif

View file

@ -26,7 +26,7 @@
/* This file is not used on systems that already have the __fpending function, /* This file is not used on systems that already have the __fpending function,
namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34, namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34,
Android API >= 23. */ Android API >= 23, musl libc, Haiku >= hrev58760. */
/* Return the number of pending (aka buffered, unflushed) /* Return the number of pending (aka buffered, unflushed)
bytes on the stream, FP, that is open for writing. */ bytes on the stream, FP, that is open for writing. */

View file

@ -47,8 +47,6 @@
N_NAME_POINTER The nlist n_name element is a pointer, N_NAME_POINTER The nlist n_name element is a pointer,
not an array. not an array.
HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'. HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File
containing load averages.
Specific system predefines this file uses, aside from setting Specific system predefines this file uses, aside from setting
default values if not emacs: default values if not emacs:
@ -65,8 +63,7 @@
UMAX4_3 UMAX4_3
VMS VMS
_WIN32 Native Windows (possibly also defined on Cygwin) _WIN32 Native Windows (possibly also defined on Cygwin)
__linux__, __ANDROID__ Linux: assumes /proc file system mounted. __linux__, __ANDROID__ Linux: assumes sysinfo() call.
Support from Michael K. Johnson.
__CYGWIN__ Cygwin emulates linux /proc/loadavg. __CYGWIN__ Cygwin emulates linux /proc/loadavg.
__NetBSD__ NetBSD: assumes /kern file system mounted. __NetBSD__ NetBSD: assumes /kern file system mounted.
@ -108,10 +105,10 @@
# endif # endif
/* Same issues as for NeXT apply to the HURD-based GNU system. */ /* Same issues as for NeXT apply to the HURD-based GNU system. */
# ifdef __GNU__ # if defined __gnu_hurd__ || defined NeXT
# undef BSD # undef BSD
# undef FSCALE # undef FSCALE
# endif /* __GNU__ */ # endif /* __gnu_hurd__ || NeXT */
/* Set values that are different from the defaults, which are /* Set values that are different from the defaults, which are
set a little farther down with #ifndef. */ set a little farther down with #ifndef. */
@ -312,8 +309,7 @@
# endif # endif
# endif # endif
# if defined (__GNU__) && !defined (NeXT) # if defined __gnu_hurd__ && !defined NeXT
/* Note that NeXT Openstep defines __GNU__ even though it should not. */
/* GNU system acts much like NeXT, for load average purposes, /* GNU system acts much like NeXT, for load average purposes,
but not exactly. */ but not exactly. */
# define NeXT # define NeXT
@ -358,6 +354,11 @@
# include <sys/dg_sys_info.h> # include <sys/dg_sys_info.h>
# endif # endif
# if defined __linux__ || defined __ANDROID__
# include <sys/param.h>
# include <sys/sysinfo.h>
# endif
# if (defined __linux__ || defined __ANDROID__ \ # if (defined __linux__ || defined __ANDROID__ \
|| defined __CYGWIN__ || defined SUNOS_5 \ || defined __CYGWIN__ || defined SUNOS_5 \
|| (defined LOAD_AVE_TYPE && ! defined __VMS)) || (defined LOAD_AVE_TYPE && ! defined __VMS))
@ -498,20 +499,32 @@ getloadavg (double loadavg[], int nelem)
} }
# endif # endif
# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) # if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__)
/* Linux without glibc, Android, Cygwin */ /* Linux without glibc, Android, Cygwin */
# define LDAV_DONE # define LDAV_DONE
# undef LOAD_AVE_TYPE # undef LOAD_AVE_TYPE
# ifndef LINUX_LDAV_FILE {
# define LINUX_LDAV_FILE "/proc/loadavg" struct sysinfo info;
# endif if (sysinfo (&info) < 0)
return -1;
loadavg[0] = info.loads[0] / (double)(1U << SI_LOAD_SHIFT);
loadavg[1] = info.loads[1] / (double)(1U << SI_LOAD_SHIFT);
loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT);
elem = 3;
}
# endif /* __linux__ || __ANDROID__ */
# if !defined (LDAV_DONE) && defined __CYGWIN__
/* Cygwin */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")]; char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
char const *ptr = ldavgbuf; char const *ptr = ldavgbuf;
int fd, count, saved_errno; int fd, count, saved_errno;
fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC); fd = open ("/proc/loadavg", O_RDONLY | O_CLOEXEC);
if (fd == -1) if (fd == -1)
return -1; return -1;
count = read (fd, ldavgbuf, sizeof ldavgbuf - 1); count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
@ -554,7 +567,7 @@ getloadavg (double loadavg[], int nelem)
return elem; return elem;
# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ # endif /* __CYGWIN__ */
# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ # if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
# define LDAV_DONE # define LDAV_DONE

View file

@ -38,11 +38,9 @@
# endif # endif
# undef getopt_long # undef getopt_long
# undef getopt_long_only # undef getopt_long_only
# undef option
# undef _getopt_internal # undef _getopt_internal
# define getopt_long __GETOPT_ID (getopt_long) # define getopt_long __GETOPT_ID (getopt_long)
# define getopt_long_only __GETOPT_ID (getopt_long_only) # define getopt_long_only __GETOPT_ID (getopt_long_only)
# define option __GETOPT_ID (option)
# define _getopt_internal __GETOPT_ID (getopt_internal) # define _getopt_internal __GETOPT_ID (getopt_internal)
/* The system's getopt.h may have already included getopt-ext.h to /* The system's getopt.h may have already included getopt-ext.h to

View file

@ -30,7 +30,12 @@
<getopt.h>; our definitions will be present soon enough. */ <getopt.h>; our definitions will be present soon enough. */
#if @HAVE_GETOPT_H@ #if @HAVE_GETOPT_H@
# define _GL_SYSTEM_GETOPT # define _GL_SYSTEM_GETOPT
/* Rename the system's 'struct option' to 'struct sys_option',
so that we don't have to rename ours to 'struct rpl_option'
(which would cause significant trouble in C++ mode). */
# define option sys_option
# @INCLUDE_NEXT@ @NEXT_GETOPT_H@ # @INCLUDE_NEXT@ @NEXT_GETOPT_H@
# undef option
# undef _GL_SYSTEM_GETOPT # undef _GL_SYSTEM_GETOPT
#endif #endif

View file

@ -49,6 +49,7 @@
# --avoid=iswxdigit \ # --avoid=iswxdigit \
# --avoid=langinfo-h \ # --avoid=langinfo-h \
# --avoid=libgmp-mpq \ # --avoid=libgmp-mpq \
# --avoid=locale-h \
# --avoid=localename-unsafe-limited \ # --avoid=localename-unsafe-limited \
# --avoid=lock \ # --avoid=lock \
# --avoid=mbrtowc \ # --avoid=mbrtowc \
@ -624,6 +625,7 @@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
GL_GNULIB_STRERROR_L = @GL_GNULIB_STRERROR_L@
GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
@ -916,6 +918,7 @@ HAVE_STR2SIG = @HAVE_STR2SIG@
HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
HAVE_STRERROR_L = @HAVE_STRERROR_L@
HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRPTIME = @HAVE_STRPTIME@
HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRSEP = @HAVE_STRSEP@
@ -1213,6 +1216,7 @@ REPLACE_GETENTROPY = @REPLACE_GETENTROPY@
REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
REPLACE_GETLINE = @REPLACE_GETLINE@ REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@ REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@
REPLACE_GETLOGIN = @REPLACE_GETLOGIN@
REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_GETPASS = @REPLACE_GETPASS@ REPLACE_GETPASS = @REPLACE_GETPASS@
@ -1307,6 +1311,7 @@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRDUP = @REPLACE_STRDUP@
REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@
REPLACE_STRERROR_L = @REPLACE_STRERROR_L@
REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRFTIME = @REPLACE_STRFTIME@
REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNCAT = @REPLACE_STRNCAT@
@ -1543,6 +1548,7 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
standardlisppath = @standardlisppath@ standardlisppath = @standardlisppath@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
systemduserunitdir = @systemduserunitdir@
target_alias = @target_alias@ target_alias = @target_alias@
version = @version@ version = @version@
with_mailutils = @with_mailutils@ with_mailutils = @with_mailutils@
@ -1715,13 +1721,25 @@ libgnu_a_SOURCES += c-ctype.h c-ctype.c
endif endif
## end gnulib module c-ctype ## end gnulib module c-ctype
## begin gnulib module c-strcase ## begin gnulib module c-strcasecmp
ifeq (,$(OMIT_GNULIB_MODULE_c-strcase)) ifeq (,$(OMIT_GNULIB_MODULE_c-strcasecmp))
libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c libgnu_a_SOURCES += c-strcasecmp.c
EXTRA_DIST += c-strcase.h
endif endif
## end gnulib module c-strcase ## end gnulib module c-strcasecmp
## begin gnulib module c-strncasecmp
ifeq (,$(OMIT_GNULIB_MODULE_c-strncasecmp))
libgnu_a_SOURCES += c-strncasecmp.c
EXTRA_DIST += c-strcase.h
endif
## end gnulib module c-strncasecmp
## begin gnulib module canonicalize-lgpl ## begin gnulib module canonicalize-lgpl
ifeq (,$(OMIT_GNULIB_MODULE_canonicalize-lgpl)) ifeq (,$(OMIT_GNULIB_MODULE_canonicalize-lgpl))
@ -3681,6 +3699,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \ -e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \
-e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
-e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
-e 's/@''GNULIB_STRERROR_L''@/$(GL_GNULIB_STRERROR_L)/g' \
-e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \
-e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \
-e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \
@ -3711,6 +3730,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
-e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
-e 's|@''HAVE_STRERROR_L''@|$(HAVE_STRERROR_L)|g' \
-e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \
-e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \
-e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \
@ -3734,6 +3754,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
-e 's|@''REPLACE_STRERROR_L''@|$(REPLACE_STRERROR_L)|g' \
-e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
-e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \ -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \
@ -4328,6 +4349,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
-e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
-e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \
-e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \

View file

@ -39,7 +39,7 @@
then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some
enum values are deliberately omitted from the switch's cases. enum values are deliberately omitted from the switch's cases.
Here, unary + is safer than a cast or inline function, as unary + Here, unary + is safer than a cast or inline function, as unary +
does only integer promotions. */ does only integer promotions and is disallowed on pointers. */
#define INT_PROMOTE(e) (+ (e)) #define INT_PROMOTE(e) (+ (e))

View file

@ -398,20 +398,16 @@ parse_omp_threads (char const* threads)
/* Convert it from positive decimal to 'unsigned long'. */ /* Convert it from positive decimal to 'unsigned long'. */
if (c_isdigit (*threads)) if (c_isdigit (*threads))
{ {
char *endptr = NULL; char *endptr;
unsigned long int value = strtoul (threads, &endptr, 10); unsigned long int value = strtoul (threads, &endptr, 10);
while (*endptr != '\0' && c_isspace (*endptr))
if (endptr != NULL) endptr++;
{ if (*endptr == '\0')
while (*endptr != '\0' && c_isspace (*endptr)) return value;
endptr++; /* Also accept the first value in a nesting level,
if (*endptr == '\0') since we can't determine the nesting level from env vars. */
return value; else if (*endptr == ',')
/* Also accept the first value in a nesting level, return value;
since we can't determine the nesting level from env vars. */
else if (*endptr == ',')
return value;
}
} }
return ret; return ret;
@ -438,6 +434,9 @@ num_processors (enum nproc_query query)
query = NPROC_CURRENT; query = NPROC_CURRENT;
} }
/* Here query is one of NPROC_ALL, NPROC_CURRENT. */ /* Here query is one of NPROC_ALL, NPROC_CURRENT. */
if (omp_env_limit == 1)
/* No need to even call num_processors_ignoring_omp (query). */
return 1;
{ {
unsigned long nprocs = num_processors_ignoring_omp (query); unsigned long nprocs = num_processors_ignoring_omp (query);
return MIN (nprocs, omp_env_limit); return MIN (nprocs, omp_env_limit);

View file

@ -45,7 +45,7 @@
# include <utmp.h> # include <utmp.h>
#endif #endif
/* Needed for BOOT_TIME and USER_PROCESS. */ /* Needed for BOOT_TIME, USER_PROCESS, LOGIN_PROCESS. */
#if HAVE_UTMPX_H #if HAVE_UTMPX_H
# if defined _THREAD_SAFE && defined UTMP_DATA_INIT # if defined _THREAD_SAFE && defined UTMP_DATA_INIT
/* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE /* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
@ -74,7 +74,8 @@ struct gl_utmp
struct timespec ut_ts; /* time */ struct timespec ut_ts; /* time */
pid_t ut_pid; /* process ID of ? */ pid_t ut_pid; /* process ID of ? */
pid_t ut_session; /* process ID of session leader */ pid_t ut_session; /* process ID of session leader */
short ut_type; /* BOOT_TIME, USER_PROCESS, or other */ short ut_type; /* BOOT_TIME, USER_PROCESS, LOGIN_PROCESS,
or other */
struct { int e_termination; int e_exit; } ut_exit; struct { int e_termination; int e_exit; } ut_exit;
}; };
@ -257,19 +258,21 @@ struct utmpx32
# define WTMP_FILE "/etc/wtmp" # define WTMP_FILE "/etc/wtmp"
#endif #endif
/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only /* In early versions of Android, <utmp.h> did not define BOOT_TIME or
USER_PROCESS. We need to use the value that is defined in newer versions LOGIN_PROCESS, only USER_PROCESS. We need to use the value that is defined
of Android. */ in newer versions of Android. */
#if defined __ANDROID__ && !defined BOOT_TIME #if defined __ANDROID__ && !defined BOOT_TIME
# define BOOT_TIME 2 # define BOOT_TIME 2
# define LOGIN_PROCESS 6
#endif #endif
/* Some platforms, such as OpenBSD, don't have an ut_type field and don't have /* Some platforms, such as OpenBSD, don't have an ut_type field and don't have
the BOOT_TIME and USER_PROCESS macros. But we want to support them in the BOOT_TIME, USER_PROCESS, and LOGIN_PROCESS macros. But we want to
'struct gl_utmp'. */ support them in 'struct gl_utmp'. */
#if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE) #if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
# define BOOT_TIME 2 # define BOOT_TIME 2
# define USER_PROCESS 0 # define USER_PROCESS 0
# define LOGIN_PROCESS 6
#endif #endif
/* Macros that test (UT)->ut_type. */ /* Macros that test (UT)->ut_type. */
@ -283,6 +286,11 @@ struct utmpx32
#else #else
# define UT_TYPE_USER_PROCESS(UT) 0 # define UT_TYPE_USER_PROCESS(UT) 0
#endif #endif
#ifdef LOGIN_PROCESS
# define UT_TYPE_LOGIN_PROCESS(UT) ((UT)->ut_type == LOGIN_PROCESS)
#else
# define UT_TYPE_LOGIN_PROCESS(UT) 0
#endif
/* Determines whether an entry *UT corresponds to a user process. */ /* Determines whether an entry *UT corresponds to a user process. */
#define IS_USER_PROCESS(UT) \ #define IS_USER_PROCESS(UT) \

View file

@ -831,7 +831,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
if (table_size > pat_len) if (table_size > pat_len)
break; break;
dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); dfa->state_table = calloc (table_size, sizeof (struct re_state_table_entry));
dfa->state_hash_mask = table_size - 1; dfa->state_hash_mask = table_size - 1;
dfa->mb_cur_max = MB_CUR_MAX; dfa->mb_cur_max = MB_CUR_MAX;
@ -862,7 +862,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
{ {
int i, j, ch; int i, j, ch;
dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); dfa->sb_char = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
if (__glibc_unlikely (dfa->sb_char == NULL)) if (__glibc_unlikely (dfa->sb_char == NULL))
return REG_ESPACE; return REG_ESPACE;
@ -3055,8 +3055,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
_NL_COLLATE_SYMB_EXTRAMB); _NL_COLLATE_SYMB_EXTRAMB);
} }
#endif #endif
sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
if (__glibc_unlikely (sbcset == NULL || mbcset == NULL)) if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
{ {
re_free (sbcset); re_free (sbcset);
@ -3548,13 +3548,13 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
reg_errcode_t ret; reg_errcode_t ret;
bin_tree_t *tree; bin_tree_t *tree;
sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
if (__glibc_unlikely (sbcset == NULL)) if (__glibc_unlikely (sbcset == NULL))
{ {
*err = REG_ESPACE; *err = REG_ESPACE;
return NULL; return NULL;
} }
mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
if (__glibc_unlikely (mbcset == NULL)) if (__glibc_unlikely (mbcset == NULL))
{ {
re_free (sbcset); re_free (sbcset);

View file

@ -66,15 +66,14 @@ typedef unsigned long int active_reg_t;
/* The following bits are used to determine the regexp syntax we /* The following bits are used to determine the regexp syntax we
recognize. The set/not-set meanings are chosen so that Emacs syntax recognize. The set/not-set meanings are chosen so that Emacs syntax
remains the value 0. The bits are given in alphabetical order, and is the value 0 for Emacs 20 (2000) and earlier, and the value
the definitions shifted by one from the previous bit; thus, when we RE_SYNTAX_EMACS for Emacs 21 (2001) and later. */
add or remove a bit, only one other definition need change. */
typedef unsigned long int reg_syntax_t; typedef unsigned long int reg_syntax_t;
#ifdef __USE_GNU #ifdef __USE_GNU
/* If this bit is not set, then \ inside a bracket expression is literal. /* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */ If set, then such a \ quotes the following character. */
# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) # define RE_BACKSLASH_ESCAPE_IN_LISTS 1ul
/* If this bit is not set, then + and ? are operators, and \+ and \? are /* If this bit is not set, then + and ? are operators, and \+ and \? are
literals. literals.
@ -215,7 +214,8 @@ extern reg_syntax_t re_syntax_options;
(The [[[ comments delimit what gets put into the Texinfo file, so (The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */ don't delete them!) */
/* [[[begin syntaxes]]] */ /* [[[begin syntaxes]]] */
# define RE_SYNTAX_EMACS 0 # define RE_SYNTAX_EMACS \
(RE_CHAR_CLASSES | RE_INTERVALS)
# define RE_SYNTAX_AWK \ # define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
@ -522,20 +522,6 @@ typedef struct
/* Declarations for routines. */ /* Declarations for routines. */
#ifndef _REGEX_NELTS
# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
&& !defined __STDC_NO_VLA__)
# define _REGEX_NELTS(n) n
# else
# define _REGEX_NELTS(n)
# endif
#endif
#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wvla"
#endif
#ifndef _Attr_access_ #ifndef _Attr_access_
# ifdef __attr_access # ifdef __attr_access
# define _Attr_access_(arg) __attr_access (arg) # define _Attr_access_(arg) __attr_access (arg)
@ -682,8 +668,7 @@ extern int regcomp (regex_t *_Restrict_ __preg,
extern int regexec (const regex_t *_Restrict_ __preg, extern int regexec (const regex_t *_Restrict_ __preg,
const char *_Restrict_ __String, size_t __nmatch, const char *_Restrict_ __String, size_t __nmatch,
regmatch_t __pmatch[_Restrict_arr_ regmatch_t __pmatch[_Restrict_arr_],
_REGEX_NELTS (__nmatch)],
int __eflags); int __eflags);
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
@ -692,10 +677,6 @@ extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
extern void regfree (regex_t *__preg); extern void regfree (regex_t *__preg);
#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic pop
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* C++ */ #endif /* C++ */

View file

@ -1595,7 +1595,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
reg_errcode_t err; reg_errcode_t err;
re_dfastate_t *newstate; re_dfastate_t *newstate;
newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
if (__glibc_unlikely (newstate == NULL)) if (__glibc_unlikely (newstate == NULL))
return NULL; return NULL;
err = re_node_set_init_copy (&newstate->nodes, nodes); err = re_node_set_init_copy (&newstate->nodes, nodes);
@ -1643,7 +1643,7 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
reg_errcode_t err; reg_errcode_t err;
re_dfastate_t *newstate; re_dfastate_t *newstate;
newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
if (__glibc_unlikely (newstate == NULL)) if (__glibc_unlikely (newstate == NULL))
return NULL; return NULL;
err = re_node_set_init_copy (&newstate->nodes, nodes); err = re_node_set_init_copy (&newstate->nodes, nodes);

View file

@ -185,7 +185,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
int int
regexec (const regex_t *__restrict preg, const char *__restrict string, regexec (const regex_t *__restrict preg, const char *__restrict string,
size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) size_t nmatch, regmatch_t pmatch[], int eflags)
{ {
reg_errcode_t err; reg_errcode_t err;
Idx start, length; Idx start, length;
@ -229,7 +229,7 @@ int
attribute_compat_text_section attribute_compat_text_section
__compat_regexec (const regex_t *__restrict preg, __compat_regexec (const regex_t *__restrict preg,
const char *__restrict string, size_t nmatch, const char *__restrict string, size_t nmatch,
regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) regmatch_t pmatch[], int eflags)
{ {
return regexec (preg, string, nmatch, pmatch, return regexec (preg, string, nmatch, pmatch,
eflags & (REG_NOTBOL | REG_NOTEOL)); eflags & (REG_NOTBOL | REG_NOTEOL));
@ -2721,8 +2721,8 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
continue; /* No. */ continue; /* No. */
if (sub_top->path == NULL) if (sub_top->path == NULL)
{ {
sub_top->path = calloc (sizeof (state_array_t), sub_top->path = calloc (sl_str - sub_top->str_idx + 1,
sl_str - sub_top->str_idx + 1); sizeof (state_array_t));
if (sub_top->path == NULL) if (sub_top->path == NULL)
return REG_ESPACE; return REG_ESPACE;
} }
@ -3266,7 +3266,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
if (ndests == 0) if (ndests == 0)
{ {
state->trtable = (re_dfastate_t **) state->trtable = (re_dfastate_t **)
calloc (sizeof (re_dfastate_t *), SBC_MAX); calloc (SBC_MAX, sizeof (re_dfastate_t *));
if (__glibc_unlikely (state->trtable == NULL)) if (__glibc_unlikely (state->trtable == NULL))
return false; return false;
return true; return true;
@ -3338,7 +3338,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
discern by looking at the character code: allocate a discern by looking at the character code: allocate a
256-entry transition table. */ 256-entry transition table. */
trtable = state->trtable = trtable = state->trtable =
(re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); (re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *));
if (__glibc_unlikely (trtable == NULL)) if (__glibc_unlikely (trtable == NULL))
goto out_free; goto out_free;
@ -3369,7 +3369,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
transition tables, one starting at trtable[0] and one transition tables, one starting at trtable[0] and one
starting at trtable[SBC_MAX]. */ starting at trtable[SBC_MAX]. */
trtable = state->word_trtable = trtable = state->word_trtable =
(re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); (re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *));
if (__glibc_unlikely (trtable == NULL)) if (__glibc_unlikely (trtable == NULL))
goto out_free; goto out_free;

View file

@ -30,6 +30,49 @@
# endif # endif
#endif #endif
/* Haiku stdio implementation. */
#if defined __HAIKU__
# include <stdint.h>
/* This FILE structure was made into an incomplete type in 2025.
See <https://cgit.haiku-os.org/haiku/tree/src/system/libroot/posix/glibc/libio/libio.h>. */
# define fp_ ((struct { int _flags; \
char *_IO_read_ptr; \
char *_IO_read_end; \
char *_IO_read_base; \
char *_IO_write_base; \
char *_IO_write_ptr; \
char *_IO_write_end; \
char *_IO_buf_base; \
char *_IO_buf_end; \
char *_IO_save_base; \
char *_IO_backup_base; \
char *_IO_save_end; \
void *_markers; \
void *_chain; \
int _fileno; \
int _flags2; \
off_t _old_offset; \
unsigned short _cur_column; \
signed char _vtable_offset; \
char _shortbuf[1]; \
void *_lock; \
int64_t _offset; \
/* More fields, not relevant here. */ \
} *) fp)
# if !defined _IO_UNBUFFERED
# define _IO_UNBUFFERED 0x2
# endif
# if !defined _IO_EOF_SEEN
# define _IO_EOF_SEEN 0x10
# endif
# if !defined _IO_IN_BACKUP
# define _IO_IN_BACKUP 0x100
# endif
# if !defined _IO_LINE_BUF
# define _IO_LINE_BUF 0x200
# endif
#endif
/* BSD stdio derived implementations. */ /* BSD stdio derived implementations. */
#if defined __NetBSD__ /* NetBSD */ #if defined __NetBSD__ /* NetBSD */

View file

@ -63,7 +63,7 @@
#include <stddef.h> #include <stddef.h>
/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
glibc 2.40 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */ glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) #if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
# include <sys/wait.h> # include <sys/wait.h>
#endif #endif
@ -120,14 +120,14 @@ struct random_data
# include <unistd.h> # include <unistd.h>
#endif #endif
#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && defined __sun #if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && (defined __sun || defined _AIX)
/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro /* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
below, this may cause compilation errors later in the libstdc++ header files below, this may cause compilation errors later in the libstdc++ header files
(that are part of GCC), such as: (that are part of GCC), such as:
error: 'rpl_strtol' is not a member of 'std' error: 'rpl_strtol' is not a member of 'std'
To avoid this, include the relevant header files here, before these symbols To avoid this, include the relevant header files here, before these symbols
get defined as macros. But do so only on Solaris 11 (where it is needed), get defined as macros. But do so only on Solaris 11 and AIX (where it is
not on mingw (where it would cause other compilation errors). */ needed), not on mingw (where it would cause other compilation errors). */
# include <string> # include <string>
#endif #endif
@ -1473,11 +1473,17 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2 # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
# define _GL_INLINE_RPL_REALLOC 1 # define _GL_INLINE_RPL_REALLOC 1
# ifdef __cplusplus
extern "C" {
# endif
_GL_REALLOC_INLINE void * _GL_REALLOC_INLINE void *
rpl_realloc (void *ptr, size_t size) rpl_realloc (void *ptr, size_t size)
{ {
return realloc (ptr, size ? size : 1); return realloc (ptr, size ? size : 1);
} }
# ifdef __cplusplus
}
# endif
# endif # endif
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC) || _GL_USE_STDLIB_ALLOC)

View file

@ -54,6 +54,11 @@
/* NetBSD 5.0 mis-defines NULL. */ /* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h> #include <stddef.h>
#if @GNULIB_STRERROR_L@
/* Get locale_t. */
# include <locale.h>
#endif
/* MirBSD defines mbslen as a macro. */ /* MirBSD defines mbslen as a macro. */
#if @GNULIB_MBSLEN@ && defined __MirBSD__ #if @GNULIB_MBSLEN@ && defined __MirBSD__
# include <wchar.h> # include <wchar.h>
@ -429,7 +434,9 @@ _GL_FUNCDECL_SYS (memset_explicit, void *,
# endif # endif
_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (memset_explicit); _GL_CXXALIASWARN (memset_explicit);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef memset_explicit # undef memset_explicit
# if HAVE_RAW_DECL_MEMSET_EXPLICIT # if HAVE_RAW_DECL_MEMSET_EXPLICIT
@ -1178,6 +1185,33 @@ _GL_CXXALIASWARN (mbsrchr);
_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
_GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)); _GL_ARG_NONNULL ((1, 2));
# ifndef _GL_NO_CONST_GENERICS
/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
compiler warnings for 'const' related mistakes. */
# ifdef __cplusplus
extern "C++" { /* needed for AIX */
template <typename T>
T * mbsstr_template (T* haystack, const char *needle);
template <>
inline char * mbsstr_template (char *haystack, const char *needle)
{ return mbsstr (haystack, needle); }
template <>
inline const char * mbsstr_template (const char *haystack, const char *needle)
{ return mbsstr (haystack, needle); }
}
# undef mbsstr
# define mbsstr mbsstr_template
# elif !defined mbsstr
# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
|| defined __ICC || defined __TINYC__ \
|| (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
# define mbsstr(h,n) \
_Generic ((h), \
char const *: (char const *) mbsstr ((h), (n)), \
default : mbsstr ((h), (n)))
# endif
# endif
# endif
#endif #endif
#if @GNULIB_MBSCASECMP@ #if @GNULIB_MBSCASECMP@
@ -1219,6 +1253,33 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
_GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)); _GL_ARG_NONNULL ((1, 2));
# ifndef _GL_NO_CONST_GENERICS
/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
compiler warnings for 'const' related mistakes. */
# ifdef __cplusplus
extern "C++" { /* needed for AIX */
template <typename T>
T * mbspcasecmp_template (T* string, const char *prefix);
template <>
inline char * mbspcasecmp_template (char *string, const char *prefix)
{ return mbspcasecmp (string, prefix); }
template <>
inline const char * mbspcasecmp_template (const char *string, const char *prefix)
{ return mbspcasecmp (string, prefix); }
}
# undef mbspcasecmp
# define mbspcasecmp mbspcasecmp_template
# elif !defined mbspcasecmp
# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
|| defined __ICC || defined __TINYC__ \
|| (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
# define mbspcasecmp(s,p) \
_Generic ((s), \
char const *: (char const *) mbspcasecmp ((s), (p)), \
default : mbspcasecmp ((s), (p)))
# endif
# endif
# endif
#endif #endif
#if @GNULIB_MBSCASESTR@ #if @GNULIB_MBSCASESTR@
@ -1230,6 +1291,33 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
_GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)); _GL_ARG_NONNULL ((1, 2));
# ifndef _GL_NO_CONST_GENERICS
/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
compiler warnings for 'const' related mistakes. */
# ifdef __cplusplus
extern "C++" { /* needed for AIX */
template <typename T>
T * mbscasestr_template (T* haystack, const char *needle);
template <>
inline char * mbscasestr_template (char *haystack, const char *needle)
{ return mbscasestr (haystack, needle); }
template <>
inline const char * mbscasestr_template (const char *haystack, const char *needle)
{ return mbscasestr (haystack, needle); }
}
# undef mbscasestr
# define mbscasestr mbscasestr_template
# elif !defined mbscasestr
# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
|| defined __ICC || defined __TINYC__ \
|| (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
# define mbscasestr(h,n) \
_Generic ((h), \
char const *: (char const *) mbscasestr ((h), (n)), \
default : mbscasestr ((h), (n)))
# endif
# endif
# endif
#endif #endif
#if @GNULIB_MBSCSPN@ #if @GNULIB_MBSCSPN@
@ -1388,6 +1476,44 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
# endif # endif
#endif #endif
/* Map any int, typically from errno, into an error message.
With locale_t argument. */
#if @GNULIB_STRERROR_L@
# if @REPLACE_STRERROR_L@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef strerror_l
# define strerror_l rpl_strerror_l
# endif
_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
# else
# if !@HAVE_STRERROR_L@
_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strerror_l);
# endif
#elif defined GNULIB_POSIXCHECK
# undef strerror_l
# if HAVE_RAW_DECL_STRERROR_L
_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
"use gnulib module strerror_l for portability");
# endif
#endif
/* Map any int, typically from errno, into an error message. Multithread-safe,
with locale_t argument.
Not portable! Only provided by gnulib. */
#if @GNULIB_STRERROR_L@
_GL_FUNCDECL_SYS (strerror_l_r, int,
(int errnum, char *buf, size_t buflen, locale_t locale),
_GL_ARG_NONNULL ((2, 4)));
#endif
/* Return the name of the system error code ERRNUM. */ /* Return the name of the system error code ERRNUM. */
#if @GNULIB_STRERRORNAME_NP@ #if @GNULIB_STRERRORNAME_NP@
# if @REPLACE_STRERRORNAME_NP@ # if @REPLACE_STRERRORNAME_NP@
@ -1403,7 +1529,9 @@ _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
# endif # endif
_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strerrorname_np); _GL_CXXALIASWARN (strerrorname_np);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef strerrorname_np # undef strerrorname_np
# if HAVE_RAW_DECL_STRERRORNAME_NP # if HAVE_RAW_DECL_STRERRORNAME_NP

View file

@ -186,7 +186,9 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
# endif # endif
_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (timespec_getres); _GL_CXXALIASWARN (timespec_getres);
# endif
# elif defined GNULIB_POSIXCHECK # elif defined GNULIB_POSIXCHECK
# undef timespec_getres # undef timespec_getres
# if HAVE_RAW_DECL_TIMESPEC_GETRES # if HAVE_RAW_DECL_TIMESPEC_GETRES

View file

@ -95,12 +95,15 @@
# include <stdio.h> # include <stdio.h>
#endif #endif
/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
do not define O_CLOEXEC in <unistd.h>. */
/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
<unistd.h>. */ <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */ /* But avoid namespace pollution on glibc systems. */
#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ #if ! defined O_CLOEXEC \
&& (defined __CYGWIN__ || defined __ANDROID__) \ || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
&& ! defined __GLIBC__ && (defined __CYGWIN__ || defined __ANDROID__) \
&& ! defined __GLIBC__)
# include <fcntl.h> # include <fcntl.h>
#endif #endif
@ -463,7 +466,9 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
int ofd, off_t *opos, int ofd, off_t *opos,
size_t len, unsigned flags)); size_t len, unsigned flags));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (copy_file_range); _GL_CXXALIASWARN (copy_file_range);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef copy_file_range # undef copy_file_range
# if HAVE_RAW_DECL_COPY_FILE_RANGE # if HAVE_RAW_DECL_COPY_FILE_RANGE
@ -1362,11 +1367,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
${LOGNAME-$USER} on Unix platforms, ${LOGNAME-$USER} on Unix platforms,
$USERNAME on native Windows platforms. $USERNAME on native Windows platforms.
*/ */
# if !@HAVE_DECL_GETLOGIN@ # if @REPLACE_GETLOGIN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define getlogin rpl_getlogin
# endif
_GL_FUNCDECL_RPL (getlogin, char *, (void), );
_GL_CXXALIAS_RPL (getlogin, char *, (void));
# else
# if !@HAVE_DECL_GETLOGIN@
_GL_FUNCDECL_SYS (getlogin, char *, (void), ); _GL_FUNCDECL_SYS (getlogin, char *, (void), );
# endif # endif
_GL_CXXALIAS_SYS (getlogin, char *, (void)); _GL_CXXALIAS_SYS (getlogin, char *, (void));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getlogin); _GL_CXXALIASWARN (getlogin);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef getlogin # undef getlogin
# if HAVE_RAW_DECL_GETLOGIN # if HAVE_RAW_DECL_GETLOGIN
@ -2405,7 +2420,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
#if @GNULIB_USLEEP@ #if @GNULIB_USLEEP@
/* Pause the execution of the current thread for N microseconds. /* Pause the execution of the current thread for N microseconds.
Returns 0 on completion, or -1 on range error. Returns 0 on completion, or -1 on range error.
See the POSIX:2001 specification See the POSIX.1-2004 specification
<https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
# if @REPLACE_USLEEP@ # if @REPLACE_USLEEP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)

View file

@ -25,7 +25,7 @@
#include <time.h> #include <time.h>
#if HAVE_UTIMENS || HAVE_LUTIMENS #if HAVE_UTIMENS || HAVE_LUTIMENS
# include <sys/time.h> # include <sys/stat.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -136,8 +136,9 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
} }
# endif # endif
# endif # endif
# if defined __APPLE__ && defined __MACH__ # if (defined __APPLE__ && defined __MACH__) || defined __gnu_hurd__
/* macOS 10.13 does not reject invalid tv_nsec values either. */ /* macOS 10.13 and GNU Hurd do not reject invalid tv_nsec values
either. */
if (times if (times
&& ((times[0].tv_nsec != UTIME_OMIT && ((times[0].tv_nsec != UTIME_OMIT
&& times[0].tv_nsec != UTIME_NOW && times[0].tv_nsec != UTIME_NOW
@ -151,6 +152,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
# if defined __APPLE__ && defined __MACH__
size_t len = strlen (file); size_t len = strlen (file);
if (len > 0 && file[len - 1] == '/') if (len > 0 && file[len - 1] == '/')
{ {
@ -163,6 +165,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
return -1; return -1;
} }
} }
# endif
# endif # endif
result = utimensat (fd, file, times, flag); result = utimensat (fd, file, times, flag);
/* Linux kernel 2.6.25 has a bug where it returns EINVAL for /* Linux kernel 2.6.25 has a bug where it returns EINVAL for

View file

@ -157,9 +157,10 @@
#define _GL_CONCAT0(x, y) x##y #define _GL_CONCAT0(x, y) x##y
/* _GL_COUNTER is an integer, preferably one that changes each time we /* _GL_COUNTER is an integer, preferably one that changes each time we
use it. Use __COUNTER__ if it works, falling back on __LINE__ use it. Use __COUNTER__ if it works (it does so with most compilers,
otherwise. __LINE__ isn't perfect, but it's better than a see <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>),
constant. */ falling back on __LINE__ otherwise. __LINE__ isn't perfect, but it's
better than a constant. */
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ #if defined __COUNTER__ && __COUNTER__ != __COUNTER__
# define _GL_COUNTER __COUNTER__ # define _GL_COUNTER __COUNTER__
#else #else

View file

@ -1,5 +1,5 @@
# builtin-expect.m4 # builtin-expect.m4
# serial 2 # serial 3
dnl Copyright 2016-2025 Free Software Foundation, Inc. dnl Copyright 2016-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -48,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
#elif HAVE___BUILTIN_EXPECT == 2 #elif HAVE___BUILTIN_EXPECT == 2
# include <builtins.h> # include <builtins.h>
#endif #endif
]) ])])
])

View file

@ -1,5 +1,5 @@
# futimens.m4 # futimens.m4
# serial 11 # serial 12
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -32,22 +32,45 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
]GL_MDA_DEFINES], ]GL_MDA_DEFINES],
[[struct timespec ts[2]; [[struct timespec ts[2];
int fd = creat ("conftest.file", 0600); int fd = creat ("conftest.file", 0600);
int result = 0;
struct stat st; struct stat st;
if (fd < 0) return 1; if (fd < 0)
return 1;
ts[0].tv_sec = 1; ts[0].tv_sec = 1;
ts[0].tv_nsec = UTIME_OMIT; ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 1; ts[1].tv_sec = 1;
ts[1].tv_nsec = UTIME_NOW; ts[1].tv_nsec = UTIME_NOW;
errno = 0; errno = 0;
if (futimens (AT_FDCWD, NULL) == 0) return 2; if (futimens (AT_FDCWD, NULL) == 0 || errno != EBADF)
if (errno != EBADF) return 3; result |= 2;
if (futimens (fd, ts)) return 4; if (futimens (fd, ts))
result |= 4;
sleep (1); sleep (1);
ts[0].tv_nsec = UTIME_NOW; ts[0].tv_nsec = UTIME_NOW;
ts[1].tv_nsec = UTIME_OMIT; ts[1].tv_nsec = UTIME_OMIT;
if (futimens (fd, ts)) return 5; if (futimens (fd, ts))
if (fstat (fd, &st)) return 6; result |= 8;
if (st.st_ctime < st.st_atime) return 7; if (fstat (fd, &st))
result |= 16;
if (st.st_ctime < st.st_atime)
result |= 32;
enum
{
BILLION = 1000 * 1000 * 1000,
/* Bogus positive and negative tv_nsec values closest to valid
range, but without colliding with UTIME_NOW or UTIME_OMIT. */
UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
? (1 + (UTIME_NOW == BILLION + 1)
+ (UTIME_OMIT == BILLION + 1))
: 0)
};
ts[0].tv_sec = 1;
ts[0].tv_nsec = UTIME_BOGUS_POS;
ts[1].tv_sec = 1;
ts[1].tv_nsec = 0;
if (futimens (fd, ts) == 0)
result |= 64;
return result;
]])], ]])],
[gl_cv_func_futimens_works=yes], [gl_cv_func_futimens_works=yes],
[gl_cv_func_futimens_works=no], [gl_cv_func_futimens_works=no],

View file

@ -1,5 +1,5 @@
# gnulib-common.m4 # gnulib-common.m4
# serial 107 # serial 109
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -20,6 +20,20 @@ AC_DEFUN([gl_COMMON_BODY], [
AH_VERBATIM([0witness], AH_VERBATIM([0witness],
[/* Witness that <config.h> has been included. */ [/* Witness that <config.h> has been included. */
#define _GL_CONFIG_H_INCLUDED 1 #define _GL_CONFIG_H_INCLUDED 1
])
dnl Avoid warnings from gcc -Wtrailing-whitespace.
dnl This is a temporary workaround until Autoconf fixes it.
dnl Test case:
dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
dnl should produce "#define FOO /**/", not "#define FOO ".
AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
#endif
])
AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
# pragma GCC diagnostic pop
#endif
]) ])
AH_VERBATIM([_GL_GNUC_PREREQ], AH_VERBATIM([_GL_GNUC_PREREQ],
[/* True if the compiler says it groks GNU C version MAJOR.MINOR. [/* True if the compiler says it groks GNU C version MAJOR.MINOR.
@ -1304,7 +1318,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for C compiler option to allow warnings], AC_CACHE_CHECK([for C compiler option to allow warnings],
[gl_cv_cc_wallow], [gl_cv_cc_wallow],
[rm -f conftest* [rm -fr conftest*
echo 'int dummy;' > conftest.c echo 'int dummy;' > conftest.c
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
@ -1317,7 +1331,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
else else
gl_cv_cc_wallow=none gl_cv_cc_wallow=none
fi fi
rm -f conftest* rm -fr conftest*
]) ])
case "$gl_cv_cc_wallow" in case "$gl_cv_cc_wallow" in
none) GL_CFLAG_ALLOW_WARNINGS='' ;; none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@ -1335,7 +1349,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
if test -n "$CXX" && test "$CXX" != no; then if test -n "$CXX" && test "$CXX" != no; then
AC_CACHE_CHECK([for C++ compiler option to allow warnings], AC_CACHE_CHECK([for C++ compiler option to allow warnings],
[gl_cv_cxx_wallow], [gl_cv_cxx_wallow],
[rm -f conftest* [rm -fr conftest*
echo 'int dummy;' > conftest.cc echo 'int dummy;' > conftest.cc
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
@ -1348,7 +1362,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
else else
gl_cv_cxx_wallow=none gl_cv_cxx_wallow=none
fi fi
rm -f conftest* rm -fr conftest*
]) ])
case "$gl_cv_cxx_wallow" in case "$gl_cv_cxx_wallow" in
none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;

View file

@ -57,6 +57,8 @@ AC_DEFUN([gl_EARLY],
# Code from module byteswap: # Code from module byteswap:
# Code from module c-ctype: # Code from module c-ctype:
# Code from module c-strcase: # Code from module c-strcase:
# Code from module c-strcasecmp:
# Code from module c-strncasecmp:
# Code from module c99: # Code from module c99:
# Code from module canonicalize-lgpl: # Code from module canonicalize-lgpl:
# Code from module careadlinkat: # Code from module careadlinkat:

View file

@ -1,5 +1,5 @@
# manywarnings.m4 # manywarnings.m4
# serial 28 # serial 29
dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -94,7 +94,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
# List all gcc warning categories. # List all gcc warning categories.
# To compare this list to your installed GCC's, run this Bash command: # To compare this list to your installed GCC's, run this Bash command:
# #
# comm -3 \ # export LC_ALL=C && comm -3 \
# <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \ # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
# awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \ # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
# <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort) # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)

View file

@ -1,5 +1,5 @@
# regex.m4 # regex.m4
# serial 78 # serial 81
dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc. dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -53,6 +53,11 @@ AC_DEFUN([gl_REGEX],
/* Exit with distinguishable exit code. */ /* Exit with distinguishable exit code. */
static void sigabrt_no_core (int sig) { raise (SIGTERM); } static void sigabrt_no_core (int sig) { raise (SIGTERM); }
#endif #endif
/* There is no need to check whether RE_SYNTAX_EMACS is
(RE_CHAR_CLASSES | RE_INTERVALS), corresponding to
Emacs 21 (2001) and later, because Gnulib's lib/regex.h
is always used and has this value. */
]], ]],
[[int result = 0; [[int result = 0;
static struct re_pattern_buffer regex; static struct re_pattern_buffer regex;

View file

@ -1,5 +1,5 @@
# stddef_h.m4 # stddef_h.m4
# serial 17 # serial 19
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -90,24 +90,25 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
GL_GENERATE_STDDEF_H=true GL_GENERATE_STDDEF_H=true
fi fi
AC_CACHE_CHECK([for clean definition of __STDC_VERSION_STDDEF_H__], dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870
[gl_cv_clean_version_stddef], dnl affects GCC 13 and 14.
[AC_PREPROC_IFELSE( AC_CACHE_CHECK([whether <stddef.h> is idempotent],
[AC_LANG_SOURCE( [gl_cv_stddef_idempotent],
[[/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 */ [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
#include <stddef.h> [[
#undef __STDC_VERSION_STDDEF_H__ #if __GNUC__ == 13 || __GNUC__ == 14
#include <time.h> #error "bug 114870 is present"
#ifdef __STDC_VERSION_STDDEF_H__ #endif
# error "<time.h> defines __STDC_VERSION_STDDEF_H__" ]])],
#endif [gl_cv_stddef_idempotent="guessing yes"],
]])], [gl_cv_stddef_idempotent="guessing no"])
[gl_cv_clean_version_stddef=yes], ])
[gl_cv_clean_version_stddef=no])]) case "$gl_cv_stddef_idempotent" in
if test "$gl_cv_clean_version_stddef" = no; then *yes) ;;
STDDEF_NOT_IDEMPOTENT=1 *) STDDEF_NOT_IDEMPOTENT=1
GL_GENERATE_STDDEF_H=true GL_GENERATE_STDDEF_H=true
fi ;;
esac
if $GL_GENERATE_STDDEF_H; then if $GL_GENERATE_STDDEF_H; then
gl_NEXT_HEADERS([stddef.h]) gl_NEXT_HEADERS([stddef.h])

View file

@ -1,5 +1,5 @@
# string_h.m4 # string_h.m4
# serial 43 # serial 44
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -25,7 +25,8 @@ AC_DEFUN_ONCE([gl_STRING_H],
[explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
rawmemchr stpcpy stpncpy strchrnul rawmemchr stpcpy stpncpy strchrnul
strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) strerror_l strerror_r strerrorname_np
sigabbrev_np sigdescr_np strsignal strverscmp])
AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_C_RESTRICT])
]) ])
@ -90,6 +91,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
@ -128,6 +130,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
@ -150,6 +153,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP])

View file

@ -1,5 +1,5 @@
# unistd_h.m4 # unistd_h.m4
# serial 96 # serial 97
dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -244,6 +244,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY])
REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN])
REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])

View file

@ -1,5 +1,5 @@
# utimensat.m4 # utimensat.m4
# serial 12 # serial 14
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -67,11 +67,30 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
ts[1].tv_sec = 1; ts[1].tv_sec = 1;
ts[1].tv_nsec = UTIME_OMIT; ts[1].tv_nsec = UTIME_OMIT;
if (utimensat (AT_FDCWD, f, ts, 0)) if (utimensat (AT_FDCWD, f, ts, 0))
result |= 16; result |= 8;
if (stat (f, &st)) if (stat (f, &st))
result |= 32; result |= 8;
else if (st.st_ctime < st.st_atime) else if (st.st_ctime < st.st_atime)
result |= 64; result |= 16;
}
enum
{
BILLION = 1000 * 1000 * 1000,
/* Bogus positive and negative tv_nsec values closest to valid
range, but without colliding with UTIME_NOW or UTIME_OMIT. */
UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
? (1 + (UTIME_NOW == BILLION + 1)
+ (UTIME_OMIT == BILLION + 1))
: 0)
};
{
struct timespec ts[2];
ts[0].tv_sec = 1;
ts[0].tv_nsec = UTIME_BOGUS_POS;
ts[1].tv_sec = 1;
ts[1].tv_nsec = 0;
if (utimensat (AT_FDCWD, f, ts, 0) == 0)
result |= 32;
} }
return result; return result;
]])], ]])],
@ -83,8 +102,11 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
], ],
[case "$host_os" in [case "$host_os" in
# Guess yes on Linux or glibc systems. # Guess yes on Linux or glibc systems.
linux-* | linux | *-gnu* | gnu*) linux*)
gl_cv_func_utimensat_works="guessing yes" ;; gl_cv_func_utimensat_works="guessing yes" ;;
# Guess no on GNU/Hurd.
gnu*)
gl_cv_func_utimensat_works="guessing no" ;;
# Guess yes on systems that emulate the Linux system calls. # Guess yes on systems that emulate the Linux system calls.
midipix*) midipix*)
gl_cv_func_utimensat_works="guessing yes" ;; gl_cv_func_utimensat_works="guessing yes" ;;

View file

@ -1,5 +1,5 @@
# warnings.m4 # warnings.m4
# serial 20 # serial 21
dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -114,7 +114,7 @@ AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for C compiler option to inhibit all warnings], AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
[gl_cv_cc_winhibit], [gl_cv_cc_winhibit],
[rm -f conftest* [rm -fr conftest*
echo 'int dummy;' > conftest.c echo 'int dummy;' > conftest.c
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null
@ -123,7 +123,7 @@ AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
else else
gl_cv_cc_winhibit=none gl_cv_cc_winhibit=none
fi fi
rm -f conftest* rm -fr conftest*
]) ])
case "$gl_cv_cc_winhibit" in case "$gl_cv_cc_winhibit" in
none) GL_CFLAG_INHIBIT_WARNINGS='' ;; none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
@ -146,7 +146,7 @@ AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
if test -n "$CXX" && test "$CXX" != no; then if test -n "$CXX" && test "$CXX" != no; then
AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings], AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
[gl_cv_cxx_winhibit], [gl_cv_cxx_winhibit],
[rm -f conftest* [rm -fr conftest*
echo 'int dummy;' > conftest.cc echo 'int dummy;' > conftest.cc
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null
@ -155,7 +155,7 @@ AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
else else
gl_cv_cxx_winhibit=none gl_cv_cxx_winhibit=none
fi fi
rm -f conftest* rm -fr conftest*
]) ])
case "$gl_cv_cxx_winhibit" in case "$gl_cv_cxx_winhibit" in
none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;; none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;