1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Update from Gnulib by running admin/merge-gnulib

This commit is contained in:
Paul Eggert 2022-09-28 00:29:09 -07:00
parent c1eb13b326
commit a9b29ee4a0
52 changed files with 489 additions and 191 deletions

View file

@ -4,7 +4,7 @@
# shellcheck disable=SC2006,SC2268 # see below for rationale # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-05-25' timestamp='2022-08-01'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
@ -1036,7 +1036,7 @@ EOF
k1om:Linux:*:*) k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;; ;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) loongarch32:Linux:*:* | loongarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;; ;;
m32r*:Linux:*:*) m32r*:Linux:*:*)

View file

@ -4,7 +4,7 @@
# shellcheck disable=SC2006,SC2268 # see below for rationale # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-01-03' timestamp='2022-08-01'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
@ -1207,7 +1207,7 @@ case $cpu-$vendor in
| k1om \ | k1om \
| le32 | le64 \ | le32 | le64 \
| lm32 \ | lm32 \
| loongarch32 | loongarch64 | loongarchx32 \ | loongarch32 | loongarch64 \
| m32c | m32r | m32rle \ | m32c | m32r | m32rle \
| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \

View file

@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex. % Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
% %
\def\texinfoversion{2022-08-20.19} \def\texinfoversion{2022-09-21.15}
% %
% Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc. % Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
% %
@ -241,9 +241,6 @@
% %
\def\finalout{\overfullrule=0pt } \def\finalout{\overfullrule=0pt }
\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
\newdimen\topandbottommargin \topandbottommargin=.75in
% Output a mark which sets \thischapter, \thissection and \thiscolor. % Output a mark which sets \thischapter, \thissection and \thiscolor.
% We dump everything together because we only have one kind of mark. % We dump everything together because we only have one kind of mark.
% This works because we only use \botmark / \topmark, not \firstmark. % This works because we only use \botmark / \topmark, not \firstmark.
@ -317,16 +314,8 @@
\newbox\footlinebox \newbox\footlinebox
% When outputting the double column layout for indices, an output routine % When outputting the double column layout for indices, an output routine
% is run several times, which hides the original value of \topmark. This % is run several times, hiding the original value of \topmark. Hence, save
% can lead to a page heading being output and duplicating the chapter heading % \topmark at the beginning.
% of the index. Hence, save the contents of \topmark at the beginning of
% the output routine. The saved contents are valid until we actually
% \shipout a page.
%
% (We used to run a short output routine to actually set \topmark and
% \firstmark to the right values, but if this was called with an empty page
% containing whatsits for writing index entries, the whatsits would be thrown
% away and the index auxiliary file would remain empty.)
% %
\newtoks\savedtopmark \newtoks\savedtopmark
\newif\iftopmarksaved \newif\iftopmarksaved
@ -351,15 +340,9 @@
% %
\checkchapterpage \checkchapterpage
% %
% Retrieve the information for the headings from the marks in the page, % Make the heading and footing. \makeheadline and \makefootline
% and call Plain TeX's \makeheadline and \makefootline, which use the % use the contents of \headline and \footline.
% values in \headline and \footline.
%
% Common context changes for both heading and footing.
% Do this outside of the \shipout so @code etc. will be expanded in
% the headline as they should be, not taken literally (outputting ''code).
\def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars} \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
%
\ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
\global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}% \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
\ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
@ -617,21 +600,6 @@
% @? is an end-of-sentence query. % @? is an end-of-sentence query.
\def\?{?\spacefactor=\endofsentencespacefactor\space} \def\?{?\spacefactor=\endofsentencespacefactor\space}
% @frenchspacing on|off says whether to put extra space after punctuation.
%
\def\onword{on}
\def\offword{off}
%
\parseargdef\frenchspacing{%
\def\temp{#1}%
\ifx\temp\onword \plainfrenchspacing
\else\ifx\temp\offword \plainnonfrenchspacing
\else
\errhelp = \EMsimple
\errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
\fi\fi
}
% @w prevents a word break. Without the \leavevmode, @w at the % @w prevents a word break. Without the \leavevmode, @w at the
% beginning of a paragraph, when TeX is still in vertical mode, would % beginning of a paragraph, when TeX is still in vertical mode, would
% produce a whole line of output instead of starting the paragraph. % produce a whole line of output instead of starting the paragraph.
@ -2803,14 +2771,22 @@ end
% @var unconditionally uses \sl. This gives consistency for % @var unconditionally uses \sl. This gives consistency for
% parameter names whether they are in @def, @table @code or a % parameter names whether they are in @def, @table @code or a
% regular paragraph. % regular paragraph.
% To get ttsl font for @var when used in code context, @set txicodevaristt.
% The \null is to reset \spacefactor. % The \null is to reset \spacefactor.
\def\aftersmartic{} \def\aftersmartic{}
\def\var#1{% \def\var#1{%
\let\saveaftersmartic = \aftersmartic \let\saveaftersmartic = \aftersmartic
\def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
{\sl #1}\smartitaliccorrection %
\ifflagclear{txicodevaristt}%
{\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
{\def\varnext{\smartslanted{#1}}}%
\varnext
} }
% To be removed after next release
\def\SETtxicodevaristt{}% @set txicodevaristt
\let\i=\smartitalic \let\i=\smartitalic
\let\slanted=\smartslanted \let\slanted=\smartslanted
\let\dfn=\smartslanted \let\dfn=\smartslanted
@ -2859,6 +2835,24 @@ end
\catcode`@=\other \catcode`@=\other
\def\endofsentencespacefactor{3000}% default \def\endofsentencespacefactor{3000}% default
% @frenchspacing on|off says whether to put extra space after punctuation.
%
\def\onword{on}
\def\offword{off}
%
\let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
\parseargdef\frenchspacing{%
\def\temp{#1}%
\ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
\else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
\else
\errhelp = \EMsimple
\errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
\fi\fi
\frenchspacingsetting
}
% @t, explicit typewriter. % @t, explicit typewriter.
\def\t#1{% \def\t#1{%
{\tt \defcharsdefault \plainfrenchspacing #1}% {\tt \defcharsdefault \plainfrenchspacing #1}%
@ -3449,16 +3443,22 @@ $$%
% for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
% Revert to plain's \scriptsize, which is 7pt. % Revert to plain's \scriptsize, which is 7pt.
\count255=\the\fam $\fam\count255 \scriptstyle A$% \count255=\the\fam $\fam\count255 \scriptstyle A$%
\else
\ifx\curfontsize\smallword
% For footnotes and indices
\count255=\the\fam $\fam\count255 \scriptstyle A$%
\else \else
% For 11pt, we can use our lllsize. % For 11pt, we can use our lllsize.
\switchtolllsize A% \switchtolllsize A%
\fi \fi
\fi
}% }%
\vss \vss
}}% }}%
\kern-.15em \kern-.15em
\TeX \TeX
} }
\def\smallword{small}
% Some math mode symbols. Define \ensuremath to switch into math mode % Some math mode symbols. Define \ensuremath to switch into math mode
% unless we are already there. Expansion tricks may not be needed here, % unless we are already there. Expansion tricks may not be needed here,
@ -3829,15 +3829,16 @@ $$%
\newtoks\oddfootline % footline on odd pages \newtoks\oddfootline % footline on odd pages
% Now make \makeheadline and \makefootline in Plain TeX use those variables % Now make \makeheadline and \makefootline in Plain TeX use those variables
\headline={{\textfonts\rm \headline={{\textfonts\rm\frenchspacingsetting
\ifchapterpage \ifchapterpage
\ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
\else \else
\ifodd\pageno\the\oddheadline\else\the\evenheadline\fi \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
\fi}} \fi}}
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \footline={{\textfonts\rm\frenchspacingsetting
\else \the\evenfootline \fi}\HEADINGShook} \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
\HEADINGShook}
\let\HEADINGShook=\relax \let\HEADINGShook=\relax
% Commands to set those variables. % Commands to set those variables.
@ -3963,7 +3964,7 @@ $$%
\global\oddfootline={\hfil} \global\oddfootline={\hfil}
\global\evenheadline={\line{\folio\hfil\thistitle}} \global\evenheadline={\line{\folio\hfil\thistitle}}
\global\oddheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}}
\global\evenchapheadline={\line{\folio\hfil}} \global\evenchapheadline={\line{\folio\hfil\thistitle}}
\global\oddchapheadline={\line{\hfil\folio}} \global\oddchapheadline={\line{\hfil\folio}}
\global\let\contentsalignmacro = \chapoddpage \global\let\contentsalignmacro = \chapoddpage
} }
@ -4351,8 +4352,7 @@ $$%
% undo it ourselves. % undo it ourselves.
\def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitemfont{\b}% for people to use in the template row; not changeable
\def\headitem{% \def\headitem{%
\checkenv\multitable \crcr % must appear first
\crcr
\gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
\global\everytab={\bf}% can't use \headitemfont since the parsing differs \global\everytab={\bf}% can't use \headitemfont since the parsing differs
\the\everytab % for the first item \the\everytab % for the first item
@ -6755,6 +6755,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\ifnum\romancount=0 \global\romancount=\pagecount \fi \ifnum\romancount=0 \global\romancount=\pagecount \fi
} }
% \raggedbottom in plain.tex hardcodes \topskip so override it
\catcode`\@=11
\def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
\catcode`\@=\other
% redefined for the two-volume lispref. We always output on % redefined for the two-volume lispref. We always output on
% \jobname.toc even if this is redefined. % \jobname.toc even if this is redefined.
% %
@ -7115,7 +7120,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% collide with the section heading. % collide with the section heading.
\ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
% %
\setbox\groupbox=\vbox\bgroup \setbox\groupbox=\vtop\bgroup
\baselineskip=0pt\parskip=0pt\lineskip=0pt \baselineskip=0pt\parskip=0pt\lineskip=0pt
\carttop \carttop
\hbox\bgroup \hbox\bgroup
@ -7801,6 +7806,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% Print arguments. Use slanted for @def*, typewriter for @deftype*. % Print arguments. Use slanted for @def*, typewriter for @deftype*.
\def\defunargs#1{% \def\defunargs#1{%
\df \ifdoingtypefn \tt \else \sl \fi \df \ifdoingtypefn \tt \else \sl \fi
\ifflagclear{txicodevaristt}{}%
{\def\var##1{{\setregularquotes \ttsl ##1}}}%
#1% #1%
} }
@ -9311,6 +9318,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\imagexxx #1,,,,,\finish \imagexxx #1,,,,,\finish
\fi \fi
} }
% Approximate height of a line in the standard text font.
\newdimen\capheight
\setbox0=\vbox{\tenrm H}
\capheight=\ht0
% %
% Arguments to @image: % Arguments to @image:
% #1 is (mandatory) image filename; we tack on .eps extension. % #1 is (mandatory) image filename; we tack on .eps extension.
@ -9340,7 +9353,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% %
% Place image in a \vtop for a top page margin that is (close to) correct, % Place image in a \vtop for a top page margin that is (close to) correct,
% as \topskip glue is relative to the first baseline. % as \topskip glue is relative to the first baseline.
\vtop\bgroup\hrule height 0pt\vskip-\parskip \vtop\bgroup \kern -\capheight \vskip-\parskip
\fi \fi
% %
% Enter horizontal mode so that indentation from an enclosing % Enter horizontal mode so that indentation from an enclosing
@ -11217,13 +11230,9 @@ directory should work if nowhere else does.}
% %
\vsize = #1\relax \vsize = #1\relax
\advance\vsize by \topskip \advance\vsize by \topskip
\outervsize = \vsize
\advance\outervsize by 2\topandbottommargin
\txipageheight = \vsize \txipageheight = \vsize
% %
\hsize = #2\relax \hsize = #2\relax
\outerhsize = \hsize
\advance\outerhsize by 0.5in
\txipagewidth = \hsize \txipagewidth = \hsize
% %
\normaloffset = #4\relax \normaloffset = #4\relax

