]> git.eshelyaron.com Git - emacs.git/commitdiff
Update from Gnulib by running admin/merge-gnulib
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 19 Apr 2025 19:18:28 +0000 (12:18 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 21 Apr 2025 20:41:14 +0000 (22:41 +0200)
(cherry picked from commit 71ee484cac3e0e5b68f006b4cca81c13ca6ce11e)

37 files changed:
doc/misc/texinfo.tex
lib/acl-internal.c
lib/acl-internal.h
lib/acl_entries.c
lib/fcntl.in.h
lib/file-has-acl.c
lib/fpending.c
lib/getloadavg.c
lib/getopt-pfx-ext.h
lib/getopt.in.h
lib/gnulib.mk.in
lib/intprops.h
lib/nproc.c
lib/readutmp.h
lib/regcomp.c
lib/regex.h
lib/regex_internal.c
lib/regexec.c
lib/stdio-impl.h
lib/stdlib.in.h
lib/string.in.h
lib/time.in.h
lib/unistd.in.h
lib/utimens.h
lib/utimensat.c
lib/verify.h
m4/builtin-expect.m4
m4/futimens.m4
m4/gnulib-common.m4
m4/gnulib-comp.m4
m4/manywarnings.m4
m4/regex.m4
m4/stddef_h.m4
m4/string_h.m4
m4/unistd_h.m4
m4/utimensat.m4
m4/warnings.m4

index faad184e345b058eda6fd880c4070a7950e419c5..3ebea93cb1d604c6b0fa7f1b95fcb6e5b1dda01a 100644 (file)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2025-01-31.21}
+\def\texinfoversion{2025-03-22.08}
 %
 % Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
 %
 % Avoid "undefined control sequence" errors.
 \def\currentchapterdefs{}
 \def\currentsectiondefs{}
-\def\currentsection{}
 \def\prevchapterdefs{}
 \def\prevsectiondefs{}
 \def\currentcolordefs{}
@@ -980,18 +979,51 @@ where each line of input produces a line of output.}
 \newif\ifpdf
 \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
 \ifx\luatexversion\thisisundefined\else
   \luatextrue
+  \ifnum\luatexversion>84
+    \pdftrue
+  \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
 %
 
-\newif\iftxiuseunicodedestname
-\txiuseunicodedestnamefalse % For pdfTeX etc.
-
 \ifluatex
   % Use Unicode destination names
   \txiuseunicodedestnametrue
@@ -1045,7 +1077,7 @@ where each line of input produces a line of output.}
     %
   \endgroup
   \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
-  \ifnum\luatexversion>84
+  \ifpdf
     % For LuaTeX >= 0.85
     \def\pdfdest{\pdfextension dest}
     \let\pdfoutput\outputmode
@@ -1068,33 +1100,6 @@ where each line of input produces a line of output.}
   \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.
 % See PDF reference v.1.7 p.594, section 8.3.1.
@@ -1388,9 +1393,6 @@ output) for that.)}
     \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
   % come from Petr Olsak
   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
@@ -1416,7 +1418,7 @@ output) for that.)}
       \def\pdfdestname{#4}%
     \fi
     %
-    \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
+    \pdfoutline goto name{\pdfdestname}#2{\pdfoutlinetext}%
   }
   %
   \def\pdfmakeoutlines{%
@@ -1427,15 +1429,18 @@ output) for that.)}
        \def\thischapnum{##2}%
        \def\thissecnum{0}%
        \def\thissubsecnum{0}%
+       \def\indexlastsec{chap\thischapnum}%
       }%
       \def\numsecentry##1##2##3##4{%
        \advancenumber{chap\thischapnum}%
        \def\thissecnum{##2}%
        \def\thissubsecnum{0}%
+       \def\indexlastsec{sec\thissecnum}%
       }%
       \def\numsubsecentry##1##2##3##4{%
        \advancenumber{sec\thissecnum}%
        \def\thissubsecnum{##2}%
+       \def\indexlastsec{subsec\thissecnum}%
       }%
       \def\numsubsubsecentry##1##2##3##4{%
        \advancenumber{subsec\thissubsecnum}%
@@ -1443,7 +1448,13 @@ output) for that.)}
       \def\thischapnum{0}%
       \def\thissecnum{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
       % al. a second time, below.
       \def\appentry{\numchapentry}%
@@ -1455,9 +1466,6 @@ output) for that.)}
       \def\unnsubsecentry{\numsubsecentry}%
       \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}%
       %
       % Read toc second time, this time actually producing the outlines.
@@ -1482,18 +1490,6 @@ output) for that.)}
       \def\idxinitialentry##1##2##3##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
       \setupdatafile
       % We can have normal brace characters in the PDF outlines, unlike
@@ -1501,9 +1497,9 @@ output) for that.)}
       \def\{{\lbracecharliteral}%
       \def\}{\rbracecharliteral}%
       \catcode`\\=\active \otherbackslash
-      \input \tocreadfilename
+      \input \tocreadfilename\relax
+      \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
     \endgroup
-    \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
   }
   \def\dopdfoutlinecontents{%
     \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}%
@@ -1541,7 +1537,7 @@ output) for that.)}
   %
   \def\pdflink#1{\pdflinkpage{#1}{#1}}%
   \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}
 \else
   % non-pdf mode
@@ -1644,18 +1640,20 @@ output) for that.)}
       % horizontal space being required in the PDF viewer.
       \def\partentry##1##2##3##4{}% ignore parts in the outlines
       \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{%
-        \dopdfoutline{##1}{2}{##3}{##4}}%
+        \dopdfoutline{##1}{2}{##3}{##4}%
+        \def\indexseclevel{3}}%
       \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{%
-        \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{%
-         \dopdfoutline{##1}{2}{idx.##1.##2}{##4}}%
+         \dopdfoutline{##1}{\indexseclevel}{idx.##1.##2}{##4}}%
       %
       \let\appentry\numchapentry%
       \let\appsecentry\numsecentry%
@@ -1680,7 +1678,9 @@ output) for that.)}
       \def\{{\lbracecharliteral}%
       \def\}{\rbracecharliteral}%
       \catcode`\\=\active \otherbackslash
+      \xetexpreauxfile
       \input \tocreadfilename\relax
+      \xetexpostauxfile
       \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
     \endgroup
   }
@@ -5177,8 +5177,8 @@ $$%
   %
   \uccode`\1=`\{ \uppercase{\def\{{1}}%
   \uccode`\1=`\} \uppercase{\def\}{1}}%
-  \let\lbracechar\{%
-  \let\rbracechar\}%
+  \def\lbracechar##1{\{}%
+  \def\rbracechar##1{\}}%
   %
   %
   % We need to get rid of all macros, leaving only the arguments (if present).
@@ -5523,6 +5523,8 @@ $$%
   \tolerance = 9500
   \plainfrenchspacing
   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
+  \let\entry\indexentry
+  \ifxetex\xetexpreauxfile\fi
   %
   % See comment in \requireopenindexfile.
   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
@@ -5548,6 +5550,7 @@ $$%
     \fi
   \fi
   \closein 1
+  \ifxetex\xetexpostauxfile\fi
 \endgroup}
 
 % Checked in @bye
@@ -5583,7 +5586,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       }%
     \else
       \begindoublecolumns
+      \ifxetex\xetexpreauxfile\fi
       \input \jobname.\indexname s
