aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2025-04-19 12:18:28 -0700
committerPaul Eggert2025-04-19 19:31:25 -0700
commit71ee484cac3e0e5b68f006b4cca81c13ca6ce11e (patch)
tree21476621d11357283ad30c8b2bcec2871e604ba1
parent30335bb73483fce9d4204f1e18618fe777d0f45e (diff)
downloademacs-71ee484cac3e0e5b68f006b4cca81c13ca6ce11e.tar.gz
emacs-71ee484cac3e0e5b68f006b4cca81c13ca6ce11e.zip
Update from Gnulib by running admin/merge-gnulib
-rw-r--r--doc/misc/texinfo.tex409
-rw-r--r--lib/acl-internal.c8
-rw-r--r--lib/acl-internal.h14
-rw-r--r--lib/acl_entries.c6
-rw-r--r--lib/fcntl.in.h12
-rw-r--r--lib/file-has-acl.c26
-rw-r--r--lib/fpending.c2
-rw-r--r--lib/getloadavg.c41
-rw-r--r--lib/getopt-pfx-ext.h2
-rw-r--r--lib/getopt.in.h5
-rw-r--r--lib/gnulib.mk.in30
-rw-r--r--lib/intprops.h2
-rw-r--r--lib/nproc.c25
-rw-r--r--lib/readutmp.h22
-rw-r--r--lib/regcomp.c12
-rw-r--r--lib/regex.h31
-rw-r--r--lib/regex_internal.c4
-rw-r--r--lib/regexec.c14
-rw-r--r--lib/stdio-impl.h43
-rw-r--r--lib/stdlib.in.h14
-rw-r--r--lib/string.in.h128
-rw-r--r--lib/time.in.h2
-rw-r--r--lib/unistd.in.h27
-rw-r--r--lib/utimens.h2
-rw-r--r--lib/utimensat.c7
-rw-r--r--lib/verify.h7
-rw-r--r--m4/builtin-expect.m45
-rw-r--r--m4/futimens.m439
-rw-r--r--m4/gnulib-common.m424
-rw-r--r--m4/gnulib-comp.m42
-rw-r--r--m4/manywarnings.m44
-rw-r--r--m4/regex.m47
-rw-r--r--m4/stddef_h.m439
-rw-r--r--m4/string_h.m48
-rw-r--r--m4/unistd_h.m43
-rw-r--r--m4/utimensat.m432
-rw-r--r--m4/warnings.m410
37 files changed, 724 insertions, 344 deletions
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index faad184e345..3ebea93cb1d 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2025-01-31.21} 6\def\texinfoversion{2025-03-22.08}
7% 7%
8% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc. 8% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
9% 9%
@@ -287,7 +287,6 @@
287% Avoid "undefined control sequence" errors. 287% Avoid "undefined control sequence" errors.
288\def\currentchapterdefs{} 288\def\currentchapterdefs{}
289\def\currentsectiondefs{} 289\def\currentsectiondefs{}
290\def\currentsection{}
291\def\prevchapterdefs{} 290\def\prevchapterdefs{}
292\def\prevsectiondefs{} 291\def\prevsectiondefs{}
293\def\currentcolordefs{} 292\def\currentcolordefs{}
@@ -980,18 +979,51 @@ where each line of input produces a line of output.}
980\newif\ifpdf 979\newif\ifpdf
981\newif\ifpdfmakepagedest 980\newif\ifpdfmakepagedest
982 981
982% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
983% can be set). So we test for \relax and 0 as well as being undefined.
984\ifx\pdfoutput\thisisundefined
985\else
986 \ifx\pdfoutput\relax
987 \else
988 \ifcase\pdfoutput
989 \else
990 \pdftrue
991 \fi
992 \fi
993\fi
994
995\newif\ifxetex
996\ifx\XeTeXrevision\thisisundefined\else
997 \xetextrue
998\fi
999
983\newif\ifluatex 1000\newif\ifluatex
984\ifx\luatexversion\thisisundefined\else 1001\ifx\luatexversion\thisisundefined\else
985 \luatextrue 1002 \luatextrue
1003 \ifnum\luatexversion>84
1004 \pdftrue
1005 \fi
986\fi 1006\fi
987 1007
1008\newif\ifpdforxetex
1009\ifpdf
1010 \pdforxetextrue
1011\fi
1012\ifxetex
1013 \pdforxetextrue
1014\fi
1015
1016
1017
1018% Whether to use non-ASCII bytes in internal link targets. Presently this
1019% is almost always on.
1020\newif\iftxiuseunicodedestname
1021\txiuseunicodedestnametrue
1022
988% 1023%
989% For LuaTeX 1024% For LuaTeX
990% 1025%
991 1026
992\newif\iftxiuseunicodedestname
993\txiuseunicodedestnamefalse % For pdfTeX etc.
994
995\ifluatex 1027\ifluatex
996 % Use Unicode destination names 1028 % Use Unicode destination names
997 \txiuseunicodedestnametrue 1029 \txiuseunicodedestnametrue
@@ -1045,7 +1077,7 @@ where each line of input produces a line of output.}
1045 % 1077 %
1046 \endgroup 1078 \endgroup
1047 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} 1079 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1048 \ifnum\luatexversion>84 1080 \ifpdf
1049 % For LuaTeX >= 0.85 1081 % For LuaTeX >= 0.85
1050 \def\pdfdest{\pdfextension dest} 1082 \def\pdfdest{\pdfextension dest}
1051 \let\pdfoutput\outputmode 1083 \let\pdfoutput\outputmode
@@ -1068,33 +1100,6 @@ where each line of input produces a line of output.}
1068 \fi 1100 \fi
1069\fi 1101\fi
1070 1102
1071% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1072% can be set). So we test for \relax and 0 as well as being undefined.
1073\ifx\pdfoutput\thisisundefined
1074\else
1075 \ifx\pdfoutput\relax
1076 \else
1077 \ifcase\pdfoutput
1078 \else
1079 \pdftrue
1080 \fi
1081 \fi
1082\fi
1083
1084\newif\ifxetex
1085\ifx\XeTeXrevision\thisisundefined\else
1086 \xetextrue
1087\fi
1088
1089\newif\ifpdforxetex
1090\pdforxetexfalse
1091\ifpdf
1092 \pdforxetextrue
1093\fi
1094\ifxetex
1095 \pdforxetextrue
1096\fi
1097
1098 1103
1099% Output page labels information. 1104% Output page labels information.
1100% See PDF reference v.1.7 p.594, section 8.3.1. 1105% See PDF reference v.1.7 p.594, section 8.3.1.
@@ -1388,9 +1393,6 @@ output) for that.)}
1388 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1393 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1389 } 1394 }
1390 % 1395 %
1391 % used to mark target names; must be expandable.
1392 \def\pdfmkpgn#1{#1}
1393 %
1394 % Adding outlines to PDF; macros for calculating structure of outlines 1396 % Adding outlines to PDF; macros for calculating structure of outlines
1395 % come from Petr Olsak 1397 % come from Petr Olsak
1396 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% 1398 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
@@ -1416,7 +1418,7 @@ output) for that.)}
1416 \def\pdfdestname{#4}% 1418 \def\pdfdestname{#4}%
1417 \fi 1419 \fi
1418 % 1420 %
1419 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% 1421 \pdfoutline goto name{\pdfdestname}#2{\pdfoutlinetext}%
1420 } 1422 }
1421 % 1423 %
1422 \def\pdfmakeoutlines{% 1424 \def\pdfmakeoutlines{%
@@ -1427,15 +1429,18 @@ output) for that.)}
1427 \def\thischapnum{##2}% 1429 \def\thischapnum{##2}%
1428 \def\thissecnum{0}% 1430 \def\thissecnum{0}%
1429 \def\thissubsecnum{0}% 1431 \def\thissubsecnum{0}%
1432 \def\indexlastsec{chap\thischapnum}%
1430 }% 1433 }%
1431 \def\numsecentry##1##2##3##4{% 1434 \def\numsecentry##1##2##3##4{%
1432 \advancenumber{chap\thischapnum}% 1435 \advancenumber{chap\thischapnum}%
1433 \def\thissecnum{##2}% 1436 \def\thissecnum{##2}%
1434 \def\thissubsecnum{0}% 1437 \def\thissubsecnum{0}%
1438 \def\indexlastsec{sec\thissecnum}%
1435 }% 1439 }%
1436 \def\numsubsecentry##1##2##3##4{% 1440 \def\numsubsecentry##1##2##3##4{%
1437 \advancenumber{sec\thissecnum}% 1441 \advancenumber{sec\thissecnum}%
1438 \def\thissubsecnum{##2}% 1442 \def\thissubsecnum{##2}%
1443 \def\indexlastsec{subsec\thissecnum}%
1439 }% 1444 }%
1440 \def\numsubsubsecentry##1##2##3##4{% 1445 \def\numsubsubsecentry##1##2##3##4{%
1441 \advancenumber{subsec\thissubsecnum}% 1446 \advancenumber{subsec\thissubsecnum}%
@@ -1443,7 +1448,13 @@ output) for that.)}
1443 \def\thischapnum{0}% 1448 \def\thischapnum{0}%
1444 \def\thissecnum{0}% 1449 \def\thissecnum{0}%
1445 \def\thissubsecnum{0}% 1450 \def\thissubsecnum{0}%
1451 \let\indexlastsec\empty
1446 % 1452 %
1453 % Index initials are subsidiary to whatever sectioning command just
1454 % occurred, usually @appendix or @chapter but occasionally a lower level.
1455 \def\idxinitialentry##1##2##3##4{%
1456 \expandafter\advancenumber\expandafter{\indexlastsec}%
1457 }%
1447 % use \def rather than \let here because we redefine \chapentry et 1458 % use \def rather than \let here because we redefine \chapentry et
1448 % al. a second time, below. 1459 % al. a second time, below.
1449 \def\appentry{\numchapentry}% 1460 \def\appentry{\numchapentry}%
@@ -1455,9 +1466,6 @@ output) for that.)}
1455 \def\unnsubsecentry{\numsubsecentry}% 1466 \def\unnsubsecentry{\numsubsecentry}%
1456 \def\unnsubsubsecentry{\numsubsubsecentry}% 1467 \def\unnsubsubsecentry{\numsubsubsecentry}%
1457 % 1468 %
1458 % Treat index initials like @section. Note that this is the wrong
1459 % level if the index is not at the level of @appendix or @chapter.
1460 \def\idxinitialentry{\numsecentry}%
1461 \readdatafile{toc}% 1469 \readdatafile{toc}%
1462 % 1470 %
1463 % Read toc second time, this time actually producing the outlines. 1471 % Read toc second time, this time actually producing the outlines.
@@ -1482,18 +1490,6 @@ output) for that.)}
1482 \def\idxinitialentry##1##2##3##4{% 1490 \def\idxinitialentry##1##2##3##4{%
1483 \dopdfoutline{##1}{}{idx.##1.##2}{##4}}% 1491 \dopdfoutline{##1}{}{idx.##1.##2}{##4}}%
1484 % 1492 %
1485 % PDF outlines are displayed using system fonts, instead of
1486 % document fonts. Therefore we cannot use special characters,
1487 % since the encoding is unknown. For example, the eogonek from
1488 % Latin 2 (0xea) gets translated to a | character. Info from
1489 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1490 %
1491 % TODO this right, we have to translate 8-bit characters to
1492 % their "best" equivalent, based on the @documentencoding. Too
1493 % much work for too little return. Just use the ASCII equivalents
1494 % we use for the index sort strings.
1495 %
1496 \indexnofonts
1497 \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning 1493 \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
1498 \setupdatafile 1494 \setupdatafile
1499 % We can have normal brace characters in the PDF outlines, unlike 1495 % We can have normal brace characters in the PDF outlines, unlike
@@ -1501,9 +1497,9 @@ output) for that.)}
1501 \def\{{\lbracecharliteral}% 1497 \def\{{\lbracecharliteral}%
1502 \def\}{\rbracecharliteral}% 1498 \def\}{\rbracecharliteral}%
1503 \catcode`\\=\active \otherbackslash 1499 \catcode`\\=\active \otherbackslash
1504 \input \tocreadfilename 1500 \input \tocreadfilename\relax
1501 \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
1505 \endgroup 1502 \endgroup
1506 \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
1507 } 1503 }
1508 \def\dopdfoutlinecontents{% 1504 \def\dopdfoutlinecontents{%
1509 \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}% 1505 \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}%
@@ -1541,7 +1537,7 @@ output) for that.)}
1541 % 1537 %
1542 \def\pdflink#1{\pdflinkpage{#1}{#1}}% 1538 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1543 \def\pdflinkpage#1#2{% 1539 \def\pdflinkpage#1#2{%
1544 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} 1540 \startlink attr{/Border [0 0 0]} goto name{#1}
1545 \setcolor{\linkcolor}#2\endlink} 1541 \setcolor{\linkcolor}#2\endlink}
1546\else 1542\else
1547 % non-pdf mode 1543 % non-pdf mode
@@ -1644,18 +1640,20 @@ output) for that.)}
1644 % horizontal space being required in the PDF viewer. 1640 % horizontal space being required in the PDF viewer.
1645 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1641 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1646 \def\numchapentry##1##2##3##4{% 1642 \def\numchapentry##1##2##3##4{%
1647 \dopdfoutline{##2 ##1}{1}{##3}{##4}}% 1643 \dopdfoutline{##2 ##1}{1}{##3}{##4}%
1644 \def\indexseclevel{2}}%
1648 \def\numsecentry##1##2##3##4{% 1645 \def\numsecentry##1##2##3##4{%
1649 \dopdfoutline{##1}{2}{##3}{##4}}% 1646 \dopdfoutline{##1}{2}{##3}{##4}%
1647 \def\indexseclevel{3}}%
1650 \def\numsubsecentry##1##2##3##4{% 1648 \def\numsubsecentry##1##2##3##4{%
1651 \dopdfoutline{##1}{3}{##3}{##4}}% 1649 \dopdfoutline{##1}{3}{##3}{##4}%
1650 \def\indexseclevel{4}}%
1652 \def\numsubsubsecentry##1##2##3##4{% 1651 \def\numsubsubsecentry##1##2##3##4{%
1653 \dopdfoutline{##1}{4}{##3}{##4}}% 1652 \dopdfoutline{##1}{4}{##3}{##4}%
1653 \def\indexseclevel{5}}%
1654 % 1654 %
1655 % Note this is at the wrong level unless the index is in an @appendix
1656 % or @chapter.
1657 \def\idxinitialentry##1##2##3##4{% 1655 \def\idxinitialentry##1##2##3##4{%
1658 \dopdfoutline{##1}{2}{idx.##1.##2}{##4}}% 1656 \dopdfoutline{##1}{\indexseclevel}{idx.##1.##2}{##4}}%
1659 % 1657 %
1660 \let\appentry\numchapentry% 1658 \let\appentry\numchapentry%
1661 \let\appsecentry\numsecentry% 1659 \let\appsecentry\numsecentry%
@@ -1680,7 +1678,9 @@ output) for that.)}
1680 \def\{{\lbracecharliteral}% 1678 \def\{{\lbracecharliteral}%
1681 \def\}{\rbracecharliteral}% 1679 \def\}{\rbracecharliteral}%
1682 \catcode`\\=\active \otherbackslash 1680 \catcode`\\=\active \otherbackslash
1681 \xetexpreauxfile
1683 \input \tocreadfilename\relax 1682 \input \tocreadfilename\relax
1683 \xetexpostauxfile
1684 \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end 1684 \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
1685 \endgroup 1685 \endgroup
1686 } 1686 }
@@ -5177,8 +5177,8 @@ $$%
5177 % 5177 %
5178 \uccode`\1=`\{ \uppercase{\def\{{1}}% 5178 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5179 \uccode`\1=`\} \uppercase{\def\}{1}}% 5179 \uccode`\1=`\} \uppercase{\def\}{1}}%
5180 \let\lbracechar\{% 5180 \def\lbracechar##1{\{}%
5181 \let\rbracechar\}% 5181 \def\rbracechar##1{\}}%
5182 % 5182 %
5183 % 5183 %
5184 % We need to get rid of all macros, leaving only the arguments (if present). 5184 % We need to get rid of all macros, leaving only the arguments (if present).
@@ -5523,6 +5523,8 @@ $$%
5523 \tolerance = 9500 5523 \tolerance = 9500
5524 \plainfrenchspacing 5524 \plainfrenchspacing
5525 \everypar = {}% don't want the \kern\-parindent from indentation suppression. 5525 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5526 \let\entry\indexentry
5527 \ifxetex\xetexpreauxfile\fi
5526 % 5528 %
5527 % See comment in \requireopenindexfile. 5529 % See comment in \requireopenindexfile.
5528 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi 5530 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
@@ -5548,6 +5550,7 @@ $$%
5548 \fi 5550 \fi
5549 \fi 5551 \fi
5550 \closein 1 5552 \closein 1
5553 \ifxetex\xetexpostauxfile\fi
5551\endgroup} 5554\endgroup}
5552 5555
5553% Checked in @bye 5556% Checked in @bye
@@ -5583,7 +5586,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
5583 }% 5586 }%
5584 \else 5587 \else
5585 \begindoublecolumns 5588 \begindoublecolumns
5589 \ifxetex\xetexpreauxfile\fi
5586 \input \jobname.\indexname s 5590 \input \jobname.\indexname s
5591 \ifxetex\xetexpostauxfile\fi
5587 \enddoublecolumns 5592 \enddoublecolumns
5588 \fi 5593 \fi
5589 }{% 5594 }{%
@@ -5594,11 +5599,39 @@ might help (with 'rm \jobname.?? \jobname.??s')%
5594 % should work because we (hopefully) don't otherwise use @ in index files. 5599 % should work because we (hopefully) don't otherwise use @ in index files.
5595 %\catcode`\@=12\relax 5600 %\catcode`\@=12\relax
5596 \catcode`\@=0\relax 5601 \catcode`\@=0\relax
5602 \ifxetex\xetexpreauxfile\fi
5597 \input \jobname.\indexname s 5603 \input \jobname.\indexname s
5604 \ifxetex\xetexpostauxfile\fi
5598 \enddoublecolumns 5605 \enddoublecolumns
5599 }% 5606 }%
5600} 5607}
5601 5608
5609\def\indexentry#1#2{%
5610 \let\entrypagetarget\empty
5611 \ifpdforxetex
5612 % only link the index text to the page if no comma appears in the
5613 % list of pages, i.e. there is only one page
5614 \checkpagelistcomma{#2}\pagelistcomma
5615 \expandafter\ifcase\pagelistcomma
5616 \def\entrypagetarget{#2}%
5617 \fi
5618 \fi%
5619 \entryinternal{#1}{#2}%
5620}
5621
5622\def\checkpagelistcomma#1#2{%
5623 \checkpagelistcommaxx#2#1,\finish
5624}
5625\def\checkpagelistcommaxx#1#2,#3\finish{%
5626 \def\tmp{#3}%
5627 \ifx\tmp\empty
5628 \def#1{0\relax}
5629 \else
5630 \def#1{1\relax}
5631 \fi
5632}
5633
5634
5602% These macros are used by the sorted index file itself. 5635% These macros are used by the sorted index file itself.
5603% Change them to control the appearance of the index. 5636% Change them to control the appearance of the index.
5604 5637
@@ -5673,18 +5706,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
5673\def\doindexinitialentry#1{% 5706\def\doindexinitialentry#1{%
5674 \ifpdforxetex 5707 \ifpdforxetex
5675 \global\advance\idxinitialno by 1 5708 \global\advance\idxinitialno by 1
5676 \def\indexlbrace{\{} 5709 \def\indexlbrace{\{}%
5677 \def\indexrbrace{\}} 5710 \def\indexrbrace{\}}%
5678 \def\indexbackslash{\realbackslash} 5711 \def\indexbackslash{\realbackslash}%
5679 \def\indexatchar{\@} 5712 \def\indexatchar{\@}%
5680 \writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}% 5713 \writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}%
5681 % The @asis removes a pair of braces around e.g. {@indexatchar} that 5714 % The @asis removes a pair of braces around e.g. {@indexatchar} that
5682 % are output by texindex. 5715 % are output by texindex.
5683 % 5716 %
5684 \vbox to 0pt{}%
5685 % This vbox fixes the \pdfdest location for double column formatting.
5686 % Without it, the \pdfdest is output above topskip glue at the top
5687 % of a column as this glue is not added until the first box.
5688 \pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}% 5717 \pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}%
5689 \fi 5718 \fi
5690} 5719}
@@ -5704,16 +5733,18 @@ might help (with 'rm \jobname.?? \jobname.??s')%
5704\newdimen\entrycontskip 5733\newdimen\entrycontskip
5705\entrycontskip=1em 5734\entrycontskip=1em
5706 5735
5707% for PDF output, whether to make the text of the entry a link to the page 5736% for PDF output, whether to make the text of the entry a link to the section.
5708% number. set for @contents and @shortcontents where there is only one 5737% set for @contents and @shortcontents.
5709% page number.
5710\newif\iflinkentrytext 5738\newif\iflinkentrytext
5711 5739
5712% \entry typesets a paragraph consisting of the text (#1), dot leaders, and 5740% \entryinternal typesets a paragraph consisting of the text (#1), dot
5713% then page number (#2) flushed to the right margin. It is used for index 5741% leaders, and then page number (#2) flushed to the right margin. It is
5714% and table of contents entries. The paragraph is indented by \leftskip. 5742% used for index and table of contents entries. The paragraph is indented
5715% If \tocnodetarget is set, link text to the referenced node. 5743% by \leftskip.
5716\def\entry{% 5744% For PDF output, if \linkentrytexttrue and \tocnodetarget is set, link text
5745% to the referenced node. Else if \entrypagetarget is set, link text to the
5746% page.
5747\def\entryinternal{%
5717 \begingroup 5748 \begingroup
5718 % 5749 %
5719 % Start a new paragraph if necessary, so our assignments below can't 5750 % Start a new paragraph if necessary, so our assignments below can't
@@ -5761,7 +5792,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
5761 \endlink 5792 \endlink
5762 \fi 5793 \fi
5763 \else 5794 \else
5764 \unhbox\boxA 5795 \ifx\entrypagetarget\empty
5796 \unhbox\boxA
5797 \else
5798 \pdflinkpage{\entrypagetarget}{\unhbox\boxA}%
5799 \fi
5765 \fi 5800 \fi
5766 \else 5801 \else
5767 \unhbox\boxA 5802 \unhbox\boxA
@@ -6433,6 +6468,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6433\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} 6468\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6434 \suppressfirstparagraphindent} 6469 \suppressfirstparagraphindent}
6435 6470
6471% @xrefname - give text with printed name for linking to node and allow
6472% referencing node, but do not print any heading.
6473\parseargdef\xrefname{\donoderef{Yomitfromtoc}{#1}}%
6474
6436% These macros generate a chapter, section, etc. heading only 6475% These macros generate a chapter, section, etc. heading only
6437% (including whitespace, linebreaking, etc. around it), 6476% (including whitespace, linebreaking, etc. around it),
6438% given all the information in convenient, parsed form. 6477% given all the information in convenient, parsed form.
@@ -6554,11 +6593,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6554 \chapfonts \rm 6593 \chapfonts \rm
6555 \let\footnote=\errfootnoteheading % give better error message 6594 \let\footnote=\errfootnoteheading % give better error message
6556 % 6595 %
6557 % Have to define \currentsection before calling \donoderef, because the
6558 % xref code eventually uses it. On the other hand, it has to be called
6559 % after \pchapsepmacro, or the headline will change too soon.
6560 \gdef\currentsection{#1}%
6561 %
6562 % Only insert the separating space if we have a chapter/appendix 6596 % Only insert the separating space if we have a chapter/appendix
6563 % number, and don't print the unnumbered ``number''. 6597 % number, and don't print the unnumbered ``number''.
6564 \ifx\temptype\Ynothingkeyword 6598 \ifx\temptype\Ynothingkeyword
@@ -6585,7 +6619,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6585 % been typeset. If the destination for the pdf outline is after the 6619 % been typeset. If the destination for the pdf outline is after the
6586 % text, then jumping from the outline may wind up with the text not 6620 % text, then jumping from the outline may wind up with the text not
6587 % being visible, for instance under high magnification. 6621 % being visible, for instance under high magnification.
6588 \donoderef{#2}% 6622 \donoderef{#2}{#1}%
6589 % 6623 %
6590 % Typeset the actual heading. 6624 % Typeset the actual heading.
6591 \nobreak % Avoid page breaks at the interline glue. 6625 \nobreak % Avoid page breaks at the interline glue.
@@ -6701,21 +6735,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6701 \ifx\temptype\Ynothingkeyword 6735 \ifx\temptype\Ynothingkeyword
6702 \setbox0 = \hbox{}% 6736 \setbox0 = \hbox{}%
6703 \def\toctype{unn}% 6737 \def\toctype{unn}%
6704 \gdef\currentsection{#1}%
6705 \else\ifx\temptype\Yomitfromtockeyword 6738 \else\ifx\temptype\Yomitfromtockeyword
6706 % for @headings -- no section number, don't include in toc, 6739 % for @headings -- no section number, don't include in toc.
6707 % and don't redefine \currentsection.
6708 \setbox0 = \hbox{}% 6740 \setbox0 = \hbox{}%
6709 \def\toctype{omit}% 6741 \def\toctype{omit}%
6710 \let\sectionlevel=\empty 6742 \let\sectionlevel=\empty
6711 \else\ifx\temptype\Yappendixkeyword 6743 \else\ifx\temptype\Yappendixkeyword
6712 \setbox0 = \hbox{#4\enspace}% 6744 \setbox0 = \hbox{#4\enspace}%
6713 \def\toctype{app}% 6745 \def\toctype{app}%
6714 \gdef\currentsection{#1}%
6715 \else 6746 \else
6716 \setbox0 = \hbox{#4\enspace}% 6747 \setbox0 = \hbox{#4\enspace}%
6717 \def\toctype{num}% 6748 \def\toctype{num}%
6718 \gdef\currentsection{#1}%
6719 \fi\fi\fi 6749 \fi\fi\fi
6720 % 6750 %
6721 % Write the toc entry (before \donoderef). See comments in \chapmacro. 6751 % Write the toc entry (before \donoderef). See comments in \chapmacro.
@@ -6723,7 +6753,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6723 % 6753 %
6724 % Write the node reference (= pdf destination for pdftex). 6754 % Write the node reference (= pdf destination for pdftex).
6725 % Again, see comments in \chapmacro. 6755 % Again, see comments in \chapmacro.
6726 \donoderef{#3}% 6756 \donoderef{#3}{#1}%
6727 % 6757 %
6728 % Interline glue will be inserted when the vbox is completed. 6758 % Interline glue will be inserted when the vbox is completed.
6729 % That glue will be a valid breakpoint for the page, since it'll be 6759 % 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')%
6955% 6985%
6956\def\contents{% 6986\def\contents{%
6957 \startcontents{\putwordTOC}{\contentsmkdest}% 6987 \startcontents{\putwordTOC}{\contentsmkdest}%
6988 \ifxetex\xetexpreauxfile\fi
6958 \openin 1 \tocreadfilename\space 6989 \openin 1 \tocreadfilename\space
6959 \ifeof 1 \else 6990 \ifeof 1 \else
6960 \findsecnowidths 6991 \findsecnowidths
@@ -6966,6 +6997,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6966 \pdfmakeoutlines 6997 \pdfmakeoutlines
6967 \fi 6998 \fi
6968 \closein 1 6999 \closein 1
7000 \ifxetex\xetexpostauxfile\fi
6969 \endgroup 7001 \endgroup
6970 \contentsendroman 7002 \contentsendroman
6971} 7003}
@@ -6999,11 +7031,13 @@ might help (with 'rm \jobname.?? \jobname.??s')%
6999 \let\numsubsubsecentry = \numsecentry 7031 \let\numsubsubsecentry = \numsecentry
7000 \let\appsubsubsecentry = \numsecentry 7032 \let\appsubsubsecentry = \numsecentry
7001 \let\unnsubsubsecentry = \numsecentry 7033 \let\unnsubsubsecentry = \numsecentry
7034 \ifxetex\xetexpreauxfile\fi
7002 \openin 1 \tocreadfilename\space 7035 \openin 1 \tocreadfilename\space
7003 \ifeof 1 \else 7036 \ifeof 1 \else
7004 \readtocfile 7037 \readtocfile
7005 \fi 7038 \fi
7006 \closein 1 7039 \closein 1
7040 \ifxetex\xetexpostauxfile\fi
7007 \vfill \eject 7041 \vfill \eject
7008 \contentsalignmacro % in case @setchapternewpage odd is in effect 7042 \contentsalignmacro % in case @setchapternewpage odd is in effect
7009 \endgroup 7043 \endgroup
@@ -7167,6 +7201,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
7167\extrasecnoskip=0pt 7201\extrasecnoskip=0pt
7168 7202
7169\let\tocnodetarget\empty 7203\let\tocnodetarget\empty
7204\let\entrypagetarget\empty
7170 7205
7171% \tocentry{TITLE}{SEC NO}{NODE}{PAGE} 7206% \tocentry{TITLE}{SEC NO}{NODE}{PAGE}
7172% 7207%
@@ -7174,7 +7209,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
7174 \def\tocnodetarget{#3}% 7209 \def\tocnodetarget{#3}%
7175 \def\secno{#2}% 7210 \def\secno{#2}%
7176 \ifx\empty\secno 7211 \ifx\empty\secno
7177 \entry{#1}{#4}% 7212 \entryinternal{#1}{#4}%
7178 \else 7213 \else
7179 \ifdim 0pt=\secnowidth 7214 \ifdim 0pt=\secnowidth
7180 \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}% 7215 \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
@@ -7185,7 +7220,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
7185 #2\hskip\labelspace\hskip\extrasecnoskip\hfill}% 7220 #2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
7186 \fi 7221 \fi
7187 \entrycontskip=\wd0 7222 \entrycontskip=\wd0
7188 \entry{\box0 #1}{#4}% 7223 \entryinternal{\box0 #1}{#4}%
7189 \fi 7224 \fi
7190} 7225}
7191\newdimen\labelspace 7226\newdimen\labelspace
@@ -8170,18 +8205,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8170 } 8205 }
8171\fi 8206\fi
8172 8207
8173\let\E=\expandafter
8174
8175% Used at the time of macro expansion. 8208% Used at the time of macro expansion.
8176% Argument is macro body with arguments substituted 8209% Argument is macro body with arguments substituted
8177\def\scanmacro#1{% 8210\def\scanmacro#1{%
8178 \newlinechar`\^^M 8211 \newlinechar`\^^M
8179 % expand the expansion of \eatleadingcr twice to maybe remove a leading 8212 \def\xeatspaces##1{\eatleadingcrthen\eatspaces{##1}}%
8180 % newline (and \else and \fi tokens), then call \eatspaces on the result.
8181 \def\xeatspaces##1{%
8182 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
8183 }}%
8184 \def\xempty##1{}%
8185 % 8213 %
8186 % Process the macro body under the current catcode regime. 8214 % Process the macro body under the current catcode regime.
8187 \scantokens{#1@comment}% 8215 \scantokens{#1@comment}%
@@ -8234,10 +8262,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8234\unbrace{\gdef\trim@@@ #1 } #2@{#1} 8262\unbrace{\gdef\trim@@@ #1 } #2@{#1}
8235} 8263}
8236 8264
8237{\catcode`\^^M=\other% 8265% Trim a single leading ^^M off a string, then call #1
8238\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}% 8266{\catcode`\^^M=\active \catcode`\Q=3%
8239% Warning: this won't work for a delimited argument 8267\gdef\eatleadingcrthen #1#2{\eatlcra #1Q#2Q^^MQ}%
8240% or for an empty argument 8268\gdef\eatlcra #1#2Q^^M{\eatlcrb #1#2Q}%
8269\gdef\eatlcrb #1Q#2Q#3Q{#1{#2}}%
8270}
8241 8271
8242% Trim a single trailing ^^M off a string. 8272% Trim a single trailing ^^M off a string.
8243{\catcode`\^^M=\other \catcode`\Q=3% 8273{\catcode`\^^M=\other \catcode`\Q=3%
@@ -8373,6 +8403,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8373% <parameter list> is #, then the preceding argument is delimited by 8403% <parameter list> is #, then the preceding argument is delimited by
8374% an opening brace, and that opening brace is not consumed. 8404% an opening brace, and that opening brace is not consumed.
8375 8405
8406% Make @ a letter, so that we can make private-to-Texinfo macro names.
8407\edef\texiatcatcode{\the\catcode`\@}
8408\catcode `@=11\relax
8409
8376% Parse the optional {params} list to @macro or @rmacro. 8410% Parse the optional {params} list to @macro or @rmacro.
8377% Set \paramno to the number of arguments, 8411% Set \paramno to the number of arguments,
8378% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a 8412% 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')%
8385% That gets used by \mbodybackslash (above). 8419% That gets used by \mbodybackslash (above).
8386% 8420%
8387% If there are 10 or more arguments, a different technique is used: see 8421% If there are 10 or more arguments, a different technique is used: see
8388% \parsemmanyargdef. 8422% \parsemmanyargdef@@.
8389% 8423%
8390\def\parsemargdef#1;{% 8424\def\parsemargdef#1;{%
8391 \paramno=0\def\paramlist{}% 8425 \paramno=0\def\paramlist{}%
8392 \let\hash\relax 8426 \let\hash\relax
8393 % \hash is redefined to `#' later to get it into definitions 8427 % \hash is redefined to `#' later to get it into definitions
8394 \let\xeatspaces\relax 8428 \let\xeatspaces\relax
8395 \let\xempty\relax
8396 \parsemargdefxxx#1,;,% 8429 \parsemargdefxxx#1,;,%
8397 \ifnum\paramno<10\relax\else 8430 \ifnum\paramno<10\relax\else
8398 \paramno0\relax 8431 \paramno0\relax
@@ -8404,11 +8437,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8404 \else \let\next=\parsemargdefxxx 8437 \else \let\next=\parsemargdefxxx
8405 \advance\paramno by 1 8438 \advance\paramno by 1
8406 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname 8439 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8407 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}% 8440 {\xeatspaces{\hash\the\paramno}}%
8408 \edef\paramlist{\paramlist\hash\the\paramno,}% 8441 \edef\paramlist{\paramlist\hash\the\paramno,}%
8409 \fi\next} 8442 \fi\next}
8410% the \xempty{} is to give \eatleadingcr an argument in the case of an
8411% empty macro argument.
8412 8443
8413% \parsemacbody, \parsermacbody 8444% \parsemacbody, \parsermacbody
8414% 8445%
@@ -8419,14 +8450,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8419% body to be transformed. 8450% body to be transformed.
8420% Set \macrobody to the body of the macro, and call \macrodef. 8451% Set \macrobody to the body of the macro, and call \macrodef.
8421% 8452%
8453\catcode `\@\texiatcatcode
8422{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% 8454{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8423\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}% 8455\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8424{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% 8456{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8425\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}% 8457\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8426 8458\catcode `\@=11\relax
8427% Make @ a letter, so that we can make private-to-Texinfo macro names.
8428\edef\texiatcatcode{\the\catcode`\@}
8429\catcode `@=11\relax
8430 8459
8431%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% 8460%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8432 8461
@@ -8687,15 +8716,13 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8687 \noexpand\expandafter 8716 \noexpand\expandafter
8688 \expandafter\noexpand\csname\the\macname @@\endcsname}% 8717 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8689 \expandafter\xdef\csname\the\macname @@\endcsname##1{% 8718 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8690 \noexpand\passargtomacro 8719 \noexpand\passargtomacro
8691 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% 8720 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8692 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8721 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8693 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% 8722 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8694 \expandafter\expandafter 8723 \expandaftergroup{\expandafter\xdef\csname\the\macname @@@@\endcsname}%
8695 \expandafter\xdef 8724 \paramlist{%
8696 \expandafter\expandafter 8725 \endgroup\noexpand\scanmacro{\macrobody}}%
8697 \csname\the\macname @@@@\endcsname\paramlist{%
8698 \endgroup\noexpand\scanmacro{\macrobody}}%
8699 \else % 10 or more: 8726 \else % 10 or more:
8700 \expandafter\xdef\csname\the\macname\endcsname{% 8727 \expandafter\xdef\csname\the\macname\endcsname{%
8701 \noexpand\getargvals@{\the\macname}{\argl}% 8728 \noexpand\getargvals@{\the\macname}{\argl}%
@@ -8707,6 +8734,16 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8707 8734
8708\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes 8735\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8709 8736
8737% utility definition to avoid excessive use of \expandafter. call
8738% as \expandaftergroup{CONTENT}\WORD to expand \WORD exactly once and remove
8739% braces around CONTENT.
8740\def\expandaftergroup#1#2{%
8741 \expandafter\expandaftergroupx\expandafter{#2}{#1}%
8742}
8743\def\expandaftergroupx#1#2{%
8744 #2#1%
8745}
8746
8710\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 8747\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8711 8748
8712 8749
@@ -8876,9 +8913,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8876 \expandafter\noexpand 8913 \expandafter\noexpand
8877 \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro 8914 \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
8878 } 8915 }
8879 \expandafter\expandafter 8916 \expandaftergroup{\expandafter\xdef\csname\the\macname @@@\endcsname}%
8880 \expandafter\xdef 8917 \paramlist{%
8881 \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
8882 \newlinechar=13 % split \macrobody into lines 8918 \newlinechar=13 % split \macrobody into lines
8883 \noexpand\scantokens{\macrobody}% 8919 \noexpand\scantokens{\macrobody}%
8884 } 8920 }
@@ -8953,11 +8989,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8953\let\lastnode=\empty 8989\let\lastnode=\empty
8954 8990
8955% Write a cross-reference definition for the current node. #1 is the 8991% Write a cross-reference definition for the current node. #1 is the
8956% type (Ynumbered, Yappendix, Ynothing). 8992% type (Ynumbered, Yappendix, Ynothing). #2 is the section title.
8957% 8993%
8958\def\donoderef#1{% 8994\def\donoderef#1#2{%
8959 \ifx\lastnode\empty\else 8995 \ifx\lastnode\empty\else
8960 \setref{\lastnode}{#1}% 8996 \setref{\lastnode}{#1}{#2}%
8961 \global\let\lastnode=\empty 8997 \global\let\lastnode=\empty
8962 \setnodeseenonce 8998 \setnodeseenonce
8963 \fi 8999 \fi
@@ -8978,21 +9014,28 @@ might help (with 'rm \jobname.?? \jobname.??s')%
8978% 9014%
8979\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} 9015\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8980\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} 9016\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8981\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} 9017\def\anchor#1{%
8982 9018 \savesf \setref{#1}{Yanchor}{#1}\restoresf \ignorespaces
8983% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an 9019}
8984% anchor), which consists of three parts: 9020
8985% 1) NAME-title - the current sectioning name taken from \currentsection, 9021% @namedanchor{NAME, XREFNAME} -- define xref target at arbitrary point
8986% or the anchor name. 9022% with label text for cross-references to it.
8987% 2) NAME-snt - section number and type, passed as the SNT arg, or 9023\def\namedanchor#1{\donamedanchor#1\finish}%
8988% empty for anchors. 9024\def\donamedanchor#1,#2\finish{%
9025 \savesf \setref{#1}{Yanchor}{\ignorespaces #2\unskip}\restoresf \ignorespaces
9026}
9027
9028% \setref{NAME}{SNT}{TITLE} defines a cross-reference point NAME (a node
9029% or an anchor), which consists of three parts:
9030% 1) NAME-title - the current sectioning name
9031% 2) NAME-snt - section number and type, passed as the SNT arg.
8989% 3) NAME-pg - the page number. 9032% 3) NAME-pg - the page number.
8990% 9033%
8991% This is called from \donoderef, \anchor, and \dofloat. In the case of 9034% This is called from \donoderef, \anchor, and \dofloat. In the case of
8992% floats, there is an additional part, which is not written here: 9035% floats, there is an additional part, which is not written here:
8993% 4) NAME-lof - the text as it should appear in a @listoffloats. 9036% 4) NAME-lof - the text as it should appear in a @listoffloats.
8994% 9037%
8995\def\setref#1#2{% 9038\def\setref#1#2#3{%
8996 \pdfmkdest{#1}% 9039 \pdfmkdest{#1}%
8997 \iflinks 9040 \iflinks
8998 {% 9041 {%
@@ -9004,7 +9047,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9004 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef 9047 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
9005 ##1}{##2}}% these are parameters of \writexrdef 9048 ##1}{##2}}% these are parameters of \writexrdef
9006 }% 9049 }%
9007 \toks0 = \expandafter{\currentsection}% 9050 \toks0 = {#3}%
9008 \immediate \writexrdef{title}{\the\toks0 }% 9051 \immediate \writexrdef{title}{\the\toks0 }%
9009 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. 9052 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
9010 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout 9053 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
@@ -9058,15 +9101,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9058 \setbox\infofilenamebox = \hbox{\infofilename\unskip}% 9101 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
9059 % 9102 %
9060 \startxreflink{#1}{#4}% 9103 \startxreflink{#1}{#4}%
9061 {% 9104 \getrefx{#1-title}\Xthisreftitle
9062 % Have to otherify everything special to allow the \csname to
9063 % include an _ in the xref name, etc.
9064 \indexnofonts
9065 \turnoffactive
9066 \def\value##1{##1}%
9067 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
9068 \csname XR#1-title\endcsname
9069 }%
9070 % 9105 %
9071 % Float references are printed completely differently: "Figure 1.2" 9106 % Float references are printed completely differently: "Figure 1.2"
9072 % instead of "[somenode], p.3". \iffloat distinguishes them by 9107 % instead of "[somenode], p.3". \iffloat distinguishes them by
@@ -9099,21 +9134,23 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9099 % Cross-manual reference with a printed manual name. 9134 % Cross-manual reference with a printed manual name.
9100 % 9135 %
9101 \crossmanualxref{\cite{\printedmanual\unskip}}% 9136 \crossmanualxref{\cite{\printedmanual\unskip}}%
9102 %
9103 \else\ifdim \wd\infofilenamebox > 0pt 9137 \else\ifdim \wd\infofilenamebox > 0pt
9104 % Cross-manual reference with only an info filename (arg 4), no 9138 % Cross-manual reference with only an info filename (arg 4), no
9105 % printed manual name (arg 5). This is essentially the same as 9139 % printed manual name (arg 5). This is essentially the same as
9106 % the case above; we output the filename, since we have nothing else. 9140 % the case above; we output the filename, since we have nothing else.
9107 % 9141 %
9108 \crossmanualxref{\code{\infofilename\unskip}}% 9142 \crossmanualxref{\code{\infofilename\unskip}}%
9109 %
9110 \else 9143 \else
9111 % Reference within this manual. 9144 % Reference within this manual.
9112 % 9145 %
9113 % Only output a following space if the -snt ref is nonempty, as the ref 9146 % Only output a following space if the -snt ref is nonempty, as is
9114 % will be empty for @unnumbered and @anchor. 9147 % the case for @unnumbered and @anchor.
9115 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}% 9148 \getrefx{#1-snt}\tmp
9116 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi 9149 \ifx\tmp\empty\else
9150 \ifx\tmp\Yanchor\else
9151 \tmp\space
9152 \fi
9153 \fi
9117 % 9154 %
9118 % output the `[mynode]' via the macro below so it can be overridden. 9155 % output the `[mynode]' via the macro below so it can be overridden.
9119 \xrefprintnodename\printedrefname 9156 \xrefprintnodename\printedrefname
@@ -9169,7 +9206,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9169 \else 9206 \else
9170 % Otherwise just copy the Info node name. 9207 % Otherwise just copy the Info node name.
9171 \def\printedrefname{\ignorespaces #1}% 9208 \def\printedrefname{\ignorespaces #1}%
9172 \fi% 9209 \fi
9173 \fi 9210 \fi
9174 \fi 9211 \fi
9175 \fi 9212 \fi
@@ -9201,7 +9238,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9201 \ifnum\filenamelength>0 9238 \ifnum\filenamelength>0
9202 goto file{\the\filename.pdf} name{\pdfdestname}% 9239 goto file{\the\filename.pdf} name{\pdfdestname}%
9203 \else 9240 \else
9204 goto name{\pdfmkpgn{\pdfdestname}}% 9241 goto name{\pdfdestname}%
9205 \fi 9242 \fi
9206 \else % XeTeX 9243 \else % XeTeX
9207 \ifnum\filenamelength>0 9244 \ifnum\filenamelength>0
@@ -9281,6 +9318,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9281% 9318%
9282\def\Ynothing{} 9319\def\Ynothing{}
9283\def\Yomitfromtoc{} 9320\def\Yomitfromtoc{}
9321\def\Yanchor{\isanchor} \let\isanchor\relax
9284\def\Ynumbered{% 9322\def\Ynumbered{%
9285 \ifnum\secno=0 9323 \ifnum\secno=0
9286 \putwordChapter@tie \the\chapno 9324 \putwordChapter@tie \the\chapno
@@ -9307,14 +9345,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9307 9345
9308% \refx{NAME} - reference a cross-reference string named NAME. 9346% \refx{NAME} - reference a cross-reference string named NAME.
9309\def\refx#1{% 9347\def\refx#1{%
9310 \requireauxfile 9348 \getrefx{#1}\thisrefX
9311 {%
9312 \indexnofonts
9313 \turnoffactive
9314 \def\value##1{##1}%
9315 \expandafter\global\expandafter\let\expandafter\thisrefX
9316 \csname XR#1\endcsname
9317 }%
9318 \ifx\thisrefX\relax 9349 \ifx\thisrefX\relax
9319 % If not defined, say something at least. 9350 % If not defined, say something at least.
9320 \angleleft un\-de\-fined\angleright 9351 \angleleft un\-de\-fined\angleright
@@ -9335,6 +9366,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9335 \fi 9366 \fi
9336} 9367}
9337 9368
9369% Set #2 to xref string #1
9370\def\getrefx#1#2{%
9371 \requireauxfile
9372 {%
9373 \indexnofonts
9374 \turnoffactive
9375 \def\value##1{##1}%
9376 \expandafter\global\expandafter\let\expandafter#2\csname XR#1\endcsname
9377 }%
9378}
9379
9338% This is the macro invoked by entries in the aux file. Define a control 9380% This is the macro invoked by entries in the aux file. Define a control
9339% sequence for a cross-reference target (we prepend XR to the control sequence 9381% sequence for a cross-reference target (we prepend XR to the control sequence
9340% name to avoid collisions). The value is the page number. If this is a float 9382% 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')%
9399% Read the last existing aux file, if any. No error if none exists. 9441% Read the last existing aux file, if any. No error if none exists.
9400% 9442%
9401\def\tryauxfile{% 9443\def\tryauxfile{%
9444 \ifxetex\xetexpreauxfile\fi
9402 \openin 1 \jobname.aux 9445 \openin 1 \jobname.aux
9403 \ifeof 1 \else 9446 \ifeof 1 \else
9404 \readdatafile{aux}% 9447 \readdatafile{aux}%
9405 \global\havexrefstrue 9448 \global\havexrefstrue
9406 \fi 9449 \fi
9407 \closein 1 9450 \closein 1
9451 \ifxetex\xetexpostauxfile\fi
9408} 9452}
9409 9453
9410\def\setupdatafile{% 9454\def\setupdatafile{%
@@ -9790,14 +9834,15 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9790 \global\advance\floatno by 1 9834 \global\advance\floatno by 1
9791 % 9835 %
9792 {% 9836 {%
9793 % This magic value for \currentsection is output by \setref as the 9837 % This magic value for the third argument of \setref is output as
9794 % XREFLABEL-title value. \xrefX uses it to distinguish float 9838 % the XREFLABEL-title value. \xrefX uses it to distinguish float
9795 % labels (which have a completely different output format) from 9839 % labels (which have a completely different output format) from
9796 % node and anchor labels. And \xrdef uses it to construct the 9840 % node and anchor labels. And \xrdef uses it to construct the
9797 % lists of floats. 9841 % lists of floats.
9798 % 9842 %
9799 \edef\currentsection{\floatmagic=\safefloattype}% 9843 \edef\tmp{\noexpand\setref{\floatlabel}{Yfloat}%
9800 \setref{\floatlabel}{Yfloat}% 9844 {\floatmagic=\safefloattype}}%
9845 \tmp
9801 }% 9846 }%
9802 \fi 9847 \fi
9803 % 9848 %
@@ -9919,7 +9964,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9919 9964
9920% #1 is the control sequence we are passed; we expand into a conditional 9965% #1 is the control sequence we are passed; we expand into a conditional
9921% which is true if #1 represents a float ref. That is, the magic 9966% which is true if #1 represents a float ref. That is, the magic
9922% \currentsection value which we \setref above. 9967% value which we passed to \setref above.
9923% 9968%
9924\def\iffloat#1{\expandafter\doiffloat#1==\finish} 9969\def\iffloat#1{\expandafter\doiffloat#1==\finish}
9925% 9970%
@@ -9976,6 +10021,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9976 \toksA = \expandafter{\csname XR#1-lof\endcsname}% 10021 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9977 % 10022 %
9978 % use the same \entry macro we use to generate the TOC and index. 10023 % use the same \entry macro we use to generate the TOC and index.
10024 \let\entry\entryinternal
9979 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% 10025 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9980 \writeentry 10026 \writeentry
9981}} 10027}}
@@ -10071,17 +10117,24 @@ directory should work if nowhere else does.}
10071 \fi 10117 \fi
10072\fi 10118\fi
10073 10119
10120\let\xetexpreauxfile\relax
10121\let\xetexpostauxfile\relax
10122
10074% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex 10123% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
10075% for non-UTF-8 (byte-wise) encodings. 10124% for non-UTF-8 (byte-wise) encodings.
10076% 10125%
10077\def\setbytewiseio{% 10126\def\setbytewiseio{%
10078 \ifxetex 10127 \ifxetex
10079 \XeTeXdefaultencoding "bytes" % For subsequent files to be read 10128 % For document root file
10080 \XeTeXinputencoding "bytes" % For document root file 10129 \XeTeXinputencoding "bytes"
10081 % Unfortunately, there seems to be no corresponding XeTeX command for 10130 %
10082 % output encoding. This is a problem for auxiliary index and TOC files. 10131 % Setting for subsequent files to be read with @include.
10083 % The only solution would be perhaps to write out @U{...} sequences in 10132 \XeTeXdefaultencoding "bytes"
10084 % place of non-ASCII characters. 10133 %
10134 % Use UTF-8 for reading auxiliary index and TOC files, which are
10135 % always output in UTF-8 with XeTeX.
10136 \def\xetexpreauxfile{\XeTeXdefaultencoding "UTF-8"}%
10137 \def\xetexpostauxfile{\XeTeXdefaultencoding "bytes"}%
10085 \fi 10138 \fi
10086 10139
10087 \ifluatex 10140 \ifluatex
@@ -10713,12 +10766,12 @@ directory should work if nowhere else does.}
10713 10766
10714% Suppress ligature creation from adjacent characters. 10767% Suppress ligature creation from adjacent characters.
10715\ifluatex 10768\ifluatex
10716 \def\nolig{{}}
10717\else
10718 % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice 10769 % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice
10719 % to suppress the "ff" ligature. Using a kern appears to be the only 10770 % to suppress the "ff" ligature. Using a kern appears to be the only
10720 % workaround. 10771 % workaround.
10721 \def\nolig{\kern0pt{}} 10772 \def\nolig{\kern0pt{}}
10773\else
10774 \def\nolig{{}}
10722\fi 10775\fi
10723 10776
10724% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M 10777% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
index 1a6087b03a9..6c50feacbb8 100644
--- a/lib/acl-internal.c
+++ b/lib/acl-internal.c
@@ -31,7 +31,7 @@
31# include <string.h> 31# include <string.h>
32#endif 32#endif
33 33
34#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ 34#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
35 35
36# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ 36# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
37 37
@@ -45,7 +45,7 @@ acl_extended_nontrivial (acl_t acl)
45 return (acl_entries (acl) > 0); 45 return (acl_entries (acl) > 0);
46} 46}
47 47
48# else /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */ 48# else /* Linux, FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
49 49
50/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS. 50/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
51 Return 1 if the given ACL is non-trivial. 51 Return 1 if the given ACL is non-trivial.
@@ -59,7 +59,7 @@ acl_access_nontrivial (acl_t acl)
59 at least, allowing us to write 59 at least, allowing us to write
60 return (3 < acl_entries (acl)); 60 return (3 < acl_entries (acl));
61 but the following code is more robust. */ 61 but the following code is more robust. */
62# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Cygwin >= 2.5 */ 62# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
63 63
64 acl_entry_t ace; 64 acl_entry_t ace;
65 int got_one; 65 int got_one;
@@ -548,7 +548,7 @@ void
548free_permission_context (struct permission_context *ctx) 548free_permission_context (struct permission_context *ctx)
549{ 549{
550#if USE_ACL 550#if USE_ACL
551# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ 551# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
552 if (ctx->acl) 552 if (ctx->acl)
553 acl_free (ctx->acl); 553 acl_free (ctx->acl);
554# if !HAVE_ACL_TYPE_EXTENDED 554# if !HAVE_ACL_TYPE_EXTENDED
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index f37b3bcff5b..cb969e9797e 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -52,10 +52,7 @@ extern int aclsort (int, int, struct acl *);
52#include <errno.h> 52#include <errno.h>
53 53
54#include <limits.h> 54#include <limits.h>
55 55#include <stdint.h>
56#ifndef SIZE_MAX
57# define SIZE_MAX ((size_t) -1)
58#endif
59 56
60#ifndef HAVE_FCHMOD 57#ifndef HAVE_FCHMOD
61# define HAVE_FCHMOD false 58# define HAVE_FCHMOD false
@@ -121,8 +118,13 @@ rpl_acl_set_fd (int fd, acl_t acl)
121# endif 118# endif
122 119
123/* Linux-specific */ 120/* Linux-specific */
124/* Cygwin >= 2.5 implements this function, but it returns 1 for all 121/* Cygwin >= 2.5 implements acl_extended_file(), but it returns 1 for nearly all
125 directories, thus is unusable. */ 122 directories — for reasons explained in
123 <https://sourceware.org/pipermail/cygwin/2025-March/257762.html> —, thus is
124 unusable. For the user, 'ls' should not print a '+' sign, indicating the
125 presence of an ACL, for 99,9% of the files; this would not be useful.
126 Therefore, on Cygwin, we ignore the acl_extended_file function and instead
127 use our own acl_access_nontrivial function. */
126# if !defined HAVE_ACL_EXTENDED_FILE || defined __CYGWIN__ 128# if !defined HAVE_ACL_EXTENDED_FILE || defined __CYGWIN__
127# undef HAVE_ACL_EXTENDED_FILE 129# undef HAVE_ACL_EXTENDED_FILE
128# define HAVE_ACL_EXTENDED_FILE false 130# define HAVE_ACL_EXTENDED_FILE false
diff --git a/lib/acl_entries.c b/lib/acl_entries.c
index 808ad93fe2c..57b7b4998c0 100644
--- a/lib/acl_entries.c
+++ b/lib/acl_entries.c
@@ -22,7 +22,7 @@
22#include "acl-internal.h" 22#include "acl-internal.h"
23 23
24/* This file assumes POSIX-draft like ACLs 24/* This file assumes POSIX-draft like ACLs
25 (Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */ 25 (Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */
26 26
27/* Return the number of entries in ACL. 27/* Return the number of entries in ACL.
28 Return -1 and set errno upon failure to determine it. */ 28 Return -1 and set errno upon failure to determine it. */
@@ -34,7 +34,7 @@ acl_entries (acl_t acl)
34 34
35 if (acl != NULL) 35 if (acl != NULL)
36 { 36 {
37#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */ 37#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */
38# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ 38# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
39 /* acl_get_entry returns 0 when it successfully fetches an entry, 39 /* acl_get_entry returns 0 when it successfully fetches an entry,
40 and -1/EINVAL at the end. */ 40 and -1/EINVAL at the end. */
@@ -45,7 +45,7 @@ acl_entries (acl_t acl)
45 got_one >= 0; 45 got_one >= 0;
46 got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) 46 got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
47 count++; 47 count++;
48# else /* Linux, FreeBSD, Cygwin >= 2.5 */ 48# else /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
49 /* acl_get_entry returns 1 when it successfully fetches an entry, 49 /* acl_get_entry returns 1 when it successfully fetches an entry,
50 and 0 at the end. */ 50 and 0 at the end. */
51 acl_entry_t ace; 51 acl_entry_t ace;
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index ac61c0865a4..d7f551b30f3 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -22,8 +22,12 @@
22#endif 22#endif
23@PRAGMA_COLUMNS@ 23@PRAGMA_COLUMNS@
24 24
25#if defined __need_system_fcntl_h 25#if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
26/* Special invocation convention. */ 26/* Special invocation convention:
27 - On Haiku we have a sequence of nested includes
28 <fcntl.h> -> <unistd.h> -> <fcntl.h>
29 In this situation, GNULIB_defined_O_NONBLOCK gets defined before the
30 system's definition of O_NONBLOCK is processed. */
27 31
28/* Needed before <sys/stat.h>. 32/* Needed before <sys/stat.h>.
29 May also define off_t to a 64-bit type on native Windows. */ 33 May also define off_t to a 64-bit type on native Windows. */
@@ -50,6 +54,8 @@
50 54
51#ifndef _@GUARD_PREFIX@_FCNTL_H 55#ifndef _@GUARD_PREFIX@_FCNTL_H
52 56
57#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
58
53/* Needed before <sys/stat.h>. 59/* Needed before <sys/stat.h>.
54 May also define off_t to a 64-bit type on native Windows. 60 May also define off_t to a 64-bit type on native Windows.
55 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ 61 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
@@ -72,6 +78,8 @@
72# include <io.h> 78# include <io.h>
73#endif 79#endif
74 80
81#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
82
75#ifndef _@GUARD_PREFIX@_FCNTL_H 83#ifndef _@GUARD_PREFIX@_FCNTL_H
76#define _@GUARD_PREFIX@_FCNTL_H 84#define _@GUARD_PREFIX@_FCNTL_H
77 85
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index c02cfee842b..66b920c1ab2 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -50,7 +50,6 @@ static char const UNKNOWN_SECURITY_CONTEXT[] = "?";
50# include <selinux/selinux.h> 50# include <selinux/selinux.h>
51# endif 51# endif
52# include <stdckdint.h> 52# include <stdckdint.h>
53# include <stdint.h>
54# include <string.h> 53# include <string.h>
55# include <arpa/inet.h> 54# include <arpa/inet.h>
56# include <sys/xattr.h> 55# include <sys/xattr.h>
@@ -363,6 +362,29 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
363} 362}
364#endif 363#endif
365 364
365#if (!USE_LINUX_XATTR && USE_ACL && HAVE_ACL_GET_FD \
366 && !HAVE_ACL_EXTENDED_FILE && !HAVE_ACL_TYPE_EXTENDED \
367 && !HAVE_ACL_GET_LINK_NP)
368# include <fcntl.h>
369# ifdef O_PATH
370
371/* Like acl_get_file, but do not follow symbolic links. */
372static acl_t
373acl_get_link_np (char const *name, acl_type_t type)
374{
375 int fd = open (name, O_PATH | O_NOFOLLOW);
376 if (fd < 0)
377 return NULL;
378 acl_t r = acl_get_fd (fd);
379 int err = errno;
380 close (fd);
381 errno = err;
382 return r;
383}
384# define HAVE_ACL_GET_LINK_NP 1
385# endif
386#endif
387
366/* Return 1 if NAME has a nontrivial access control list, 388/* Return 1 if NAME has a nontrivial access control list,
367 0 if ACLs are not supported, or if NAME has no or only a base ACL, 389 0 if ACLs are not supported, or if NAME has no or only a base ACL,
368 and -1 (setting errno) on error. Note callers can determine 390 and -1 (setting errno) on error. Note callers can determine
@@ -468,7 +490,7 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
468 ret = -1; 490 ret = -1;
469# else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */ 491# else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
470 acl_t (*acl_get_file_or_link) (char const *, acl_type_t) = acl_get_file; 492 acl_t (*acl_get_file_or_link) (char const *, acl_type_t) = acl_get_file;
471# if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10 */ 493# if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
472 if (! (flags & ACL_SYMLINK_FOLLOW)) 494 if (! (flags & ACL_SYMLINK_FOLLOW))
473 acl_get_file_or_link = acl_get_link_np; 495 acl_get_file_or_link = acl_get_link_np;
474# endif 496# endif
diff --git a/lib/fpending.c b/lib/fpending.c
index 7614b607832..be8a9877349 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -26,7 +26,7 @@
26 26
27/* This file is not used on systems that already have the __fpending function, 27/* This file is not used on systems that already have the __fpending function,
28 namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34, 28 namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34,
29 Android API >= 23. */ 29 Android API >= 23, musl libc, Haiku >= hrev58760. */
30 30
31/* Return the number of pending (aka buffered, unflushed) 31/* Return the number of pending (aka buffered, unflushed)
32 bytes on the stream, FP, that is open for writing. */ 32 bytes on the stream, FP, that is open for writing. */
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index a7966462c73..9da41c16c02 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -47,8 +47,6 @@
47 N_NAME_POINTER The nlist n_name element is a pointer, 47 N_NAME_POINTER The nlist n_name element is a pointer,
48 not an array. 48 not an array.
49 HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'. 49 HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
50 LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File
51 containing load averages.
52 50
53 Specific system predefines this file uses, aside from setting 51 Specific system predefines this file uses, aside from setting
54 default values if not emacs: 52 default values if not emacs:
@@ -65,8 +63,7 @@
65 UMAX4_3 63 UMAX4_3
66 VMS 64 VMS
67 _WIN32 Native Windows (possibly also defined on Cygwin) 65 _WIN32 Native Windows (possibly also defined on Cygwin)
68 __linux__, __ANDROID__ Linux: assumes /proc file system mounted. 66 __linux__, __ANDROID__ Linux: assumes sysinfo() call.
69 Support from Michael K. Johnson.
70 __CYGWIN__ Cygwin emulates linux /proc/loadavg. 67 __CYGWIN__ Cygwin emulates linux /proc/loadavg.
71 __NetBSD__ NetBSD: assumes /kern file system mounted. 68 __NetBSD__ NetBSD: assumes /kern file system mounted.
72 69
@@ -108,10 +105,10 @@
108# endif 105# endif
109 106
110/* Same issues as for NeXT apply to the HURD-based GNU system. */ 107/* Same issues as for NeXT apply to the HURD-based GNU system. */
111# ifdef __GNU__ 108# if defined __gnu_hurd__ || defined NeXT
112# undef BSD 109# undef BSD
113# undef FSCALE 110# undef FSCALE
114# endif /* __GNU__ */ 111# endif /* __gnu_hurd__ || NeXT */
115 112
116/* Set values that are different from the defaults, which are 113/* Set values that are different from the defaults, which are
117 set a little farther down with #ifndef. */ 114 set a little farther down with #ifndef. */
@@ -312,8 +309,7 @@
312# endif 309# endif
313# endif 310# endif
314 311
315# if defined (__GNU__) && !defined (NeXT) 312# if defined __gnu_hurd__ && !defined NeXT
316/* Note that NeXT Openstep defines __GNU__ even though it should not. */
317/* GNU system acts much like NeXT, for load average purposes, 313/* GNU system acts much like NeXT, for load average purposes,
318 but not exactly. */ 314 but not exactly. */
319# define NeXT 315# define NeXT
@@ -358,6 +354,11 @@
358# include <sys/dg_sys_info.h> 354# include <sys/dg_sys_info.h>
359# endif 355# endif
360 356
357# if defined __linux__ || defined __ANDROID__
358# include <sys/param.h>
359# include <sys/sysinfo.h>
360# endif
361
361# if (defined __linux__ || defined __ANDROID__ \ 362# if (defined __linux__ || defined __ANDROID__ \
362 || defined __CYGWIN__ || defined SUNOS_5 \ 363 || defined __CYGWIN__ || defined SUNOS_5 \
363 || (defined LOAD_AVE_TYPE && ! defined __VMS)) 364 || (defined LOAD_AVE_TYPE && ! defined __VMS))
@@ -498,20 +499,32 @@ getloadavg (double loadavg[], int nelem)
498 } 499 }
499# endif 500# endif
500 501
501# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) 502# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__)
502 /* Linux without glibc, Android, Cygwin */ 503 /* Linux without glibc, Android, Cygwin */
503# define LDAV_DONE 504# define LDAV_DONE
504# undef LOAD_AVE_TYPE 505# undef LOAD_AVE_TYPE
505 506
506# ifndef LINUX_LDAV_FILE 507 {
507# define LINUX_LDAV_FILE "/proc/loadavg" 508 struct sysinfo info;
508# endif 509 if (sysinfo (&info) < 0)
510 return -1;
511 loadavg[0] = info.loads[0] / (double)(1U << SI_LOAD_SHIFT);
512 loadavg[1] = info.loads[1] / (double)(1U << SI_LOAD_SHIFT);
513 loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT);
514 elem = 3;
515 }
516# endif /* __linux__ || __ANDROID__ */
517
518# if !defined (LDAV_DONE) && defined __CYGWIN__
519 /* Cygwin */
520# define LDAV_DONE
521# undef LOAD_AVE_TYPE
509 522
510 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")]; 523 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
511 char const *ptr = ldavgbuf; 524 char const *ptr = ldavgbuf;
512 int fd, count, saved_errno; 525 int fd, count, saved_errno;
513 526
514 fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC); 527 fd = open ("/proc/loadavg", O_RDONLY | O_CLOEXEC);
515 if (fd == -1) 528 if (fd == -1)
516 return -1; 529 return -1;
517 count = read (fd, ldavgbuf, sizeof ldavgbuf - 1); 530 count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
@@ -554,7 +567,7 @@ getloadavg (double loadavg[], int nelem)
554 567
555 return elem; 568 return elem;
556 569
557# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ 570# endif /* __CYGWIN__ */
558 571
559# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ 572# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
560# define LDAV_DONE 573# define LDAV_DONE
diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
index 1f2b2d71bf7..a61c68c795e 100644
--- a/lib/getopt-pfx-ext.h
+++ b/lib/getopt-pfx-ext.h
@@ -38,11 +38,9 @@
38# endif 38# endif
39# undef getopt_long 39# undef getopt_long
40# undef getopt_long_only 40# undef getopt_long_only
41# undef option
42# undef _getopt_internal 41# undef _getopt_internal
43# define getopt_long __GETOPT_ID (getopt_long) 42# define getopt_long __GETOPT_ID (getopt_long)
44# define getopt_long_only __GETOPT_ID (getopt_long_only) 43# define getopt_long_only __GETOPT_ID (getopt_long_only)
45# define option __GETOPT_ID (option)
46# define _getopt_internal __GETOPT_ID (getopt_internal) 44# define _getopt_internal __GETOPT_ID (getopt_internal)
47 45
48/* The system's getopt.h may have already included getopt-ext.h to 46/* The system's getopt.h may have already included getopt-ext.h to
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 79200ecdab9..4a87a2d53bf 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -30,7 +30,12 @@
30 <getopt.h>; our definitions will be present soon enough. */ 30 <getopt.h>; our definitions will be present soon enough. */
31#if @HAVE_GETOPT_H@ 31#if @HAVE_GETOPT_H@
32# define _GL_SYSTEM_GETOPT 32# define _GL_SYSTEM_GETOPT
33/* Rename the system's 'struct option' to 'struct sys_option',
34 so that we don't have to rename ours to 'struct rpl_option'
35 (which would cause significant trouble in C++ mode). */
36# define option sys_option
33# @INCLUDE_NEXT@ @NEXT_GETOPT_H@ 37# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
38# undef option
34# undef _GL_SYSTEM_GETOPT 39# undef _GL_SYSTEM_GETOPT
35#endif 40#endif
36 41
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index fa2250cf686..fb34cf2cc1d 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -49,6 +49,7 @@
49# --avoid=iswxdigit \ 49# --avoid=iswxdigit \
50# --avoid=langinfo-h \ 50# --avoid=langinfo-h \
51# --avoid=libgmp-mpq \ 51# --avoid=libgmp-mpq \
52# --avoid=locale-h \
52# --avoid=localename-unsafe-limited \ 53# --avoid=localename-unsafe-limited \
53# --avoid=lock \ 54# --avoid=lock \
54# --avoid=mbrtowc \ 55# --avoid=mbrtowc \
@@ -624,6 +625,7 @@ GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
624GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ 625GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
625GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ 626GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
626GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ 627GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
628GL_GNULIB_STRERROR_L = @GL_GNULIB_STRERROR_L@
627GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ 629GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
628GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ 630GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
629GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ 631GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
@@ -916,6 +918,7 @@ HAVE_STR2SIG = @HAVE_STR2SIG@
916HAVE_STRCASESTR = @HAVE_STRCASESTR@ 918HAVE_STRCASESTR = @HAVE_STRCASESTR@
917HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ 919HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
918HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ 920HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
921HAVE_STRERROR_L = @HAVE_STRERROR_L@
919HAVE_STRPBRK = @HAVE_STRPBRK@ 922HAVE_STRPBRK = @HAVE_STRPBRK@
920HAVE_STRPTIME = @HAVE_STRPTIME@ 923HAVE_STRPTIME = @HAVE_STRPTIME@
921HAVE_STRSEP = @HAVE_STRSEP@ 924HAVE_STRSEP = @HAVE_STRSEP@
@@ -1213,6 +1216,7 @@ REPLACE_GETENTROPY = @REPLACE_GETENTROPY@
1213REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ 1216REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
1214REPLACE_GETLINE = @REPLACE_GETLINE@ 1217REPLACE_GETLINE = @REPLACE_GETLINE@
1215REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@ 1218REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@
1219REPLACE_GETLOGIN = @REPLACE_GETLOGIN@
1216REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ 1220REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
1217REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ 1221REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
1218REPLACE_GETPASS = @REPLACE_GETPASS@ 1222REPLACE_GETPASS = @REPLACE_GETPASS@
@@ -1307,6 +1311,7 @@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
1307REPLACE_STRDUP = @REPLACE_STRDUP@ 1311REPLACE_STRDUP = @REPLACE_STRDUP@
1308REPLACE_STRERROR = @REPLACE_STRERROR@ 1312REPLACE_STRERROR = @REPLACE_STRERROR@
1309REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ 1313REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@
1314REPLACE_STRERROR_L = @REPLACE_STRERROR_L@
1310REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ 1315REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
1311REPLACE_STRFTIME = @REPLACE_STRFTIME@ 1316REPLACE_STRFTIME = @REPLACE_STRFTIME@
1312REPLACE_STRNCAT = @REPLACE_STRNCAT@ 1317REPLACE_STRNCAT = @REPLACE_STRNCAT@
@@ -1543,6 +1548,7 @@ sharedstatedir = @sharedstatedir@
1543srcdir = @srcdir@ 1548srcdir = @srcdir@
1544standardlisppath = @standardlisppath@ 1549standardlisppath = @standardlisppath@
1545sysconfdir = @sysconfdir@ 1550sysconfdir = @sysconfdir@
1551systemduserunitdir = @systemduserunitdir@
1546target_alias = @target_alias@ 1552target_alias = @target_alias@
1547version = @version@ 1553version = @version@
1548with_mailutils = @with_mailutils@ 1554with_mailutils = @with_mailutils@
@@ -1715,13 +1721,25 @@ libgnu_a_SOURCES += c-ctype.h c-ctype.c
1715endif 1721endif
1716## end gnulib module c-ctype 1722## end gnulib module c-ctype
1717 1723
1718## begin gnulib module c-strcase 1724## begin gnulib module c-strcasecmp
1719ifeq (,$(OMIT_GNULIB_MODULE_c-strcase)) 1725ifeq (,$(OMIT_GNULIB_MODULE_c-strcasecmp))
1720 1726
1721libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c 1727libgnu_a_SOURCES += c-strcasecmp.c
1728
1729EXTRA_DIST += c-strcase.h
1730
1731endif
1732## end gnulib module c-strcasecmp
1733
1734## begin gnulib module c-strncasecmp
1735ifeq (,$(OMIT_GNULIB_MODULE_c-strncasecmp))
1736
1737libgnu_a_SOURCES += c-strncasecmp.c
1738
1739EXTRA_DIST += c-strcase.h
1722 1740
1723endif 1741endif
1724## end gnulib module c-strcase 1742## end gnulib module c-strncasecmp
1725 1743
1726## begin gnulib module canonicalize-lgpl 1744## begin gnulib module canonicalize-lgpl
1727ifeq (,$(OMIT_GNULIB_MODULE_canonicalize-lgpl)) 1745ifeq (,$(OMIT_GNULIB_MODULE_canonicalize-lgpl))
@@ -3681,6 +3699,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
3681 -e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \ 3699 -e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \
3682 -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ 3700 -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
3683 -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ 3701 -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
3702 -e 's/@''GNULIB_STRERROR_L''@/$(GL_GNULIB_STRERROR_L)/g' \
3684 -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ 3703 -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \
3685 -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ 3704 -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \
3686 -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ 3705 -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
3711 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ 3730 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
3712 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ 3731 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
3713 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ 3732 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
3733 -e 's|@''HAVE_STRERROR_L''@|$(HAVE_STRERROR_L)|g' \
3714 -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ 3734 -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \
3715 -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ 3735 -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \
3716 -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ 3736 -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
3734 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ 3754 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
3735 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ 3755 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
3736 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ 3756 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
3757 -e 's|@''REPLACE_STRERROR_L''@|$(REPLACE_STRERROR_L)|g' \
3737 -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ 3758 -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \
3738 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ 3759 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
3739 -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \ 3760 -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
4328 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ 4349 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
4329 -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ 4350 -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
4330 -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ 4351 -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \
4352 -e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \
4331 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ 4353 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
4332 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ 4354 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
4333 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ 4355 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
diff --git a/lib/intprops.h b/lib/intprops.h
index 83efe39910a..2f9fa0a0222 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -39,7 +39,7 @@
39 then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some 39 then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some
40 enum values are deliberately omitted from the switch's cases. 40 enum values are deliberately omitted from the switch's cases.
41 Here, unary + is safer than a cast or inline function, as unary + 41 Here, unary + is safer than a cast or inline function, as unary +
42 does only integer promotions. */ 42 does only integer promotions and is disallowed on pointers. */
43#define INT_PROMOTE(e) (+ (e)) 43#define INT_PROMOTE(e) (+ (e))
44 44
45 45
diff --git a/lib/nproc.c b/lib/nproc.c
index d48e4dd94f5..83439aa0eb2 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -398,20 +398,16 @@ parse_omp_threads (char const* threads)
398 /* Convert it from positive decimal to 'unsigned long'. */ 398 /* Convert it from positive decimal to 'unsigned long'. */
399 if (c_isdigit (*threads)) 399 if (c_isdigit (*threads))
400 { 400 {
401 char *endptr = NULL; 401 char *endptr;
402 unsigned long int value = strtoul (threads, &endptr, 10); 402 unsigned long int value = strtoul (threads, &endptr, 10);
403 403 while (*endptr != '\0' && c_isspace (*endptr))
404 if (endptr != NULL) 404 endptr++;
405 { 405 if (*endptr == '\0')
406 while (*endptr != '\0' && c_isspace (*endptr)) 406 return value;
407 endptr++; 407 /* Also accept the first value in a nesting level,
408 if (*endptr == '\0') 408 since we can't determine the nesting level from env vars. */
409 return value; 409 else if (*endptr == ',')
410 /* Also accept the first value in a nesting level, 410 return value;
411 since we can't determine the nesting level from env vars. */
412 else if (*endptr == ',')
413 return value;
414 }
415 } 411 }
416 412
417 return ret; 413 return ret;
@@ -438,6 +434,9 @@ num_processors (enum nproc_query query)
438 query = NPROC_CURRENT; 434 query = NPROC_CURRENT;
439 } 435 }
440 /* Here query is one of NPROC_ALL, NPROC_CURRENT. */ 436 /* Here query is one of NPROC_ALL, NPROC_CURRENT. */
437 if (omp_env_limit == 1)
438 /* No need to even call num_processors_ignoring_omp (query). */
439 return 1;
441 { 440 {
442 unsigned long nprocs = num_processors_ignoring_omp (query); 441 unsigned long nprocs = num_processors_ignoring_omp (query);
443 return MIN (nprocs, omp_env_limit); 442 return MIN (nprocs, omp_env_limit);
diff --git a/lib/readutmp.h b/lib/readutmp.h
index b5e8133c7c6..60d63df9598 100644
--- a/lib/readutmp.h
+++ b/lib/readutmp.h
@@ -45,7 +45,7 @@
45# include <utmp.h> 45# include <utmp.h>
46#endif 46#endif
47 47
48/* Needed for BOOT_TIME and USER_PROCESS. */ 48/* Needed for BOOT_TIME, USER_PROCESS, LOGIN_PROCESS. */
49#if HAVE_UTMPX_H 49#if HAVE_UTMPX_H
50# if defined _THREAD_SAFE && defined UTMP_DATA_INIT 50# if defined _THREAD_SAFE && defined UTMP_DATA_INIT
51 /* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE 51 /* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
@@ -74,7 +74,8 @@ struct gl_utmp
74 struct timespec ut_ts; /* time */ 74 struct timespec ut_ts; /* time */
75 pid_t ut_pid; /* process ID of ? */ 75 pid_t ut_pid; /* process ID of ? */
76 pid_t ut_session; /* process ID of session leader */ 76 pid_t ut_session; /* process ID of session leader */
77 short ut_type; /* BOOT_TIME, USER_PROCESS, or other */ 77 short ut_type; /* BOOT_TIME, USER_PROCESS, LOGIN_PROCESS,
78 or other */
78 struct { int e_termination; int e_exit; } ut_exit; 79 struct { int e_termination; int e_exit; } ut_exit;
79}; 80};
80 81
@@ -257,19 +258,21 @@ struct utmpx32
257# define WTMP_FILE "/etc/wtmp" 258# define WTMP_FILE "/etc/wtmp"
258#endif 259#endif
259 260
260/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only 261/* In early versions of Android, <utmp.h> did not define BOOT_TIME or
261 USER_PROCESS. We need to use the value that is defined in newer versions 262 LOGIN_PROCESS, only USER_PROCESS. We need to use the value that is defined
262 of Android. */ 263 in newer versions of Android. */
263#if defined __ANDROID__ && !defined BOOT_TIME 264#if defined __ANDROID__ && !defined BOOT_TIME
264# define BOOT_TIME 2 265# define BOOT_TIME 2
266# define LOGIN_PROCESS 6
265#endif 267#endif
266 268
267/* Some platforms, such as OpenBSD, don't have an ut_type field and don't have 269/* Some platforms, such as OpenBSD, don't have an ut_type field and don't have
268 the BOOT_TIME and USER_PROCESS macros. But we want to support them in 270 the BOOT_TIME, USER_PROCESS, and LOGIN_PROCESS macros. But we want to
269 'struct gl_utmp'. */ 271 support them in 'struct gl_utmp'. */
270#if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE) 272#if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
271# define BOOT_TIME 2 273# define BOOT_TIME 2
272# define USER_PROCESS 0 274# define USER_PROCESS 0
275# define LOGIN_PROCESS 6
273#endif 276#endif
274 277
275/* Macros that test (UT)->ut_type. */ 278/* Macros that test (UT)->ut_type. */
@@ -283,6 +286,11 @@ struct utmpx32
283#else 286#else
284# define UT_TYPE_USER_PROCESS(UT) 0 287# define UT_TYPE_USER_PROCESS(UT) 0
285#endif 288#endif
289#ifdef LOGIN_PROCESS
290# define UT_TYPE_LOGIN_PROCESS(UT) ((UT)->ut_type == LOGIN_PROCESS)
291#else
292# define UT_TYPE_LOGIN_PROCESS(UT) 0
293#endif
286 294
287/* Determines whether an entry *UT corresponds to a user process. */ 295/* Determines whether an entry *UT corresponds to a user process. */
288#define IS_USER_PROCESS(UT) \ 296#define IS_USER_PROCESS(UT) \
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 41b0f989c03..a23f289d7a1 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -831,7 +831,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
831 if (table_size > pat_len) 831 if (table_size > pat_len)
832 break; 832 break;
833 833
834 dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); 834 dfa->state_table = calloc (table_size, sizeof (struct re_state_table_entry));
835 dfa->state_hash_mask = table_size - 1; 835 dfa->state_hash_mask = table_size - 1;
836 836
837 dfa->mb_cur_max = MB_CUR_MAX; 837 dfa->mb_cur_max = MB_CUR_MAX;
@@ -862,7 +862,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
862 { 862 {
863 int i, j, ch; 863 int i, j, ch;
864 864
865 dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 865 dfa->sb_char = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
866 if (__glibc_unlikely (dfa->sb_char == NULL)) 866 if (__glibc_unlikely (dfa->sb_char == NULL))
867 return REG_ESPACE; 867 return REG_ESPACE;
868 868
@@ -3055,8 +3055,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
3055 _NL_COLLATE_SYMB_EXTRAMB); 3055 _NL_COLLATE_SYMB_EXTRAMB);
3056 } 3056 }
3057#endif 3057#endif
3058 sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 3058 sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
3059 mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); 3059 mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
3060 if (__glibc_unlikely (sbcset == NULL || mbcset == NULL)) 3060 if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
3061 { 3061 {
3062 re_free (sbcset); 3062 re_free (sbcset);
@@ -3548,13 +3548,13 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
3548 reg_errcode_t ret; 3548 reg_errcode_t ret;
3549 bin_tree_t *tree; 3549 bin_tree_t *tree;
3550 3550
3551 sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 3551 sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
3552 if (__glibc_unlikely (sbcset == NULL)) 3552 if (__glibc_unlikely (sbcset == NULL))
3553 { 3553 {
3554 *err = REG_ESPACE; 3554 *err = REG_ESPACE;
3555 return NULL; 3555 return NULL;
3556 } 3556 }
3557 mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); 3557 mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
3558 if (__glibc_unlikely (mbcset == NULL)) 3558 if (__glibc_unlikely (mbcset == NULL))
3559 { 3559 {
3560 re_free (sbcset); 3560 re_free (sbcset);
diff --git a/lib/regex.h b/lib/regex.h
index 67a3aa70a51..e9ab85e8b5a 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -66,15 +66,14 @@ typedef unsigned long int active_reg_t;
66 66
67/* The following bits are used to determine the regexp syntax we 67/* The following bits are used to determine the regexp syntax we
68 recognize. The set/not-set meanings are chosen so that Emacs syntax 68 recognize. The set/not-set meanings are chosen so that Emacs syntax
69 remains the value 0. The bits are given in alphabetical order, and 69 is the value 0 for Emacs 20 (2000) and earlier, and the value
70 the definitions shifted by one from the previous bit; thus, when we 70 RE_SYNTAX_EMACS for Emacs 21 (2001) and later. */
71 add or remove a bit, only one other definition need change. */
72typedef unsigned long int reg_syntax_t; 71typedef unsigned long int reg_syntax_t;
73 72
74#ifdef __USE_GNU 73#ifdef __USE_GNU
75/* If this bit is not set, then \ inside a bracket expression is literal. 74/* If this bit is not set, then \ inside a bracket expression is literal.
76 If set, then such a \ quotes the following character. */ 75 If set, then such a \ quotes the following character. */
77# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) 76# define RE_BACKSLASH_ESCAPE_IN_LISTS 1ul
78 77
79/* If this bit is not set, then + and ? are operators, and \+ and \? are 78/* If this bit is not set, then + and ? are operators, and \+ and \? are
80 literals. 79 literals.
@@ -215,7 +214,8 @@ extern reg_syntax_t re_syntax_options;
215 (The [[[ comments delimit what gets put into the Texinfo file, so 214 (The [[[ comments delimit what gets put into the Texinfo file, so
216 don't delete them!) */ 215 don't delete them!) */
217/* [[[begin syntaxes]]] */ 216/* [[[begin syntaxes]]] */
218# define RE_SYNTAX_EMACS 0 217# define RE_SYNTAX_EMACS \
218 (RE_CHAR_CLASSES | RE_INTERVALS)
219 219
220# define RE_SYNTAX_AWK \ 220# define RE_SYNTAX_AWK \
221 (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ 221 (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
@@ -522,20 +522,6 @@ typedef struct
522 522
523/* Declarations for routines. */ 523/* Declarations for routines. */
524 524
525#ifndef _REGEX_NELTS
526# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
527 && !defined __STDC_NO_VLA__)
528# define _REGEX_NELTS(n) n
529# else
530# define _REGEX_NELTS(n)
531# endif
532#endif
533
534#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
535# pragma GCC diagnostic push
536# pragma GCC diagnostic ignored "-Wvla"
537#endif
538
539#ifndef _Attr_access_ 525#ifndef _Attr_access_
540# ifdef __attr_access 526# ifdef __attr_access
541# define _Attr_access_(arg) __attr_access (arg) 527# define _Attr_access_(arg) __attr_access (arg)
@@ -682,8 +668,7 @@ extern int regcomp (regex_t *_Restrict_ __preg,
682 668
683extern int regexec (const regex_t *_Restrict_ __preg, 669extern int regexec (const regex_t *_Restrict_ __preg,
684 const char *_Restrict_ __String, size_t __nmatch, 670 const char *_Restrict_ __String, size_t __nmatch,
685 regmatch_t __pmatch[_Restrict_arr_ 671 regmatch_t __pmatch[_Restrict_arr_],
686 _REGEX_NELTS (__nmatch)],
687 int __eflags); 672 int __eflags);
688 673
689extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, 674extern 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,
692 677
693extern void regfree (regex_t *__preg); 678extern void regfree (regex_t *__preg);
694 679
695#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
696# pragma GCC diagnostic pop
697#endif
698
699#ifdef __cplusplus 680#ifdef __cplusplus
700} 681}
701#endif /* C++ */ 682#endif /* C++ */
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 8bf761c7616..9b89cc9372b 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1595,7 +1595,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
1595 reg_errcode_t err; 1595 reg_errcode_t err;
1596 re_dfastate_t *newstate; 1596 re_dfastate_t *newstate;
1597 1597
1598 newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); 1598 newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
1599 if (__glibc_unlikely (newstate == NULL)) 1599 if (__glibc_unlikely (newstate == NULL))
1600 return NULL; 1600 return NULL;
1601 err = re_node_set_init_copy (&newstate->nodes, nodes); 1601 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,
1643 reg_errcode_t err; 1643 reg_errcode_t err;
1644 re_dfastate_t *newstate; 1644 re_dfastate_t *newstate;
1645 1645
1646 newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); 1646 newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
1647 if (__glibc_unlikely (newstate == NULL)) 1647 if (__glibc_unlikely (newstate == NULL))
1648 return NULL; 1648 return NULL;
1649 err = re_node_set_init_copy (&newstate->nodes, nodes); 1649 err = re_node_set_init_copy (&newstate->nodes, nodes);
diff --git a/lib/regexec.c b/lib/regexec.c
index 58215bd3766..c5ab9b6649f 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -185,7 +185,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
185 185
186int 186int
187regexec (const regex_t *__restrict preg, const char *__restrict string, 187regexec (const regex_t *__restrict preg, const char *__restrict string,
188 size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) 188 size_t nmatch, regmatch_t pmatch[], int eflags)
189{ 189{
190 reg_errcode_t err; 190 reg_errcode_t err;
191 Idx start, length; 191 Idx start, length;
@@ -229,7 +229,7 @@ int
229attribute_compat_text_section 229attribute_compat_text_section
230__compat_regexec (const regex_t *__restrict preg, 230__compat_regexec (const regex_t *__restrict preg,
231 const char *__restrict string, size_t nmatch, 231 const char *__restrict string, size_t nmatch,
232 regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) 232 regmatch_t pmatch[], int eflags)
233{ 233{
234 return regexec (preg, string, nmatch, pmatch, 234 return regexec (preg, string, nmatch, pmatch,
235 eflags & (REG_NOTBOL | REG_NOTEOL)); 235 eflags & (REG_NOTBOL | REG_NOTEOL));
@@ -2721,8 +2721,8 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
2721 continue; /* No. */ 2721 continue; /* No. */
2722 if (sub_top->path == NULL) 2722 if (sub_top->path == NULL)
2723 { 2723 {
2724 sub_top->path = calloc (sizeof (state_array_t), 2724 sub_top->path = calloc (sl_str - sub_top->str_idx + 1,
2725 sl_str - sub_top->str_idx + 1); 2725 sizeof (state_array_t));
2726 if (sub_top->path == NULL) 2726 if (sub_top->path == NULL)
2727 return REG_ESPACE; 2727 return REG_ESPACE;
2728 } 2728 }
@@ -3266,7 +3266,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
3266 if (ndests == 0) 3266 if (ndests == 0)
3267 { 3267 {
3268 state->trtable = (re_dfastate_t **) 3268 state->trtable = (re_dfastate_t **)
3269 calloc (sizeof (re_dfastate_t *), SBC_MAX); 3269 calloc (SBC_MAX, sizeof (re_dfastate_t *));
3270 if (__glibc_unlikely (state->trtable == NULL)) 3270 if (__glibc_unlikely (state->trtable == NULL))
3271 return false; 3271 return false;
3272 return true; 3272 return true;
@@ -3338,7 +3338,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
3338 discern by looking at the character code: allocate a 3338 discern by looking at the character code: allocate a
3339 256-entry transition table. */ 3339 256-entry transition table. */
3340 trtable = state->trtable = 3340 trtable = state->trtable =
3341 (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); 3341 (re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *));
3342 if (__glibc_unlikely (trtable == NULL)) 3342 if (__glibc_unlikely (trtable == NULL))
3343 goto out_free; 3343 goto out_free;
3344 3344
@@ -3369,7 +3369,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
3369 transition tables, one starting at trtable[0] and one 3369 transition tables, one starting at trtable[0] and one
3370 starting at trtable[SBC_MAX]. */ 3370 starting at trtable[SBC_MAX]. */
3371 trtable = state->word_trtable = 3371 trtable = state->word_trtable =
3372 (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); 3372 (re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *));
3373 if (__glibc_unlikely (trtable == NULL)) 3373 if (__glibc_unlikely (trtable == NULL))
3374 goto out_free; 3374 goto out_free;
3375 3375
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 878e9f8c97d..4b4263fe908 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -30,6 +30,49 @@
30# endif 30# endif
31#endif 31#endif
32 32
33/* Haiku stdio implementation. */
34#if defined __HAIKU__
35# include <stdint.h>
36/* This FILE structure was made into an incomplete type in 2025.
37 See <https://cgit.haiku-os.org/haiku/tree/src/system/libroot/posix/glibc/libio/libio.h>. */
38# define fp_ ((struct { int _flags; \
39 char *_IO_read_ptr; \
40 char *_IO_read_end; \
41 char *_IO_read_base; \
42 char *_IO_write_base; \
43 char *_IO_write_ptr; \
44 char *_IO_write_end; \
45 char *_IO_buf_base; \
46 char *_IO_buf_end; \
47 char *_IO_save_base; \
48 char *_IO_backup_base; \
49 char *_IO_save_end; \
50 void *_markers; \
51 void *_chain; \
52 int _fileno; \
53 int _flags2; \
54 off_t _old_offset; \
55 unsigned short _cur_column; \
56 signed char _vtable_offset; \
57 char _shortbuf[1]; \
58 void *_lock; \
59 int64_t _offset; \
60 /* More fields, not relevant here. */ \
61 } *) fp)
62# if !defined _IO_UNBUFFERED
63# define _IO_UNBUFFERED 0x2
64# endif
65# if !defined _IO_EOF_SEEN
66# define _IO_EOF_SEEN 0x10
67# endif
68# if !defined _IO_IN_BACKUP
69# define _IO_IN_BACKUP 0x100
70# endif
71# if !defined _IO_LINE_BUF
72# define _IO_LINE_BUF 0x200
73# endif
74#endif
75
33/* BSD stdio derived implementations. */ 76/* BSD stdio derived implementations. */
34 77
35#if defined __NetBSD__ /* NetBSD */ 78#if defined __NetBSD__ /* NetBSD */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index bd82086ff37..dbe8ebc8502 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -63,7 +63,7 @@
63#include <stddef.h> 63#include <stddef.h>
64 64
65/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. 65/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
66 glibc 2.40 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */ 66 glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
67#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) 67#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
68# include <sys/wait.h> 68# include <sys/wait.h>
69#endif 69#endif
@@ -120,14 +120,14 @@ struct random_data
120# include <unistd.h> 120# include <unistd.h>
121#endif 121#endif
122 122
123#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 123#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)
124/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro 124/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
125 below, this may cause compilation errors later in the libstdc++ header files 125 below, this may cause compilation errors later in the libstdc++ header files
126 (that are part of GCC), such as: 126 (that are part of GCC), such as:
127 error: 'rpl_strtol' is not a member of 'std' 127 error: 'rpl_strtol' is not a member of 'std'
128 To avoid this, include the relevant header files here, before these symbols 128 To avoid this, include the relevant header files here, before these symbols
129 get defined as macros. But do so only on Solaris 11 (where it is needed), 129 get defined as macros. But do so only on Solaris 11 and AIX (where it is
130 not on mingw (where it would cause other compilation errors). */ 130 needed), not on mingw (where it would cause other compilation errors). */
131# include <string> 131# include <string>
132#endif 132#endif
133 133
@@ -1473,11 +1473,17 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1473# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ 1473# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
1474# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2 1474# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
1475# define _GL_INLINE_RPL_REALLOC 1 1475# define _GL_INLINE_RPL_REALLOC 1
1476# ifdef __cplusplus
1477extern "C" {
1478# endif
1476_GL_REALLOC_INLINE void * 1479_GL_REALLOC_INLINE void *
1477rpl_realloc (void *ptr, size_t size) 1480rpl_realloc (void *ptr, size_t size)
1478{ 1481{
1479 return realloc (ptr, size ? size : 1); 1482 return realloc (ptr, size ? size : 1);
1480} 1483}
1484# ifdef __cplusplus
1485}
1486# endif
1481# endif 1487# endif
1482# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1488# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1483 || _GL_USE_STDLIB_ALLOC) 1489 || _GL_USE_STDLIB_ALLOC)
diff --git a/lib/string.in.h b/lib/string.in.h
index ce488299006..44b9497d802 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -54,6 +54,11 @@
54/* NetBSD 5.0 mis-defines NULL. */ 54/* NetBSD 5.0 mis-defines NULL. */
55#include <stddef.h> 55#include <stddef.h>
56 56
57#if @GNULIB_STRERROR_L@
58/* Get locale_t. */
59# include <locale.h>
60#endif
61
57/* MirBSD defines mbslen as a macro. */ 62/* MirBSD defines mbslen as a macro. */
58#if @GNULIB_MBSLEN@ && defined __MirBSD__ 63#if @GNULIB_MBSLEN@ && defined __MirBSD__
59# include <wchar.h> 64# include <wchar.h>
@@ -429,7 +434,9 @@ _GL_FUNCDECL_SYS (memset_explicit, void *,
429# endif 434# endif
430_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 435_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
431# endif 436# endif
437# if __GLIBC__ >= 2
432_GL_CXXALIASWARN (memset_explicit); 438_GL_CXXALIASWARN (memset_explicit);
439# endif
433#elif defined GNULIB_POSIXCHECK 440#elif defined GNULIB_POSIXCHECK
434# undef memset_explicit 441# undef memset_explicit
435# if HAVE_RAW_DECL_MEMSET_EXPLICIT 442# if HAVE_RAW_DECL_MEMSET_EXPLICIT
@@ -1178,6 +1185,33 @@ _GL_CXXALIASWARN (mbsrchr);
1178_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) 1185_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1179 _GL_ATTRIBUTE_PURE 1186 _GL_ATTRIBUTE_PURE
1180 _GL_ARG_NONNULL ((1, 2)); 1187 _GL_ARG_NONNULL ((1, 2));
1188# ifndef _GL_NO_CONST_GENERICS
1189/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1190 compiler warnings for 'const' related mistakes. */
1191# ifdef __cplusplus
1192extern "C++" { /* needed for AIX */
1193template <typename T>
1194 T * mbsstr_template (T* haystack, const char *needle);
1195template <>
1196 inline char * mbsstr_template (char *haystack, const char *needle)
1197 { return mbsstr (haystack, needle); }
1198template <>
1199 inline const char * mbsstr_template (const char *haystack, const char *needle)
1200 { return mbsstr (haystack, needle); }
1201}
1202# undef mbsstr
1203# define mbsstr mbsstr_template
1204# elif !defined mbsstr
1205# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1206 || defined __ICC || defined __TINYC__ \
1207 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1208# define mbsstr(h,n) \
1209 _Generic ((h), \
1210 char const *: (char const *) mbsstr ((h), (n)), \
1211 default : mbsstr ((h), (n)))
1212# endif
1213# endif
1214# endif
1181#endif 1215#endif
1182 1216
1183#if @GNULIB_MBSCASECMP@ 1217#if @GNULIB_MBSCASECMP@
@@ -1219,6 +1253,33 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1219_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) 1253_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1220 _GL_ATTRIBUTE_PURE 1254 _GL_ATTRIBUTE_PURE
1221 _GL_ARG_NONNULL ((1, 2)); 1255 _GL_ARG_NONNULL ((1, 2));
1256# ifndef _GL_NO_CONST_GENERICS
1257/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1258 compiler warnings for 'const' related mistakes. */
1259# ifdef __cplusplus
1260extern "C++" { /* needed for AIX */
1261template <typename T>
1262 T * mbspcasecmp_template (T* string, const char *prefix);
1263template <>
1264 inline char * mbspcasecmp_template (char *string, const char *prefix)
1265 { return mbspcasecmp (string, prefix); }
1266template <>
1267 inline const char * mbspcasecmp_template (const char *string, const char *prefix)
1268 { return mbspcasecmp (string, prefix); }
1269}
1270# undef mbspcasecmp
1271# define mbspcasecmp mbspcasecmp_template
1272# elif !defined mbspcasecmp
1273# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1274 || defined __ICC || defined __TINYC__ \
1275 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1276# define mbspcasecmp(s,p) \
1277 _Generic ((s), \
1278 char const *: (char const *) mbspcasecmp ((s), (p)), \
1279 default : mbspcasecmp ((s), (p)))
1280# endif
1281# endif
1282# endif
1222#endif 1283#endif
1223 1284
1224#if @GNULIB_MBSCASESTR@ 1285#if @GNULIB_MBSCASESTR@
@@ -1230,6 +1291,33 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1230_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) 1291_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1231 _GL_ATTRIBUTE_PURE 1292 _GL_ATTRIBUTE_PURE
1232 _GL_ARG_NONNULL ((1, 2)); 1293 _GL_ARG_NONNULL ((1, 2));
1294# ifndef _GL_NO_CONST_GENERICS
1295/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1296 compiler warnings for 'const' related mistakes. */
1297# ifdef __cplusplus
1298extern "C++" { /* needed for AIX */
1299template <typename T>
1300 T * mbscasestr_template (T* haystack, const char *needle);
1301template <>
1302 inline char * mbscasestr_template (char *haystack, const char *needle)
1303 { return mbscasestr (haystack, needle); }
1304template <>
1305 inline const char * mbscasestr_template (const char *haystack, const char *needle)
1306 { return mbscasestr (haystack, needle); }
1307}
1308# undef mbscasestr
1309# define mbscasestr mbscasestr_template
1310# elif !defined mbscasestr
1311# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1312 || defined __ICC || defined __TINYC__ \
1313 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1314# define mbscasestr(h,n) \
1315 _Generic ((h), \
1316 char const *: (char const *) mbscasestr ((h), (n)), \
1317 default : mbscasestr ((h), (n)))
1318# endif
1319# endif
1320# endif
1233#endif 1321#endif
1234 1322
1235#if @GNULIB_MBSCSPN@ 1323#if @GNULIB_MBSCSPN@
@@ -1388,6 +1476,44 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1388# endif 1476# endif
1389#endif 1477#endif
1390 1478
1479/* Map any int, typically from errno, into an error message.
1480 With locale_t argument. */
1481#if @GNULIB_STRERROR_L@
1482# if @REPLACE_STRERROR_L@
1483# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484# undef strerror_l
1485# define strerror_l rpl_strerror_l
1486# endif
1487_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
1488 _GL_ARG_NONNULL ((2)));
1489_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
1490# else
1491# if !@HAVE_STRERROR_L@
1492_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
1493 _GL_ARG_NONNULL ((2)));
1494# endif
1495_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
1496# endif
1497# if __GLIBC__ >= 2
1498_GL_CXXALIASWARN (strerror_l);
1499# endif
1500#elif defined GNULIB_POSIXCHECK
1501# undef strerror_l
1502# if HAVE_RAW_DECL_STRERROR_L
1503_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
1504 "use gnulib module strerror_l for portability");
1505# endif
1506#endif
1507
1508/* Map any int, typically from errno, into an error message. Multithread-safe,
1509 with locale_t argument.
1510 Not portable! Only provided by gnulib. */
1511#if @GNULIB_STRERROR_L@
1512_GL_FUNCDECL_SYS (strerror_l_r, int,
1513 (int errnum, char *buf, size_t buflen, locale_t locale),
1514 _GL_ARG_NONNULL ((2, 4)));
1515#endif
1516
1391/* Return the name of the system error code ERRNUM. */ 1517/* Return the name of the system error code ERRNUM. */
1392#if @GNULIB_STRERRORNAME_NP@ 1518#if @GNULIB_STRERRORNAME_NP@
1393# if @REPLACE_STRERRORNAME_NP@ 1519# if @REPLACE_STRERRORNAME_NP@
@@ -1403,7 +1529,9 @@ _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
1403# endif 1529# endif
1404_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); 1530_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1405# endif 1531# endif
1532# if __GLIBC__ >= 2
1406_GL_CXXALIASWARN (strerrorname_np); 1533_GL_CXXALIASWARN (strerrorname_np);
1534# endif
1407#elif defined GNULIB_POSIXCHECK 1535#elif defined GNULIB_POSIXCHECK
1408# undef strerrorname_np 1536# undef strerrorname_np
1409# if HAVE_RAW_DECL_STRERRORNAME_NP 1537# if HAVE_RAW_DECL_STRERRORNAME_NP
diff --git a/lib/time.in.h b/lib/time.in.h
index 60801c972c9..3ff16e3b3e4 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -186,7 +186,9 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
186# endif 186# endif
187_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); 187_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
188# endif 188# endif
189# if __GLIBC__ >= 2
189_GL_CXXALIASWARN (timespec_getres); 190_GL_CXXALIASWARN (timespec_getres);
191# endif
190# elif defined GNULIB_POSIXCHECK 192# elif defined GNULIB_POSIXCHECK
191# undef timespec_getres 193# undef timespec_getres
192# if HAVE_RAW_DECL_TIMESPEC_GETRES 194# if HAVE_RAW_DECL_TIMESPEC_GETRES
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 3f96e10d7e7..c135a770dc1 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -95,12 +95,15 @@
95# include <stdio.h> 95# include <stdio.h>
96#endif 96#endif
97 97
98/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
99 do not define O_CLOEXEC in <unistd.h>. */
98/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in 100/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
99 <unistd.h>. */ 101 <unistd.h>. */
100/* But avoid namespace pollution on glibc systems. */ 102/* But avoid namespace pollution on glibc systems. */
101#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ 103#if ! defined O_CLOEXEC \
102 && (defined __CYGWIN__ || defined __ANDROID__) \ 104 || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
103 && ! defined __GLIBC__ 105 && (defined __CYGWIN__ || defined __ANDROID__) \
106 && ! defined __GLIBC__)
104# include <fcntl.h> 107# include <fcntl.h>
105#endif 108#endif
106 109
@@ -463,7 +466,9 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
463 int ofd, off_t *opos, 466 int ofd, off_t *opos,
464 size_t len, unsigned flags)); 467 size_t len, unsigned flags));
465# endif 468# endif
469# if __GLIBC__ >= 2
466_GL_CXXALIASWARN (copy_file_range); 470_GL_CXXALIASWARN (copy_file_range);
471# endif
467#elif defined GNULIB_POSIXCHECK 472#elif defined GNULIB_POSIXCHECK
468# undef copy_file_range 473# undef copy_file_range
469# if HAVE_RAW_DECL_COPY_FILE_RANGE 474# if HAVE_RAW_DECL_COPY_FILE_RANGE
@@ -1362,11 +1367,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1362 ${LOGNAME-$USER} on Unix platforms, 1367 ${LOGNAME-$USER} on Unix platforms,
1363 $USERNAME on native Windows platforms. 1368 $USERNAME on native Windows platforms.
1364 */ 1369 */
1365# if !@HAVE_DECL_GETLOGIN@ 1370# if @REPLACE_GETLOGIN@
1371# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1372# define getlogin rpl_getlogin
1373# endif
1374_GL_FUNCDECL_RPL (getlogin, char *, (void), );
1375_GL_CXXALIAS_RPL (getlogin, char *, (void));
1376# else
1377# if !@HAVE_DECL_GETLOGIN@
1366_GL_FUNCDECL_SYS (getlogin, char *, (void), ); 1378_GL_FUNCDECL_SYS (getlogin, char *, (void), );
1367# endif 1379# endif
1368_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1380_GL_CXXALIAS_SYS (getlogin, char *, (void));
1381# endif
1382# if __GLIBC__ >= 2
1369_GL_CXXALIASWARN (getlogin); 1383_GL_CXXALIASWARN (getlogin);
1384# endif
1370#elif defined GNULIB_POSIXCHECK 1385#elif defined GNULIB_POSIXCHECK
1371# undef getlogin 1386# undef getlogin
1372# if HAVE_RAW_DECL_GETLOGIN 1387# if HAVE_RAW_DECL_GETLOGIN
@@ -2405,7 +2420,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2405#if @GNULIB_USLEEP@ 2420#if @GNULIB_USLEEP@
2406/* Pause the execution of the current thread for N microseconds. 2421/* Pause the execution of the current thread for N microseconds.
2407 Returns 0 on completion, or -1 on range error. 2422 Returns 0 on completion, or -1 on range error.
2408 See the POSIX:2001 specification 2423 See the POSIX.1-2004 specification
2409 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2424 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2410# if @REPLACE_USLEEP@ 2425# if @REPLACE_USLEEP@
2411# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2426# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/utimens.h b/lib/utimens.h
index 007958dd933..62ea7d8f5fd 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -25,7 +25,7 @@
25#include <time.h> 25#include <time.h>
26 26
27#if HAVE_UTIMENS || HAVE_LUTIMENS 27#if HAVE_UTIMENS || HAVE_LUTIMENS
28# include <sys/time.h> 28# include <sys/stat.h>
29#endif 29#endif
30 30
31#ifdef __cplusplus 31#ifdef __cplusplus
diff --git a/lib/utimensat.c b/lib/utimensat.c
index 227474fdaa5..ca1d39e5900 100644
--- a/lib/utimensat.c
+++ b/lib/utimensat.c
@@ -136,8 +136,9 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
136 } 136 }
137# endif 137# endif
138# endif 138# endif
139# if defined __APPLE__ && defined __MACH__ 139# if (defined __APPLE__ && defined __MACH__) || defined __gnu_hurd__
140 /* macOS 10.13 does not reject invalid tv_nsec values either. */ 140 /* macOS 10.13 and GNU Hurd do not reject invalid tv_nsec values
141 either. */
141 if (times 142 if (times
142 && ((times[0].tv_nsec != UTIME_OMIT 143 && ((times[0].tv_nsec != UTIME_OMIT
143 && times[0].tv_nsec != UTIME_NOW 144 && times[0].tv_nsec != UTIME_NOW
@@ -151,6 +152,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
151 errno = EINVAL; 152 errno = EINVAL;
152 return -1; 153 return -1;
153 } 154 }
155# if defined __APPLE__ && defined __MACH__
154 size_t len = strlen (file); 156 size_t len = strlen (file);
155 if (len > 0 && file[len - 1] == '/') 157 if (len > 0 && file[len - 1] == '/')
156 { 158 {
@@ -163,6 +165,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
163 return -1; 165 return -1;
164 } 166 }
165 } 167 }
168# endif
166# endif 169# endif
167 result = utimensat (fd, file, times, flag); 170 result = utimensat (fd, file, times, flag);
168 /* Linux kernel 2.6.25 has a bug where it returns EINVAL for 171 /* Linux kernel 2.6.25 has a bug where it returns EINVAL for
diff --git a/lib/verify.h b/lib/verify.h
index 96fde0b9c81..3b01d7c2fb3 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -157,9 +157,10 @@
157#define _GL_CONCAT0(x, y) x##y 157#define _GL_CONCAT0(x, y) x##y
158 158
159/* _GL_COUNTER is an integer, preferably one that changes each time we 159/* _GL_COUNTER is an integer, preferably one that changes each time we
160 use it. Use __COUNTER__ if it works, falling back on __LINE__ 160 use it. Use __COUNTER__ if it works (it does so with most compilers,
161 otherwise. __LINE__ isn't perfect, but it's better than a 161 see <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>),
162 constant. */ 162 falling back on __LINE__ otherwise. __LINE__ isn't perfect, but it's
163 better than a constant. */
163#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ 164#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
164# define _GL_COUNTER __COUNTER__ 165# define _GL_COUNTER __COUNTER__
165#else 166#else
diff --git a/m4/builtin-expect.m4 b/m4/builtin-expect.m4
index 2c2fab4bb62..76d3286788a 100644
--- a/m4/builtin-expect.m4
+++ b/m4/builtin-expect.m4
@@ -1,5 +1,5 @@
1# builtin-expect.m4 1# builtin-expect.m4
2# serial 2 2# serial 3
3dnl Copyright 2016-2025 Free Software Foundation, Inc. 3dnl Copyright 2016-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -48,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
48#elif HAVE___BUILTIN_EXPECT == 2 48#elif HAVE___BUILTIN_EXPECT == 2
49# include <builtins.h> 49# include <builtins.h>
50#endif 50#endif
51 ]) 51])])
52])
diff --git a/m4/futimens.m4 b/m4/futimens.m4
index fe89fdffa1b..7252dd66d1a 100644
--- a/m4/futimens.m4
+++ b/m4/futimens.m4
@@ -1,5 +1,5 @@
1# futimens.m4 1# futimens.m4
2# serial 11 2# serial 12
3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -32,22 +32,45 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
32]GL_MDA_DEFINES], 32]GL_MDA_DEFINES],
33 [[struct timespec ts[2]; 33 [[struct timespec ts[2];
34 int fd = creat ("conftest.file", 0600); 34 int fd = creat ("conftest.file", 0600);
35 int result = 0;
35 struct stat st; 36 struct stat st;
36 if (fd < 0) return 1; 37 if (fd < 0)
38 return 1;
37 ts[0].tv_sec = 1; 39 ts[0].tv_sec = 1;
38 ts[0].tv_nsec = UTIME_OMIT; 40 ts[0].tv_nsec = UTIME_OMIT;
39 ts[1].tv_sec = 1; 41 ts[1].tv_sec = 1;
40 ts[1].tv_nsec = UTIME_NOW; 42 ts[1].tv_nsec = UTIME_NOW;
41 errno = 0; 43 errno = 0;
42 if (futimens (AT_FDCWD, NULL) == 0) return 2; 44 if (futimens (AT_FDCWD, NULL) == 0 || errno != EBADF)
43 if (errno != EBADF) return 3; 45 result |= 2;
44 if (futimens (fd, ts)) return 4; 46 if (futimens (fd, ts))
47 result |= 4;
45 sleep (1); 48 sleep (1);
46 ts[0].tv_nsec = UTIME_NOW; 49 ts[0].tv_nsec = UTIME_NOW;
47 ts[1].tv_nsec = UTIME_OMIT; 50 ts[1].tv_nsec = UTIME_OMIT;
48 if (futimens (fd, ts)) return 5; 51 if (futimens (fd, ts))
49 if (fstat (fd, &st)) return 6; 52 result |= 8;
50 if (st.st_ctime < st.st_atime) return 7; 53 if (fstat (fd, &st))
54 result |= 16;
55 if (st.st_ctime < st.st_atime)
56 result |= 32;
57 enum
58 {
59 BILLION = 1000 * 1000 * 1000,
60 /* Bogus positive and negative tv_nsec values closest to valid
61 range, but without colliding with UTIME_NOW or UTIME_OMIT. */
62 UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
63 ? (1 + (UTIME_NOW == BILLION + 1)
64 + (UTIME_OMIT == BILLION + 1))
65 : 0)
66 };
67 ts[0].tv_sec = 1;
68 ts[0].tv_nsec = UTIME_BOGUS_POS;
69 ts[1].tv_sec = 1;
70 ts[1].tv_nsec = 0;
71 if (futimens (fd, ts) == 0)
72 result |= 64;
73 return result;
51 ]])], 74 ]])],
52 [gl_cv_func_futimens_works=yes], 75 [gl_cv_func_futimens_works=yes],
53 [gl_cv_func_futimens_works=no], 76 [gl_cv_func_futimens_works=no],
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 6eff85bea12..daf05db2a47 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
1# gnulib-common.m4 1# gnulib-common.m4
2# serial 107 2# serial 109
3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -21,6 +21,20 @@ AC_DEFUN([gl_COMMON_BODY], [
21[/* Witness that <config.h> has been included. */ 21[/* Witness that <config.h> has been included. */
22#define _GL_CONFIG_H_INCLUDED 1 22#define _GL_CONFIG_H_INCLUDED 1
23]) 23])
24 dnl Avoid warnings from gcc -Wtrailing-whitespace.
25 dnl This is a temporary workaround until Autoconf fixes it.
26 dnl Test case:
27 dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
28 dnl should produce "#define FOO /**/", not "#define FOO ".
29 AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
30# pragma GCC diagnostic push
31# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
32#endif
33])
34 AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
35# pragma GCC diagnostic pop
36#endif
37])
24 AH_VERBATIM([_GL_GNUC_PREREQ], 38 AH_VERBATIM([_GL_GNUC_PREREQ],
25[/* True if the compiler says it groks GNU C version MAJOR.MINOR. 39[/* True if the compiler says it groks GNU C version MAJOR.MINOR.
26 Except that 40 Except that
@@ -1304,7 +1318,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1304 AC_REQUIRE([AC_PROG_CC]) 1318 AC_REQUIRE([AC_PROG_CC])
1305 AC_CACHE_CHECK([for C compiler option to allow warnings], 1319 AC_CACHE_CHECK([for C compiler option to allow warnings],
1306 [gl_cv_cc_wallow], 1320 [gl_cv_cc_wallow],
1307 [rm -f conftest* 1321 [rm -fr conftest*
1308 echo 'int dummy;' > conftest.c 1322 echo 'int dummy;' > conftest.c
1309 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 1323 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
1310 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null 1324 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],
1317 else 1331 else
1318 gl_cv_cc_wallow=none 1332 gl_cv_cc_wallow=none
1319 fi 1333 fi
1320 rm -f conftest* 1334 rm -fr conftest*
1321 ]) 1335 ])
1322 case "$gl_cv_cc_wallow" in 1336 case "$gl_cv_cc_wallow" in
1323 none) GL_CFLAG_ALLOW_WARNINGS='' ;; 1337 none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1335,7 +1349,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1335 if test -n "$CXX" && test "$CXX" != no; then 1349 if test -n "$CXX" && test "$CXX" != no; then
1336 AC_CACHE_CHECK([for C++ compiler option to allow warnings], 1350 AC_CACHE_CHECK([for C++ compiler option to allow warnings],
1337 [gl_cv_cxx_wallow], 1351 [gl_cv_cxx_wallow],
1338 [rm -f conftest* 1352 [rm -fr conftest*
1339 echo 'int dummy;' > conftest.cc 1353 echo 'int dummy;' > conftest.cc
1340 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 1354 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
1341 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null 1355 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],
1348 else 1362 else
1349 gl_cv_cxx_wallow=none 1363 gl_cv_cxx_wallow=none
1350 fi 1364 fi
1351 rm -f conftest* 1365 rm -fr conftest*
1352 ]) 1366 ])
1353 case "$gl_cv_cxx_wallow" in 1367 case "$gl_cv_cxx_wallow" in
1354 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; 1368 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 42f67d0a42b..97db7d32a66 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -57,6 +57,8 @@ AC_DEFUN([gl_EARLY],
57 # Code from module byteswap: 57 # Code from module byteswap:
58 # Code from module c-ctype: 58 # Code from module c-ctype:
59 # Code from module c-strcase: 59 # Code from module c-strcase:
60 # Code from module c-strcasecmp:
61 # Code from module c-strncasecmp:
60 # Code from module c99: 62 # Code from module c99:
61 # Code from module canonicalize-lgpl: 63 # Code from module canonicalize-lgpl:
62 # Code from module careadlinkat: 64 # Code from module careadlinkat:
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 86ec8889c96..cf3f730b4c3 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
1# manywarnings.m4 1# manywarnings.m4
2# serial 28 2# serial 29
3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -94,7 +94,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
94 # List all gcc warning categories. 94 # List all gcc warning categories.
95 # To compare this list to your installed GCC's, run this Bash command: 95 # To compare this list to your installed GCC's, run this Bash command:
96 # 96 #
97 # comm -3 \ 97 # export LC_ALL=C && comm -3 \
98 # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \ 98 # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
99 # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \ 99 # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
100 # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort) 100 # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
diff --git a/m4/regex.m4 b/m4/regex.m4
index 80dfb8e1e5f..49a8059f618 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,5 +1,5 @@
1# regex.m4 1# regex.m4
2# serial 78 2# serial 81
3dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -53,6 +53,11 @@ AC_DEFUN([gl_REGEX],
53 /* Exit with distinguishable exit code. */ 53 /* Exit with distinguishable exit code. */
54 static void sigabrt_no_core (int sig) { raise (SIGTERM); } 54 static void sigabrt_no_core (int sig) { raise (SIGTERM); }
55 #endif 55 #endif
56
57 /* There is no need to check whether RE_SYNTAX_EMACS is
58 (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to
59 Emacs 21 (2001) and later, because Gnulib's lib/regex.h
60 is always used and has this value. */
56 ]], 61 ]],
57 [[int result = 0; 62 [[int result = 0;
58 static struct re_pattern_buffer regex; 63 static struct re_pattern_buffer regex;
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index c09396ae559..a6bc6243143 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,5 +1,5 @@
1# stddef_h.m4 1# stddef_h.m4
2# serial 17 2# serial 19
3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -90,24 +90,25 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
90 GL_GENERATE_STDDEF_H=true 90 GL_GENERATE_STDDEF_H=true
91 fi 91 fi
92 92
93 AC_CACHE_CHECK([for clean definition of __STDC_VERSION_STDDEF_H__], 93 dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870
94 [gl_cv_clean_version_stddef], 94 dnl affects GCC 13 and 14.
95 [AC_PREPROC_IFELSE( 95 AC_CACHE_CHECK([whether <stddef.h> is idempotent],
96 [AC_LANG_SOURCE( 96 [gl_cv_stddef_idempotent],
97 [[/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 */ 97 [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
98 #include <stddef.h> 98 [[
99 #undef __STDC_VERSION_STDDEF_H__ 99 #if __GNUC__ == 13 || __GNUC__ == 14
100 #include <time.h> 100 #error "bug 114870 is present"
101 #ifdef __STDC_VERSION_STDDEF_H__ 101 #endif
102 # error "<time.h> defines __STDC_VERSION_STDDEF_H__" 102 ]])],
103 #endif 103 [gl_cv_stddef_idempotent="guessing yes"],
104 ]])], 104 [gl_cv_stddef_idempotent="guessing no"])
105 [gl_cv_clean_version_stddef=yes], 105 ])
106 [gl_cv_clean_version_stddef=no])]) 106 case "$gl_cv_stddef_idempotent" in
107 if test "$gl_cv_clean_version_stddef" = no; then 107 *yes) ;;
108 STDDEF_NOT_IDEMPOTENT=1 108 *) STDDEF_NOT_IDEMPOTENT=1
109 GL_GENERATE_STDDEF_H=true 109 GL_GENERATE_STDDEF_H=true
110 fi 110 ;;
111 esac
111 112
112 if $GL_GENERATE_STDDEF_H; then 113 if $GL_GENERATE_STDDEF_H; then
113 gl_NEXT_HEADERS([stddef.h]) 114 gl_NEXT_HEADERS([stddef.h])
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index d0a67608114..bdcd6ef2b67 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -1,5 +1,5 @@
1# string_h.m4 1# string_h.m4
2# serial 43 2# serial 44
3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,8 @@ AC_DEFUN_ONCE([gl_STRING_H],
25 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit 25 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
26 rawmemchr stpcpy stpncpy strchrnul 26 rawmemchr stpcpy stpncpy strchrnul
27 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r 27 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
28 strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) 28 strerror_l strerror_r strerrorname_np
29 sigabbrev_np sigdescr_np strsignal strverscmp])
29 30
30 AC_REQUIRE([AC_C_RESTRICT]) 31 AC_REQUIRE([AC_C_RESTRICT])
31]) 32])
@@ -90,6 +91,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH]) 91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) 92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) 93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) 95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) 96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) 97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
@@ -128,6 +130,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
128 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 130 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
129 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 131 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
130 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) 132 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
133 HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
131 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) 134 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
132 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) 135 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
133 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) 136 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
@@ -150,6 +153,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
150 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) 153 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
151 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 154 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
152 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) 155 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
156 REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
153 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) 157 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
154 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 158 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
155 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) 159 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 2c08d65e0d8..6ec16286ef8 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,5 +1,5 @@
1# unistd_h.m4 1# unistd_h.m4
2# serial 96 2# serial 97
3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -244,6 +244,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
244 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) 244 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
245 REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) 245 REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
246 REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) 246 REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY])
247 REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN])
247 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) 248 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
248 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) 249 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
249 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) 250 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index 8753e1cb294..d017af37b25 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -1,5 +1,5 @@
1# utimensat.m4 1# utimensat.m4
2# serial 12 2# serial 14
3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -67,11 +67,30 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
67 ts[1].tv_sec = 1; 67 ts[1].tv_sec = 1;
68 ts[1].tv_nsec = UTIME_OMIT; 68 ts[1].tv_nsec = UTIME_OMIT;
69 if (utimensat (AT_FDCWD, f, ts, 0)) 69 if (utimensat (AT_FDCWD, f, ts, 0))
70 result |= 16; 70 result |= 8;
71 if (stat (f, &st)) 71 if (stat (f, &st))
72 result |= 32; 72 result |= 8;
73 else if (st.st_ctime < st.st_atime) 73 else if (st.st_ctime < st.st_atime)
74 result |= 64; 74 result |= 16;
75 }
76 enum
77 {
78 BILLION = 1000 * 1000 * 1000,
79 /* Bogus positive and negative tv_nsec values closest to valid
80 range, but without colliding with UTIME_NOW or UTIME_OMIT. */
81 UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
82 ? (1 + (UTIME_NOW == BILLION + 1)
83 + (UTIME_OMIT == BILLION + 1))
84 : 0)
85 };
86 {
87 struct timespec ts[2];
88 ts[0].tv_sec = 1;
89 ts[0].tv_nsec = UTIME_BOGUS_POS;
90 ts[1].tv_sec = 1;
91 ts[1].tv_nsec = 0;
92 if (utimensat (AT_FDCWD, f, ts, 0) == 0)
93 result |= 32;
75 } 94 }
76 return result; 95 return result;
77 ]])], 96 ]])],
@@ -83,8 +102,11 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
83 ], 102 ],
84 [case "$host_os" in 103 [case "$host_os" in
85 # Guess yes on Linux or glibc systems. 104 # Guess yes on Linux or glibc systems.
86 linux-* | linux | *-gnu* | gnu*) 105 linux*)
87 gl_cv_func_utimensat_works="guessing yes" ;; 106 gl_cv_func_utimensat_works="guessing yes" ;;
107 # Guess no on GNU/Hurd.
108 gnu*)
109 gl_cv_func_utimensat_works="guessing no" ;;
88 # Guess yes on systems that emulate the Linux system calls. 110 # Guess yes on systems that emulate the Linux system calls.
89 midipix*) 111 midipix*)
90 gl_cv_func_utimensat_works="guessing yes" ;; 112 gl_cv_func_utimensat_works="guessing yes" ;;
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 5d7c4ef03a0..c616d7751fc 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,5 +1,5 @@
1# warnings.m4 1# warnings.m4
2# serial 20 2# serial 21
3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -114,7 +114,7 @@ AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
114 AC_REQUIRE([AC_PROG_CC]) 114 AC_REQUIRE([AC_PROG_CC])
115 AC_CACHE_CHECK([for C compiler option to inhibit all warnings], 115 AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
116 [gl_cv_cc_winhibit], 116 [gl_cv_cc_winhibit],
117 [rm -f conftest* 117 [rm -fr conftest*
118 echo 'int dummy;' > conftest.c 118 echo 'int dummy;' > conftest.c
119 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 119 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
120 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null 120 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],
123 else 123 else
124 gl_cv_cc_winhibit=none 124 gl_cv_cc_winhibit=none
125 fi 125 fi
126 rm -f conftest* 126 rm -fr conftest*
127 ]) 127 ])
128 case "$gl_cv_cc_winhibit" in 128 case "$gl_cv_cc_winhibit" in
129 none) GL_CFLAG_INHIBIT_WARNINGS='' ;; 129 none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
@@ -146,7 +146,7 @@ AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
146 if test -n "$CXX" && test "$CXX" != no; then 146 if test -n "$CXX" && test "$CXX" != no; then
147 AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings], 147 AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
148 [gl_cv_cxx_winhibit], 148 [gl_cv_cxx_winhibit],
149 [rm -f conftest* 149 [rm -fr conftest*
150 echo 'int dummy;' > conftest.cc 150 echo 'int dummy;' > conftest.cc
151 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 151 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
152 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null 152 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],
155 else 155 else
156 gl_cv_cxx_winhibit=none 156 gl_cv_cxx_winhibit=none
157 fi 157 fi
158 rm -f conftest* 158 rm -fr conftest*
159 ]) 159 ])
160 case "$gl_cv_cxx_winhibit" in 160 case "$gl_cv_cxx_winhibit" in
161 none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;; 161 none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;