View file

@ -19,7 +19,6 @@
#include "acl.h" #include "acl.h"
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
/* All systems define the ACL related API in <sys/acl.h>. */ /* All systems define the ACL related API in <sys/acl.h>. */

View file

@ -20,7 +20,6 @@
#ifndef _GL_ACL_H #ifndef _GL_ACL_H
#define _GL_ACL_H 1 #define _GL_ACL_H 1
#include <stdbool.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>

27
lib/assert.in.h Normal file
View file

@ -0,0 +1,27 @@
/* Substitute for and wrapper around <assert.h>
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Do not guard the include, since <assert.h> is supposed to define
the assert macro each time it is included. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#@INCLUDE_NEXT@ @NEXT_ASSERT_H@
/* The definition of static_assert is copied here. */

View file

@ -23,8 +23,6 @@
#ifndef C_CTYPE_H #ifndef C_CTYPE_H
#define C_CTYPE_H #define C_CTYPE_H
#include <stdbool.h>
#ifndef _GL_INLINE_HEADER_BEGIN #ifndef _GL_INLINE_HEADER_BEGIN
#error "Please include config.h first." #error "Please include config.h first."
#endif #endif

View file

@ -30,7 +30,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <stdbool.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>

View file

@ -15,8 +15,6 @@
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <stdbool.h>
/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
or clear the flag if VALUE is false. or clear the flag if VALUE is false.
Return 0 on success, or -1 on error with 'errno' set. Return 0 on success, or -1 on error with 'errno' set.

View file

@ -20,7 +20,6 @@
#include "close-stream.h" #include "close-stream.h"
#include <errno.h> #include <errno.h>
#include <stdbool.h>
#include "fpending.h" #include "fpending.h"

View file