+      \ifxetex\xetexpostauxfile\fi
       \enddoublecolumns
     \fi
   }{%
@@ -5594,11 +5599,39 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     % should work because we (hopefully) don't otherwise use @ in index files.
     %\catcode`\@=12\relax
     \catcode`\@=0\relax
+    \ifxetex\xetexpreauxfile\fi
     \input \jobname.\indexname s
+    \ifxetex\xetexpostauxfile\fi
     \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.
 % Change them to control the appearance of the index.
 
@@ -5673,18 +5706,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \def\doindexinitialentry#1{%
   \ifpdforxetex
     \global\advance\idxinitialno by 1
-    \def\indexlbrace{\{}
-    \def\indexrbrace{\}}
-    \def\indexbackslash{\realbackslash}
-    \def\indexatchar{\@}
+    \def\indexlbrace{\{}%
+    \def\indexrbrace{\}}%
+    \def\indexbackslash{\realbackslash}%
+    \def\indexatchar{\@}%
     \writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}%
     % The @asis removes a pair of braces around e.g. {@indexatchar} that
     % 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}%
   \fi
 }
@@ -5704,16 +5733,18 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \newdimen\entrycontskip
 \entrycontskip=1em
 
-% for PDF output, whether to make the text of the entry a link to the page
-% number.  set for @contents and @shortcontents where there is only one
-% page number.
+% for PDF output, whether to make the text of the entry a link to the section.
+% set for @contents and @shortcontents.
 \newif\iflinkentrytext
 
-% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
-% then page number (#2) flushed to the right margin.  It is used for index
-% and table of contents entries.  The paragraph is indented by \leftskip.
-% If \tocnodetarget is set, link text to the referenced node.
-\def\entry{%
+% \entryinternal typesets a paragraph consisting of the text (#1), dot
+% leaders, and then page number (#2) flushed to the right margin.  It is
+% used for index and table of contents entries.  The paragraph is indented
+% by \leftskip.
+% 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
     %
     % Start a new paragraph if necessary, so our assignments below can't
@@ -5761,7 +5792,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
             \endlink
           \fi
         \else
-          \unhbox\boxA
+          \ifx\entrypagetarget\empty
+            \unhbox\boxA
+          \else
+            \pdflinkpage{\entrypagetarget}{\unhbox\boxA}%
+          \fi
         \fi
       \else
         \unhbox\boxA
@@ -6433,6 +6468,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
   \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
 % (including whitespace, linebreaking, etc. around it),
 % given all the information in convenient, parsed form.
@@ -6554,11 +6593,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \chapfonts \rm
     \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
     % number, and don't print the unnumbered ``number''.
     \ifx\temptype\Ynothingkeyword
@@ -6585,7 +6619,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     % 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
     % being visible, for instance under high magnification.
-    \donoderef{#2}%
+    \donoderef{#2}{#1}%
     %
     % Typeset the actual heading.
     \nobreak % Avoid page breaks at the interline glue.
@@ -6701,21 +6735,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \ifx\temptype\Ynothingkeyword
       \setbox0 = \hbox{}%
       \def\toctype{unn}%
-      \gdef\currentsection{#1}%
     \else\ifx\temptype\Yomitfromtockeyword
-      % for @headings -- no section number, don't include in toc,
-      % and don't redefine \currentsection.
+      % for @headings -- no section number, don't include in toc.
       \setbox0 = \hbox{}%
       \def\toctype{omit}%
       \let\sectionlevel=\empty
     \else\ifx\temptype\Yappendixkeyword
       \setbox0 = \hbox{#4\enspace}%
       \def\toctype{app}%
-      \gdef\currentsection{#1}%
     \else
       \setbox0 = \hbox{#4\enspace}%
       \def\toctype{num}%
-      \gdef\currentsection{#1}%
     \fi\fi\fi
     %
     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
@@ -6723,7 +6753,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     %
     % Write the node reference (= pdf destination for pdftex).
     % Again, see comments in \chapmacro.
-    \donoderef{#3}%
+    \donoderef{#3}{#1}%
     %
     % Interline glue will be inserted when the vbox is completed.
     % That glue will be a valid breakpoint for the page, since it'll be
@@ -6955,6 +6985,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 %
 \def\contents{%
   \startcontents{\putwordTOC}{\contentsmkdest}%
+    \ifxetex\xetexpreauxfile\fi
     \openin 1 \tocreadfilename\space
     \ifeof 1 \else
       \findsecnowidths
@@ -6966,6 +6997,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \pdfmakeoutlines
     \fi
     \closein 1
+    \ifxetex\xetexpostauxfile\fi
   \endgroup
   \contentsendroman
 }
@@ -6999,11 +7031,13 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \let\numsubsubsecentry = \numsecentry
     \let\appsubsubsecentry = \numsecentry
     \let\unnsubsubsecentry = \numsecentry
+    \ifxetex\xetexpreauxfile\fi
     \openin 1 \tocreadfilename\space
     \ifeof 1 \else
       \readtocfile
     \fi
     \closein 1
+    \ifxetex\xetexpostauxfile\fi
     \vfill \eject
     \contentsalignmacro % in case @setchapternewpage odd is in effect
   \endgroup
@@ -7167,6 +7201,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \extrasecnoskip=0pt
 
 \let\tocnodetarget\empty
+\let\entrypagetarget\empty
 
 % \tocentry{TITLE}{SEC NO}{NODE}{PAGE}
 %
@@ -7174,7 +7209,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \def\tocnodetarget{#3}%
   \def\secno{#2}%
   \ifx\empty\secno
-    \entry{#1}{#4}%
+    \entryinternal{#1}{#4}%
   \else
     \ifdim 0pt=\secnowidth
       \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
@@ -7185,7 +7220,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
         #2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
     \fi
     \entrycontskip=\wd0
-    \entry{\box0 #1}{#4}%
+    \entryinternal{\box0 #1}{#4}%
   \fi
 }
 \newdimen\labelspace
@@ -8170,18 +8205,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   }
 \fi
 
-\let\E=\expandafter
-
 % Used at the time of macro expansion.
 % Argument is macro body with arguments substituted
 \def\scanmacro#1{%
   \newlinechar`\^^M
-  % expand the expansion of \eatleadingcr twice to maybe remove a leading
-  % 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{}%
+  \def\xeatspaces##1{\eatleadingcrthen\eatspaces{##1}}%
   %
   % Process the macro body under the current catcode regime.
   \scantokens{#1@comment}%
@@ -8234,10 +8262,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
 }
 
-{\catcode`\^^M=\other%
-\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
-% Warning: this won't work for a delimited argument
-% or for an empty argument
+% Trim a single leading ^^M off a string, then call #1
+{\catcode`\^^M=\active \catcode`\Q=3%
+\gdef\eatleadingcrthen #1#2{\eatlcra #1Q#2Q^^MQ}%
+\gdef\eatlcra #1#2Q^^M{\eatlcrb #1#2Q}%
+\gdef\eatlcrb #1Q#2Q#3Q{#1{#2}}%
+}
 
 % Trim a single trailing ^^M off a string.
 {\catcode`\^^M=\other \catcode`\Q=3%
@@ -8373,6 +8403,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % <parameter list> is #, then the preceding argument is delimited by
 % 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.
 % Set \paramno to the number of arguments,
 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
@@ -8385,14 +8419,13 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % That gets used by \mbodybackslash (above).
 %
 % If there are 10 or more arguments, a different technique is used: see
-% \parsemmanyargdef.
+% \parsemmanyargdef@@.
 %
 \def\parsemargdef#1;{%
   \paramno=0\def\paramlist{}%
   \let\hash\relax
   % \hash is redefined to `#' later to get it into definitions
   \let\xeatspaces\relax
-  \let\xempty\relax
   \parsemargdefxxx#1,;,%
   \ifnum\paramno<10\relax\else
     \paramno0\relax
@@ -8404,11 +8437,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \else \let\next=\parsemargdefxxx
     \advance\paramno by 1
     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
-        {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
+        {\xeatspaces{\hash\the\paramno}}%
     \edef\paramlist{\paramlist\hash\the\paramno,}%
   \fi\next}
-% the \xempty{} is to give \eatleadingcr an argument in the case of an
-% empty macro argument.
 
 % \parsemacbody, \parsermacbody
 %
@@ -8419,14 +8450,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % body to be transformed.
 % Set \macrobody to the body of the macro, and call \macrodef.
 %
+\catcode `\@\texiatcatcode
 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
-
-% Make @ a letter, so that we can make private-to-Texinfo macro names.
-\edef\texiatcatcode{\the\catcode`\@}
-\catcode `@=11\relax
+\catcode `\@=11\relax
 
 %%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
 
@@ -8687,15 +8716,13 @@ might help (with 'rm \jobname.?? \jobname.??s')%
         \noexpand\expandafter
         \expandafter\noexpand\csname\the\macname @@\endcsname}%
       \expandafter\xdef\csname\the\macname @@\endcsname##1{%
-          \noexpand\passargtomacro
-          \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
+        \noexpand\passargtomacro
+        \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-        \csname\the\macname @@@@\endcsname\paramlist{%
-          \endgroup\noexpand\scanmacro{\macrobody}}%
+        \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
+      \expandaftergroup{\expandafter\xdef\csname\the\macname @@@@\endcsname}%
+                       \paramlist{%
+        \endgroup\noexpand\scanmacro{\macrobody}}%
     \else % 10 or more:
       \expandafter\xdef\csname\the\macname\endcsname{%
         \noexpand\getargvals@{\the\macname}{\argl}%
@@ -8707,6 +8734,16 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 \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}}
 
 
@@ -8876,9 +8913,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \expandafter\noexpand
     \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
   }
-  \expandafter\expandafter
-  \expandafter\xdef
-  \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
+  \expandaftergroup{\expandafter\xdef\csname\the\macname @@@\endcsname}%
+                     \paramlist{%
     \newlinechar=13 % split \macrobody into lines
     \noexpand\scantokens{\macrobody}%
   }
@@ -8953,11 +8989,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \let\lastnode=\empty
 
 % 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
-    \setref{\lastnode}{#1}%
+    \setref{\lastnode}{#1}{#2}%
     \global\let\lastnode=\empty
     \setnodeseenonce
   \fi
@@ -8978,21 +9014,28 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 %
 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
-
-% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
-% anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \currentsection,
-%                 or the anchor name.
-% 2) NAME-snt   - section number and type, passed as the SNT arg, or
-%                 empty for anchors.
+\def\anchor#1{%
+  \savesf \setref{#1}{Yanchor}{#1}\restoresf \ignorespaces
+}
+
+% @namedanchor{NAME, XREFNAME} -- define xref target at arbitrary point
+% with label text for cross-references to it.
+\def\namedanchor#1{\donamedanchor#1\finish}%
+\def\donamedanchor#1,#2\finish{%
+  \savesf \setref{#1}{Yanchor}{\ignorespaces #2\unskip}\restoresf \ignorespaces
+}
+
+% \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.
 %
 % This is called from \donoderef, \anchor, and \dofloat.  In the case of
 % floats, there is an additional part, which is not written here:
 % 4) NAME-lof   - the text as it should appear in a @listoffloats.
 %
-\def\setref#1#2{%
+\def\setref#1#2#3{%
   \pdfmkdest{#1}%
   \iflinks
     {%
@@ -9004,7 +9047,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
        \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
          ##1}{##2}}% these are parameters of \writexrdef
       }%
-      \toks0 = \expandafter{\currentsection}%
+      \toks0 = {#3}%
       \immediate \writexrdef{title}{\the\toks0 }%
       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
@@ -9058,15 +9101,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
   %
   \startxreflink{#1}{#4}%
-  {%
-    % 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
-  }%
+  \getrefx{#1-title}\Xthisreftitle
   %
   % Float references are printed completely differently: "Figure 1.2"
   % instead of "[somenode], p.3".  \iffloat distinguishes them by
@@ -9099,21 +9134,23 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       % Cross-manual reference with a printed manual name.
       %
       \crossmanualxref{\cite{\printedmanual\unskip}}%
-    %
     \else\ifdim \wd\infofilenamebox > 0pt
       % Cross-manual reference with only an info filename (arg 4), no
       % printed manual name (arg 5).  This is essentially the same as
       % the case above; we output the filename, since we have nothing else.
       %
       \crossmanualxref{\code{\infofilename\unskip}}%
-    %
     \else
       % Reference within this manual.
       %
-      % Only output a following space if the -snt ref is nonempty, as the ref
-      % will be empty for @unnumbered and @anchor.
-      \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
-      \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+      % Only output a following space if the -snt ref is nonempty, as is
+      % the case for @unnumbered and @anchor.
+      \getrefx{#1-snt}\tmp
+      \ifx\tmp\empty\else
+        \ifx\tmp\Yanchor\else
+          \tmp\space
+        \fi
+      \fi
       %
       % output the `[mynode]' via the macro below so it can be overridden.
       \xrefprintnodename\printedrefname
@@ -9169,7 +9206,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
         \else
           % Otherwise just copy the Info node name.
           \def\printedrefname{\ignorespaces #1}%
-        \fi%
+        \fi
       \fi
     \fi
   \fi
@@ -9201,7 +9238,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
        \ifnum\filenamelength>0
          goto file{\the\filename.pdf} name{\pdfdestname}%
        \else
-         goto name{\pdfmkpgn{\pdfdestname}}%
+         goto name{\pdfdestname}%
        \fi
      \else % XeTeX
        \ifnum\filenamelength>0
@@ -9281,6 +9318,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 %
 \def\Ynothing{}
 \def\Yomitfromtoc{}
+\def\Yanchor{\isanchor} \let\isanchor\relax
 \def\Ynumbered{%
   \ifnum\secno=0
     \putwordChapter@tie \the\chapno
@@ -9307,14 +9345,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 % \refx{NAME} - reference a cross-reference string named NAME.
 \def\refx#1{%
-  \requireauxfile
-  {%
-    \indexnofonts
-    \turnoffactive
-    \def\value##1{##1}%
-    \expandafter\global\expandafter\let\expandafter\thisrefX
-      \csname XR#1\endcsname
-  }%
+  \getrefx{#1}\thisrefX
   \ifx\thisrefX\relax
     % If not defined, say something at least.
     \angleleft un\-de\-fined\angleright
@@ -9335,6 +9366,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \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
 % 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
@@ -9399,12 +9441,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % Read the last existing aux file, if any.  No error if none exists.
 %
 \def\tryauxfile{%
+  \ifxetex\xetexpreauxfile\fi
   \openin 1 \jobname.aux
   \ifeof 1 \else
     \readdatafile{aux}%
     \global\havexrefstrue
   \fi
   \closein 1
+  \ifxetex\xetexpostauxfile\fi
 }
 
 \def\setupdatafile{%
@@ -9790,14 +9834,15 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \global\advance\floatno by 1
       %
       {%
-        % This magic value for \currentsection is output by \setref as the
-        % XREFLABEL-title value.  \xrefX uses it to distinguish float
+        % This magic value for the third argument of \setref is output as
+        % the XREFLABEL-title value.  \xrefX uses it to distinguish float
         % labels (which have a completely different output format) from
         % node and anchor labels.  And \xrdef uses it to construct the
         % lists of floats.
         %
-        \edef\currentsection{\floatmagic=\safefloattype}%
-        \setref{\floatlabel}{Yfloat}%
+        \edef\tmp{\noexpand\setref{\floatlabel}{Yfloat}%
+                  {\floatmagic=\safefloattype}}%
+        \tmp
       }%
     \fi
     %
@@ -9919,7 +9964,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 % #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
-% \currentsection value which we \setref above.
+% value which we passed to \setref above.
 %
 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
 %
@@ -9976,6 +10021,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
   %
   % 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}}%
   \writeentry
 }}
@@ -10071,17 +10117,24 @@ directory should work if nowhere else does.}
   \fi
 \fi
 
+\let\xetexpreauxfile\relax
+\let\xetexpostauxfile\relax
+
 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
 % for non-UTF-8 (byte-wise) encodings.
 %
 \def\setbytewiseio{%
   \ifxetex
-    \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
-    \XeTeXinputencoding "bytes"  % For document root file
-    % Unfortunately, there seems to be no corresponding XeTeX command for
-    % output encoding.  This is a problem for auxiliary index and TOC files.
-    % The only solution would be perhaps to write out @U{...} sequences in
-    % place of non-ASCII characters.
+    % For document root file
+    \XeTeXinputencoding "bytes"
+    %
+    % Setting for subsequent files to be read with @include.
+    \XeTeXdefaultencoding "bytes"
+    %
+    % 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
 
   \ifluatex
@@ -10713,12 +10766,12 @@ directory should work if nowhere else does.}
 
 % Suppress ligature creation from adjacent characters.
 \ifluatex
-  \def\nolig{{}}
-\else
   % 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
   % workaround.
   \def\nolig{\kern0pt{}}
+\else
+  \def\nolig{{}}
 \fi
 
 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
index 1a6087b03a9ad2b49feefe869d7de494ef992f04..6c50feacbb811da92da9a68d544132d87ad8dbf3 100644 (file)
@@ -31,7 +31,7 @@
 # include <string.h>
 #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 */
 
@@ -45,7 +45,7 @@ acl_extended_nontrivial (acl_t acl)
   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.
    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
         return (3 < acl_entries (acl));
      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;
   int got_one;
@@ -548,7 +548,7 @@ void
 free_permission_context (struct permission_context *ctx)
 {
 #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)
     acl_free (ctx->acl);
 #  if !HAVE_ACL_TYPE_EXTENDED
index f37b3bcff5bbbfe39c041bd314a177f244553f8d..cb969e9797e958794a3b67b211988df7a4c49b56 100644 (file)
@@ -52,10 +52,7 @@ extern int aclsort (int, int, struct acl *);
 #include <errno.h>
 
 #include <limits.h>
-
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
+#include <stdint.h>
 
 #ifndef HAVE_FCHMOD
 # define HAVE_FCHMOD false
@@ -121,8 +118,13 @@ rpl_acl_set_fd (int fd, acl_t acl)
 #  endif
 
 /* Linux-specific */
-/* Cygwin >= 2.5 implements this function, but it returns 1 for all
-   directories, thus is unusable.  */
+/* Cygwin >= 2.5 implements acl_extended_file(), but it returns 1 for nearly all
+   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__
 #   undef HAVE_ACL_EXTENDED_FILE
 #   define HAVE_ACL_EXTENDED_FILE false
index 808ad93fe2c17755715ec6a165e6d68c0c8075fd..57b7b4998c07c6d52103a3cf5d318b61b36e0c21 100644 (file)
@@ -22,7 +22,7 @@
 #include "acl-internal.h"
 
 /* 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 -1 and set errno upon failure to determine it.  */
@@ -34,7 +34,7 @@ acl_entries (acl_t acl)
 
   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 */
       /* acl_get_entry returns 0 when it successfully fetches an entry,
          and -1/EINVAL at the end.  */
@@ -45,7 +45,7 @@ acl_entries (acl_t acl)
            got_one >= 0;
            got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
         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,
          and 0 at the end.  */
       acl_entry_t ace;
index ac61c0865a499afffc2fd6718c646d6c0882697d..d7f551b30f3f2a0fa57c1b10c12f4eea41a9b89e 100644 (file)
 #endif
 @PRAGMA_COLUMNS@
 
-#if defined __need_system_fcntl_h
-/* Special invocation convention.  */
+#if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+/* 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>.
    May also define off_t to a 64-bit type on native Windows.  */
@@ -50,6 +54,8 @@
 
 #ifndef _@GUARD_PREFIX@_FCNTL_H
 
+#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+
 /* Needed before <sys/stat.h>.
    May also define off_t to a 64-bit type on native Windows.
    Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku.  */
@@ -72,6 +78,8 @@
 # include <io.h>
 #endif
 
+#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+
 #ifndef _@GUARD_PREFIX@_FCNTL_H
 #define _@GUARD_PREFIX@_FCNTL_H
 
index c02cfee842bf5f7f847d641d28a4081b4e0f1aa3..66b920c1ab24dfdd49045cab290e817748c30472 100644 (file)
@@ -50,7 +50,6 @@ static char const UNKNOWN_SECURITY_CONTEXT[] = "?";
 #  include <selinux/selinux.h>
 # endif
 # include <stdckdint.h>
-# include <stdint.h>
 # include <string.h>
 # include <arpa/inet.h>
 # include <sys/xattr.h>
@@ -363,6 +362,29 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
 }
 #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,
    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
@@ -468,7 +490,7 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
       ret = -1;
 #   else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
     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))
       acl_get_file_or_link = acl_get_link_np;
 #    endif
index 7614b6078323ff11eb9267af0179a42a0ce85395..be8a98773494d6606abcdfb1451d957be75b1d30 100644 (file)
@@ -26,7 +26,7 @@
 
 /* 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,
-   Android API >= 23.  */
+   Android API >= 23, musl libc, Haiku >= hrev58760.  */
 
 /* Return the number of pending (aka buffered, unflushed)
    bytes on the stream, FP, that is open for writing.  */
index a7966462c73a3834870e5f02585c7a1a98ba50c5..9da41c16c028c5bc46b96357d7f70bec0f234bd1 100644 (file)
@@ -47,8 +47,6 @@
    N_NAME_POINTER               The nlist n_name element is a pointer,
                                 not an array.
    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
    default values if not emacs:
@@ -65,8 +63,7 @@
    UMAX4_3
    VMS
    _WIN32                       Native Windows (possibly also defined on Cygwin)
-   __linux__, __ANDROID__       Linux: assumes /proc file system mounted.
-                                Support from Michael K. Johnson.
+   __linux__, __ANDROID__       Linux: assumes sysinfo() call.
    __CYGWIN__                   Cygwin emulates linux /proc/loadavg.
    __NetBSD__                   NetBSD: assumes /kern file system mounted.
 
 # endif
 
 /* Same issues as for NeXT apply to the HURD-based GNU system.  */
-# ifdef __GNU__
+# if defined __gnu_hurd__ || defined NeXT
 #  undef BSD
 #  undef FSCALE
-# endif /* __GNU__ */
+# endif /* __gnu_hurd__ || NeXT */
 
 /* Set values that are different from the defaults, which are
    set a little farther down with #ifndef.  */
 #  endif
 # endif
 
-# if defined (__GNU__) && !defined (NeXT)
-/* Note that NeXT Openstep defines __GNU__ even though it should not.  */
+# if defined __gnu_hurd__ && !defined NeXT
 /* GNU system acts much like NeXT, for load average purposes,
    but not exactly.  */
 #  define NeXT
 #  include <sys/dg_sys_info.h>
 # endif
 
+# if defined __linux__ || defined __ANDROID__
+#  include <sys/param.h>
+#  include <sys/sysinfo.h>
+# endif
+
 # if (defined __linux__ || defined __ANDROID__ \
       || defined __CYGWIN__ || defined SUNOS_5 \
       || (defined LOAD_AVE_TYPE && ! defined __VMS))
@@ -498,20 +499,32 @@ getloadavg (double loadavg[], int nelem)
   }
 # endif
 
-# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__)
+# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__)
                                       /* Linux without glibc, Android, Cygwin */
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
 
-#  ifndef LINUX_LDAV_FILE
-#   define LINUX_LDAV_FILE "/proc/loadavg"
-#  endif
+  {
+    struct sysinfo info;
+    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 const *ptr = ldavgbuf;
   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)
     return -1;
   count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
@@ -554,7 +567,7 @@ getloadavg (double loadavg[], int nelem)
 
   return elem;
 
-# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */
+# endif /* __CYGWIN__ */
 
 # if !defined (LDAV_DONE) && defined (__NetBSD__)          /* NetBSD < 0.9 */
 #  define LDAV_DONE
index 1f2b2d71bf71b0f35be2e03ec5c2eb3b3bd11527..a61c68c795e57aaf6d46df31142b06f6c0c72da5 100644 (file)
 # endif
 # undef getopt_long
 # undef getopt_long_only
-# undef option
 # undef _getopt_internal
 # define getopt_long __GETOPT_ID (getopt_long)
 # define getopt_long_only __GETOPT_ID (getopt_long_only)
-# define option __GETOPT_ID (option)
 # define _getopt_internal __GETOPT_ID (getopt_internal)
 
 /* The system's getopt.h may have already included getopt-ext.h to
index 79200ecdab97ba480351f54cac95f61c0aa8a79f..4a87a2d53bfccc28c1bdc9e34e545e4e0bf4774f 100644 (file)
    <getopt.h>; our definitions will be present soon enough.  */
 #if @HAVE_GETOPT_H@
 # 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@
+# undef option
 # undef _GL_SYSTEM_GETOPT
 #endif
 
index fa2250cf686b2460a133c5c98f5f228a756de508..fb34cf2cc1dcdacc1c97bf3d7f0aafa37f49216e 100644 (file)
@@ -49,6 +49,7 @@
 #  --avoid=iswxdigit \
 #  --avoid=langinfo-h \
 #  --avoid=libgmp-mpq \
+#  --avoid=locale-h \
 #  --avoid=localename-unsafe-limited \
 #  --avoid=lock \
 #  --avoid=mbrtowc \
@@ -624,6 +625,7 @@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
 GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
 GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
 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_STRFTIME = @GL_GNULIB_STRFTIME@
 GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
@@ -916,6 +918,7 @@ HAVE_STR2SIG = @HAVE_STR2SIG@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
+HAVE_STRERROR_L = @HAVE_STRERROR_L@
 HAVE_STRPBRK = @HAVE_STRPBRK@
 HAVE_STRPTIME = @HAVE_STRPTIME@
 HAVE_STRSEP = @HAVE_STRSEP@
@@ -1213,6 +1216,7 @@ REPLACE_GETENTROPY = @REPLACE_GETENTROPY@
 REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
 REPLACE_GETLINE = @REPLACE_GETLINE@
 REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@
+REPLACE_GETLOGIN = @REPLACE_GETLOGIN@
 REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
 REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETPASS = @REPLACE_GETPASS@
@@ -1307,6 +1311,7 @@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
 REPLACE_STRDUP = @REPLACE_STRDUP@
 REPLACE_STRERROR = @REPLACE_STRERROR@
 REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@
+REPLACE_STRERROR_L = @REPLACE_STRERROR_L@
 REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
 REPLACE_STRFTIME = @REPLACE_STRFTIME@
 REPLACE_STRNCAT = @REPLACE_STRNCAT@
@@ -1543,6 +1548,7 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 standardlisppath = @standardlisppath@
 sysconfdir = @sysconfdir@
+systemduserunitdir = @systemduserunitdir@
 target_alias = @target_alias@
 version = @version@
 with_mailutils = @with_mailutils@
@@ -1715,13 +1721,25 @@ libgnu_a_SOURCES += c-ctype.h c-ctype.c
 endif
 ## end   gnulib module c-ctype
 
-## begin gnulib module c-strcase
-ifeq (,$(OMIT_GNULIB_MODULE_c-strcase))
+## begin gnulib module c-strcasecmp
+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
+## 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-strcase
+## end   gnulib module c-strncasecmp
 
 ## begin 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_STRERROR''@/$(GL_GNULIB_STRERROR)/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_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_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_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_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_SIGABBREV_NP''@|$(HAVE_SIGABBREV_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_STRERROR''@|$(REPLACE_STRERROR)|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_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|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_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|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_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
index 83efe39910aaf1025a37c362a391b0156f718455..2f9fa0a0222b68177d16ffee18c9c4a1809e25cd 100644 (file)
@@ -39,7 +39,7 @@
    then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some
    enum values are deliberately omitted from the switch's cases.
    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))
 
 
index d48e4dd94f545ef0bc62782d01df6617429115da..83439aa0eb2bc56ea780d1fd156cfa459ebdbde6 100644 (file)
@@ -398,20 +398,16 @@ parse_omp_threads (char const* threads)
   /* Convert it from positive decimal to 'unsigned long'.  */
   if (c_isdigit (*threads))
     {
-      char *endptr = NULL;
+      char *endptr;
       unsigned long int value = strtoul (threads, &endptr, 10);
-
-      if (endptr != NULL)
-        {
-          while (*endptr != '\0' && c_isspace (*endptr))
-            endptr++;
-          if (*endptr == '\0')
-            return value;
-          /* Also accept the first value in a nesting level,
-             since we can't determine the nesting level from env vars.  */
-          else if (*endptr == ',')
-            return value;
-        }
+      while (*endptr != '\0' && c_isspace (*endptr))
+        endptr++;
+      if (*endptr == '\0')
+        return value;
+      /* Also accept the first value in a nesting level,
+         since we can't determine the nesting level from env vars.  */
+      else if (*endptr == ',')
+        return value;
     }
 
   return ret;
@@ -438,6 +434,9 @@ num_processors (enum nproc_query query)
       query = 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);
     return MIN (nprocs, omp_env_limit);
index b5e8133c7c6124360ff633f5d3f7e7ee5475a6cb..60d63df95987b4f0481a7ae97910dd19abc318ce 100644 (file)
@@ -45,7 +45,7 @@
 # include <utmp.h>
 #endif
 
-/* Needed for BOOT_TIME and USER_PROCESS.  */
+/* Needed for BOOT_TIME, USER_PROCESS, LOGIN_PROCESS.  */
 #if HAVE_UTMPX_H
 # if defined _THREAD_SAFE && defined UTMP_DATA_INIT
     /* 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 */
   pid_t ut_pid;                 /* process ID of ? */
   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;
 };
 
@@ -257,19 +258,21 @@ struct utmpx32
 # define WTMP_FILE "/etc/wtmp"
 #endif
 
-/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only
-   USER_PROCESS.  We need to use the value that is defined in newer versions
-   of Android.  */
+/* In early versions of Android, <utmp.h> did not define BOOT_TIME or
+   LOGIN_PROCESS, only USER_PROCESS.  We need to use the value that is defined
+   in newer versions of Android.  */
 #if defined __ANDROID__ && !defined BOOT_TIME
 # define BOOT_TIME 2
+# define LOGIN_PROCESS 6
 #endif
 
 /* 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
-   'struct gl_utmp'.  */
+   the BOOT_TIME, USER_PROCESS, and LOGIN_PROCESS macros.  But we want to
+   support them in 'struct gl_utmp'.  */
 #if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
 # define BOOT_TIME 2
 # define USER_PROCESS 0
+# define LOGIN_PROCESS 6
 #endif
 
 /* Macros that test (UT)->ut_type.  */
@@ -283,6 +286,11 @@ struct utmpx32
 #else
 # define UT_TYPE_USER_PROCESS(UT) 0
 #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.  */
 #define IS_USER_PROCESS(UT)                                    \
index 41b0f989c0309d4321c1a8acee82433fda12388f..a23f289d7a1292b43d2c432057efdb48e268bc42 100644 (file)
@@ -831,7 +831,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
     if (table_size > pat_len)
       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->mb_cur_max = MB_CUR_MAX;
@@ -862,7 +862,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
        {
          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))
            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);
     }
 #endif
-  sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
-  mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
+  sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
+  mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
   if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
     {
       re_free (sbcset);
@@ -3548,13 +3548,13 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
   reg_errcode_t ret;
   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))
     {
       *err = REG_ESPACE;
       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))
     {
       re_free (sbcset);
index 67a3aa70a518605ede0f4a3b91df73574466040c..e9ab85e8b5a00a0edfd61d9cf3f9d2c4e8fb038b 100644 (file)
@@ -66,15 +66,14 @@ typedef unsigned long int active_reg_t;
 
 /* The following bits are used to determine the regexp syntax we
    recognize.  The set/not-set meanings are chosen so that Emacs syntax
-   remains the value 0.  The bits are given in alphabetical order, and
-   the definitions shifted by one from the previous bit; thus, when we
-   add or remove a bit, only one other definition need change.  */
+   is the value 0 for Emacs 20 (2000) and earlier, and the value
+   RE_SYNTAX_EMACS for Emacs 21 (2001) and later.  */
 typedef unsigned long int reg_syntax_t;
 
 #ifdef __USE_GNU
 /* If this bit is not set, then \ inside a bracket expression is literal.
    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
      literals.
@@ -215,7 +214,8 @@ extern reg_syntax_t re_syntax_options;
    (The [[[ comments delimit what gets put into the Texinfo file, so
    don't delete them!)  */
 /* [[[begin syntaxes]]] */
-# define RE_SYNTAX_EMACS 0
+# define RE_SYNTAX_EMACS                                               \
+  (RE_CHAR_CLASSES | RE_INTERVALS)
 
 # define RE_SYNTAX_AWK                                                 \
   (RE_BACKSLASH_ESCAPE_IN_LISTS   | RE_DOT_NOT_NULL                    \
@@ -522,20 +522,6 @@ typedef struct
 \f
 /* 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_
 # ifdef __attr_access
 #  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,
                    const char *_Restrict_ __String, size_t __nmatch,
-                   regmatch_t __pmatch[_Restrict_arr_
-                                       _REGEX_NELTS (__nmatch)],
+                   regmatch_t __pmatch[_Restrict_arr_],
                    int __eflags);
 
 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);
 
-#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
-# pragma GCC diagnostic pop
-#endif
-
 #ifdef __cplusplus
 }
 #endif /* C++ */
index 8bf761c76165084d19176d2eaa2198d38652c756..9b89cc9372bd7fd5bd9d42eaeeafc5f98de9ca6f 100644 (file)
@@ -1595,7 +1595,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
   reg_errcode_t err;
   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))
     return NULL;
   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;
   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))
     return NULL;
   err = re_node_set_init_copy (&newstate->nodes, nodes);
index 58215bd3766677367c4f241708f73929c7afa797..c5ab9b6649f36752047cfbd55704ef5f0e211a97 100644 (file)
@@ -185,7 +185,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
 
 int
 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;
   Idx start, length;
@@ -229,7 +229,7 @@ int
 attribute_compat_text_section
 __compat_regexec (const regex_t *__restrict preg,
                  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,
                  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.  */
          if (sub_top->path == NULL)
            {
-             sub_top->path = calloc (sizeof (state_array_t),
-                                     sl_str - sub_top->str_idx + 1);
+             sub_top->path = calloc (sl_str - sub_top->str_idx + 1,
+                                      sizeof (state_array_t));
              if (sub_top->path == NULL)
                return REG_ESPACE;
            }
@@ -3266,7 +3266,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
       if (ndests == 0)
        {
          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))
             return false;
          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
         256-entry transition table.  */
       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))
        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
         starting at trtable[SBC_MAX].  */
       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))
        goto out_free;
 
