From f3868cb9d1806b35186eabc0262393316ebe689a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 12 Aug 2023 12:50:15 -0700 Subject: [PATCH] Update from Gnulib by running admin/merge-gnulib --- build-aux/config.guess | 33 +++++- build-aux/config.sub | 37 ++---- doc/misc/texinfo.tex | 257 ++++++++++++++++++++++++++++++----------- lib/diffseq.h | 24 +--- lib/gnulib.mk.in | 6 +- lib/time.in.h | 81 +++++++++++++ m4/clock_time.m4 | 32 +++-- m4/mktime.m4 | 3 +- m4/nanosleep.m4 | 6 +- m4/stdalign.m4 | 10 +- m4/time_h.m4 | 35 +++--- m4/time_r.m4 | 4 +- m4/timegm.m4 | 3 +- src/Makefile.in | 4 +- 14 files changed, 371 insertions(+), 164 deletions(-) diff --git a/build-aux/config.guess b/build-aux/config.guess index 354a8ccde42..b187213930f 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2023-06-23' +timestamp='2023-07-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -976,7 +976,27 @@ EOF GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be @@ -1042,6 +1062,15 @@ EOF k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; diff --git a/build-aux/config.sub b/build-aux/config.sub index 9865d6ea4d1..6ae25027537 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2023-06-26' +timestamp='2023-07-31' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1206,6 +1206,7 @@ case $cpu-$vendor in | i370 | i*86 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ + | kvx \ | le32 | le64 \ | lm32 \ | loongarch32 | loongarch64 \ @@ -1214,31 +1215,7 @@ case $cpu-$vendor in | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ | m88110 | m88k | maxq | mb | mcore | mep | metag \ | microblaze | microblazeel \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64eb | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r3 | mipsisa32r3el \ - | mipsisa32r5 | mipsisa32r5el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r3 | mipsisa64r3el \ - | mipsisa64r5 | mipsisa64r5el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ + | mips* \ | mmix \ | mn10200 | mn10300 \ | moxie \ @@ -1733,7 +1710,7 @@ case $os in | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ | hiux* | abug | nacl* | netware* | windows* \ - | os9* | macos* | osx* | ios* \ + | os9* | macos* | osx* | ios* | tvos* | watchos* \ | mpw* | magic* | mmixware* | mon960* | lnews* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ @@ -1759,7 +1736,7 @@ case $os in | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* | mlibc* ) + | fiwix* | mlibc* | cos* | mbr* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) @@ -1816,6 +1793,10 @@ case $kernel-$os in ;; *-eabi* | *-gnueabi*) ;; + none-coff* | none-elf*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an output format "OS" + ;; -*) # Blank kernel with real OS is always fine. ;; diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index b1d2999e5d7..6e521944b22 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2023-07-02.10} +\def\texinfoversion{2023-07-27.21} % % Copyright 1985, 1986, 1988, 1990-2023 Free Software Foundation, Inc. % @@ -426,42 +426,21 @@ } % First remove any @comment, then any @c comment. Pass the result on to -% \argcheckspaces. +% \argremovespace. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} -\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} - -% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. -% -% \argremovec might leave us with trailing space, e.g., +\def\argremovec#1\c#2\ArgTerm{\argremovespace#1$ $\ArgTerm} +% \argremovec might leave us with trailing space, though; e.g., % @end itemize @c foo -% This space token undergoes the same procedure and is eventually removed -% by \finishparsearg. -% -\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} -\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} -\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% - \def\temp{#3}% - \ifx\temp\empty - % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: - \let\temp\finishparsearg - \else - \let\temp\argcheckspaces - \fi - % Put the space token in: - \temp#1 #3\ArgTerm -} +% Note that the argument cannot contain the TeX $, as its catcode is +% changed to \other when Texinfo source is read. +\def\argremovespace#1 $#2\ArgTerm{\finishparsearg#1$\ArgTerm} % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. -% We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \argtorun. -% (Similarly, we have to think about #3 of \argcheckspacesY above: it is -% either the null string, or it ends with \^^M---thus there is no danger -% that a pair of braces would be stripped. -% -% But first, we have to remove the trailing space token. -% -\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} +% We prepended an \empty token at the very beginning and we expand it +% just before passing the control to \next. +% (But first, we have to remove the remaining $ or two.) +\def\finishparsearg#1$#2\ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef - define a command taking an argument on the line @@ -5575,6 +5554,11 @@ might help (with 'rm \jobname.?? \jobname.??s')% \newdimen\entryrightmargin \entryrightmargin=0pt +% amount to indent subsequent lines in an entry when it spans more than +% one line. +\newdimen\entrycontskip +\entrycontskip=1em + % for PDF output, whether to make the text of the entry a link to the page % number. set for @contents and @shortcontents where there is only one % page number. @@ -5684,25 +5668,30 @@ might help (with 'rm \jobname.?? \jobname.??s')% \advance\dimen@ii by 1\dimen@i \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line \ifdim\dimen@ > 0.8\dimen@ii % due to long index text + % Undo changes above + \advance \parfillskip by 0pt minus -1\dimen@i + \advance\dimen@ii by -1\dimen@i + % % Try to split the text roughly evenly. \dimen@ will be the length of % the first line. \dimen@ = 0.7\dimen@ \dimen@ii = \hsize \ifnum\dimen@>\dimen@ii % If the entry is too long (for example, if it needs more than - % two lines), use all the space in the first line. + % two lines), use the same line length for all lines. \dimen@ = \dimen@ii + \else + \advance \dimen@ by 1\rightskip \fi \advance\leftskip by 0pt plus 1fill % ragged right - \advance \dimen@ by 1\rightskip \parshape = 2 0pt \dimen@ 0em \dimen@ii % Ideally we'd add a finite glue at the end of the first line only, % instead of using \parshape with explicit line lengths, but TeX % doesn't seem to provide a way to do such a thing. % % Indent all lines but the first one. - \advance\leftskip by 1em - \advance\parindent by -1em + \advance\leftskip by \entrycontskip + \advance\parindent by -\entrycontskip \fi\fi \indent % start paragraph \unhbox\boxA @@ -6721,6 +6710,82 @@ might help (with 'rm \jobname.?? \jobname.??s')% \input \tocreadfilename } +% process toc file to find the maximum width of the section numbers for +% each chapter +\def\findsecnowidths{% + \begingroup + \setupdatafile + \activecatcodes + \secentryfonts + % Redefinitions + \def\numchapentry##1##2##3##4{% + \def\curchapname{secnowidth-##2}% + \curchapmax=0pt + }% + \let\appentry\numchapentry + % + \def\numsecentry##1##2##3##4{% + \def\cursecname{secnowidth-##2}% + \cursecmax=0pt + % + \setbox0=\hbox{##2}% + \ifdim\wd0>\curchapmax + \curchapmax=\wd0 + \expandafter\xdef\csname\curchapname\endcsname{\the\wd0}% + \fi + }% + \let\appsecentry\numsecentry + % + \def\numsubsecentry##1##2##3##4{% + \def\curssecname{secnowidth-##2}% + \curssecmax=0pt + % + \setbox0=\hbox{##2}% + \ifdim\wd0>\cursecmax + \cursecmax=\wd0 + \expandafter\xdef\csname\cursecname\endcsname{\the\wd0}% + \fi + }% + \let\appsubsecentry\numsubsecentry + % + \def\numsubsubsecentry##1##2##3##4{% + \setbox0=\hbox{##2}% + \ifdim\wd0>\curssecmax + \curssecmax=\wd0 + \expandafter\xdef\csname\curssecname\endcsname{\the\wd0}% + \fi + }% + \let\appsubsubsecentry\numsubsubsecentry + % + % Discard any output by outputting to dummy vbox, in case the toc file + % contains macros that we have not redefined above. + \setbox\dummybox\vbox\bgroup + \input \tocreadfilename\relax + \egroup + \endgroup +} +\newdimen\curchapmax +\newdimen\cursecmax +\newdimen\curssecmax + + +% set #1 to the maximum section width for #2 +\def\retrievesecnowidth#1#2{% + \expandafter\let\expandafter\savedsecnowidth \csname secnowidth-#2\endcsname + \ifx\savedsecnowidth\relax + #1=0pt + \else + #1=\savedsecnowidth + \fi +} +\newdimen\secnowidthchap +\secnowidthchap=0pt +\newdimen\secnowidthsec +\secnowidthsec=0pt +\newdimen\secnowidthssec +\secnowidthssec=0pt + + \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 @@ -6766,6 +6831,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% \startcontents{\putwordTOC}% \openin 1 \tocreadfilename\space \ifeof 1 \else + \findsecnowidths \readtocfile \fi \vfill \eject @@ -6793,6 +6859,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. + \extrasecnoskip=0.4pt \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry @@ -6828,8 +6895,6 @@ might help (with 'rm \jobname.?? \jobname.??s')% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and @@ -6839,10 +6904,15 @@ might help (with 'rm \jobname.?? \jobname.??s')% \hbox to 1em{#1\hss}% } -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... +% These macros generate individual entries in the table of contents, +% and are read in from the *.toc file. +% +% The arguments are like: +% \def\numchapentry#1#2#3#4 +% #1 - the chapter or section name. +% #2 - section number +% #3 - level of section (e.g "chap", "sec") +% #4 - page number % Parts, in the main contents. Replace the part number, which doesn't % exist, with an empty box. Let's hope all the numbers have the same width. @@ -6855,7 +6925,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% \vskip 0pt plus 5\baselineskip \penalty-300 \vskip 0pt plus -5\baselineskip - \dochapentry{\numeralbox\labelspace#1}{}% + \dochapentry{#1}{\numeralbox}{}% } % % Parts, in the short toc. @@ -6866,12 +6936,14 @@ might help (with 'rm \jobname.?? \jobname.??s')% } % Chapters, in the main contents. -\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +\def\numchapentry#1#2#3#4{% + \retrievesecnowidth\secnowidthchap{#2}% + \dochapentry{#1}{#2}{#4}% +} % Chapters, in the short toc. -% See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}% + \tocentry{#1}{\shortchaplabel{#2}}{#4}% } % Appendices, in the main contents. @@ -6882,67 +6954,111 @@ might help (with 'rm \jobname.?? \jobname.??s')% \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % -\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} +\def\appentry#1#2#3#4{% + \retrievesecnowidth\secnowidthchap{#2}% + \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#4}% +} % Unnumbered chapters. -\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} -\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}} +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#4}} % Sections. -\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\def\numsecentry#1#2#3#4{\dosecentry{#1}{#2}{#4}} + +\def\numsecentry#1#2#3#4{% + \retrievesecnowidth\secnowidthsec{#2}% + \dosecentry{#1}{#2}{#4}% +} \let\appsecentry=\numsecentry -\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} +\def\unnsecentry#1#2#3#4{% + \retrievesecnowidth\secnowidthsec{#2}% + \dosecentry{#1}{}{#4}% +} % Subsections. -\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\def\numsubsecentry#1#2#3#4{% + \retrievesecnowidth\secnowidthssec{#2}% + \dosubsecentry{#1}{#2}{#4}% +} \let\appsubsecentry=\numsubsecentry -\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} +\def\unnsubsecentry#1#2#3#4{% + \retrievesecnowidth\secnowidthssec{#2}% + \dosubsecentry{#1}{}{#4}% +} % And subsubsections. -\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#4}} \let\appsubsubsecentry=\numsubsubsecentry -\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. +% Now for the actual typesetting. In all these, #1 is the text, #2 is +% a section number if present, and #3 is the page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. -\def\dochapentry#1#2{% +\def\dochapentry#1#2#3{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup % Move the page numbers slightly to the right \advance\entryrightmargin by -0.05em \chapentryfonts - \tocentry{#1}{#2}% + \extrasecnoskip=0.4em % separate chapter number more + \tocentry{#1}{#2}{#3}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } -\def\dosecentry#1#2{\begingroup +\def\dosecentry#1#2#3{\begingroup + \secnowidth=\secnowidthchap \secentryfonts \leftskip=\tocindent - \tocentry{#1}{#2}% + \tocentry{#1}{#2}{#3}% \endgroup} -\def\dosubsecentry#1#2{\begingroup +\def\dosubsecentry#1#2#3{\begingroup + \secnowidth=\secnowidthsec \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{#2}% + \tocentry{#1}{#2}{#3}% \endgroup} -\def\dosubsubsecentry#1#2{\begingroup +\def\dosubsubsecentry#1#2#3{\begingroup + \secnowidth=\secnowidthssec \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{#2}% + \tocentry{#1}{#2}{#3}% \endgroup} -% We use the same \entry macro as for the index entries. -\let\tocentry = \entry +% Used for the maximum width of a section number so we can align +% section titles. +\newdimen\secnowidth +\secnowidth=0pt +\newdimen\extrasecnoskip +\extrasecnoskip=0pt -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} +% \tocentry{TITLE}{SEC NO}{PAGE} +% +\def\tocentry#1#2#3{% + \def\secno{#2}% + \ifx\empty\secno + \entry{#1}{#3}% + \else + \ifdim 0pt=\secnowidth + \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}% + \else + \advance\secnowidth by \labelspace + \advance\secnowidth by \extrasecnoskip + \setbox0=\hbox to \secnowidth{% + #2\hskip\labelspace\hskip\extrasecnoskip\hfill}% + \fi + \entrycontskip=\wd0 + \entry{\box0 #1}{#3}% + \fi +} +\newdimen\labelspace +\labelspace=0.6em \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} @@ -7787,6 +7903,8 @@ might help (with 'rm \jobname.?? \jobname.??s')% \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% + \def\^^M{}% for line continuation + % % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's @@ -7819,6 +7937,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% % Print arguments. Use slanted for @def*, typewriter for @deftype*. \def\defunargs#1{% \bgroup + \def\^^M{}% for line continuation \df \ifdoingtypefn \tt \else \sl \fi \ifflagclear{txicodevaristt}{}% {\def\var##1{{\setregularquotes \ttsl ##1}}}% diff --git a/lib/diffseq.h b/lib/diffseq.h index 06e1465bf1b..3f85ab2ec41 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -92,20 +92,11 @@ # define NOTE_ORDERED false #endif -/* Use this to suppress gcc's "...may be used before initialized" warnings. - Beware: The Code argument must not contain commas. */ +/* Suppress gcc's "...may be used before initialized" warnings, + generated by GCC versions up to at least GCC 13.2. */ #if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4 # pragma GCC diagnostic push -#endif -#ifndef IF_LINT -# if defined GCC_LINT || defined lint -# define IF_LINT(Code) Code -# else -# define IF_LINT(Code) /* empty */ -# if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4 -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -# endif -# endif +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif /* @@ -388,13 +379,8 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal, and report halfway between our best results so far. */ if (c >= ctxt->too_expensive) { - OFFSET fxybest; - OFFSET fxbest IF_LINT (= 0); - OFFSET bxybest; - OFFSET bxbest IF_LINT (= 0); - /* Find forward diagonal that maximizes X + Y. */ - fxybest = -1; + OFFSET fxybest = -1, fxbest; for (d = fmax; d >= fmin; d -= 2) { OFFSET x = MIN (fd[d], xlim); @@ -412,7 +398,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal, } /* Find backward diagonal that minimizes X + Y. */ - bxybest = OFFSET_MAX; + OFFSET bxybest = OFFSET_MAX, bxbest; for (d = bmax; d >= bmin; d -= 2) { OFFSET x = MAX (xoff, bd[d]); diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 1bfa1daa0b3..78ecb544c6e 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -41,6 +41,10 @@ # --avoid=dup \ # --avoid=fchdir \ # --avoid=fstat \ +# --avoid=iswblank \ +# --avoid=iswctype \ +# --avoid=iswdigit \ +# --avoid=iswxdigit \ # --avoid=langinfo \ # --avoid=lock \ # --avoid=mbrtowc \ @@ -67,6 +71,7 @@ # --avoid=utime-h \ # --avoid=wchar \ # --avoid=wcrtomb \ +# --avoid=wctype \ # --avoid=wctype-h \ # alignasof \ # alloca-opt \ @@ -658,7 +663,6 @@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GMALLOC_OBJ = @GMALLOC_OBJ@ GMP_H = @GMP_H@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ -GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ diff --git a/lib/time.in.h b/lib/time.in.h index 06428adb1d0..06824da9d3d 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -143,6 +143,12 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (timespec_get); # endif +# elif defined GNULIB_POSIXCHECK +# undef timespec_get +# if HAVE_RAW_DECL_TIMESPEC_GET +_GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " + "use gnulib module timespec_get for portability"); +# endif # endif /* Set *TS to the current time resolution, and return BASE. @@ -154,6 +160,12 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) # endif _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_getres); +# elif defined GNULIB_POSIXCHECK +# undef timespec_getres +# if HAVE_RAW_DECL_TIMESPEC_GETRES +_GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " + "use gnulib module timespec_getres for portability"); +# endif # endif /* Return the number of seconds that have elapsed since the Epoch. */ @@ -170,6 +182,12 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (time); # endif +# elif defined GNULIB_POSIXCHECK +# undef time +# if HAVE_RAW_DECL_TIME +_GL_WARN_ON_USE (time, "time has consistency problems - " + "use gnulib module time for portability"); +# endif # endif /* Sleep for at least RQTP seconds unless interrupted, If interrupted, @@ -195,6 +213,12 @@ _GL_CXXALIAS_SYS (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # endif _GL_CXXALIASWARN (nanosleep); +# elif defined GNULIB_POSIXCHECK +# undef nanosleep +# if HAVE_RAW_DECL_NANOSLEEP +_GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " + "use gnulib module nanosleep for portability"); +# endif # endif /* Initialize time conversion information. */ @@ -230,6 +254,12 @@ _GL_CXXALIAS_MDA (tzset, void, (void)); _GL_CXXALIAS_SYS (tzset, void, (void)); # endif _GL_CXXALIASWARN (tzset); +# elif defined GNULIB_POSIXCHECK +# undef tzset +# if HAVE_RAW_DECL_TZSET +_GL_WARN_ON_USE (tzset, "tzset has portability problems - " + "use gnulib module tzset for portability"); +# endif # endif /* Return the 'time_t' representation of TP and normalize TP. */ @@ -246,6 +276,12 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mktime); # endif +# elif defined GNULIB_POSIXCHECK +# undef mktime +# if HAVE_RAW_DECL_MKTIME +_GL_WARN_ON_USE (mktime, "mktime has portability problems - " + "use gnulib module mktime for portability"); +# endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See @@ -296,6 +332,17 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, # if @HAVE_DECL_LOCALTIME_R@ _GL_CXXALIASWARN (gmtime_r); # endif +# elif defined GNULIB_POSIXCHECK +# undef localtime_r +# if HAVE_RAW_DECL_LOCALTIME_R +_GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " + "use gnulib module time_r for portability"); +# endif +# undef gmtime_r +# if HAVE_RAW_DECL_GMTIME_R +_GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " + "use gnulib module time_r for portability"); +# endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See @@ -316,6 +363,12 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (localtime); # endif +# elif defined GNULIB_POSIXCHECK +# undef localtime +# if HAVE_RAW_DECL_LOCALTIME +_GL_WARN_ON_USE (localtime, "localtime has portability problems - " + "use gnulib module localtime for portability"); +# endif # endif # if 0 || @REPLACE_GMTIME@ @@ -347,6 +400,12 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm)); _GL_CXXALIASWARN (strptime); +# elif defined GNULIB_POSIXCHECK +# undef strptime +# if HAVE_RAW_DECL_STRPTIME +_GL_WARN_ON_USE (strptime, "strptime is unportable - " + "use gnulib module strptime for portability"); +# endif # endif /* Convert *TP to a date and time string. See @@ -368,6 +427,12 @@ _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (ctime); # endif +# elif defined GNULIB_POSIXCHECK +# undef ctime +# if HAVE_RAW_DECL_CTIME +_GL_WARN_ON_USE (ctime, "ctime has portability problems - " + "use gnulib module ctime for portability"); +# endif # endif /* Convert *TP to a date and time string. See @@ -392,6 +457,12 @@ _GL_CXXALIAS_SYS (strftime, size_t, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strftime); # endif +# elif defined GNULIB_POSIXCHECK +# undef strftime +# if HAVE_RAW_DECL_STRFTIME +_GL_WARN_ON_USE (strftime, "strftime has portability problems - " + "use gnulib module strftime-fixes for portability"); +# endif # endif # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ @@ -469,6 +540,12 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (timegm); # endif +# elif defined GNULIB_POSIXCHECK +# undef timegm +# if HAVE_RAW_DECL_TIMEGM +_GL_WARN_ON_USE (timegm, "timegm is unportable - " + "use gnulib module timegm for portability"); +# endif # endif /* Encourage applications to avoid unsafe functions that can overrun @@ -476,8 +553,10 @@ _GL_CXXALIASWARN (timegm); applications should use strftime (or even sprintf) instead. */ # if defined GNULIB_POSIXCHECK # undef asctime +# if HAVE_RAW_DECL_ASCTIME _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); +# endif # endif # if defined GNULIB_POSIXCHECK # undef asctime_r @@ -488,8 +567,10 @@ _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " # endif # if defined GNULIB_POSIXCHECK # undef ctime +# if HAVE_RAW_DECL_CTIME _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); +# endif # endif # if defined GNULIB_POSIXCHECK # undef ctime_r diff --git a/m4/clock_time.m4 b/m4/clock_time.m4 index d624a73d35d..28534db1c76 100644 --- a/m4/clock_time.m4 +++ b/m4/clock_time.m4 @@ -1,4 +1,4 @@ -# clock_time.m4 serial 12 +# clock_time.m4 serial 13 dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,9 +12,17 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CLOCK_TIME], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + dnl Persuade glibc and Solaris to declare these functions. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # On mingw, these functions are defined in the libwinpthread library, + # which is better avoided. In fact, the clock_gettime function is buggy + # in 32-bit mingw, when -D__MINGW_USE_VC2005_COMPAT is used (which Gnulib's + # year2038 module does): It leaves the upper 32 bits of the tv_sec field + # of the result uninitialized. + # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. @@ -23,12 +31,22 @@ AC_DEFUN([gl_CLOCK_TIME], # library, inducing unnecessary run-time overhead. CLOCK_TIME_LIB= AC_SUBST([CLOCK_TIME_LIB]) - gl_saved_libs=$LIBS - AC_SEARCH_LIBS([clock_gettime], [rt posix4], - [test "$ac_cv_search_clock_gettime" = "none required" || - CLOCK_TIME_LIB=$ac_cv_search_clock_gettime]) - AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime]) - LIBS=$gl_saved_libs + case "$host_os" in + mingw*) + ac_cv_func_clock_getres=no + ac_cv_func_clock_gettime=no + ac_cv_func_clock_settime=no + ;; + *) + gl_saved_libs=$LIBS + AC_SEARCH_LIBS([clock_gettime], [rt posix4], + [test "$ac_cv_search_clock_gettime" = "none required" || + CLOCK_TIME_LIB=$ac_cv_search_clock_gettime]) + AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime]) + LIBS=$gl_saved_libs + ;; + esac + # For backward compatibility. LIB_CLOCK_GETTIME="$CLOCK_TIME_LIB" AC_SUBST([LIB_CLOCK_GETTIME]) diff --git a/m4/mktime.m4 b/m4/mktime.m4 index e9d31f35a46..69cce86da5a 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 37 +# serial 38 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -280,7 +280,6 @@ AC_DEFUN([gl_FUNC_MKTIME], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) - REPLACE_MKTIME=0 if test "$gl_cv_func_working_mktime" != yes; then REPLACE_MKTIME=1 AC_DEFINE([NEED_MKTIME_WORKING], [1], diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4 index e21a3e343cb..b7f22d7b606 100644 --- a/m4/nanosleep.m4 +++ b/m4/nanosleep.m4 @@ -1,4 +1,4 @@ -# serial 43 +# serial 44 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -126,9 +126,7 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], ]) ]) case "$gl_cv_func_nanosleep" in - *yes) - REPLACE_NANOSLEEP=0 - ;; + *yes) ;; *) REPLACE_NANOSLEEP=1 case "$gl_cv_func_nanosleep" in diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 1a236d66d2f..6a39ffe7565 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -68,8 +68,10 @@ AC_DEFUN([gl_ALIGNASOF], dnl The "zz" puts this toward config.h's end, to avoid potential dnl collisions with other definitions. AH_VERBATIM([zzalignas], -[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof -# if HAVE_STDALIGN_H +[#if !defined HAVE_C_ALIGNASOF \ + && !(defined __cplusplus && 201103 <= __cplusplus) \ + && !defined alignof +# if defined HAVE_STDALIGN_H # include # endif @@ -166,7 +168,7 @@ AC_DEFUN([gl_ALIGNASOF], # define _Alignas(a) __declspec (align (a)) # endif # endif -# if !HAVE_STDALIGN_H +# if !defined HAVE_STDALIGN_H # if ((defined _Alignas \ && !(defined __cplusplus \ && (201103 <= __cplusplus || defined _MSC_VER))) \ @@ -175,7 +177,7 @@ AC_DEFUN([gl_ALIGNASOF], # endif # endif -# if _GL_STDALIGN_NEEDS_STDDEF +# if defined _GL_STDALIGN_NEEDS_STDDEF # include # endif #endif]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 index 51d553a2f1a..632d18fc071 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc. -# serial 22 +# serial 24 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -23,7 +23,10 @@ AC_DEFUN_ONCE([gl_TIME_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ #include - ]], [asctime_r ctime_r]) + ]], [ + asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime + nanosleep strftime strptime time timegm timespec_get timespec_getres tzset + ]) AC_REQUIRE([AC_C_RESTRICT]) @@ -162,25 +165,15 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) dnl Even GNU libc does not have timezone_t yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) - dnl If another module says to replace or to not replace, do that. - dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; - dnl this lets maintainers check for portability. - REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) - REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) - REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) - REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) - REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) - REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) - REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) - REPLACE_TIMESPEC_GET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMESPEC_GET]) - REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) - - dnl Hack so that the time module doesn't depend on the sys_time module. - dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. - : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) - dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME - dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier - dnl is no longer a big deal. + REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) + REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) + REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) + REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) + REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) + REPLACE_TIMEGM=0; AC_SUBST([REPLACE_TIMEGM]) + REPLACE_TIMESPEC_GET=0; AC_SUBST([REPLACE_TIMESPEC_GET]) + REPLACE_TZSET=0; AC_SUBST([REPLACE_TZSET]) ]) diff --git a/m4/time_r.m4 b/m4/time_r.m4 index adce438abf1..4831eb26f90 100644 --- a/m4/time_r.m4 +++ b/m4/time_r.m4 @@ -57,9 +57,7 @@ AC_DEFUN([gl_TIME_R], [gl_cv_time_r_posix=yes], [gl_cv_time_r_posix=no]) ]) - if test $gl_cv_time_r_posix = yes; then - REPLACE_LOCALTIME_R=0 - else + if test $gl_cv_time_r_posix != yes; then REPLACE_LOCALTIME_R=1 fi else diff --git a/m4/timegm.m4 b/m4/timegm.m4 index 8ab265e65fe..6da07807698 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -1,4 +1,4 @@ -# timegm.m4 serial 15 +# timegm.m4 serial 16 dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,7 +8,6 @@ AC_DEFUN([gl_FUNC_TIMEGM], [ AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) - REPLACE_TIMEGM=0 gl_CHECK_FUNCS_ANDROID([timegm], [[#include ]]) if test $ac_cv_func_timegm = yes; then if test "$gl_cv_func_working_mktime" != yes; then diff --git a/src/Makefile.in b/src/Makefile.in index e818b6c1655..b14681f2537 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -167,7 +167,7 @@ CLOCK_TIME_LIB=@CLOCK_TIME_LIB@ EUIDACCESS_LIBGEN=@EUIDACCESS_LIBGEN@ NANOSLEEP_LIB=@NANOSLEEP_LIB@ QCOPY_ACL_LIB=@QCOPY_ACL_LIB@ -LIB_TIMER_TIME=@LIB_TIMER_TIME@ +TIMER_TIME_LIB=@TIMER_TIME_LIB@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ @@ -596,7 +596,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(PGTK_LIBS) $(LIBX_BASE) $(LIBIMAGE $(LIBX_OTHER) $(LIBSOUND) \ $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(CLOCK_TIME_LIB) \ $(NANOSLEEP_LIB) $(QCOPY_ACL_LIB) $(WEBKIT_LIBS) \ - $(EUIDACCESS_LIBGEN) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ + $(EUIDACCESS_LIBGEN) $(TIMER_TIME_LIB) $(DBUS_LIBS) \ $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \ $(XDBE_LIBS) $(XSYNC_LIBS) \ $(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \ -- 2.39.2