@ -43,13 +43,17 @@ extern "C" {
# define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ # define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \
return x ? BUILTIN (x) : CHAR_BIT * sizeof x; return x ? BUILTIN (x) : CHAR_BIT * sizeof x;
#elif _MSC_VER #elif _MSC_VER
# pragma intrinsic _BitScanReverse # pragma intrinsic (_BitScanReverse)
# pragma intrinsic _BitScanReverse64 # if defined _M_X64
# pragma intrinsic (_BitScanReverse64)
# endif
# define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ # define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \
do \ do \
{ \ { \
unsigned long result; \ unsigned long result; \
return MSC_BUILTIN (&result, x) ? result : CHAR_BIT * sizeof x; \ if (MSC_BUILTIN (&result, x)) \
return CHAR_BIT * sizeof x - 1 - result; \
return CHAR_BIT * sizeof x; \
} \ } \
while (0) while (0)
#else #else
@ -109,8 +113,18 @@ count_leading_zeros_l (unsigned long int x)
COUNT_LEADING_ZEROS_INLINE int COUNT_LEADING_ZEROS_INLINE int
count_leading_zeros_ll (unsigned long long int x) count_leading_zeros_ll (unsigned long long int x)
{ {
#if (defined _MSC_VER && !defined __clang__) && !defined _M_X64
/* 32-bit MSVC does not have _BitScanReverse64, only _BitScanReverse. */
unsigned long result;
if (_BitScanReverse (&result, (unsigned long) (x >> 32)))
return CHAR_BIT * sizeof x - 1 - 32 - result;
if (_BitScanReverse (&result, (unsigned long) x))
return CHAR_BIT * sizeof x - 1 - result;
return CHAR_BIT * sizeof x;
#else
COUNT_LEADING_ZEROS (__builtin_clzll, _BitScanReverse64, COUNT_LEADING_ZEROS (__builtin_clzll, _BitScanReverse64,
unsigned long long int); unsigned long long int);
#endif
} }
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -43,8 +43,10 @@ extern "C" {
# define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ # define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \
return x ? BUILTIN (x) : CHAR_BIT * sizeof x; return x ? BUILTIN (x) : CHAR_BIT * sizeof x;
#elif _MSC_VER #elif _MSC_VER
# pragma intrinsic _BitScanForward # pragma intrinsic (_BitScanForward)
# pragma intrinsic _BitScanForward64 # if defined _M_X64
# pragma intrinsic (_BitScanForward64)
# endif
# define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ # define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \
do \ do \
{ \ { \
@ -101,8 +103,18 @@ count_trailing_zeros_l (unsigned long int x)
COUNT_TRAILING_ZEROS_INLINE int COUNT_TRAILING_ZEROS_INLINE int
count_trailing_zeros_ll (unsigned long long int x) count_trailing_zeros_ll (unsigned long long int x)
{ {
#if (defined _MSC_VER && !defined __clang__) && !defined _M_X64
/* 32-bit MSVC does not have _BitScanForward64, only _BitScanForward. */
unsigned long result;
if (_BitScanForward (&result, (unsigned long) x))
return result;
if (_BitScanForward (&result, (unsigned long) (x >> 32)))
return result + 32;
return CHAR_BIT * sizeof x;
#else
COUNT_TRAILING_ZEROS (__builtin_ctzll, _BitScanForward64, COUNT_TRAILING_ZEROS (__builtin_ctzll, _BitScanForward64,
unsigned long long int); unsigned long long int);
#endif
} }
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -70,7 +70,6 @@
Before including this file, you also need to include: Before including this file, you also need to include:
#include <limits.h> #include <limits.h>
#include <stdbool.h>
#include "minmax.h" #include "minmax.h"
*/ */

View file

@ -20,11 +20,9 @@
#include <config.h> #include <config.h>
#include "filevercmp.h" #include "filevercmp.h"
#include <stdbool.h>
#include <c-ctype.h> #include <c-ctype.h>
#include <limits.h> #include <limits.h>
#include <idx.h> #include <idx.h>
#include <verify.h>
/* Return the length of a prefix of S that corresponds to the suffix /* Return the length of a prefix of S that corresponds to the suffix
defined by this extended regular expression in the C locale: defined by this extended regular expression in the C locale:
@ -75,7 +73,7 @@ order (char const *s, idx_t pos, idx_t len)
return -2; return -2;
else else
{ {
verify (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2); static_assert (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2);
return c + UCHAR_MAX + 1; return c + UCHAR_MAX + 1;
} }
} }

View file

@ -22,7 +22,6 @@
# define FSUSAGE_H_ # define FSUSAGE_H_
# include <stdint.h> # include <stdint.h>
# include <stdbool.h>
struct fs_usage struct fs_usage
{ {

View file

@ -82,7 +82,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
# include <sys/types.h> # include <sys/types.h>

View file

@ -23,7 +23,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h>
#include <unistd.h> #include <unistd.h>
#if defined _WIN32 && ! defined __CYGWIN__ #if defined _WIN32 && ! defined __CYGWIN__

View file

@ -180,6 +180,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
AR = @AR@ AR = @AR@
ARFLAGS = @ARFLAGS@ ARFLAGS = @ARFLAGS@
ASSERT_H = @ASSERT_H@
AUTO_DEPEND = @AUTO_DEPEND@ AUTO_DEPEND = @AUTO_DEPEND@
AWK = @AWK@ AWK = @AWK@
BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
@ -307,6 +308,7 @@ GL_COND_OBJ_TIME_RZ_CONDITION = @GL_COND_OBJ_TIME_RZ_CONDITION@
GL_COND_OBJ_TIME_R_CONDITION = @GL_COND_OBJ_TIME_R_CONDITION@ GL_COND_OBJ_TIME_R_CONDITION = @GL_COND_OBJ_TIME_R_CONDITION@
GL_COND_OBJ_UTIMENSAT_CONDITION = @GL_COND_OBJ_UTIMENSAT_CONDITION@ GL_COND_OBJ_UTIMENSAT_CONDITION = @GL_COND_OBJ_UTIMENSAT_CONDITION@
GL_GENERATE_ALLOCA_H_CONDITION = @GL_GENERATE_ALLOCA_H_CONDITION@ GL_GENERATE_ALLOCA_H_CONDITION = @GL_GENERATE_ALLOCA_H_CONDITION@
GL_GENERATE_ASSERT_H_CONDITION = @GL_GENERATE_ASSERT_H_CONDITION@
GL_GENERATE_BYTESWAP_H_CONDITION = @GL_GENERATE_BYTESWAP_H_CONDITION@ GL_GENERATE_BYTESWAP_H_CONDITION = @GL_GENERATE_BYTESWAP_H_CONDITION@
GL_GENERATE_ERRNO_H_CONDITION = @GL_GENERATE_ERRNO_H_CONDITION@ GL_GENERATE_ERRNO_H_CONDITION = @GL_GENERATE_ERRNO_H_CONDITION@
GL_GENERATE_EXECINFO_H_CONDITION = @GL_GENERATE_EXECINFO_H_CONDITION@ GL_GENERATE_EXECINFO_H_CONDITION = @GL_GENERATE_EXECINFO_H_CONDITION@
@ -1440,6 +1442,39 @@ EXTRA_DIST += allocator.h
endif endif
## end gnulib module allocator ## end gnulib module allocator
## begin gnulib module assert-h
ifeq (,$(OMIT_GNULIB_MODULE_assert-h))
BUILT_SOURCES += $(ASSERT_H)
# We need the following in order to create <assert.h> when the system
# doesn't have one that works with the given compiler.
ifneq (,$(GL_GENERATE_ASSERT_H_CONDITION))
assert.h: assert.in.h verify.h $(top_builddir)/config.status
$(gl_V_at){ $(SED_HEADER_STDOUT) \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ASSERT_H''@|$(NEXT_ASSERT_H)|g' \
< $(srcdir)/assert.in.h && \
sed -e '/@assert.h omit start@/,/@assert.h omit end@/d' \
-e 's|_gl_verify|_gl_static_assert|g' \
-e 's|_GL_VERIFY|_GL_STATIC_ASSERT|g' \
-e 's|_GL\(_STATIC_ASSERT_H\)|_GL\1|g' \
< $(srcdir)/verify.h; \
} > $@-t
$(AM_V_at)mv $@-t $@
else
assert.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += assert.h assert.h-t
EXTRA_DIST += assert.in.h verify.h
endif
## end gnulib module assert-h
## begin gnulib module at-internal ## begin gnulib module at-internal
ifeq (,$(OMIT_GNULIB_MODULE_at-internal)) ifeq (,$(OMIT_GNULIB_MODULE_at-internal))

View file

@ -94,7 +94,6 @@
#ifndef _DYNARRAY_H #ifndef _DYNARRAY_H
#define _DYNARRAY_H #define _DYNARRAY_H
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>

View file

@ -27,7 +27,6 @@
#endif #endif
#include "md5.h" #include "md5.h"
#include <stdalign.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>

View file

@ -1,8 +1,9 @@
/* mini-gmp, a minimalistic implementation of a GNU GMP subset. /* mini-gmp, a minimalistic implementation of a GNU GMP subset.
Contributed to the GNU project by Niels Möller Contributed to the GNU project by Niels Möller
Additional functionalities and improvements by Marco Bodrato.
Copyright 1991-1997, 1999-2021 Free Software Foundation, Inc. Copyright 1991-1997, 1999-2022 Free Software Foundation, Inc.
This file is part of the GNU MP Library. This file is part of the GNU MP Library.
@ -3098,7 +3099,7 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
if (en == 0) if (en == 0)
{ {
mpz_set_ui (r, 1); mpz_set_ui (r, mpz_cmpabs_ui (m, 1));
return; return;
} }

View file

@ -23,9 +23,7 @@
#include <time.h> #include <time.h>
#include "intprops.h" #include "intprops.h"
#include "verify.h"
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/select.h> #include <sys/select.h>
@ -59,7 +57,7 @@ nanosleep (const struct timespec *requested_delay,
{ {
/* Verify that time_t is large enough. */ /* Verify that time_t is large enough. */
verify (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60); static_assert (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60);
const time_t limit = 24 * 24 * 60 * 60; const time_t limit = 24 * 24 * 60 * 60;
time_t seconds = requested_delay->tv_sec; time_t seconds = requested_delay->tv_sec;
struct timespec intermediate; struct timespec intermediate;

View file

@ -65,7 +65,6 @@ extern char *tzname[];
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include "attribute.h" #include "attribute.h"
#include <intprops.h> #include <intprops.h>

View file

@ -24,7 +24,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <stdbool.h>
#ifndef _GL_INLINE_HEADER_BEGIN #ifndef _GL_INLINE_HEADER_BEGIN
#error "Please include config.h first." #error "Please include config.h first."

View file

@ -23,7 +23,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "binary-io.h" #include "binary-io.h"
#include "verify.h"
#if GNULIB_defined_O_NONBLOCK #if GNULIB_defined_O_NONBLOCK
# include "nonblocking.h" # include "nonblocking.h"
@ -95,7 +94,7 @@ pipe2 (int fd[2], int flags)
} }
# else # else
{ {
verify (O_NONBLOCK == 0); static_assert (O_NONBLOCK == 0);
} }
# endif # endif

View file

@ -23,10 +23,8 @@
#if !HAVE_RAWMEMCHR #if !HAVE_RAWMEMCHR
# include <limits.h> # include <limits.h>
# include <stdalign.h>
# include <stdint.h> # include <stdint.h>
# include "verify.h"
/* Find the first occurrence of C in S. */ /* Find the first occurrence of C in S. */
void * void *
@ -36,7 +34,7 @@ rawmemchr (const void *s, int c_in)
typedef uintptr_t longword; typedef uintptr_t longword;
/* If you change the "uintptr_t", you should change UINTPTR_WIDTH to match. /* If you change the "uintptr_t", you should change UINTPTR_WIDTH to match.
This verifies that the type does not have padding bits. */ This verifies that the type does not have padding bits. */
verify (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword)); static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword));
const unsigned char *char_ptr; const unsigned char *char_ptr;
unsigned char c = c_in; unsigned char c = c_in;