index 878e9f8c97d8ba7cb247a7705b6313a3e0c0087e..4b4263fe9087a215904158746abff13099241449 100644 (file)
 # 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.  */
 
 #if defined __NetBSD__                         /* NetBSD */
index bd82086ff37862ec832d1c86c353b8ecdada1811..dbe8ebc850290d5d57b1193c773c622b2ce32080 100644 (file)
@@ -63,7 +63,7 @@
 #include <stddef.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)
 # include <sys/wait.h>
 #endif
@@ -120,14 +120,14 @@ struct random_data
 # include <unistd.h>
 #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
    below, this may cause compilation errors later in the libstdc++ header files
    (that are part of GCC), such as:
      error: 'rpl_strtol' is not a member of 'std'
    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),
-   not on mingw (where it would cause other compilation errors).  */
+   get defined as macros.  But do so only on Solaris 11 and AIX (where it is
+   needed), not on mingw (where it would cause other compilation errors).  */
 # include <string>
 #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@ == 2
 #   define _GL_INLINE_RPL_REALLOC 1
+#   ifdef __cplusplus
+extern "C" {
+#   endif
 _GL_REALLOC_INLINE void *
 rpl_realloc (void *ptr, size_t size)
 {
   return realloc (ptr, size ? size : 1);
 }
+#   ifdef __cplusplus
+}
+#   endif
 #  endif
 #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
         || _GL_USE_STDLIB_ALLOC)