View file

@ -29,7 +29,6 @@
#include <locale.h> #include <locale.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#ifndef _LIBC #ifndef _LIBC

View file

@ -29,7 +29,6 @@
#endif #endif
#include "sha1.h" #include "sha1.h"
#include <stdalign.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>

View file

@ -28,7 +28,6 @@
#endif #endif
#include "sha256.h" #include "sha256.h"
#include <stdalign.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>

View file

@ -28,7 +28,6 @@
#endif #endif
#include "sha512.h" #include "sha512.h"
#include <stdalign.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>

View file

@ -55,13 +55,21 @@
#ifndef _@GUARD_PREFIX@_SIGNAL_H #ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _@GUARD_PREFIX@_SIGNAL_H #define _@GUARD_PREFIX@_SIGNAL_H
/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android, /* For testing the OpenBSD version. */
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
&& defined __OpenBSD__
# include <sys/param.h>
#endif
/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, OSF/1 4.0, Solaris 2.6, Android,
OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>. OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>.
But avoid namespace pollution on glibc systems.*/ But avoid namespace pollution on glibc systems.*/
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
&& ((defined __APPLE__ && defined __MACH__) \ && ((defined __APPLE__ && defined __MACH__) \
|| defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \ || (defined __FreeBSD__ && __FreeBSD__ < 8) \
|| defined __sun || defined __ANDROID__ || defined __KLIBC__) \ || (defined __OpenBSD__ && OpenBSD < 201205) \
|| defined __osf__ || defined __sun || defined __ANDROID__ \
|| defined __KLIBC__) \
&& ! defined __GLIBC__ && ! defined __GLIBC__
# include <pthread.h> # include <pthread.h>
#endif #endif

View file

@ -42,10 +42,7 @@
'-malign-double' is used. '-malign-double' is used.
The result cannot be used as a value for an 'enum' constant, if you The result cannot be used as a value for an 'enum' constant, if you
want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
Include <stddef.h> for offsetof. */
#include <stddef.h>
/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other /* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
standard headers, defines conflicting implementations of _Alignas standard headers, defines conflicting implementations of _Alignas
@ -61,17 +58,19 @@
&& !defined __clang__) \ && !defined __clang__) \
|| (defined __clang__ && __clang_major__ < 8)) || (defined __clang__ && __clang_major__ < 8))
# ifdef __cplusplus # ifdef __cplusplus
# if 201103 <= __cplusplus # if (201103 <= __cplusplus || defined _MSC_VER)
# define _Alignof(type) alignof (type) # define _Alignof(type) alignof (type)
# else # else
template <class __t> struct __alignof_helper { char __a; __t __b; }; template <class __t> struct __alignof_helper { char __a; __t __b; };
# define _Alignof(type) offsetof (__alignof_helper<type>, __b) # define _Alignof(type) offsetof (__alignof_helper<type>, __b)
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif # endif
# else # else
# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif # endif
#endif #endif
#if ! (defined __cplusplus && 201103 <= __cplusplus) #if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))
# define alignof _Alignof # define alignof _Alignof
#endif #endif
#define __alignof_is_defined 1 #define __alignof_is_defined 1
@ -102,7 +101,7 @@
*/ */
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
# if defined __cplusplus && 201103 <= __cplusplus # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)
# define _Alignas(a) alignas (a) # define _Alignas(a) alignas (a)
# elif (!defined __attribute__ \ # elif (!defined __attribute__ \
&& ((defined __APPLE__ && defined __MACH__ \ && ((defined __APPLE__ && defined __MACH__ \
@ -116,12 +115,19 @@
# define _Alignas(a) __declspec (align (a)) # define _Alignas(a) __declspec (align (a))
# endif # endif
#endif #endif
#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \ #if ((defined _Alignas \
&& !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
# define alignas _Alignas # define alignas _Alignas
#endif #endif
#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus) #if (defined alignas \
|| (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)))
# define __alignas_is_defined 1 # define __alignas_is_defined 1
#endif #endif
/* Include <stddef.h> if needed for offsetof. */
#if _GL_STDALIGN_NEEDS_STDDEF
# include <stddef.h>
#endif
#endif /* _GL_STDALIGN_H */ #endif /* _GL_STDALIGN_H */

View file

@ -20,8 +20,6 @@
#include "intprops-internal.h" #include "intprops-internal.h"
#include <stdbool.h>
/* Store into *R the low-order bits of A + B, A - B, A * B, respectively. /* Store into *R the low-order bits of A + B, A - B, A * B, respectively.
Return 1 if the result overflows, 0 otherwise. Return 1 if the result overflows, 0 otherwise.
A, B, and *R can have any integer type other than char, bool, a A, B, and *R can have any integer type other than char, bool, a

View file

@ -226,7 +226,7 @@ _GL_FUNCDECL_SYS (aligned_alloc, void *,
_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
# endif # endif
# endif # endif
# if @HAVE_ALIGNED_ALLOC@ # if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
_GL_CXXALIASWARN (aligned_alloc); _GL_CXXALIASWARN (aligned_alloc);
# endif # endif
#else #else
@ -1363,7 +1363,9 @@ _GL_CXXALIAS_SYS (strtol, long,
(const char *restrict string, char **restrict endptr, (const char *restrict string, char **restrict endptr,
int base)); int base));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strtol); _GL_CXXALIASWARN (strtol);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef strtol # undef strtol
# if HAVE_RAW_DECL_STRTOL # if HAVE_RAW_DECL_STRTOL
@ -1444,7 +1446,9 @@ _GL_CXXALIAS_SYS (strtoul, unsigned long,
(const char *restrict string, char **restrict endptr, (const char *restrict string, char **restrict endptr,
int base)); int base));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strtoul); _GL_CXXALIASWARN (strtoul);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef strtoul # undef strtoul
# if HAVE_RAW_DECL_STRTOUL # if HAVE_RAW_DECL_STRTOUL

View file

@ -943,7 +943,9 @@ _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
_GL_ARG_NONNULL ((1))); _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mbslen); _GL_CXXALIASWARN (mbslen);
# endif
#endif #endif
#if @GNULIB_MBSNLEN@ #if @GNULIB_MBSNLEN@

View file

@ -25,8 +25,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "verify.h"
#ifdef UNSIGNED #ifdef UNSIGNED
# ifndef HAVE_DECL_STRTOULL # ifndef HAVE_DECL_STRTOULL
"this configure-time declaration test was not run" "this configure-time declaration test was not run"
@ -62,7 +60,7 @@ long long int strtoll (char const *, char **, int);
Int Int
Strtoimax (char const *ptr, char **endptr, int base) Strtoimax (char const *ptr, char **endptr, int base)
{ {
verify (sizeof (Int) == sizeof (Unsigned long int) static_assert (sizeof (Int) == sizeof (Unsigned long int)
|| sizeof (Int) == sizeof (Unsigned long long int)); || sizeof (Int) == sizeof (Unsigned long long int));
if (sizeof (Int) != sizeof (Unsigned long int)) if (sizeof (Int) != sizeof (Unsigned long int))

View file

@ -84,7 +84,9 @@ _GL_FUNCDECL_SYS (getrandom, ssize_t,
_GL_CXXALIAS_SYS (getrandom, ssize_t, _GL_CXXALIAS_SYS (getrandom, ssize_t,
(void *buffer, size_t length, unsigned int flags)); (void *buffer, size_t length, unsigned int flags));
# endif # endif
# if __GLIBC__ + (__GLIBC_MINOR__ >= 25) > 2
_GL_CXXALIASWARN (getrandom); _GL_CXXALIASWARN (getrandom);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef getrandom # undef getrandom
# if HAVE_RAW_DECL_GETRANDOM # if HAVE_RAW_DECL_GETRANDOM

View file

@ -82,9 +82,10 @@
of 'struct timeval', and no definition of this type. of 'struct timeval', and no definition of this type.
Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select() Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
in <sys/time.h>. in <sys/time.h>.
But avoid namespace pollution on glibc systems and "unknown type But avoid namespace pollution on glibc systems, a circular include
name" problems on Cygwin. */ <sys/select.h> -> <sys/time.h> -> <sys/select.h> on FreeBSD 13.1, and
# if !(defined __GLIBC__ || defined __CYGWIN__) "unknown type name" problems on Cygwin. */
# if !(defined __GLIBC__ || defined __FreeBSD__ || defined __CYGWIN__)
# include <sys/time.h> # include <sys/time.h>
# endif # endif
@ -287,7 +288,9 @@ _GL_CXXALIAS_SYS_CAST (pselect, int,
struct timespec const *restrict, struct timespec const *restrict,
const sigset_t *restrict)); const sigset_t *restrict));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (pselect); _GL_CXXALIASWARN (pselect);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef pselect # undef pselect
# if HAVE_RAW_DECL_PSELECT # if HAVE_RAW_DECL_PSELECT

View file