index ce488299006f30b9323601e5d2241c6399344f2c..44b9497d8021f4063b2dde2bd8a036567be0275d 100644 (file)
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+#if @GNULIB_STRERROR_L@
+/* Get locale_t.  */
+# include <locale.h>
+#endif
+
 /* MirBSD defines mbslen as a macro.  */
 #if @GNULIB_MBSLEN@ && defined __MirBSD__
 # include <wchar.h>
@@ -429,7 +434,9 @@ _GL_FUNCDECL_SYS (memset_explicit, void *,
 #  endif
 _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (memset_explicit);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef 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_ATTRIBUTE_PURE
      _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
 
 #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_ATTRIBUTE_PURE
      _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
 
 #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_ATTRIBUTE_PURE
      _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
 
 #if @GNULIB_MBSCSPN@
@@ -1388,6 +1476,44 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
 # 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.  */
 #if @GNULIB_STRERRORNAME_NP@
 # if @REPLACE_STRERRORNAME_NP@
@@ -1403,7 +1529,9 @@ _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
 #  endif
 _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strerrorname_np);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerrorname_np
 # if HAVE_RAW_DECL_STRERRORNAME_NP
index 60801c972c9340cae341e6f5195c7cae18a8cbff..3ff16e3b3e4b24219278a1391f84de06111729de 100644 (file)
@@ -186,7 +186,9 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
 #   endif
 _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
 #  endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (timespec_getres);