@ -596,44 +596,6 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
#endif #endif
#if @GNULIB_LSTAT@
# if ! @HAVE_LSTAT@
/* mingw does not support symlinks, therefore it does not have lstat. But
without links, stat does just fine. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lstat stat
# endif
_GL_CXXALIAS_RPL_1 (lstat, stat, int,
(const char *restrict name, struct stat *restrict buf));
# elif @REPLACE_LSTAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef lstat
# define lstat rpl_lstat
# endif
_GL_FUNCDECL_RPL (lstat, int,
(const char *restrict name, struct stat *restrict buf)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (lstat, int,
(const char *restrict name, struct stat *restrict buf));
# else
_GL_CXXALIAS_SYS (lstat, int,
(const char *restrict name, struct stat *restrict buf));
# endif
# if @HAVE_LSTAT@
_GL_CXXALIASWARN (lstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
# undef lstat
# define lstat lstat_used_without_requesting_gnulib_module_lstat
#elif defined GNULIB_POSIXCHECK
# undef lstat
# if HAVE_RAW_DECL_LSTAT
_GL_WARN_ON_USE (lstat, "lstat is unportable - "
"use gnulib module lstat for portability");
# endif
#endif
#if @GNULIB_MKDIR@ #if @GNULIB_MKDIR@
# if @REPLACE_MKDIR@ # if @REPLACE_MKDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@ -895,6 +857,44 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
#endif #endif
#if @GNULIB_LSTAT@
# if ! @HAVE_LSTAT@
/* mingw does not support symlinks, therefore it does not have lstat. But
without links, stat does just fine. */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lstat stat
# endif
_GL_CXXALIAS_RPL_1 (lstat, stat, int,
(const char *restrict name, struct stat *restrict buf));
# elif @REPLACE_LSTAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef lstat
# define lstat rpl_lstat
# endif
_GL_FUNCDECL_RPL (lstat, int,
(const char *restrict name, struct stat *restrict buf)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (lstat, int,
(const char *restrict name, struct stat *restrict buf));
# else
_GL_CXXALIAS_SYS (lstat, int,
(const char *restrict name, struct stat *restrict buf));
# endif
# if @HAVE_LSTAT@
_GL_CXXALIASWARN (lstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
# undef lstat
# define lstat lstat_used_without_requesting_gnulib_module_lstat
#elif defined GNULIB_POSIXCHECK
# undef lstat
# if HAVE_RAW_DECL_LSTAT
_GL_WARN_ON_USE (lstat, "lstat is unportable - "
"use gnulib module lstat for portability");
# endif
#endif
#if @GNULIB_MDA_UMASK@ #if @GNULIB_MDA_UMASK@
/* On native Windows, map 'umask' to '_umask', so that -loldnames is not /* On native Windows, map 'umask' to '_umask', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between required. In C++ with GNULIB_NAMESPACE, avoid differences between

View file

@ -20,7 +20,6 @@
# include "tempname.h" # include "tempname.h"
#endif #endif
#include <stdbool.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>

View file

@ -435,9 +435,11 @@ _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
# endif # endif
# if defined GNULIB_POSIXCHECK # if defined GNULIB_POSIXCHECK
# undef asctime_r # undef asctime_r
# if HAVE_RAW_DECL_ASCTIME_R
_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
"better use strftime (or even sprintf) instead"); "better use strftime (or even sprintf) instead");
# endif # endif
# endif
# if defined GNULIB_POSIXCHECK # if defined GNULIB_POSIXCHECK
# undef ctime # undef ctime
_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
@ -445,8 +447,10 @@ _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
# endif # endif
# if defined GNULIB_POSIXCHECK # if defined GNULIB_POSIXCHECK
# undef ctime_r # undef ctime_r
# if HAVE_RAW_DECL_CTIME_R
_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - "
"better use strftime (or even sprintf) instead"); "better use strftime (or even sprintf) instead");
# endif # endif
# endif
#endif #endif

View file

@ -27,7 +27,6 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -1143,7 +1143,9 @@ _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
# endif # endif
_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
# endif # endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getdomainname); _GL_CXXALIASWARN (getdomainname);
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# undef getdomainname # undef getdomainname
# if HAVE_RAW_DECL_GETDOMAINNAME # if HAVE_RAW_DECL_GETDOMAINNAME
@ -2055,7 +2057,7 @@ _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
# else # else
# if defined __hpux /* HP-UX */ # if defined __hpux /* HP-UX */
_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
# elif defined __sun && !defined _XPG4 /* Solaris */ # elif defined __sun && (defined __SunOS_5_10 || defined __XOPEN_OR_POSIX) && !defined _XPG4 /* Solaris */
_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
# else # else
_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));

View file

@ -26,7 +26,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>

View file

@ -25,19 +25,19 @@
works as per C11. This is supported by GCC 4.6.0+ and by clang 4+. works as per C11. This is supported by GCC 4.6.0+ and by clang 4+.
Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as
per C2x. This is supported by GCC 9.1+. per C23. This is supported by GCC 9.1+.
Support compilers claiming conformance to the relevant standard, Support compilers claiming conformance to the relevant standard,
and also support GCC when not pedantic. If we were willing to slow and also support GCC when not pedantic. If we were willing to slow
'configure' down we could also use it with other compilers, but 'configure' down we could also use it with other compilers, but
since this affects only the quality of diagnostics, why bother? */ since this affects only the quality of diagnostics, why bother? */
#ifndef __cplusplus #ifndef __cplusplus
# if (201112L <= __STDC_VERSION__ \ # if (201112 <= __STDC_VERSION__ \
|| (!defined __STRICT_ANSI__ \ || (!defined __STRICT_ANSI__ \
&& (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__)))
# define _GL_HAVE__STATIC_ASSERT 1 # define _GL_HAVE__STATIC_ASSERT 1
# endif # endif
# if (202000L <= __STDC_VERSION__ \ # if (202000 <= __STDC_VERSION__ \
|| (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) || (!defined __STRICT_ANSI__ && 9 <= __GNUC__))
# define _GL_HAVE__STATIC_ASSERT1 1 # define _GL_HAVE__STATIC_ASSERT1 1
# endif # endif
@ -202,12 +202,12 @@ template <int w>
This macro requires three or more arguments but uses at most the first This macro requires three or more arguments but uses at most the first
two, so that the _Static_assert macro optionally defined below supports two, so that the _Static_assert macro optionally defined below supports
both the C11 two-argument syntax and the C2x one-argument syntax. both the C11 two-argument syntax and the C23 one-argument syntax.
Unfortunately, unlike C11, this implementation must appear as an Unfortunately, unlike C11, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */ ordinary declaration, and cannot appear inside struct { ... }. */
#if 200410 <= __cpp_static_assert #if 202311 <= __STDC_VERSION__ || 200410 <= __cpp_static_assert
# define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC) # define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC)
#elif defined _GL_HAVE__STATIC_ASSERT #elif defined _GL_HAVE__STATIC_ASSERT
# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC)
@ -223,12 +223,31 @@ template <int w>
/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
#ifdef _GL_STATIC_ASSERT_H #ifdef _GL_STATIC_ASSERT_H
# if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert # if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert
# define _Static_assert(...) \ # define _Static_assert(R, ...) \
_GL_VERIFY (__VA_ARGS__, "static assertion failed", -) _GL_VERIFY ((R), "static assertion failed", -)
# endif # endif
# if __cpp_static_assert < 201411 && !defined static_assert # if (!defined static_assert \
&& __STDC_VERSION__ < 202311 \
&& (!defined __cplusplus \
|| (__cpp_static_assert < 201411 \
&& __GNUG__ < 6 && __clang_major__ < 6)))
# if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__
/* MSVC 14 in C++ mode supports the two-arguments static_assert but not
the one-argument static_assert, and it does not support _Static_assert.
We have to play preprocessor tricks to distinguish the two cases.
Since the MSVC preprocessor is not ISO C compliant (cf.
<https://stackoverflow.com/questions/5134523/>), the solution is specific
to MSVC. */
# define _GL_EXPAND(x) x
# define _GL_SA1(a1) static_assert ((a1), "static assertion failed")
# define _GL_SA2 static_assert
# define _GL_SA3 static_assert
# define _GL_SA_PICK(x1,x2,x3,x4,...) x4
# define static_assert(...) _GL_EXPAND(_GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1)) (__VA_ARGS__)
# else
# define static_assert _Static_assert /* C11 requires this #define. */ # define static_assert _Static_assert /* C11 requires this #define. */
# endif # endif
# endif
#endif #endif
/* @assert.h omit start@ */ /* @assert.h omit start@ */
@ -303,7 +322,7 @@ template <int w>
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER #elif 1200 <= _MSC_VER
# define assume(R) __assume (R) # define assume(R) __assume (R)
#elif 202311L <= __STDC_VERSION__ #elif 202311 <= __STDC_VERSION__
# include <stddef.h> # include <stddef.h>
# define assume(R) ((R) ? (void) 0 : unreachable ()) # define assume(R) ((R) ? (void) 0 : unreachable ())
#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP #elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP

60
m4/assert_h.m4 Normal file
View file

@ -0,0 +1,60 @@
# assert-h.m4
dnl Copyright (C) 2011-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
AC_DEFUN([gl_ASSERT_H],
[
AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
[gl_save_CFLAGS=$CFLAGS
for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do
AS_CASE([$gl_working],
[*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#if defined __clang__ && __STDC_VERSION__ < 202311
#pragma clang diagnostic error "-Wc2x-extensions"
#endif
#ifdef INCLUDE_ASSERT_H
#include <assert.h>
#endif
static_assert (2 + 2 == 4, "arithmetic does not work");
static_assert (2 + 2 == 4);
]],
[[
static_assert (sizeof (char) == 1, "sizeof does not work");
static_assert (sizeof (char) == 1);
]])],
[gl_cv_static_assert=$gl_working],
[gl_cv_static_assert=no])
CFLAGS=$gl_save_CFLAGS
test "$gl_cv_static_assert" != no && break
done])
GL_GENERATE_ASSERT_H=false
AS_CASE([$gl_cv_static_assert],
[yes*keyword*],
[AC_DEFINE([HAVE_C_STATIC_ASSERT], [1],
[Define to 1 if the static_assert keyword works.])],
[no],
[GL_GENERATE_ASSERT_H=true
gl_NEXT_HEADERS([assert.h])])
dnl The "zz" puts this toward config.h's end, to avoid potential
dnl collisions with other definitions. #undef assert so that
dnl programs are not tempted to use it without specifically
dnl including assert.h. Break the #undef apart with a comment
dnl so that 'configure' does not comment it out.
AH_VERBATIM([zzstatic_assert],
[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \
&& (!defined __cplusplus \
|| (__cpp_static_assert < 201411 \
&& __GNUG__ < 6 && __clang_major__ < 6)))
#include <assert.h>
#undef/**/assert
#endif])
])

View file

@ -1,4 +1,4 @@
# gettime.m4 serial 11 # gettime.m4 serial 12
dnl Copyright (C) 2002, 2004-2006, 2009-2022 Free Software Foundation, Inc. dnl Copyright (C) 2002, 2004-2006, 2009-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -9,7 +9,34 @@ AC_DEFUN([gl_GETTIME],
dnl Prerequisites of lib/gettime.c. dnl Prerequisites of lib/gettime.c.
AC_REQUIRE([gl_CLOCK_TIME]) AC_REQUIRE([gl_CLOCK_TIME])
AC_REQUIRE([gl_TIMESPEC]) AC_REQUIRE([gl_TIMESPEC])
AC_CHECK_FUNCS_ONCE([timespec_get])
AC_REQUIRE([gl_CHECK_FUNC_TIMESPEC_GET])
if test $gl_cv_func_timespec_get = yes; then
AC_DEFINE([HAVE_TIMESPEC_GET], [1],
[Define if you have the timespec_get function.])
fi
])
dnl Tests whether the function timespec_get exists.
dnl Sets gl_cv_func_timespec_get.
AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET],
[
dnl Persuade OpenBSD <time.h> to declare timespec_get().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl We can't use AC_CHECK_FUNC here, because timespec_get() is defined as a
dnl static inline function in <time.h> on MSVC 14.
AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <time.h>
struct timespec ts;
]],
[[return timespec_get (&ts, 0);]])
],
[gl_cv_func_timespec_get=yes],
[gl_cv_func_timespec_get=no])
])
]) ])
AC_DEFUN([gl_GETTIME_RES], AC_DEFUN([gl_GETTIME_RES],

View file

@ -1,4 +1,4 @@
# gnulib-common.m4 serial 73 # gnulib-common.m4 serial 74
dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -115,7 +115,7 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_HAS_C_ATTRIBUTE(attr) 0 # define _GL_HAS_C_ATTRIBUTE(attr) 0
#endif #endif
]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
[ [
/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
is the size of the returned memory block. is the size of the returned memory block.

View file

@ -46,6 +46,7 @@ AC_DEFUN([gl_EARLY],
# Code from module acl-permissions: # Code from module acl-permissions:
# Code from module alloca-opt: # Code from module alloca-opt:
# Code from module allocator: # Code from module allocator:
# Code from module assert-h:
# Code from module at-internal: # Code from module at-internal:
# Code from module attribute: # Code from module attribute:
# Code from module binary-io: # Code from module binary-io:
@ -122,8 +123,8 @@ AC_DEFUN([gl_EARLY],
# Code from module intprops: # Code from module intprops:
# Code from module inttypes-incomplete: # Code from module inttypes-incomplete:
# Code from module largefile: # Code from module largefile:
AC_REQUIRE([AC_SYS_LARGEFILE])
AC_REQUIRE([gl_YEAR2038_EARLY]) AC_REQUIRE([gl_YEAR2038_EARLY])
AC_REQUIRE([AC_SYS_LARGEFILE])
# Code from module lchmod: # Code from module lchmod:
# Code from module libc-config: # Code from module libc-config:
# Code from module libgmp: # Code from module libgmp:
@ -233,6 +234,9 @@ AC_DEFUN([gl_INIT],
gl_FUNC_ALLOCA gl_FUNC_ALLOCA
gl_CONDITIONAL_HEADER([alloca.h]) gl_CONDITIONAL_HEADER([alloca.h])
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
gl_ASSERT_H
gl_CONDITIONAL_HEADER([assert.h])
AC_PROG_MKDIR_P
gl___BUILTIN_EXPECT gl___BUILTIN_EXPECT
gl_BYTESWAP gl_BYTESWAP
gl_CONDITIONAL_HEADER([byteswap.h]) gl_CONDITIONAL_HEADER([byteswap.h])
@ -1214,6 +1218,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/allocator.c lib/allocator.c
lib/allocator.h lib/allocator.h
lib/arg-nonnull.h lib/arg-nonnull.h
lib/assert.in.h
lib/at-func.c lib/at-func.c
lib/attribute.h lib/attribute.h
lib/binary-io.c lib/binary-io.c
@ -1420,6 +1425,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/absolute-header.m4 m4/absolute-header.m4
m4/acl.m4 m4/acl.m4
m4/alloca.m4 m4/alloca.m4
m4/assert_h.m4
m4/builtin-expect.m4 m4/builtin-expect.m4
m4/byteswap.m4 m4/byteswap.m4
m4/canonicalize.m4 m4/canonicalize.m4

View file

@ -1,4 +1,4 @@
# serial 41 # serial 42
dnl From Jim Meyering. dnl From Jim Meyering.
dnl Check for the nanosleep function. dnl Check for the nanosleep function.
@ -100,15 +100,22 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
#else /* A simpler test for native Windows. */ #else /* A simpler test for native Windows. */
if (nanosleep (&ts_sleep, &ts_remaining) < 0) if (nanosleep (&ts_sleep, &ts_remaining) < 0)
return 3; return 3;
/* Test for 32-bit mingw bug: negative nanosecond values do not
cause failure. */
ts_sleep.tv_sec = 1;
ts_sleep.tv_nsec = -1;
if (nanosleep (&ts_sleep, &ts_remaining) != -1)
return 7;
#endif #endif
return 0; return 0;
}]])], }]])],
[gl_cv_func_nanosleep=yes], [gl_cv_func_nanosleep=yes],
[case $? in dnl ( [case $? in
4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl ( 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)' ;;
*) gl_cv_func_nanosleep=no;; 7) gl_cv_func_nanosleep='no (mishandles negative tv_nsec)' ;;
*) gl_cv_func_nanosleep=no ;;
esac], esac],
[case "$host_os" in dnl (( [case "$host_os" in
linux*) # Guess it halfway works when the kernel is Linux. linux*) # Guess it halfway works when the kernel is Linux.
gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;; gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;;
mingw*) # Guess no on native Windows. mingw*) # Guess no on native Windows.

View file

@ -1,4 +1,4 @@
# Check for stdalign.h that conforms to C11. # Check for alignas and alignof that conform to C23.
dnl Copyright 2011-2022 Free Software Foundation, Inc. dnl Copyright 2011-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
@ -9,12 +9,18 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_STDALIGN_H], AC_DEFUN([gl_STDALIGN_H],
[ [
AC_CACHE_CHECK([for working stdalign.h], AC_CACHE_CHECK([for alignas and alignof],
[gl_cv_header_working_stdalign_h], [gl_cv_header_working_stdalign_h],
[AC_COMPILE_IFELSE( [gl_save_CFLAGS=$CFLAGS
for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do
AS_CASE([$gl_working],
[*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM( [AC_LANG_PROGRAM(
[[#include <stdint.h> [[#include <stdint.h>
#ifdef INCLUDE_STDALIGN_H
#include <stdalign.h> #include <stdalign.h>
#endif
#include <stddef.h> #include <stddef.h>
/* Test that alignof yields a result consistent with offsetof. /* Test that alignof yields a result consistent with offsetof.
@ -30,7 +36,7 @@ AC_DEFUN([gl_STDALIGN_H],
char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1];
char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1];
/* Test _Alignas only on platforms where gnulib can help. */ /* Test alignas only on platforms where gnulib can help. */
#if \ #if \
((defined __cplusplus && 201103 <= __cplusplus) \ ((defined __cplusplus && 201103 <= __cplusplus) \
|| (__TINYC__ && defined __attribute__) \ || (__TINYC__ && defined __attribute__) \
@ -45,12 +51,84 @@ AC_DEFUN([gl_STDALIGN_H],
? 1 : -1]; ? 1 : -1];
#endif #endif
]])], ]])],
[gl_cv_header_working_stdalign_h=yes], [gl_cv_header_working_stdalign_h=$gl_working],
[gl_cv_header_working_stdalign_h=no])]) [gl_cv_header_working_stdalign_h=no])
CFLAGS=$gl_save_CFLAGS
test "$gl_cv_header_working_stdalign_h" != no && break
done])
if test $gl_cv_header_working_stdalign_h = yes; then
GL_GENERATE_STDALIGN_H=false GL_GENERATE_STDALIGN_H=false
else AS_CASE([$gl_cv_header_working_stdalign_h],
GL_GENERATE_STDALIGN_H=true [no],
fi [GL_GENERATE_STDALIGN_H=true],
[yes*keyword*],
[AC_DEFINE([HAVE_C_ALIGNASOF], [1],
[Define to 1 if the alignas and alignof keywords work.])])
AC_CHECK_HEADERS_ONCE([stdalign.h])
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
# include <stdalign.h>
# else
/* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */
# ifndef _GL_STDALIGN_H
# define _GL_STDALIGN_H
# undef _Alignas
# undef _Alignof
# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
|| (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
&& !defined __clang__) \
|| (defined __clang__ && __clang_major__ < 8))
# ifdef __cplusplus
# if (201103 <= __cplusplus || defined _MSC_VER)
# define _Alignof(type) alignof (type)
# else
template <class __t> struct __alignof_helper { char __a; __t __b; };
# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
# else
# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
# endif
# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))
# define alignof _Alignof
# endif
# define __alignof_is_defined 1
# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)
# define _Alignas(a) alignas (a)
# elif (!defined __attribute__ \
&& ((defined __APPLE__ && defined __MACH__ \
? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
: __GNUC__ && !defined __ibmxl__) \
|| (4 <= __clang_major__) \
|| (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
|| __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__))
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
# elif 1300 <= _MSC_VER
# define _Alignas(a) __declspec (align (a))
# endif
# endif
# if ((defined _Alignas \
&& !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
# define alignas _Alignas
# endif
# if (defined alignas \
|| (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)))
# define __alignas_is_defined 1
# endif
# if _GL_STDALIGN_NEEDS_STDDEF
# include <stddef.h>
# endif
# endif /* _GL_STDALIGN_H */
# endif
#endif])
]) ])

View file

@ -2,7 +2,7 @@
# Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc. # Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc.
# serial 19 # serial 20
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -19,6 +19,12 @@ AC_DEFUN_ONCE([gl_TIME_H],
gl_NEXT_HEADERS([time.h]) gl_NEXT_HEADERS([time.h])
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
#include <time.h>
]], [asctime_r ctime_r])
AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_C_RESTRICT])
AC_CACHE_CHECK([for TIME_UTC in <time.h>], AC_CACHE_CHECK([for TIME_UTC in <time.h>],