+# endif
 # elif defined GNULIB_POSIXCHECK
 #  undef timespec_getres
 #  if HAVE_RAW_DECL_TIMESPEC_GETRES
index 3f96e10d7e77bbdd0c7738314aa07b93c95b58ee..c135a770dc1fe3647b745c847c2b74b0e14a4564 100644 (file)
 # include <stdio.h>
 #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
    <unistd.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
-#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
-    && (defined __CYGWIN__ || defined __ANDROID__) \
-    && ! defined __GLIBC__
+#if ! defined O_CLOEXEC \
+    || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
+         && (defined __CYGWIN__ || defined __ANDROID__) \
+         && ! defined __GLIBC__)
 # include <fcntl.h>
 #endif
 
@@ -463,7 +466,9 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
                                              int ofd, off_t *opos,
                                              size_t len, unsigned flags));
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (copy_file_range);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef 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,
      $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), );
-# endif
+#  endif
 _GL_CXXALIAS_SYS (getlogin, char *, (void));
+# endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getlogin);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin
 # if HAVE_RAW_DECL_GETLOGIN
@@ -2405,7 +2420,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
 #if @GNULIB_USLEEP@
 /* Pause the execution of the current thread for N microseconds.
    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>.  */
 # if @REPLACE_USLEEP@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
index 007958dd93322e4d0227886cb19fc633e4862666..62ea7d8f5fd5a6a5ee9887c330e71a635ba6d86c 100644 (file)
@@ -25,7 +25,7 @@
 #include <time.h>
 
 #if HAVE_UTIMENS || HAVE_LUTIMENS
-# include <sys/time.h>
+# include <sys/stat.h>
 #endif
 
 #ifdef __cplusplus
index 227474fdaa587a55e350932d421ed1d402c2aaf3..ca1d39e59005828916719bbf79db0c8bd9e7bd13 100644 (file)
@@ -136,8 +136,9 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
         }
 #   endif
 #  endif
-#  if defined __APPLE__ && defined __MACH__
-      /* macOS 10.13 does not reject invalid tv_nsec values either.  */
+#  if (defined __APPLE__ && defined __MACH__) || defined __gnu_hurd__
+      /* macOS 10.13 and GNU Hurd do not reject invalid tv_nsec values
+         either.  */
       if (times
           && ((times[0].tv_nsec != UTIME_OMIT
                && times[0].tv_nsec != UTIME_NOW
@@ -151,6 +152,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
           errno = EINVAL;
           return -1;
         }
+#   if defined __APPLE__ && defined __MACH__
       size_t len = strlen (file);
       if (len > 0 && file[len - 1] == '/')
         {
@@ -163,6 +165,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
               return -1;
             }
         }
+#   endif
 #  endif
       result = utimensat (fd, file, times, flag);
       /* Linux kernel 2.6.25 has a bug where it returns EINVAL for
index 96fde0b9c81b976d10edad082df8d75b48e957cf..3b01d7c2fb39e246ae4e88ac3264fcc259a6e1ae 100644 (file)
 #define _GL_CONCAT0(x, y) x##y
 
 /* _GL_COUNTER is an integer, preferably one that changes each time we
-   use it.  Use __COUNTER__ if it works, falling back on __LINE__
-   otherwise.  __LINE__ isn't perfect, but it's better than a
-   constant.  */
+   use it.  Use __COUNTER__ if it works (it does so with most compilers,
+   see <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>),
+   falling back on __LINE__ otherwise.  __LINE__ isn't perfect, but it's
+   better than a constant.  */
 #if defined __COUNTER__ && __COUNTER__ != __COUNTER__
 # define _GL_COUNTER __COUNTER__
 #else
index 2c2fab4bb62eeff6123f96b9876bdc2d1051ac79..76d3286788affdb2136bdecd1f01fcf252c0cab6 100644 (file)
@@ -1,5 +1,5 @@
 # builtin-expect.m4
-# serial 2
+# serial 3
 dnl Copyright 2016-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -48,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
 #elif HAVE___BUILTIN_EXPECT == 2
 # include <builtins.h>
 #endif
-    ])
-])
+])])
index fe89fdffa1b901645fdb3efd845749c004bf81e0..7252dd66d1ab6128ffa687d6d755b07e6647fe7f 100644 (file)
@@ -1,5 +1,5 @@
 # futimens.m4
-# serial 11
+# serial 12
 dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,22 +32,45 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
 ]GL_MDA_DEFINES],
      [[struct timespec ts[2];
       int fd = creat ("conftest.file", 0600);
+      int result = 0;
       struct stat st;
-      if (fd < 0) return 1;
+      if (fd < 0)
+        return 1;
       ts[0].tv_sec = 1;
       ts[0].tv_nsec = UTIME_OMIT;
       ts[1].tv_sec = 1;
       ts[1].tv_nsec = UTIME_NOW;
       errno = 0;
-      if (futimens (AT_FDCWD, NULL) == 0) return 2;
-      if (errno != EBADF) return 3;
-      if (futimens (fd, ts)) return 4;
+      if (futimens (AT_FDCWD, NULL) == 0 || errno != EBADF)
+        result |= 2;
+      if (futimens (fd, ts))
+        result |= 4;
       sleep (1);
       ts[0].tv_nsec = UTIME_NOW;
       ts[1].tv_nsec = UTIME_OMIT;
-      if (futimens (fd, ts)) return 5;
-      if (fstat (fd, &st)) return 6;
-      if (st.st_ctime < st.st_atime) return 7;
+      if (futimens (fd, ts))
+        result |= 8;
+      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=no],
index 6eff85bea128a6441893b36dc35546959d469021..daf05db2a4750ea306194581c95852814e84ebea 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-common.m4
-# serial 107
+# serial 109
 dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,6 +20,20 @@ AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([0witness],
 [/* Witness that <config.h> has been included.  */
 #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],
 [/* 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_CACHE_CHECK([for C compiler option to allow warnings],
     [gl_cv_cc_wallow],
-    [rm -f conftest*
+    [rm -fr conftest*
      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 -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
@@ -1317,7 +1331,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
      else
        gl_cv_cc_wallow=none
      fi
-     rm -f conftest*
+     rm -fr conftest*
     ])
   case "$gl_cv_cc_wallow" in
     none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1335,7 +1349,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
   if test -n "$CXX" && test "$CXX" != no; then
     AC_CACHE_CHECK([for C++ compiler option to allow warnings],
       [gl_cv_cxx_wallow],
-      [rm -f conftest*
+      [rm -fr conftest*
        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 -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
@@ -1348,7 +1362,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
        else
          gl_cv_cxx_wallow=none
        fi
-       rm -f conftest*
+       rm -fr conftest*
       ])
     case "$gl_cv_cxx_wallow" in
       none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
index 42f67d0a42ba3b5538b320f465e3832c70b5c561..97db7d32a6607af8fc21575ca5ea24023d38b450 100644 (file)
@@ -57,6 +57,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module byteswap:
   # Code from module c-ctype:
   # Code from module c-strcase:
+  # Code from module c-strcasecmp:
+  # Code from module c-strncasecmp:
   # Code from module c99:
   # Code from module canonicalize-lgpl:
   # Code from module careadlinkat:
index 86ec8889c96f9417f9db4db2c139d3316aa9a607..cf3f730b4c3b5088498d9d8aeac3a15abde38817 100644 (file)
@@ -1,5 +1,5 @@
 # manywarnings.m4
-# serial 28
+# serial 29
 dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 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.
   # 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; \
   #     awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
   #  <(LC_ALL=C gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
index 80dfb8e1e5f926b73d582fbd011ab709f9e5b12d..49a8059f618bae2349cf02ebe7887ed3cb075992 100644 (file)
@@ -1,5 +1,5 @@
 # regex.m4
-# serial 78
+# serial 81
 dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -53,6 +53,11 @@ AC_DEFUN([gl_REGEX],
             /* Exit with distinguishable exit code.  */
             static void sigabrt_no_core (int sig) { raise (SIGTERM); }
             #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;
             static struct re_pattern_buffer regex;
index c09396ae559bff35d25674a5e08939c9f128d6fb..a6bc62431432611d9e27c82cc685937fe37f99f8 100644 (file)
@@ -1,5 +1,5 @@
 # stddef_h.m4
-# serial 17
+# serial 19
 dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 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
   fi
 
-  AC_CACHE_CHECK([for clean definition of __STDC_VERSION_STDDEF_H__],
-    [gl_cv_clean_version_stddef],
-    [AC_PREPROC_IFELSE(
-       [AC_LANG_SOURCE(
-          [[/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 */
-            #include <stddef.h>
-            #undef __STDC_VERSION_STDDEF_H__
-            #include <time.h>
-            #ifdef __STDC_VERSION_STDDEF_H__
-            # error "<time.h> defines __STDC_VERSION_STDDEF_H__"
-            #endif
-          ]])],
-        [gl_cv_clean_version_stddef=yes],
-        [gl_cv_clean_version_stddef=no])])
-  if test "$gl_cv_clean_version_stddef" = no; then
-    STDDEF_NOT_IDEMPOTENT=1
-    GL_GENERATE_STDDEF_H=true
-  fi
+  dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870
+  dnl affects GCC 13 and 14.
+  AC_CACHE_CHECK([whether <stddef.h> is idempotent],
+    [gl_cv_stddef_idempotent],
+    [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+       [[
+       #if __GNUC__ == 13 || __GNUC__ == 14
+        #error "bug 114870 is present"
+       #endif
+       ]])],
+       [gl_cv_stddef_idempotent="guessing yes"],
+       [gl_cv_stddef_idempotent="guessing no"])
+    ])
+  case "$gl_cv_stddef_idempotent" in
+    *yes) ;;
+    *) STDDEF_NOT_IDEMPOTENT=1
+       GL_GENERATE_STDDEF_H=true
+       ;;
+  esac
 
   if $GL_GENERATE_STDDEF_H; then
     gl_NEXT_HEADERS([stddef.h])
index d0a676081143341012d0c1461eacea0a53d1f36c..bdcd6ef2b67e4977092b7e39acc044ffd42b3789 100644 (file)
@@ -1,5 +1,5 @@
 # string_h.m4
-# serial 43
+# serial 44
 dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 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
      rawmemchr stpcpy stpncpy strchrnul
      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])
 ])
@@ -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_STRERROR])
     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_SIGABBREV_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_DECL_STRTOK_R=1;         AC_SUBST([HAVE_DECL_STRTOK_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_SIGABBREV_NP=1;          AC_SUBST([HAVE_SIGABBREV_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_STRERROR=0;           AC_SUBST([REPLACE_STRERROR])
   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_STRSIGNAL=0;          AC_SUBST([REPLACE_STRSIGNAL])
   REPLACE_STRVERSCMP=0;         AC_SUBST([REPLACE_STRVERSCMP])
index 2c08d65e0d84391395b9609ea5161e71e41494b5..6ec16286ef8d548226982cbc6571745d78783866 100644 (file)
@@ -1,5 +1,5 @@
 # unistd_h.m4
-# serial 96
+# serial 97
 dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 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_GETDTABLESIZE=0;           AC_SUBST([REPLACE_GETDTABLESIZE])
   REPLACE_GETENTROPY=0;              AC_SUBST([REPLACE_GETENTROPY])
+  REPLACE_GETLOGIN=0;                AC_SUBST([REPLACE_GETLOGIN])
   REPLACE_GETLOGIN_R=0;              AC_SUBST([REPLACE_GETLOGIN_R])
   REPLACE_GETGROUPS=0;               AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;             AC_SUBST([REPLACE_GETPAGESIZE])
index 8753e1cb294bfccb3aa423a056831a22562a85c1..d017af37b25fac0ab27759446c76eade022a21c4 100644 (file)
@@ -1,5 +1,5 @@
 # utimensat.m4
-# serial 12
+# serial 14
 dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 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_nsec = UTIME_OMIT;
                 if (utimensat (AT_FDCWD, f, ts, 0))
-                  result |= 16;
+                  result |= 8;
                 if (stat (f, &st))
-                  result |= 32;
+                  result |= 8;
                 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;
             ]])],
@@ -83,8 +102,11 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
          ],
          [case "$host_os" in
             # Guess yes on Linux or glibc systems.
-            linux-* | linux | *-gnu* | gnu*)
+            linux*)
               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.
             midipix*)
               gl_cv_func_utimensat_works="guessing yes" ;;
index 5d7c4ef03a072875436b56939569c1ea5b59468f..c616d7751fcf1285d7a413d1589c5be94c598402 100644 (file)
@@ -1,5 +1,5 @@
 # warnings.m4
-# serial 20
+# serial 21
 dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 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_CACHE_CHECK([for C compiler option to inhibit all warnings],
     [gl_cv_cc_winhibit],
-    [rm -f conftest*
+    [rm -fr conftest*
      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 -w -c conftest.c 2>conftest2.err]) >/dev/null
@@ -123,7 +123,7 @@ AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
      else
        gl_cv_cc_winhibit=none
      fi
-     rm -f conftest*
+     rm -fr conftest*
     ])
   case "$gl_cv_cc_winhibit" in
     none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
@@ -146,7 +146,7 @@ AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
   if test -n "$CXX" && test "$CXX" != no; then
     AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
       [gl_cv_cxx_winhibit],
-      [rm -f conftest*
+      [rm -fr conftest*
        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 -w -c conftest.cc 2>conftest2.err]) >/dev/null
@@ -155,7 +155,7 @@ AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
        else
          gl_cv_cxx_winhibit=none
        fi
-       rm -f conftest*
+       rm -fr conftest*
       ])
     case "$gl_cv_cxx_winhibit" in
       none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;