mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
Update from Gnulib by running admin/merge-gnulib
In addition to the automatic changes, also do the following, needed due to recent Gnulib changes. * admin/merge-gnulib (AVOIDED_MODULES): Add btoc32, c32_apply_type_test, c32_get_type_test, c32isalnum, c32rtomb, c32tolower, c32toupper, localeinfo, mbrtoc32-regular. Remove btowc, iswctype, mbrtowc, wcrtomb, wctype, wctype-h. Also remove iswblank, iswdigit, iswxdigit, locale-h, raise, stdarg-h, some of which perhaps could have been removed earlier. * configure.ac (_REGEX_AVOID_UCHAR_H): New macro.
This commit is contained in:
parent
6fb6a4f76d
commit
834ff524f9
66 changed files with 3317 additions and 1173 deletions
|
|
@ -58,14 +58,18 @@ GNULIB_MODULES='
|
|||
'
|
||||
|
||||
AVOIDED_MODULES='
|
||||
access btowc chmod close crypto/af_alg dup fchdir fstat gnulib-i18n
|
||||
iswblank iswctype iswdigit iswxdigit langinfo-h libgmp-mpq
|
||||
localcharset locale-h localename-unsafe-limited lock
|
||||
mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo
|
||||
openat-die opendir pthread-h raise
|
||||
save-cwd select setenv sigprocmask stat std-gnu11 stdarg-h strncpy
|
||||
access btoc32
|
||||
c32_apply_type_test c32_get_type_test
|
||||
c32isalnum c32rtomb c32tolower c32toupper
|
||||
chmod close crypto/af_alg dup fchdir fstat gnulib-i18n
|
||||
langinfo-h libgmp-mpq
|
||||
localcharset localeinfo localename-unsafe-limited lock
|
||||
mbrtoc32-regular mbsinit memchr mkdir
|
||||
msvc-inval msvc-nothrow nl_langinfo
|
||||
openat-die opendir pthread-h
|
||||
save-cwd select setenv sigprocmask stat std-gnu11 strncpy
|
||||
threadlib tzset unsetenv utime utime-h
|
||||
wchar-h wcrtomb wctype wctype-h
|
||||
wchar-h uchar-h
|
||||
'
|
||||
|
||||
GNULIB_TOOL_FLAGS='
|
||||
|
|
|
|||
17
build-aux/config.guess
vendored
17
build-aux/config.guess
vendored
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2026 Free Software Foundation, Inc.
|
||||
|
||||
# shellcheck disable=SC2006,SC2268 # see below for rationale
|
||||
|
||||
timestamp='2025-07-10'
|
||||
timestamp='2026-05-17'
|
||||
|
||||
# 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
|
||||
|
|
@ -60,7 +60,7 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
Copyright 1992-2026 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
|
@ -150,7 +150,7 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
|||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case $UNAME_SYSTEM in
|
||||
Linux|GNU|GNU/*)
|
||||
Ironclad|Linux|GNU|GNU/*)
|
||||
LIBC=unknown
|
||||
|
||||
set_cc_for_build
|
||||
|
|
@ -167,6 +167,8 @@ Linux|GNU|GNU/*)
|
|||
LIBC=gnu
|
||||
#elif defined(__LLVM_LIBC__)
|
||||
LIBC=llvm
|
||||
#elif defined(__mlibc__)
|
||||
LIBC=mlibc
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
/* First heuristic to detect musl libc. */
|
||||
|
|
@ -1186,6 +1188,9 @@ EOF
|
|||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
;;
|
||||
sw_64:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
;;
|
||||
tile*:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
;;
|
||||
|
|
@ -1598,10 +1603,10 @@ EOF
|
|||
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
|
||||
;;
|
||||
x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*)
|
||||
GUESS=$UNAME_MACHINE-pc-ironclad-mlibc
|
||||
GUESS=$UNAME_MACHINE-pc-ironclad-$LIBC
|
||||
;;
|
||||
*:[Ii]ronclad:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc
|
||||
GUESS=$UNAME_MACHINE-unknown-ironclad-$LIBC
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
11
build-aux/config.sub
vendored
11
build-aux/config.sub
vendored
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2026 Free Software Foundation, Inc.
|
||||
|
||||
# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale
|
||||
|
||||
timestamp='2025-07-10'
|
||||
timestamp='2026-05-17'
|
||||
|
||||
# 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
|
||||
|
|
@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2025 Free Software Foundation, Inc.
|
||||
Copyright 1992-2026 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
|
@ -1432,6 +1432,7 @@ case $cpu-$vendor in
|
|||
| sparcv9v \
|
||||
| spu \
|
||||
| sv1 \
|
||||
| sw_64 \
|
||||
| sx* \
|
||||
| tahoe \
|
||||
| thumbv7* \
|
||||
|
|
@ -1525,7 +1526,7 @@ EOF
|
|||
;;
|
||||
ironclad*)
|
||||
kernel=ironclad
|
||||
os=`echo "$basic_os" | sed -e 's|ironclad|mlibc|'`
|
||||
os=`echo "$basic_os" | sed -e 's|ironclad|gnu|'`
|
||||
;;
|
||||
linux*)
|
||||
kernel=linux
|
||||
|
|
@ -2220,7 +2221,7 @@ case $kernel-$os-$obj in
|
|||
;;
|
||||
uclinux-uclibc*- | uclinux-gnu*- )
|
||||
;;
|
||||
ironclad-mlibc*-)
|
||||
ironclad-gnu*- | ironclad-mlibc*- )
|
||||
;;
|
||||
managarm-mlibc*- | managarm-kernel*- )
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -1615,6 +1615,10 @@ AC_DEFUN([gt_TYPE_WINT_T],
|
|||
AC_DEFUN([gl_TYPE_OFF64_T],
|
||||
[HAVE_OFF64_T=1
|
||||
AC_SUBST([HAVE_OFF64_T])])
|
||||
# Emacs does not want Gnulib's fixes for glibc bug 20381 or for
|
||||
# Unicode-compatible case matching, as that brings in too many Gnulib files.
|
||||
AC_DEFINE([_REGEX_AVOID_UCHAR_H], [1],
|
||||
[Define to 1 so that the Gnulib regex module does not use Gnulib uchar-h.])
|
||||
|
||||
# Initialize gnulib right after choosing the compiler.
|
||||
dnl Amongst other things, this sets AR and ARFLAGS.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
% Load plain if necessary, i.e., if running under initex.
|
||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||
%
|
||||
\def\texinfoversion{2025-12-23.13}
|
||||
\def\texinfoversion{2026-04-26.12}
|
||||
%
|
||||
% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
|
||||
%
|
||||
|
|
@ -348,7 +348,6 @@
|
|||
% before the \shipout runs.
|
||||
%
|
||||
\atdummies % don't expand commands in the output.
|
||||
\turnoffactive
|
||||
\shipout\vbox{%
|
||||
% Do this early so pdf references go to the beginning of the page.
|
||||
\ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
|
||||
|
|
@ -5321,14 +5320,13 @@
|
|||
\def\indexisfl{fl}
|
||||
|
||||
% Definition for writing index entry sort key.
|
||||
{
|
||||
\catcode`\-=13
|
||||
\gdef\indexwritesortas{%
|
||||
\def\indexwritesortas{%
|
||||
\begingroup
|
||||
\indexnonalnumreappear
|
||||
\indexwritesortasxxx}
|
||||
\gdef\indexwritesortasxxx#1{%
|
||||
\xdef\indexsortkey{#1}\endgroup}
|
||||
\indexwritesortasxxx
|
||||
}
|
||||
\def\indexwritesortasxxx#1{%
|
||||
\xdef\indexsortkey{#1}\endgroup
|
||||
}
|
||||
|
||||
\def\indexwriteseealso#1{
|
||||
|
|
@ -5359,6 +5357,51 @@
|
|||
\expandafter\doindexsegment#1\subentry\finish\subentry
|
||||
}
|
||||
|
||||
% \checksortas\segment
|
||||
% Call \indexwritesortas if a @sortas command appears in the segment
|
||||
\def\checksortas#1{
|
||||
\let\sortas\relax
|
||||
\expandafter\checksortasx#1\relax\sortas{}\sortas
|
||||
}
|
||||
\def\checksortasx#1\sortas#2#3\sortas{%
|
||||
\def\tmp{#3}%
|
||||
\ifx\tmp\empty\else
|
||||
\indexwritesortas{#2}%
|
||||
\fi
|
||||
}
|
||||
|
||||
% \checkseealso\segment
|
||||
% Call \indexwriteseealso if a @seealso command appears in the segment
|
||||
\def\checkseealso#1{
|
||||
\let\seealso\relax
|
||||
\expandafter\checkseealsox#1\relax\seealso{}\seealso
|
||||
}
|
||||
\def\checkseealsox#1\seealso#2#3\seealso{%
|
||||
\def\tmp{#3}%
|
||||
\ifx\tmp\empty\else
|
||||
\indexwriteseealso{#2}%
|
||||
\fi
|
||||
}
|
||||
|
||||
% \checkseeentry\segment
|
||||
% Call \indexwriteseeentry if a @seeentry command appears in the segment
|
||||
\def\checkseeentry#1{
|
||||
\let\seeentry\relax
|
||||
\expandafter\checkseeentryx#1\relax\seeentry{}\seeentry
|
||||
}
|
||||
\def\checkseeentryx#1\seeentry#2#3\seeentry{%
|
||||
\def\tmp{#3}%
|
||||
\ifx\tmp\empty\else
|
||||
\indexwriteseeentry{#2}%
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\extractindexcommands#1{%
|
||||
\checksortas#1%
|
||||
\checkseealso#1%
|
||||
\checkseeentry#1%
|
||||
}
|
||||
|
||||
% append the results from the next segment
|
||||
\def\doindexsegment#1\subentry{%
|
||||
\def\segment{#1}%
|
||||
|
|
@ -5378,9 +5421,6 @@
|
|||
% Get the string to sort by. Process the segment with all
|
||||
% font commands turned off.
|
||||
\bgroup
|
||||
\let\sortas\indexwritesortas
|
||||
\let\seealso\indexwriteseealso
|
||||
\let\seeentry\indexwriteseeentry
|
||||
\indexnofonts
|
||||
% The braces around the commands are recognized by texindex.
|
||||
\def\lbracechar{{\string\indexlbrace}}%
|
||||
|
|
@ -5394,11 +5434,10 @@
|
|||
%
|
||||
\let\indexsortkey\empty
|
||||
\global\let\pagenumbertext\empty
|
||||
% Execute the segment and throw away the typeset output. This executes
|
||||
% any @sortas or @seealso commands in this segment.
|
||||
\setbox\dummybox = \hbox{\segment}%
|
||||
\extractindexcommands\segment
|
||||
\ifx\indexsortkey\empty{%
|
||||
\indexnonalnumdisappear
|
||||
\inindexsortkeytrue
|
||||
\xdef\trimmed{\segment}%
|
||||
\xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
|
||||
\xdef\indexsortkey{\trimmed}%
|
||||
|
|
@ -5419,7 +5458,6 @@
|
|||
\fi
|
||||
}
|
||||
\def\isfinish{\finish}%
|
||||
\newbox\dummybox % used above
|
||||
|
||||
\let\subentry\relax
|
||||
|
||||
|
|
@ -7007,6 +7045,7 @@
|
|||
\newdimen\curchapmax
|
||||
\newdimen\cursecmax
|
||||
\newdimen\curssecmax
|
||||
\newbox\dummybox % used above
|
||||
|
||||
|
||||
% set #1 to the maximum section width for #2
|
||||
|
|
@ -10231,6 +10270,15 @@
|
|||
\global\righthyphenmin = #3\relax
|
||||
}
|
||||
|
||||
% @documentlanguagevariant - do nothing
|
||||
\parseargdef\documentlanguagevariant{}
|
||||
|
||||
% @documentscript - do nothing
|
||||
% This command would only become relevant if we had translations in
|
||||
% multiple "scripts", e.g. Sebian in both Latin and Cyrillic alphabets.
|
||||
% However, we do not even support loading Cyrillic fonts.
|
||||
\parseargdef\documentscript{}
|
||||
|
||||
% XeTeX and LuaTeX can handle Unicode natively.
|
||||
% Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
|
||||
% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
|
||||
|
|
@ -10673,6 +10721,38 @@
|
|||
\newif\ifutfviiidefinedwarning
|
||||
\utfviiidefinedwarningtrue
|
||||
|
||||
% Macros to output a string to sort a multibyte UTF-8 sequence by.
|
||||
% Check if there is a special definition to be used in the index
|
||||
% sort key for a character.
|
||||
% Output the sequence as-is, surrounded by curly braces. The braces are
|
||||
% to help texindex find the first character regardless of locale character
|
||||
% encoding or version of awk used to run texindex.
|
||||
\gdef\UTFviiiSortkeyTwo#1#2{%
|
||||
\expandafter\ifx\csname sort:#1#2\endcsname\relax
|
||||
{\string #1\string #2}%
|
||||
\else
|
||||
\csname sort:#1#2\endcsname
|
||||
\fi
|
||||
}
|
||||
\gdef\UTFviiiSortkeyThree#1#2#3{%
|
||||
\expandafter\ifx\csname sort:#1#2#3\endcsname\relax
|
||||
{\string #1\string #2\string #3}%
|
||||
\else
|
||||
\csname sort:#1#2#3\endcsname
|
||||
\fi
|
||||
}
|
||||
\gdef\UTFviiiSortkeyFour#1#2#3#4{%
|
||||
\expandafter\ifx\csname sort:#1#2#3#4\endcsname\relax
|
||||
{\string #1\string #2\string #3\string #4}%
|
||||
\else
|
||||
\csname sort:#1#2#3#4\endcsname
|
||||
\fi
|
||||
}
|
||||
|
||||
% We use this with the \ifindexsortkey condition to expand and discard
|
||||
% an \else block in the containing conditional.
|
||||
\def\swapnestedfi#1\fi{\fi\expandafter#1\expandafter}
|
||||
|
||||
% Give non-ASCII bytes the active definitions for processing UTF-8 sequences
|
||||
\begingroup
|
||||
\catcode`\~13
|
||||
|
|
@ -10691,8 +10771,8 @@
|
|||
\expandafter\UTFviiiLoop
|
||||
\fi}
|
||||
%
|
||||
% For bytes other than the first in a UTF-8 sequence. Not expected to
|
||||
% be expanded except when writing to auxiliary files.
|
||||
% UTF-8 continuation bytes (10XX XXXX) or unused (hex C1, C2).
|
||||
% Not expected to be expanded except when writing to auxiliary files.
|
||||
\countUTFx = "80
|
||||
\countUTFy = "C2
|
||||
\def\UTFviiiTmp{%
|
||||
|
|
@ -10704,7 +10784,9 @@
|
|||
\countUTFy = "E0
|
||||
\def\UTFviiiTmp{%
|
||||
\gdef~{%
|
||||
\ifpassthroughchars $%
|
||||
\ifpassthroughchars
|
||||
\ifinindexsortkey\swapnestedfi\UTFviiiSortkeyTwo\fi
|
||||
$%
|
||||
\else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
|
||||
\UTFviiiLoop
|
||||
|
||||
|
|
@ -10712,7 +10794,9 @@
|
|||
\countUTFy = "F0
|
||||
\def\UTFviiiTmp{%
|
||||
\gdef~{%
|
||||
\ifpassthroughchars $%
|
||||
\ifpassthroughchars
|
||||
\ifinindexsortkey\swapnestedfi\UTFviiiSortkeyThree\fi
|
||||
$%
|
||||
\else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
|
||||
\UTFviiiLoop
|
||||
|
||||
|
|
@ -10720,7 +10804,9 @@
|
|||
\countUTFy = "F4
|
||||
\def\UTFviiiTmp{%
|
||||
\gdef~{%
|
||||
\ifpassthroughchars $%
|
||||
\ifpassthroughchars
|
||||
\ifinindexsortkey\swapnestedfi\UTFviiiSortkeyFour\fi
|
||||
$%
|
||||
\else\expandafter\UTFviiiFourOctets\expandafter$\fi
|
||||
}}%
|
||||
\UTFviiiLoop
|
||||
|
|
@ -10814,7 +10900,7 @@
|
|||
\parseXMLCharref
|
||||
%
|
||||
% Completely expand \UTFviiiTmp, which looks like:
|
||||
% 1. \UTFviiTwoOctetsName B1 B2
|
||||
% 1. \UTFviiiTwoOctetsName B1 B2
|
||||
% 2. \csname u8:B1 \string B2 \endcsname
|
||||
% 3. \u8: B1 B2 (a single control sequence token)
|
||||
\xdef\UTFviiiTmp{\UTFviiiTmp}%
|
||||
|
|
@ -10891,6 +10977,55 @@
|
|||
\uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
|
||||
\endgroup
|
||||
|
||||
% Used in \DefineSortKey as temporary definitions of \UTFviiiTwoOctetsName etc.
|
||||
% Use \expandafter\noexpand to prevent excessive expansion if \DefineSortKey is
|
||||
% called more than once for the same codepoint.
|
||||
\def\UTFviiiSortTwoOctetsName#1#2{%
|
||||
\expandafter\noexpand\csname sort:#1\string #2\endcsname}%
|
||||
\def\UTFviiiSortThreeOctetsName#1#2#3{%
|
||||
\expandafter\noexpand\csname sort:#1\string #2\string #3\endcsname}%
|
||||
\def\UTFviiiSortFourOctetsName#1#2#3#4{%
|
||||
\expandafter\noexpand\csname sort:#1\string #2\string #3\string #4\endcsname}%
|
||||
|
||||
% To be used in translation files to provide strings to be output
|
||||
% in the index sort key where a character occurs.
|
||||
\def\DefineSortKey#1#2{%
|
||||
\countUTFz = "#1\relax
|
||||
\parseXMLCharref
|
||||
\def\tmp{#2}%
|
||||
\expandafter\let\csname usort:#1\endcsname\tmp
|
||||
\bgroup
|
||||
\let\UTFviiiTwoOctetsName\UTFviiiSortTwoOctetsName
|
||||
\let\UTFviiiThreeOctetsName\UTFviiiSortThreeOctetsName
|
||||
\let\UTFviiiFourOctetsName\UTFviiiSortFourOctetsName
|
||||
%
|
||||
% Expand \UTFviiiTmp fully, which looks like:
|
||||
% 1. \UTFviiiTwoOctetsName B1 B2
|
||||
% 2. \expandafter\noexpand\csname sort:B1 \string B2 \endcsname
|
||||
% 3. \noexpand\sort: B1 B2
|
||||
% 4. \sort: B1 B2 (a single control sequence token)
|
||||
%
|
||||
\xdef\UTFviiiTmp{\UTFviiiTmp}%
|
||||
\egroup
|
||||
\expandafter\gdef\UTFviiiTmp{#2}%
|
||||
}
|
||||
|
||||
% this could be used as follows
|
||||
%\DefineSortKey{00F1}{nzzz} % n tilde - sort between n and o
|
||||
%\DefineSortKey{00D1}{Nzzz} % N tilde - sort between n and o
|
||||
|
||||
% Can be used in place of \DeclareUnicodeCharacter where the value for
|
||||
% the character is completely expandable when writing to indices:
|
||||
% Good: \DeclareUnicodeCharacterSK{00C9}{\'E}
|
||||
% (\' expands to empty string)
|
||||
% Bad: \DeclareUnicodeCharacterSK{03BB}{\ensuremath\lambda}%
|
||||
% (\ensuremath expands to junk)
|
||||
\def\DeclareUnicodeCharacterSK#1#2{%
|
||||
\DeclareUnicodeCharacter{#1}{#2}%
|
||||
\DefineSortKey{#1}{#2}%
|
||||
}
|
||||
|
||||
|
||||
% For native Unicode handling (XeTeX and LuaTeX),
|
||||
% provide a definition macro that sets a catcode to `other' non-globally
|
||||
%
|
||||
|
|
@ -11054,73 +11189,73 @@
|
|||
\DeclareUnicodeCharacter{00BE}{$3\over4$}%
|
||||
\DeclareUnicodeCharacter{00BF}{\questiondown}%
|
||||
%
|
||||
\DeclareUnicodeCharacter{00C0}{\`A}%
|
||||
\DeclareUnicodeCharacter{00C1}{\'A}%
|
||||
\DeclareUnicodeCharacter{00C2}{\^A}%
|
||||
\DeclareUnicodeCharacter{00C3}{\~A}%
|
||||
\DeclareUnicodeCharacter{00C4}{\"A}%
|
||||
\DeclareUnicodeCharacter{00C5}{\AA}%
|
||||
\DeclareUnicodeCharacter{00C6}{\AE}%
|
||||
\DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
|
||||
\DeclareUnicodeCharacter{00C8}{\`E}%
|
||||
\DeclareUnicodeCharacter{00C9}{\'E}%
|
||||
\DeclareUnicodeCharacter{00CA}{\^E}%
|
||||
\DeclareUnicodeCharacter{00CB}{\"E}%
|
||||
\DeclareUnicodeCharacter{00CC}{\`I}%
|
||||
\DeclareUnicodeCharacter{00CD}{\'I}%
|
||||
\DeclareUnicodeCharacter{00CE}{\^I}%
|
||||
\DeclareUnicodeCharacter{00CF}{\"I}%
|
||||
\DeclareUnicodeCharacterSK{00C0}{\`A}%
|
||||
\DeclareUnicodeCharacterSK{00C1}{\'A}%
|
||||
\DeclareUnicodeCharacterSK{00C2}{\^A}%
|
||||
\DeclareUnicodeCharacterSK{00C3}{\~A}%
|
||||
\DeclareUnicodeCharacterSK{00C4}{\"A}%
|
||||
\DeclareUnicodeCharacterSK{00C5}{\AA}%
|
||||
\DeclareUnicodeCharacterSK{00C6}{\AE}%
|
||||
\DeclareUnicodeCharacterSK{00C7}{\cedilla{C}}%
|
||||
\DeclareUnicodeCharacterSK{00C8}{\`E}%
|
||||
\DeclareUnicodeCharacterSK{00C9}{\'E}%
|
||||
\DeclareUnicodeCharacterSK{00CA}{\^E}%
|
||||
\DeclareUnicodeCharacterSK{00CB}{\"E}%
|
||||
\DeclareUnicodeCharacterSK{00CC}{\`I}%
|
||||
\DeclareUnicodeCharacterSK{00CD}{\'I}%
|
||||
\DeclareUnicodeCharacterSK{00CE}{\^I}%
|
||||
\DeclareUnicodeCharacterSK{00CF}{\"I}%
|
||||
%
|
||||
\DeclareUnicodeCharacter{00D0}{\DH}%
|
||||
\DeclareUnicodeCharacter{00D1}{\~N}%
|
||||
\DeclareUnicodeCharacter{00D2}{\`O}%
|
||||
\DeclareUnicodeCharacter{00D3}{\'O}%
|
||||
\DeclareUnicodeCharacter{00D4}{\^O}%
|
||||
\DeclareUnicodeCharacter{00D5}{\~O}%
|
||||
\DeclareUnicodeCharacter{00D6}{\"O}%
|
||||
\DeclareUnicodeCharacterSK{00D0}{\DH}%
|
||||
\DeclareUnicodeCharacterSK{00D1}{\~N}%
|
||||
\DeclareUnicodeCharacterSK{00D2}{\`O}%
|
||||
\DeclareUnicodeCharacterSK{00D3}{\'O}%
|
||||
\DeclareUnicodeCharacterSK{00D4}{\^O}%
|
||||
\DeclareUnicodeCharacterSK{00D5}{\~O}%
|
||||
\DeclareUnicodeCharacterSK{00D6}{\"O}%
|
||||
\DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
|
||||
\DeclareUnicodeCharacter{00D8}{\O}%
|
||||
\DeclareUnicodeCharacter{00D9}{\`U}%
|
||||
\DeclareUnicodeCharacter{00DA}{\'U}%
|
||||
\DeclareUnicodeCharacter{00DB}{\^U}%
|
||||
\DeclareUnicodeCharacter{00DC}{\"U}%
|
||||
\DeclareUnicodeCharacter{00DD}{\'Y}%
|
||||
\DeclareUnicodeCharacterSK{00D8}{\O}%
|
||||
\DeclareUnicodeCharacterSK{00D9}{\`U}%
|
||||
\DeclareUnicodeCharacterSK{00DA}{\'U}%
|
||||
\DeclareUnicodeCharacterSK{00DB}{\^U}%
|
||||
\DeclareUnicodeCharacterSK{00DC}{\"U}%
|
||||
\DeclareUnicodeCharacterSK{00DD}{\'Y}%
|
||||
\DeclareUnicodeCharacter{00DE}{\TH}%
|
||||
\DeclareUnicodeCharacter{00DF}{\ss}%
|
||||
\DeclareUnicodeCharacterSK{00DF}{\ss}%
|
||||
%
|
||||
\DeclareUnicodeCharacter{00E0}{\`a}%
|
||||
\DeclareUnicodeCharacter{00E1}{\'a}%
|
||||
\DeclareUnicodeCharacter{00E2}{\^a}%
|
||||
\DeclareUnicodeCharacter{00E3}{\~a}%
|
||||
\DeclareUnicodeCharacter{00E4}{\"a}%
|
||||
\DeclareUnicodeCharacter{00E5}{\aa}%
|
||||
\DeclareUnicodeCharacter{00E6}{\ae}%
|
||||
\DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
|
||||
\DeclareUnicodeCharacter{00E8}{\`e}%
|
||||
\DeclareUnicodeCharacter{00E9}{\'e}%
|
||||
\DeclareUnicodeCharacter{00EA}{\^e}%
|
||||
\DeclareUnicodeCharacter{00EB}{\"e}%
|
||||
\DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacterSK{00E0}{\`a}%
|
||||
\DeclareUnicodeCharacterSK{00E1}{\'a}%
|
||||
\DeclareUnicodeCharacterSK{00E2}{\^a}%
|
||||
\DeclareUnicodeCharacterSK{00E3}{\~a}%
|
||||
\DeclareUnicodeCharacterSK{00E4}{\"a}%
|
||||
\DeclareUnicodeCharacterSK{00E5}{\aa}%
|
||||
\DeclareUnicodeCharacterSK{00E6}{\ae}%
|
||||
\DeclareUnicodeCharacterSK{00E7}{\cedilla{c}}%
|
||||
\DeclareUnicodeCharacterSK{00E8}{\`e}%
|
||||
\DeclareUnicodeCharacterSK{00E9}{\'e}%
|
||||
\DeclareUnicodeCharacterSK{00EA}{\^e}%
|
||||
\DeclareUnicodeCharacterSK{00EB}{\"e}%
|
||||
\DeclareUnicodeCharacterSK{00EC}{\`{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacterSK{00ED}{\'{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacterSK{00EE}{\^{\dotless{i}}}%
|
||||
\DeclareUnicodeCharacterSK{00EF}{\"{\dotless{i}}}%
|
||||
%
|
||||
\DeclareUnicodeCharacter{00F0}{\dh}%
|
||||
\DeclareUnicodeCharacter{00F1}{\~n}%
|
||||
\DeclareUnicodeCharacter{00F2}{\`o}%
|
||||
\DeclareUnicodeCharacter{00F3}{\'o}%
|
||||
\DeclareUnicodeCharacter{00F4}{\^o}%
|
||||
\DeclareUnicodeCharacter{00F5}{\~o}%
|
||||
\DeclareUnicodeCharacter{00F6}{\"o}%
|
||||
\DeclareUnicodeCharacterSK{00F0}{\dh}%
|
||||
\DeclareUnicodeCharacterSK{00F1}{\~n}%
|
||||
\DeclareUnicodeCharacterSK{00F2}{\`o}%
|
||||
\DeclareUnicodeCharacterSK{00F3}{\'o}%
|
||||
\DeclareUnicodeCharacterSK{00F4}{\^o}%
|
||||
\DeclareUnicodeCharacterSK{00F5}{\~o}%
|
||||
\DeclareUnicodeCharacterSK{00F6}{\"o}%
|
||||
\DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
|
||||
\DeclareUnicodeCharacter{00F8}{\o}%
|
||||
\DeclareUnicodeCharacter{00F9}{\`u}%
|
||||
\DeclareUnicodeCharacter{00FA}{\'u}%
|
||||
\DeclareUnicodeCharacter{00FB}{\^u}%
|
||||
\DeclareUnicodeCharacter{00FC}{\"u}%
|
||||
\DeclareUnicodeCharacter{00FD}{\'y}%
|
||||
\DeclareUnicodeCharacterSK{00F8}{\o}%
|
||||
\DeclareUnicodeCharacterSK{00F9}{\`u}%
|
||||
\DeclareUnicodeCharacterSK{00FA}{\'u}%
|
||||
\DeclareUnicodeCharacterSK{00FB}{\^u}%
|
||||
\DeclareUnicodeCharacterSK{00FC}{\"u}%
|
||||
\DeclareUnicodeCharacterSK{00FD}{\'y}%
|
||||
\DeclareUnicodeCharacter{00FE}{\th}%
|
||||
\DeclareUnicodeCharacter{00FF}{\"y}%
|
||||
\DeclareUnicodeCharacterSK{00FF}{\"y}%
|
||||
%
|
||||
\DeclareUnicodeCharacter{0100}{\=A}%
|
||||
\DeclareUnicodeCharacter{0101}{\=a}%
|
||||
|
|
@ -11719,6 +11854,9 @@
|
|||
\newif\ifpassthroughchars
|
||||
\passthroughcharsfalse
|
||||
|
||||
\newif\ifinindexsortkey
|
||||
\inindexsortkeyfalse
|
||||
|
||||
% For native Unicode handling (XeTeX and LuaTeX),
|
||||
% provide a definition macro to replace/pass-through a Unicode character
|
||||
%
|
||||
|
|
@ -11730,7 +11868,15 @@
|
|||
\uccode`\~="##2\relax
|
||||
\uppercase{\gdef~}{%
|
||||
\ifpassthroughchars
|
||||
##1%
|
||||
\ifinindexsortkey
|
||||
\expandafter\ifx\csname usort:#1\endcsname\relax
|
||||
{##1}%
|
||||
\else
|
||||
\csname usort:#1\endcsname
|
||||
\fi
|
||||
\else
|
||||
##1%
|
||||
\fi
|
||||
\else
|
||||
##3%
|
||||
\fi
|
||||
|
|
|
|||
|
|
@ -249,17 +249,19 @@ struct permission_context {
|
|||
|
||||
# elif defined GETACL /* Solaris, Cygwin < 2.5 */
|
||||
int count;
|
||||
aclent_t *entries;
|
||||
aclent_t *entries
|
||||
_GL_ATTRIBUTE_COUNTED_BY (count);
|
||||
# ifdef ACE_GETACL
|
||||
int ace_count;
|
||||
ace_t *ace_entries;
|
||||
ace_t *ace_entries
|
||||
_GL_ATTRIBUTE_COUNTED_BY (ace_count);
|
||||
# endif
|
||||
|
||||
# elif HAVE_GETACL /* HP-UX */
|
||||
struct acl_entry entries[NACLENTRIES];
|
||||
struct acl_entry entries[NACLENTRIES] /* COUNTED_BY (count) */;
|
||||
int count;
|
||||
# if HAVE_ACLV_H
|
||||
struct acl aclv_entries[NACLVENTRIES];
|
||||
struct acl aclv_entries[NACLVENTRIES] /* COUNTED_BY (aclv_count) */;
|
||||
int aclv_count;
|
||||
# endif
|
||||
|
||||
|
|
@ -268,7 +270,7 @@ struct permission_context {
|
|||
bool have_u;
|
||||
|
||||
# elif HAVE_ACLSORT /* NonStop Kernel */
|
||||
struct acl entries[NACLENTRIES];
|
||||
struct acl entries[NACLENTRIES] /* COUNTED_BY (count) */;
|
||||
int count;
|
||||
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ struct aclinfo
|
|||
{
|
||||
/* If 'size' is nonnegative, a buffer holding the concatenation
|
||||
of extended attribute names, each terminated by NUL
|
||||
(either u.__gl_acl_ch, or heap-allocated). */
|
||||
(either u._gl_acl_ch, or heap-allocated). */
|
||||
char *buf;
|
||||
|
||||
/* The number of useful bytes at the start of buf, counting trailing NULs.
|
||||
|
|
@ -72,7 +72,7 @@ struct aclinfo
|
|||
trivial NFSv4 ACL (a size used by file-has-acl.c in 2023-2024
|
||||
but no longer relevant now), and a different value might be
|
||||
better once experience is gained. For internal use only. */
|
||||
char __gl_acl_ch[152];
|
||||
char _gl_acl_ch[152];
|
||||
} u;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@
|
|||
|
||||
/* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE,
|
||||
_GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST,
|
||||
_GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR,
|
||||
_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE,
|
||||
_GL_ATTRIBUTE_COUNTED_BY, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED,
|
||||
_GL_ATTRIBUTE_ERROR, _GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE,
|
||||
_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF,
|
||||
_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
|
||||
_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
|
||||
|
|
@ -210,6 +210,19 @@
|
|||
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
|
||||
|
||||
|
||||
/* =================== Attributes for runtime diagnostics =================== */
|
||||
|
||||
/* Attributes that provide information to the undefined-behaviour sanitizer
|
||||
(UBSAN). */
|
||||
|
||||
/* COUNTED_BY (C) declares that the number of elements of the field is given
|
||||
by C, which must be another field in the same struct.
|
||||
The programmer is responsible for guaranteeing some invariants; see
|
||||
<https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html> for details. */
|
||||
/* Applies to struct fields of type array or pointer (to data). */
|
||||
#define COUNTED_BY(c) _GL_ATTRIBUTE_COUNTED_BY (c)
|
||||
|
||||
|
||||
/* ================== Attributes for debugging information ================== */
|
||||
|
||||
/* Attributes regarding debugging information emitted by the compiler. */
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ set_binary_mode (int fd, int mode)
|
|||
with console input or console output. */
|
||||
return O_TEXT;
|
||||
else
|
||||
return __gl_setmode (fd, mode);
|
||||
return _gl_set_fd_mode (fd, mode);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ _GL_INLINE_HEADER_BEGIN
|
|||
#if O_BINARY
|
||||
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
|
||||
# include <io.h> /* declares setmode() */
|
||||
# define __gl_setmode setmode
|
||||
# define _gl_set_fd_mode setmode
|
||||
# else
|
||||
# define __gl_setmode _setmode
|
||||
# define _gl_set_fd_mode _setmode
|
||||
# undef fileno
|
||||
# define fileno _fileno
|
||||
# endif
|
||||
|
|
@ -49,7 +49,7 @@ _GL_INLINE_HEADER_BEGIN
|
|||
/* Use a function rather than a macro, to avoid gcc warnings
|
||||
"warning: statement with no effect". */
|
||||
BINARY_IO_INLINE int
|
||||
__gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode)
|
||||
_gl_set_fd_mode (_GL_UNUSED int fd, _GL_UNUSED int mode)
|
||||
{
|
||||
return O_BINARY;
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ extern int set_binary_mode (int fd, int mode);
|
|||
BINARY_IO_INLINE int
|
||||
set_binary_mode (int fd, int mode)
|
||||
{
|
||||
return __gl_setmode (fd, mode);
|
||||
return _gl_set_fd_mode (fd, mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
#if defined __linux__ || defined __ANDROID__
|
||||
|
||||
/* Store the uptime counter, as managed by the Linux kernel, in *P_UPTIME.
|
||||
|
|
@ -102,7 +100,7 @@ get_linux_boot_time_fallback (struct timespec *p_boot_time)
|
|||
modified when a user logs in, i.e. long after boot. */
|
||||
"/var/run/utmp" /* seen on Alpine Linux with OpenRC */
|
||||
};
|
||||
for (idx_t i = 0; i < SIZEOF (boot_touched_files); i++)
|
||||
for (idx_t i = 0; i < countof (boot_touched_files); i++)
|
||||
{
|
||||
const char *filename = boot_touched_files[i];
|
||||
struct stat statbuf;
|
||||
|
|
@ -214,7 +212,7 @@ get_openbsd_boot_time (struct timespec *p_boot_time)
|
|||
"/var/db/host.random",
|
||||
"/var/run/utmp"
|
||||
};
|
||||
for (idx_t i = 0; i < SIZEOF (boot_touched_files); i++)
|
||||
for (idx_t i = 0; i < countof (boot_touched_files); i++)
|
||||
{
|
||||
const char *filename = boot_touched_files[i];
|
||||
struct stat statbuf;
|
||||
|
|
@ -325,7 +323,7 @@ get_windows_boot_time (struct timespec *p_boot_time)
|
|||
"C:\\pagefile.sys"
|
||||
#endif
|
||||
};
|
||||
for (idx_t i = 0; i < SIZEOF (boot_touched_files); i++)
|
||||
for (idx_t i = 0; i < countof (boot_touched_files); i++)
|
||||
{
|
||||
const char *filename = boot_touched_files[i];
|
||||
struct stat statbuf;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
/* Specification. */
|
||||
#include "boot-time.h"
|
||||
|
||||
#include <stdcountof.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -94,7 +95,8 @@ get_boot_time_uncached (struct timespec *p_boot_time)
|
|||
Solaris' utmpname returns 1 upon success -- which is contrary
|
||||
to what the GNU libc version does. In addition, older GNU libc
|
||||
versions are actually void. */
|
||||
UTMP_NAME_FUNCTION ((char *) UTMP_FILE);
|
||||
static char const utmp_file[] = UTMP_FILE;
|
||||
UTMP_NAME_FUNCTION ((char *) utmp_file);
|
||||
|
||||
SET_UTMP_ENT ();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ extern "C" {
|
|||
The difference can matter in GNU/Linux, where times in /proc/stat
|
||||
might be relative to boot time of the host, not the container.
|
||||
|
||||
This function is not multithread-safe, since on many platforms it
|
||||
This function is not thread-safe, since on many platforms it
|
||||
invokes the functions setutxent, getutxent, endutxent.
|
||||
These functions may lock a file like /var/log/wtmp (so that we
|
||||
don't read garbage when a concurrent process writes to that file),
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@
|
|||
#error "Please include config.h first."
|
||||
#endif
|
||||
|
||||
/* Define this now, rather than after including stdint.h, in case
|
||||
stdint.h recursively includes us. This is for Gnulib endian.h. */
|
||||
/* Define this now, rather than after including stdbit.h, in case stdbit.h
|
||||
recursively includes us via stdint.h. This is for Gnulib endian.h. */
|
||||
#ifndef _GL_BYTESWAP_INLINE
|
||||
# define _GL_BYTESWAP_INLINE _GL_INLINE
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbit.h> /* for stdc_memreverse8u* */
|
||||
#include <stdint.h> /* for UINT_LEAST64_MAX */
|
||||
|
||||
_GL_INLINE_HEADER_BEGIN
|
||||
|
||||
|
|
@ -37,38 +38,12 @@ _GL_INLINE_HEADER_BEGIN
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 true
|
||||
#elif defined __has_builtin
|
||||
# if __has_builtin (__builtin_bswap16)
|
||||
# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 true
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||
# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 true
|
||||
# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 true
|
||||
#elif defined __has_builtin
|
||||
# if __has_builtin (__builtin_bswap32)
|
||||
# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 true
|
||||
# endif
|
||||
# if __has_builtin (__builtin_bswap64)
|
||||
# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 true
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Given an unsigned 16-bit argument X, return the value corresponding to
|
||||
X with reversed byte order. */
|
||||
_GL_BYTESWAP_INLINE uint_least16_t
|
||||
bswap_16 (uint_least16_t x)
|
||||
{
|
||||
#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP16
|
||||
return __builtin_bswap16 (x);
|
||||
#else
|
||||
uint_fast16_t mask = 0xff;
|
||||
return ( (x & mask << 8 * 1) >> 8 * 1
|
||||
| (x & mask << 8 * 0) << 8 * 1);
|
||||
#endif
|
||||
return stdc_memreverse8u16 (x);
|
||||
}
|
||||
|
||||
/* Given an unsigned 32-bit argument X, return the value corresponding to
|
||||
|
|
@ -76,15 +51,7 @@ bswap_16 (uint_least16_t x)
|
|||
_GL_BYTESWAP_INLINE uint_least32_t
|
||||
bswap_32 (uint_least32_t x)
|
||||
{
|
||||
#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP32
|
||||
return __builtin_bswap32 (x);
|
||||
#else
|
||||
uint_fast32_t mask = 0xff;
|
||||
return ( (x & mask << 8 * 3) >> 8 * 3
|
||||
| (x & mask << 8 * 2) >> 8 * 1
|
||||
| (x & mask << 8 * 1) << 8 * 1
|
||||
| (x & mask << 8 * 0) << 8 * 3);
|
||||
#endif
|
||||
return stdc_memreverse8u32 (x);
|
||||
}
|
||||
|
||||
#ifdef UINT_LEAST64_MAX
|
||||
|
|
@ -93,19 +60,7 @@ bswap_32 (uint_least32_t x)
|
|||
_GL_BYTESWAP_INLINE uint_least64_t
|
||||
bswap_64 (uint_least64_t x)
|
||||
{
|
||||
# ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP64
|
||||
return __builtin_bswap64 (x);
|
||||
# else
|
||||
uint_fast64_t mask = 0xff;
|
||||
return ( (x & mask << 8 * 7) >> 8 * 7
|
||||
| (x & mask << 8 * 6) >> 8 * 5
|
||||
| (x & mask << 8 * 5) >> 8 * 3
|
||||
| (x & mask << 8 * 4) >> 8 * 1
|
||||
| (x & mask << 8 * 3) << 8 * 1
|
||||
| (x & mask << 8 * 2) << 8 * 3
|
||||
| (x & mask << 8 * 1) << 8 * 5
|
||||
| (x & mask << 8 * 0) << 8 * 7);
|
||||
# endif
|
||||
return stdc_memreverse8u64 (x);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -42,22 +42,17 @@ enum { STACK_BUF_SIZE = 1024 };
|
|||
/* Act like careadlinkat (see below), with an additional argument
|
||||
STACK_BUF that can be used as temporary storage.
|
||||
|
||||
If GCC_LINT is defined, do not inline this function with GCC 10.1
|
||||
and later, to avoid creating a pointer to the stack that GCC
|
||||
In GCC 10+, do not inline this function
|
||||
to avoid creating a pointer to the stack that
|
||||
-Wreturn-local-addr incorrectly complains about. See:
|
||||
https://gcc.gnu.org/PR93644
|
||||
Although the noinline attribute can hurt performance a bit, no better way
|
||||
to pacify GCC is known; even an explicit #pragma does not pacify GCC.
|
||||
When the GCC bug is fixed this workaround should be limited to the
|
||||
to pacify GCC is known; even an explicit #pragma does not pacify GCC
|
||||
10 or 11, or GCC 12+ with -flto.
|
||||
If the GCC bug is fixed this workaround should be limited to the
|
||||
broken GCC versions. */
|
||||
#if _GL_GNUC_PREREQ (10, 1)
|
||||
# if _GL_GNUC_PREREQ (12, 1)
|
||||
# pragma GCC diagnostic ignored "-Wreturn-local-addr"
|
||||
# elif defined GCC_LINT || defined lint
|
||||
__attribute__ ((__noinline__))
|
||||
# elif __OPTIMIZE__ && !__NO_INLINE__
|
||||
# define GCC_BOGUS_WRETURN_LOCAL_ADDR
|
||||
# endif
|
||||
#endif
|
||||
static char *
|
||||
readlink_stk (int fd, char const *filename,
|
||||
|
|
@ -172,10 +167,6 @@ careadlinkat (int fd, char const *filename,
|
|||
common case of a symlink of small size, we get away with a
|
||||
single small malloc instead of a big malloc followed by a
|
||||
shrinking realloc. */
|
||||
#ifdef GCC_BOGUS_WRETURN_LOCAL_ADDR
|
||||
#warning "GCC might issue a bogus -Wreturn-local-addr warning here."
|
||||
#warning "See <https://gcc.gnu.org/PR93644>."
|
||||
#endif
|
||||
char stack_buf[STACK_BUF_SIZE];
|
||||
return readlink_stk (fd, filename, buffer, buffer_size, alloc,
|
||||
preadlinkat, stack_buf);
|
||||
|
|
|
|||
|
|
@ -669,7 +669,8 @@
|
|||
# ifdef __GNUC__
|
||||
# define __restrict_arr /* Not supported in old GCC. */
|
||||
# else
|
||||
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
||||
# if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L \
|
||||
&& !defined _MSC_VER)
|
||||
# define __restrict_arr restrict
|
||||
# else
|
||||
/* Some other non-C99 compiler. */
|
||||
|
|
|
|||
|
|
@ -82,10 +82,11 @@
|
|||
#error "Please include config.h first."
|
||||
#endif
|
||||
|
||||
/* Maximum value of type OFFSET. */
|
||||
/* Maximum value of type OFFSET. The 1u pacifies -Wuseless-cast, and
|
||||
unlike a compound literal can appear in an integer constant expression. */
|
||||
#ifndef OFFSET_MAX
|
||||
# define OFFSET_MAX \
|
||||
((((OFFSET) 1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
|
||||
((((OFFSET) 1u << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Default to no early abort. */
|
||||
|
|
|
|||
|
|
@ -249,11 +249,11 @@ static DYNARRAY_ELEMENT *
|
|||
/* The implementation is imported from glibc. */
|
||||
|
||||
/* Avoid possible conflicts with symbols exported by the GNU libc. */
|
||||
#define __libc_dynarray_at_failure gl_dynarray_at_failure
|
||||
#define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge
|
||||
#define __libc_dynarray_finalize gl_dynarray_finalize
|
||||
#define __libc_dynarray_resize_clear gl_dynarray_resize_clear
|
||||
#define __libc_dynarray_resize gl_dynarray_resize
|
||||
#define __libc_dynarray_at_failure _gl_dynarray_at_failure
|
||||
#define __libc_dynarray_emplace_enlarge _gl_dynarray_emplace_enlarge
|
||||
#define __libc_dynarray_finalize _gl_dynarray_finalize
|
||||
#define __libc_dynarray_resize_clear _gl_dynarray_resize_clear
|
||||
#define __libc_dynarray_resize _gl_dynarray_resize
|
||||
|
||||
#if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX
|
||||
|
||||
|
|
|
|||
214
lib/endian.in.h
214
lib/endian.in.h
|
|
@ -109,7 +109,7 @@ _GL_INLINE_HEADER_BEGIN
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* These declarations are needed if Gnulib byteswap.h -> stdint.h ->
|
||||
/* These declarations are needed if Gnulib byteswap.h -> stdbit.h -> stdint.h ->
|
||||
sys/types.h -> endian.h -> Gnulib byteswap.h, the last of which is blocked
|
||||
by its include guard so the functions are not yet declared. */
|
||||
#ifdef _GL_BYTESWAP_INLINE
|
||||
|
|
@ -120,138 +120,174 @@ _GL_BYTESWAP_INLINE uint_least64_t bswap_64 (uint_least64_t);
|
|||
|
||||
/* Big endian to host. */
|
||||
|
||||
#if !GNULIB_defined_be16toh
|
||||
_GL_ENDIAN_INLINE uint16_t
|
||||
be16toh (uint16_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
#else
|
||||
return bswap_16 (x);
|
||||
#endif
|
||||
}
|
||||
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
be32toh (uint32_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
#else
|
||||
return bswap_32 (x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
be64toh (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
# else
|
||||
return bswap_64 (x);
|
||||
return bswap_16 (x);
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_be16toh 1
|
||||
#endif
|
||||
|
||||
#if !GNULIB_defined_be32toh
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
be32toh (uint32_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
# else
|
||||
return bswap_32 (x);
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_be32toh 1
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
# if !GNULIB_defined_be64toh
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
be64toh (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
# else
|
||||
return bswap_64 (x);
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_be64toh 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Host to big endian. */
|
||||
|
||||
#if !GNULIB_defined_htobe16
|
||||
_GL_ENDIAN_INLINE uint16_t
|
||||
htobe16 (uint16_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
#else
|
||||
return bswap_16 (x);
|
||||
#endif
|
||||
}
|
||||
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
htobe32 (uint32_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
#else
|
||||
return bswap_32 (x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
htobe64 (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
# else
|
||||
return bswap_64 (x);
|
||||
return bswap_16 (x);
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_htobe16 1
|
||||
#endif
|
||||
|
||||
#if !GNULIB_defined_htobe32
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
htobe32 (uint32_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
# else
|
||||
return bswap_32 (x);
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_htobe32 1
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
# if !GNULIB_defined_htobe64
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
htobe64 (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return x;
|
||||
# else
|
||||
return bswap_64 (x);
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_htobe64 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Little endian to host. */
|
||||
|
||||
#if !GNULIB_defined_le16toh
|
||||
_GL_ENDIAN_INLINE uint16_t
|
||||
le16toh (uint16_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_16 (x);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
le32toh (uint32_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_32 (x);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
le64toh (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_64 (x);
|
||||
return bswap_16 (x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_le16toh 1
|
||||
#endif
|
||||
|
||||
#if !GNULIB_defined_le32toh
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
le32toh (uint32_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_32 (x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_le32toh 1
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
# if !GNULIB_defined_le64toh
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
le64toh (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_64 (x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_le64toh 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Host to little endian. */
|
||||
|
||||
#if !GNULIB_defined_htole16
|
||||
_GL_ENDIAN_INLINE uint16_t
|
||||
htole16 (uint16_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_16 (x);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
htole32 (uint32_t x)
|
||||
{
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_32 (x);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
htole64 (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_64 (x);
|
||||
return bswap_16 (x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_htole16 1
|
||||
#endif
|
||||
|
||||
#if !GNULIB_defined_htole32
|
||||
_GL_ENDIAN_INLINE uint32_t
|
||||
htole32 (uint32_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_32 (x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_htole32 1
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
# if !GNULIB_defined_htole64
|
||||
_GL_ENDIAN_INLINE uint64_t
|
||||
htole64 (uint64_t x)
|
||||
{
|
||||
# if BYTE_ORDER == BIG_ENDIAN
|
||||
return bswap_64 (x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
# define GNULIB_defined_htole64 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ aclinfo_has_xattr (struct aclinfo const *ai, char const *xattr)
|
|||
static void
|
||||
get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags)
|
||||
{
|
||||
ai->buf = ai->u.__gl_acl_ch;
|
||||
ssize_t acl_alloc = sizeof ai->u.__gl_acl_ch;
|
||||
ai->buf = ai->u._gl_acl_ch;
|
||||
ssize_t acl_alloc = sizeof ai->u._gl_acl_ch;
|
||||
|
||||
if (! (USE_ACL || flags & ACL_GET_SCONTEXT))
|
||||
ai->size = 0;
|
||||
|
|
@ -194,10 +194,10 @@ get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags)
|
|||
/* Grow allocation to at least 'size'. Grow it by a nontrivial
|
||||
amount, to defend against denial of service by an adversary
|
||||
that fiddles with ACLs. */
|
||||
if (ai->buf != ai->u.__gl_acl_ch)
|
||||
if (ai->buf != ai->u._gl_acl_ch)
|
||||
{
|
||||
free (ai->buf);
|
||||
ai->buf = ai->u.__gl_acl_ch;
|
||||
ai->buf = ai->u._gl_acl_ch;
|
||||
}
|
||||
if (ckd_add (&acl_alloc, acl_alloc, acl_alloc >> 1))
|
||||
acl_alloc = SSIZE_MAX;
|
||||
|
|
@ -297,7 +297,7 @@ aclinfo_scontext_free (char *scontext)
|
|||
void
|
||||
aclinfo_free (struct aclinfo *ai)
|
||||
{
|
||||
if (ai->buf != ai->u.__gl_acl_ch)
|
||||
if (ai->buf != ai->u._gl_acl_ch)
|
||||
free (ai->buf);
|
||||
aclinfo_scontext_free (ai->scontext);
|
||||
}
|
||||
|
|
@ -510,7 +510,7 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd,
|
|||
|
||||
#else /* !USE_LINUX_XATTR */
|
||||
|
||||
ai->buf = ai->u.__gl_acl_ch;
|
||||
ai->buf = ai->u._gl_acl_ch;
|
||||
ai->size = -1;
|
||||
ai->u.err = ENOTSUP;
|
||||
ai->scontext = (char *) UNKNOWN_SECURITY_CONTEXT;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
&& (~ (x) == (sizeof (x) < sizeof (int) \
|
||||
? - (1 << (sizeof (x) * CHAR_BIT)) \
|
||||
: 0))) \
|
||||
? UINTMAX_MAX : (uintmax_t) (x))
|
||||
? UINTMAX_MAX : (uintmax_t) {(x)})
|
||||
|
||||
/* Extract the top bit of X as an uintmax_t value. */
|
||||
#define EXTRACT_TOP_BIT(x) ((x) \
|
||||
|
|
|
|||
139
lib/gettext.h
139
lib/gettext.h
|
|
@ -60,10 +60,40 @@
|
|||
# endif
|
||||
|
||||
/* Disabled NLS. */
|
||||
/* When gcc is used with option -Wformat=2, we need to silence
|
||||
"warning: format not a string literal, argument types not checked [-Wformat-nonliteral]"
|
||||
warnings that would occur at every invocation of a *gettext function
|
||||
in a *printf format string position.
|
||||
Do this with inline functions when possible, namely for gettext, dgettext,
|
||||
dcgettext, which are known to gcc as "external built-ins".
|
||||
It is not ideal to ignore the possible side effects done in the
|
||||
Domainname and Category arguments, but it's better than to have a
|
||||
warning at every invocation in a format string position. */
|
||||
/* When clang is used with option -Wformat=2, we need to silence
|
||||
"warning: format string is not a string literal [-Wformat-nonliteral]"
|
||||
warnings that would occur at every invocation of a *gettext function
|
||||
in a *printf format string position.
|
||||
It is not ideal to ignore the possible side effects done in the
|
||||
Domainname and Category arguments, but it's better than to have a
|
||||
warning at every invocation in a format string position. */
|
||||
/* These warnings would not occur with enabled NLS. */
|
||||
/* A test case:
|
||||
================================ foo.c ================================
|
||||
#include <stdio.h>
|
||||
#include "gettext.h"
|
||||
void foo (int n)
|
||||
{
|
||||
printf (gettext ("foo %d"), n);
|
||||
printf (dgettext ("toto", "foo %d"), n);
|
||||
printf (dcgettext ("toto", "foo %d", LC_MESSAGES), n);
|
||||
printf (ngettext ("foo %d", "bar %d", n), n);
|
||||
printf (dngettext ("toto", "foo %d", "bar %d", n), n);
|
||||
printf (dcngettext ("toto", "foo %d", "bar %d", n, LC_MESSAGES), n);
|
||||
}
|
||||
=======================================================================
|
||||
$CC -Wformat=2 -S foo.c
|
||||
*/
|
||||
# if defined __GNUC__ && !defined __clang__ && !defined __cplusplus
|
||||
/* Use inline functions, to avoid warnings
|
||||
warning: format not a string literal and no format arguments
|
||||
that don't occur with enabled NLS. */
|
||||
/* The return type 'const char *' serves the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions. */
|
||||
# if __GNUC__ >= 9
|
||||
|
|
@ -118,36 +148,80 @@ dcgettext (const char *domain, const char *msgid, int category)
|
|||
# if __GNUC__ >= 9
|
||||
# pragma GCC diagnostic pop
|
||||
# endif
|
||||
# else
|
||||
/* The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions. */
|
||||
# elif defined __clang__
|
||||
# undef gettext
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# undef dgettext
|
||||
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
||||
# define dgettext(Domainname, Msgid) gettext (Msgid)
|
||||
# undef dcgettext
|
||||
# define dcgettext(Domainname, Msgid, Category) dgettext (Domainname, Msgid)
|
||||
# else
|
||||
/* The conversions to 'const char *' via compound literals serve the purpose
|
||||
of producing warnings for invalid uses of the value returned from these
|
||||
functions and for invalid-typed Msgid arguments. */
|
||||
# undef gettext
|
||||
# define gettext(Msgid) ((const char *) {(Msgid)})
|
||||
/* The conversions via compound literals serve the purpose of producing warnings
|
||||
for invalid-typed arguments. */
|
||||
# undef dgettext
|
||||
# define dgettext(Domainname, Msgid) \
|
||||
((void) (const char *) {(Domainname)}, gettext (Msgid))
|
||||
# undef dcgettext
|
||||
# define dcgettext(Domainname, Msgid, Category) \
|
||||
((void) (Category), dgettext (Domainname, Msgid))
|
||||
((void) (int) {(Category)}, dgettext (Domainname, Msgid))
|
||||
# endif
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 \
|
||||
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
||||
: ((void) (Msgid1), (const char *) (Msgid2)))
|
||||
# undef dngettext
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# undef dcngettext
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
|
||||
|
||||
# if (defined __GNUC__ && defined __cplusplus) || defined __clang__
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# undef dngettext
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
ngettext (Msgid1, Msgid2, N)
|
||||
# undef dcngettext
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
dngettext (Domainname, Msgid1, Msgid2, N)
|
||||
# elif defined __GNUC__ && !defined __cplusplus
|
||||
/* Silence -Wuseless-cast warnings. */
|
||||
# if __GNUC__ >= 14
|
||||
# pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
# endif
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# undef dngettext
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (const char *) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# undef dcngettext
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (int) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
|
||||
# else
|
||||
/* The conversions to 'const char *' via compound literals serve the purpose
|
||||
of producing warnings for invalid uses of the value returned from these
|
||||
functions and for invalid-typed Msgid1 and Msgid2 arguments. */
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 \
|
||||
? ((void) (Msgid2), (const char *) {(Msgid1)}) \
|
||||
: ((void) (Msgid1), (const char *) {(Msgid2)}))
|
||||
/* The conversions via compound literals serve the purpose of producing warnings
|
||||
for invalid-typed arguments. */
|
||||
# undef dngettext
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (const char *) {(Domainname)}, ngettext (Msgid1, Msgid2, N))
|
||||
# undef dcngettext
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (int) {(Category)}, dngettext (Domainname, Msgid1, Msgid2, N))
|
||||
# endif
|
||||
|
||||
# undef textdomain
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define textdomain(Domainname) ((const char *) {(Domainname)})
|
||||
# undef bindtextdomain
|
||||
# define bindtextdomain(Domainname, Dirname) \
|
||||
((void) (Domainname), (const char *) (Dirname))
|
||||
((void) (const char *) {(Domainname)}, (const char *) {(Dirname)})
|
||||
# undef bind_textdomain_codeset
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) \
|
||||
((void) (Domainname), (const char *) (Codeset))
|
||||
((void) (const char *) {(Domainname)}, (const char *) {(Codeset)})
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -178,6 +252,11 @@ dcgettext (const char *domain, const char *msgid, int category)
|
|||
The letter 'p' stands for 'particular' or 'special'. */
|
||||
|
||||
#include <locale.h> /* for LC_MESSAGES */
|
||||
/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
|
||||
On systems that don't define it, use the same value as GNU libintl. */
|
||||
#if !defined LC_MESSAGES
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
|
|
@ -204,11 +283,9 @@ dcgettext (const char *domain, const char *msgid, int category)
|
|||
|
||||
#if defined __GNUC__ || defined __clang__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#elif defined __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
pgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
|
|
@ -223,11 +300,9 @@ pgettext_aux (const char *domain,
|
|||
|
||||
#if defined __GNUC__ || defined __clang__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#elif defined __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
npgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
|
|
@ -274,11 +349,9 @@ npgettext_aux (const char *domain,
|
|||
|
||||
#if defined __GNUC__ || defined __clang__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#elif defined __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
|
|
@ -320,11 +393,9 @@ dcpgettext_expr (const char *domain,
|
|||
|
||||
#if defined __GNUC__ || defined __clang__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#elif defined __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcnpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
|
|
|
|||
170
lib/gnulib.mk.in
170
lib/gnulib.mk.in
|
|
@ -35,7 +35,13 @@
|
|||
# --macro-prefix=gl \
|
||||
# --no-vc-files \
|
||||
# --avoid=access \
|
||||
# --avoid=btowc \
|
||||
# --avoid=btoc32 \
|
||||
# --avoid=c32_apply_type_test \
|
||||
# --avoid=c32_get_type_test \
|
||||
# --avoid=c32isalnum \
|
||||
# --avoid=c32rtomb \
|
||||
# --avoid=c32tolower \
|
||||
# --avoid=c32toupper \
|
||||
# --avoid=chmod \
|
||||
# --avoid=close \
|
||||
# --avoid=crypto/af_alg \
|
||||
|
|
@ -43,17 +49,13 @@
|
|||
# --avoid=fchdir \
|
||||
# --avoid=fstat \
|
||||
# --avoid=gnulib-i18n \
|
||||
# --avoid=iswblank \
|
||||
# --avoid=iswctype \
|
||||
# --avoid=iswdigit \
|
||||
# --avoid=iswxdigit \
|
||||
# --avoid=langinfo-h \
|
||||
# --avoid=libgmp-mpq \
|
||||
# --avoid=localcharset \
|
||||
# --avoid=locale-h \
|
||||
# --avoid=localeinfo \
|
||||
# --avoid=localename-unsafe-limited \
|
||||
# --avoid=lock \
|
||||
# --avoid=mbrtowc \
|
||||
# --avoid=mbrtoc32-regular \
|
||||
# --avoid=mbsinit \
|
||||
# --avoid=memchr \
|
||||
# --avoid=mkdir \
|
||||
|
|
@ -63,14 +65,12 @@
|
|||
# --avoid=openat-die \
|
||||
# --avoid=opendir \
|
||||
# --avoid=pthread-h \
|
||||
# --avoid=raise \
|
||||
# --avoid=save-cwd \
|
||||
# --avoid=select \
|
||||
# --avoid=setenv \
|
||||
# --avoid=sigprocmask \
|
||||
# --avoid=stat \
|
||||
# --avoid=std-gnu11 \
|
||||
# --avoid=stdarg-h \
|
||||
# --avoid=strncpy \
|
||||
# --avoid=threadlib \
|
||||
# --avoid=tzset \
|
||||
|
|
@ -78,9 +78,7 @@
|
|||
# --avoid=utime \
|
||||
# --avoid=utime-h \
|
||||
# --avoid=wchar-h \
|
||||
# --avoid=wcrtomb \
|
||||
# --avoid=wctype \
|
||||
# --avoid=wctype-h \
|
||||
# --avoid=uchar-h \
|
||||
# alignasof \
|
||||
# alloca-opt \
|
||||
# attribute \
|
||||
|
|
@ -254,6 +252,7 @@ CPPFLAGS = @CPPFLAGS@
|
|||
CRYPTOLIB = @CRYPTOLIB@
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXX_HAVE_STDCOUNTOF_H = @CXX_HAVE_STDCOUNTOF_H@
|
||||
CYGWIN_OBJ = @CYGWIN_OBJ@
|
||||
C_SWITCH_MACHINE = @C_SWITCH_MACHINE@
|
||||
C_SWITCH_SYSTEM = @C_SWITCH_SYSTEM@
|
||||
|
|
@ -372,6 +371,7 @@ GL_GENERATE_LIMITS_H_CONDITION = @GL_GENERATE_LIMITS_H_CONDITION@
|
|||
GL_GENERATE_MINI_GMP_H_CONDITION = @GL_GENERATE_MINI_GMP_H_CONDITION@
|
||||
GL_GENERATE_STDBIT_H_CONDITION = @GL_GENERATE_STDBIT_H_CONDITION@
|
||||
GL_GENERATE_STDCKDINT_H_CONDITION = @GL_GENERATE_STDCKDINT_H_CONDITION@
|
||||
GL_GENERATE_STDCOUNTOF_H_CONDITION = @GL_GENERATE_STDCOUNTOF_H_CONDITION@
|
||||
GL_GENERATE_STDDEF_H_CONDITION = @GL_GENERATE_STDDEF_H_CONDITION@
|
||||
GL_GENERATE_STDINT_H_CONDITION = @GL_GENERATE_STDINT_H_CONDITION@
|
||||
GL_GNULIB_ABORT_DEBUG = @GL_GNULIB_ABORT_DEBUG@
|
||||
|
|
@ -621,6 +621,28 @@ GL_GNULIB_SNZPRINTF = @GL_GNULIB_SNZPRINTF@
|
|||
GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@
|
||||
GL_GNULIB_STACK_TRACE = @GL_GNULIB_STACK_TRACE@
|
||||
GL_GNULIB_STAT = @GL_GNULIB_STAT@
|
||||
GL_GNULIB_STDC_BIT_CEIL = @GL_GNULIB_STDC_BIT_CEIL@
|
||||
GL_GNULIB_STDC_BIT_FLOOR = @GL_GNULIB_STDC_BIT_FLOOR@
|
||||
GL_GNULIB_STDC_BIT_WIDTH = @GL_GNULIB_STDC_BIT_WIDTH@
|
||||
GL_GNULIB_STDC_COUNT_ONES = @GL_GNULIB_STDC_COUNT_ONES@
|
||||
GL_GNULIB_STDC_COUNT_ZEROS = @GL_GNULIB_STDC_COUNT_ZEROS@
|
||||
GL_GNULIB_STDC_FIRST_LEADING_ONE = @GL_GNULIB_STDC_FIRST_LEADING_ONE@
|
||||
GL_GNULIB_STDC_FIRST_LEADING_ZERO = @GL_GNULIB_STDC_FIRST_LEADING_ZERO@
|
||||
GL_GNULIB_STDC_FIRST_TRAILING_ONE = @GL_GNULIB_STDC_FIRST_TRAILING_ONE@
|
||||
GL_GNULIB_STDC_FIRST_TRAILING_ZERO = @GL_GNULIB_STDC_FIRST_TRAILING_ZERO@
|
||||
GL_GNULIB_STDC_HAS_SINGLE_BIT = @GL_GNULIB_STDC_HAS_SINGLE_BIT@
|
||||
GL_GNULIB_STDC_LEADING_ONES = @GL_GNULIB_STDC_LEADING_ONES@
|
||||
GL_GNULIB_STDC_LEADING_ZEROS = @GL_GNULIB_STDC_LEADING_ZEROS@
|
||||
GL_GNULIB_STDC_LOAD8 = @GL_GNULIB_STDC_LOAD8@
|
||||
GL_GNULIB_STDC_LOAD8_ALIGNED = @GL_GNULIB_STDC_LOAD8_ALIGNED@
|
||||
GL_GNULIB_STDC_MEMREVERSE8 = @GL_GNULIB_STDC_MEMREVERSE8@
|
||||
GL_GNULIB_STDC_MEMREVERSE8U = @GL_GNULIB_STDC_MEMREVERSE8U@
|
||||
GL_GNULIB_STDC_ROTATE_LEFT = @GL_GNULIB_STDC_ROTATE_LEFT@
|
||||
GL_GNULIB_STDC_ROTATE_RIGHT = @GL_GNULIB_STDC_ROTATE_RIGHT@
|
||||
GL_GNULIB_STDC_STORE8 = @GL_GNULIB_STDC_STORE8@
|
||||
GL_GNULIB_STDC_STORE8_ALIGNED = @GL_GNULIB_STDC_STORE8_ALIGNED@
|
||||
GL_GNULIB_STDC_TRAILING_ONES = @GL_GNULIB_STDC_TRAILING_ONES@
|
||||
GL_GNULIB_STDC_TRAILING_ZEROS = @GL_GNULIB_STDC_TRAILING_ZEROS@
|
||||
GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@
|
||||
GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@
|
||||
GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@
|
||||
|
|
@ -681,6 +703,7 @@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@
|
|||
GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@
|
||||
GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@
|
||||
GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@
|
||||
GL_GNULIB_VAPRINTF = @GL_GNULIB_VAPRINTF@
|
||||
GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@
|
||||
GL_GNULIB_VASZPRINTF = @GL_GNULIB_VASZPRINTF@
|
||||
GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@
|
||||
|
|
@ -701,20 +724,7 @@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@
|
|||
GL_GNULIB_WRITE = @GL_GNULIB_WRITE@
|
||||
GL_GNULIB_ZPRINTF = @GL_GNULIB_ZPRINTF@
|
||||
GL_GNULIB__EXIT = @GL_GNULIB__EXIT@
|
||||
GL_STDC_BIT_CEIL = @GL_STDC_BIT_CEIL@
|
||||
GL_STDC_BIT_FLOOR = @GL_STDC_BIT_FLOOR@
|
||||
GL_STDC_BIT_WIDTH = @GL_STDC_BIT_WIDTH@
|
||||
GL_STDC_COUNT_ONES = @GL_STDC_COUNT_ONES@
|
||||
GL_STDC_COUNT_ZEROS = @GL_STDC_COUNT_ZEROS@
|
||||
GL_STDC_FIRST_LEADING_ONE = @GL_STDC_FIRST_LEADING_ONE@
|
||||
GL_STDC_FIRST_LEADING_ZERO = @GL_STDC_FIRST_LEADING_ZERO@
|
||||
GL_STDC_FIRST_TRAILING_ONE = @GL_STDC_FIRST_TRAILING_ONE@
|
||||
GL_STDC_FIRST_TRAILING_ZERO = @GL_STDC_FIRST_TRAILING_ZERO@
|
||||
GL_STDC_HAS_SINGLE_BIT = @GL_STDC_HAS_SINGLE_BIT@
|
||||
GL_STDC_LEADING_ONES = @GL_STDC_LEADING_ONES@
|
||||
GL_STDC_LEADING_ZEROS = @GL_STDC_LEADING_ZEROS@
|
||||
GL_STDC_TRAILING_ONES = @GL_STDC_TRAILING_ONES@
|
||||
GL_STDC_TRAILING_ZEROS = @GL_STDC_TRAILING_ZEROS@
|
||||
GL_HAVE_STDBIT_H_CONDITION = @GL_HAVE_STDBIT_H_CONDITION@
|
||||
GMALLOC_OBJ = @GMALLOC_OBJ@
|
||||
GMP_H = @GMP_H@
|
||||
GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@
|
||||
|
|
@ -924,7 +934,9 @@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
|
|||
HAVE_SIGSET_T = @HAVE_SIGSET_T@
|
||||
HAVE_SLEEP = @HAVE_SLEEP@
|
||||
HAVE_SPAWN_H = @HAVE_SPAWN_H@
|
||||
HAVE_STDBIT_H = @HAVE_STDBIT_H@
|
||||
HAVE_STDCKDINT_H = @HAVE_STDCKDINT_H@
|
||||
HAVE_STDCOUNTOF_H = @HAVE_STDCOUNTOF_H@
|
||||
HAVE_STDINT_H = @HAVE_STDINT_H@
|
||||
HAVE_STPCPY = @HAVE_STPCPY@
|
||||
HAVE_STPNCPY = @HAVE_STPNCPY@
|
||||
|
|
@ -1104,7 +1116,9 @@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
|
|||
NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_STDBIT_H = @NEXT_AS_FIRST_DIRECTIVE_STDBIT_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_STDCKDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDCKDINT_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_STDCOUNTOF_H = @NEXT_AS_FIRST_DIRECTIVE_STDCOUNTOF_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
|
||||
NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
|
||||
|
|
@ -1125,7 +1139,9 @@ NEXT_GETOPT_H = @NEXT_GETOPT_H@
|
|||
NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
|
||||
NEXT_LIMITS_H = @NEXT_LIMITS_H@
|
||||
NEXT_SIGNAL_H = @NEXT_SIGNAL_H@
|
||||
NEXT_STDBIT_H = @NEXT_STDBIT_H@
|
||||
NEXT_STDCKDINT_H = @NEXT_STDCKDINT_H@
|
||||
NEXT_STDCOUNTOF_H = @NEXT_STDCOUNTOF_H@
|
||||
NEXT_STDDEF_H = @NEXT_STDDEF_H@
|
||||
NEXT_STDINT_H = @NEXT_STDINT_H@
|
||||
NEXT_STDIO_H = @NEXT_STDIO_H@
|
||||
|
|
@ -1391,6 +1407,7 @@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
|
|||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STDBIT_H = @STDBIT_H@
|
||||
STDCKDINT_H = @STDCKDINT_H@
|
||||
STDCOUNTOF_H = @STDCOUNTOF_H@
|
||||
STDDEF_H = @STDDEF_H@
|
||||
STDDEF_NOT_IDEMPOTENT = @STDDEF_NOT_IDEMPOTENT@
|
||||
STDINT_H = @STDINT_H@
|
||||
|
|
@ -1516,6 +1533,7 @@ gl_GNULIB_ENABLED_issymlinkat_CONDITION = @gl_GNULIB_ENABLED_issymlinkat_CONDITI
|
|||
gl_GNULIB_ENABLED_lchmod_CONDITION = @gl_GNULIB_ENABLED_lchmod_CONDITION@
|
||||
gl_GNULIB_ENABLED_open_CONDITION = @gl_GNULIB_ENABLED_open_CONDITION@
|
||||
gl_GNULIB_ENABLED_rawmemchr_CONDITION = @gl_GNULIB_ENABLED_rawmemchr_CONDITION@
|
||||
gl_GNULIB_ENABLED_stdc_memreverse8u_CONDITION = @gl_GNULIB_ENABLED_stdc_memreverse8u_CONDITION@
|
||||
gl_GNULIB_ENABLED_strtoll_CONDITION = @gl_GNULIB_ENABLED_strtoll_CONDITION@
|
||||
gl_GNULIB_ENABLED_utimens_CONDITION = @gl_GNULIB_ENABLED_utimens_CONDITION@
|
||||
gl_GNULIB_ENABLED_verify_CONDITION = @gl_GNULIB_ENABLED_verify_CONDITION@
|
||||
|
|
@ -3199,23 +3217,36 @@ BUILT_SOURCES += $(STDBIT_H)
|
|||
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
|
||||
stdbit.h: stdbit.in.h $(top_builddir)/config.status
|
||||
$(gl_V_at)$(SED_HEADER_STDOUT) \
|
||||
-e 's/@''GL_STDC_LEADING_ZEROS''@/$(GL_STDC_LEADING_ZEROS)/g' \
|
||||
-e 's/@''GL_STDC_LEADING_ONES''@/$(GL_STDC_LEADING_ONES)/g' \
|
||||
-e 's/@''GL_STDC_TRAILING_ZEROS''@/$(GL_STDC_TRAILING_ZEROS)/g' \
|
||||
-e 's/@''GL_STDC_TRAILING_ONES''@/$(GL_STDC_TRAILING_ONES)/g' \
|
||||
-e 's/@''GL_STDC_FIRST_LEADING_ZERO''@/$(GL_STDC_FIRST_LEADING_ZERO)/g' \
|
||||
-e 's/@''GL_STDC_FIRST_LEADING_ONE''@/$(GL_STDC_FIRST_LEADING_ONE)/g' \
|
||||
-e 's/@''GL_STDC_FIRST_TRAILING_ZERO''@/$(GL_STDC_FIRST_TRAILING_ZERO)/g' \
|
||||
-e 's/@''GL_STDC_FIRST_TRAILING_ONE''@/$(GL_STDC_FIRST_TRAILING_ONE)/g' \
|
||||
-e 's/@''GL_STDC_COUNT_ZEROS''@/$(GL_STDC_COUNT_ZEROS)/g' \
|
||||
-e 's/@''GL_STDC_COUNT_ONES''@/$(GL_STDC_COUNT_ONES)/g' \
|
||||
-e 's/@''GL_STDC_HAS_SINGLE_BIT''@/$(GL_STDC_HAS_SINGLE_BIT)/g' \
|
||||
-e 's/@''GL_STDC_BIT_WIDTH''@/$(GL_STDC_BIT_WIDTH)/g' \
|
||||
-e 's/@''GL_STDC_BIT_FLOOR''@/$(GL_STDC_BIT_FLOOR)/g' \
|
||||
-e 's/@''GL_STDC_BIT_CEIL''@/$(GL_STDC_BIT_CEIL)/g' \
|
||||
-e 's/@''HAVE_STDBIT_H''@/$(HAVE_STDBIT_H)/g' \
|
||||
-e 's/@''GUARD_PREFIX''@/$(GUARD_PREFIX)/g' \
|
||||
-e 's/@''PRAGMA_SYSTEM_HEADER''@/$(PRAGMA_SYSTEM_HEADER)/g' \
|
||||
-e 's/@''PRAGMA_COLUMNS''@/$(PRAGMA_COLUMNS)/g' \
|
||||
-e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
|
||||
-e 's/@''NEXT_STDBIT_H''@/$(NEXT_STDBIT_H)/g' \
|
||||
-e 's/@''GNULIB_STDC_LEADING_ZEROS''@/$(GL_GNULIB_STDC_LEADING_ZEROS)/g' \
|
||||
-e 's/@''GNULIB_STDC_LEADING_ONES''@/$(GL_GNULIB_STDC_LEADING_ONES)/g' \
|
||||
-e 's/@''GNULIB_STDC_TRAILING_ZEROS''@/$(GL_GNULIB_STDC_TRAILING_ZEROS)/g' \
|
||||
-e 's/@''GNULIB_STDC_TRAILING_ONES''@/$(GL_GNULIB_STDC_TRAILING_ONES)/g' \
|
||||
-e 's/@''GNULIB_STDC_FIRST_LEADING_ZERO''@/$(GL_GNULIB_STDC_FIRST_LEADING_ZERO)/g' \
|
||||
-e 's/@''GNULIB_STDC_FIRST_LEADING_ONE''@/$(GL_GNULIB_STDC_FIRST_LEADING_ONE)/g' \
|
||||
-e 's/@''GNULIB_STDC_FIRST_TRAILING_ZERO''@/$(GL_GNULIB_STDC_FIRST_TRAILING_ZERO)/g' \
|
||||
-e 's/@''GNULIB_STDC_FIRST_TRAILING_ONE''@/$(GL_GNULIB_STDC_FIRST_TRAILING_ONE)/g' \
|
||||
-e 's/@''GNULIB_STDC_COUNT_ZEROS''@/$(GL_GNULIB_STDC_COUNT_ZEROS)/g' \
|
||||
-e 's/@''GNULIB_STDC_COUNT_ONES''@/$(GL_GNULIB_STDC_COUNT_ONES)/g' \
|
||||
-e 's/@''GNULIB_STDC_HAS_SINGLE_BIT''@/$(GL_GNULIB_STDC_HAS_SINGLE_BIT)/g' \
|
||||
-e 's/@''GNULIB_STDC_BIT_WIDTH''@/$(GL_GNULIB_STDC_BIT_WIDTH)/g' \
|
||||
-e 's/@''GNULIB_STDC_BIT_FLOOR''@/$(GL_GNULIB_STDC_BIT_FLOOR)/g' \
|
||||
-e 's/@''GNULIB_STDC_BIT_CEIL''@/$(GL_GNULIB_STDC_BIT_CEIL)/g' \
|
||||
-e 's/@''GNULIB_STDC_ROTATE_LEFT''@/$(GL_GNULIB_STDC_ROTATE_LEFT)/g' \
|
||||
-e 's/@''GNULIB_STDC_ROTATE_RIGHT''@/$(GL_GNULIB_STDC_ROTATE_RIGHT)/g' \
|
||||
-e 's/@''GNULIB_STDC_MEMREVERSE8''@/$(GL_GNULIB_STDC_MEMREVERSE8)/g' \
|
||||
-e 's/@''GNULIB_STDC_MEMREVERSE8U''@/$(GL_GNULIB_STDC_MEMREVERSE8U)/g' \
|
||||
-e 's/@''GNULIB_STDC_LOAD8_ALIGNED''@/$(GL_GNULIB_STDC_LOAD8_ALIGNED)/g' \
|
||||
-e 's/@''GNULIB_STDC_LOAD8''@/$(GL_GNULIB_STDC_LOAD8)/g' \
|
||||
-e 's/@''GNULIB_STDC_STORE8_ALIGNED''@/$(GL_GNULIB_STDC_STORE8_ALIGNED)/g' \
|
||||
-e 's/@''GNULIB_STDC_STORE8''@/$(GL_GNULIB_STDC_STORE8)/g' \
|
||||
$(srcdir)/stdbit.in.h > $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
libgnu_a_SOURCES += stdbit.c
|
||||
else
|
||||
stdbit.h: $(top_builddir)/config.status
|
||||
rm -f $@
|
||||
|
|
@ -3230,7 +3261,8 @@ endif
|
|||
## begin gnulib module stdc_bit_width
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stdc_bit_width))
|
||||
|
||||
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
|
||||
ifneq (,$(GL_HAVE_STDBIT_H_CONDITION))
|
||||
else
|
||||
libgnu_a_SOURCES += stdc_bit_width.c
|
||||
endif
|
||||
|
||||
|
|
@ -3240,7 +3272,8 @@ endif
|
|||
## begin gnulib module stdc_count_ones
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stdc_count_ones))
|
||||
|
||||
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
|
||||
ifneq (,$(GL_HAVE_STDBIT_H_CONDITION))
|
||||
else
|
||||
libgnu_a_SOURCES += stdc_count_ones.c
|
||||
endif
|
||||
|
||||
|
|
@ -3250,17 +3283,31 @@ endif
|
|||
## begin gnulib module stdc_leading_zeros
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stdc_leading_zeros))
|
||||
|
||||
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
|
||||
ifneq (,$(GL_HAVE_STDBIT_H_CONDITION))
|
||||
else
|
||||
libgnu_a_SOURCES += stdc_leading_zeros.c
|
||||
endif
|
||||
|
||||
endif
|
||||
## end gnulib module stdc_leading_zeros
|
||||
|
||||
## begin gnulib module stdc_memreverse8u
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stdc_memreverse8u))
|
||||
|
||||
ifneq (,$(gl_GNULIB_ENABLED_stdc_memreverse8u_CONDITION))
|
||||
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
|
||||
libgnu_a_SOURCES += stdc_memreverse8u.c
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
## end gnulib module stdc_memreverse8u
|
||||
|
||||
## begin gnulib module stdc_trailing_zeros
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stdc_trailing_zeros))
|
||||
|
||||
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
|
||||
ifneq (,$(GL_HAVE_STDBIT_H_CONDITION))
|
||||
else
|
||||
libgnu_a_SOURCES += stdc_trailing_zeros.c
|
||||
endif
|
||||
|
||||
|
|
@ -3299,6 +3346,36 @@ EXTRA_DIST += intprops-internal.h stdckdint.in.h
|
|||
endif
|
||||
## end gnulib module stdckdint-h
|
||||
|
||||
## begin gnulib module stdcountof-h
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stdcountof-h))
|
||||
|
||||
BUILT_SOURCES += $(STDCOUNTOF_H)
|
||||
|
||||
# We need the following in order to create <stdcountof.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
ifneq (,$(GL_GENERATE_STDCOUNTOF_H_CONDITION))
|
||||
stdcountof.h: stdcountof.in.h $(top_builddir)/config.status
|
||||
$(gl_V_at)$(SED_HEADER_STDOUT) \
|
||||
-e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's/@''HAVE_STDCOUNTOF_H''@/$(HAVE_STDCOUNTOF_H)/g' \
|
||||
-e 's/@''CXX_HAVE_STDCOUNTOF_H''@/$(CXX_HAVE_STDCOUNTOF_H)/g' \
|
||||
-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_STDCOUNTOF_H''@|$(NEXT_STDCOUNTOF_H)|g' \
|
||||
$(srcdir)/stdcountof.in.h > $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
else
|
||||
stdcountof.h: $(top_builddir)/config.status
|
||||
rm -f $@
|
||||
endif
|
||||
MOSTLYCLEANFILES += stdcountof.h stdcountof.h-t
|
||||
|
||||
EXTRA_DIST += stdcountof.in.h
|
||||
|
||||
endif
|
||||
## end gnulib module stdcountof-h
|
||||
|
||||
## begin gnulib module stddef-h
|
||||
ifeq (,$(OMIT_GNULIB_MODULE_stddef-h))
|
||||
|
||||
|
|
@ -3445,6 +3522,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
|
|||
-e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \
|
||||
-e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \
|
||||
-e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \
|
||||
-e 's/@''GNULIB_VAPRINTF''@/$(GL_GNULIB_VAPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \
|
||||
|
|
@ -3468,6 +3546,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
|
|||
-e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \
|
||||
-e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \
|
||||
-e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \
|
||||
-e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \
|
||||
< $(srcdir)/stdio.in.h > $@-t1
|
||||
$(AM_V_at)sed \
|
||||
-e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \
|
||||
|
|
@ -3499,6 +3578,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
|
|||
-e 's|@''REPLACE_FOPEN_FOR_FOPEN_GNU''@|$(REPLACE_FOPEN_FOR_FOPEN_GNU)|g' \
|
||||
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
|
||||
-e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
|
||||
-e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
|
||||
-e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
|
||||
-e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
|
||||
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
|
||||
|
|
|
|||
22
lib/idx.h
22
lib/idx.h
|
|
@ -19,11 +19,17 @@
|
|||
#ifndef _IDX_H
|
||||
#define _IDX_H
|
||||
|
||||
/* Get ptrdiff_t. */
|
||||
#include <stddef.h>
|
||||
#ifndef __PTRDIFF_TYPE__
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* Get PTRDIFF_MAX. */
|
||||
#include <stdint.h>
|
||||
/* IDX_MAX is the maximum value of an idx_t. */
|
||||
#ifdef __PTRDIFF_MAX__
|
||||
# define IDX_MAX __PTRDIFF_MAX__
|
||||
#else
|
||||
# include <stdint.h>
|
||||
# define IDX_MAX PTRDIFF_MAX
|
||||
#endif
|
||||
|
||||
/* The type 'idx_t' holds an (array) index or an (object) size.
|
||||
Its implementation promotes to a signed integer type,
|
||||
|
|
@ -127,10 +133,12 @@ extern "C" {
|
|||
/* Use the signed type 'ptrdiff_t'. */
|
||||
/* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same
|
||||
size, but it is so on all platforms we have seen since 1990. */
|
||||
#ifdef __PTRDIFF_TYPE__
|
||||
typedef __PTRDIFF_TYPE__ idx_t;
|
||||
#else
|
||||
/* <stddef.h> already included above. */
|
||||
typedef ptrdiff_t idx_t;
|
||||
|
||||
/* IDX_MAX is the maximum value of an idx_t. */
|
||||
#define IDX_MAX PTRDIFF_MAX
|
||||
#endif
|
||||
|
||||
/* So far no need has been found for an IDX_WIDTH macro.
|
||||
Perhaps there should be another macro IDX_VALUE_BITS that does not
|
||||
|
|
|
|||
|
|
@ -25,6 +25,23 @@
|
|||
# pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
#endif
|
||||
|
||||
/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See:
|
||||
https://gcc.gnu.org/PR68193
|
||||
https://github.com/llvm/llvm-project/issues/25764
|
||||
For now, assume GCC < 14 and all Clang versions generate bogus
|
||||
warnings for _Generic. This matters only for compilers that
|
||||
lack relevant builtins. */
|
||||
#if (__GNUC__ && __GNUC__ < 14) || defined __clang__
|
||||
# define _GL__GENERIC_BOGUS 1
|
||||
#else
|
||||
# define _GL__GENERIC_BOGUS 0
|
||||
#endif
|
||||
|
||||
/* Suppress -Wuseless-cast for, e.g., gcc-14 -std=gnu99. */
|
||||
#if __STDC_VERSION__ < 201112 && 14 <= __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif
|
||||
|
||||
/* Return a value with the common real type of E and V and the value of V.
|
||||
Do not evaluate E. */
|
||||
#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v))
|
||||
|
|
@ -32,8 +49,20 @@
|
|||
/* The extra casts in the following macros work around compiler bugs,
|
||||
e.g., in Cray C 5.0.3.0. */
|
||||
|
||||
/* True if the real type T is signed. */
|
||||
#define _GL_TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
/* True if the standard integer or standard real type T is signed. */
|
||||
#if (__STDC_VERSION__ < 201112 || (defined _MSC_VER && _MSC_VER < 1944) \
|
||||
|| _GL__GENERIC_BOGUS)
|
||||
# define _GL_TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
#else
|
||||
/* Pacify -Wuseless-cast, but do not default to the simpler expression;
|
||||
see <https://gcc.gnu.org/PR125261>. */
|
||||
# define _GL_TYPE_SIGNED(t) \
|
||||
(_Generic ((t) {0}, \
|
||||
bool: 0, char: CHAR_MIN < 0, signed char: 1, unsigned char: 0, \
|
||||
short int: 1, unsigned short int: 0, int: 1, unsigned int: 0, \
|
||||
long int: 1, unsigned long int: 0, long long int: 1, unsigned long long int: 0, \
|
||||
float: 1, double: 1, long double: 1))
|
||||
#endif
|
||||
|
||||
/* Return 1 if the real expression E, after promotion, has a
|
||||
signed or floating type. Do not evaluate E. */
|
||||
|
|
@ -179,18 +208,6 @@
|
|||
_GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
|
||||
#endif
|
||||
|
||||
/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See:
|
||||
https://gcc.gnu.org/PR68193
|
||||
https://github.com/llvm/llvm-project/issues/25764
|
||||
For now, assume GCC < 14 and all Clang versions generate bogus
|
||||
warnings for _Generic. This matters only for compilers that
|
||||
lack relevant builtins. */
|
||||
#if (__GNUC__ && __GNUC__ < 14) || defined __clang__
|
||||
# define _GL__GENERIC_BOGUS 1
|
||||
#else
|
||||
# define _GL__GENERIC_BOGUS 0
|
||||
#endif
|
||||
|
||||
/* Store the low-order bits of A <op> B into *R, where OP specifies
|
||||
the operation and OVERFLOW the overflow predicate. Return 1 if the
|
||||
result overflows. Arguments should not have side effects,
|
||||
|
|
@ -304,15 +321,15 @@
|
|||
? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
|
||||
: (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
|
||||
|
||||
/* Return 1 if the integer expressions A - B and -A would overflow,
|
||||
respectively. Arguments should not have side effects,
|
||||
/* Return 1 if the integer expression -A would overflow.
|
||||
Arguments should not have side effects,
|
||||
and can be any signed integer type other than char, bool, a
|
||||
bit-precise integer type, or an enumeration type.
|
||||
These macros are tuned for their last input argument being a constant. */
|
||||
|
||||
#if _GL_HAS_BUILTIN_OVERFLOW_P
|
||||
# define _GL_INT_NEGATE_OVERFLOW(a) \
|
||||
__builtin_sub_overflow_p (0, a, (__typeof__ (- (a))) 0)
|
||||
__builtin_sub_overflow_p (0, a, _GL_INT_CONVERT (- (a), 0))
|
||||
#else
|
||||
# define _GL_INT_NEGATE_OVERFLOW(a) \
|
||||
_GL_INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
|
||||
|
|
|
|||
|
|
@ -25,9 +25,21 @@
|
|||
|
||||
/* True if the arithmetic type T is an integer type. bool counts as
|
||||
an integer. */
|
||||
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
|
||||
#if (__STDC_VERSION__ < 201112 || (defined _MSC_VER && _MSC_VER < 1944) \
|
||||
|| _GL__GENERIC_BOGUS)
|
||||
# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
|
||||
#else
|
||||
/* Pacify -Wuseless-cast and do not default to the simpler expression;
|
||||
see <https://gcc.gnu.org/PR125261>. */
|
||||
# define TYPE_IS_INTEGER(t) \
|
||||
(_Generic ((t) {0}, \
|
||||
bool: 1, char: 1, signed char: 1, unsigned char: 1, \
|
||||
short int: 1, unsigned short int: 1, int: 1, unsigned int: 1, \
|
||||
long int: 1, unsigned long int: 1, long long int: 1, unsigned long long int: 1, \
|
||||
float: 0, double: 0, long double: 0))
|
||||
#endif
|
||||
|
||||
/* True if the real type T is signed. */
|
||||
/* True if the standard integer or standard real type T is signed. */
|
||||
#define TYPE_SIGNED(t) _GL_TYPE_SIGNED (t)
|
||||
|
||||
/* Return 1 if the real expression E, after promotion, has a
|
||||
|
|
@ -50,12 +62,34 @@
|
|||
Padding bits are not supported; this is checked at compile-time below. */
|
||||
#define TYPE_WIDTH(t) _GL_TYPE_WIDTH (t)
|
||||
|
||||
/* The maximum and minimum values for the integer type T. */
|
||||
#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
|
||||
#define TYPE_MAXIMUM(t) \
|
||||
((t) (! TYPE_SIGNED (t) \
|
||||
? (t) -1 \
|
||||
: ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
|
||||
/* The maximum and minimum values for the standard integer type T. */
|
||||
#if (__STDC_VERSION__ < 201112 || (defined _MSC_VER && _MSC_VER < 1944) \
|
||||
|| _GL__GENERIC_BOGUS)
|
||||
# define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
|
||||
# define TYPE_MAXIMUM(t) \
|
||||
((t) (! TYPE_SIGNED (t) \
|
||||
? (t) -1 \
|
||||
: ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
|
||||
#else
|
||||
/* Pacify -Wuseless-cast and do not default to the simpler expressions;
|
||||
see <https://gcc.gnu.org/PR125261>. */
|
||||
# define TYPE_MINIMUM(t) \
|
||||
(_Generic ((t) {0}, \
|
||||
bool: (bool) 0, char: (char) CHAR_MIN, \
|
||||
signed char: (signed char) SCHAR_MIN, unsigned char: (unsigned char) 0, \
|
||||
short int: (short int) SHRT_MIN, unsigned short int: (unsigned short int) 0, \
|
||||
int: INT_MIN, unsigned int: 0u, \
|
||||
long int: LONG_MIN, unsigned long int: 0ul, \
|
||||
long long int: LLONG_MIN, unsigned long long int: 0ull))
|
||||
# define TYPE_MAXIMUM(t) \
|
||||
(_Generic ((t) {0}, \
|
||||
bool: (bool) 1, char: (char) CHAR_MAX, \
|
||||
signed char: (signed char) SCHAR_MAX, unsigned char: (unsigned char) -1, \
|
||||
short int: (short int) SHRT_MAX, unsigned short int: (unsigned short int) -1, \
|
||||
int: INT_MAX, unsigned int: -1u, \
|
||||
long int: LONG_MAX, unsigned long int: -1ul, \
|
||||
long long int: LLONG_MAX, unsigned long long int: -1ull))
|
||||
#endif
|
||||
|
||||
/* Bound on length of the string representing an unsigned integer
|
||||
value representable in B bits. log10 (2.0) < 146/485. The
|
||||
|
|
@ -184,11 +218,11 @@
|
|||
that the result (e.g., A + B) has that type. */
|
||||
#if _GL_HAS_BUILTIN_OVERFLOW_P
|
||||
# define _GL_ADD_OVERFLOW(a, b, min, max) \
|
||||
__builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
|
||||
__builtin_add_overflow_p (a, b, _GL_INT_CONVERT ((a) + (b), 0))
|
||||
# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
|
||||
__builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
|
||||
__builtin_sub_overflow_p (a, b, _GL_INT_CONVERT ((a) - (b), 0))
|
||||
# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
|
||||
__builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
|
||||
__builtin_mul_overflow_p (a, b, _GL_INT_CONVERT ((a) * (b), 0))
|
||||
#else
|
||||
# define _GL_ADD_OVERFLOW(a, b, min, max) \
|
||||
((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#if HAVE_SETMNTENT
|
||||
# include <mntent.h>
|
||||
#endif
|
||||
#include <stdcountof.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -61,8 +62,6 @@
|
|||
|
||||
#include "minmax.h"
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
#define NPROC_MINIMUM 1
|
||||
|
||||
/* Return the number of processors available to the current process, based
|
||||
|
|
@ -335,9 +334,9 @@ num_processors_available (enum nproc_query query)
|
|||
# endif
|
||||
{ CTL_HW, HW_NCPU }
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE (mib); i++)
|
||||
for (int i = 0; i < countof (mib); i++)
|
||||
{
|
||||
if (sysctl (mib[i], ARRAY_SIZE (mib[i]), &nprocs, &len, NULL, 0) == 0
|
||||
if (sysctl (mib[i], countof (mib[i]), &nprocs, &len, NULL, 0) == 0
|
||||
&& len == sizeof (nprocs)
|
||||
&& 0 < nprocs)
|
||||
return nprocs;
|
||||
|
|
|
|||
|
|
@ -19,19 +19,22 @@
|
|||
/* Specification. */
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
/* The native Windows implementation is defined in sigprocmask.c. */
|
||||
#if !(defined _WIN32 && !defined __CYGWIN__)
|
||||
|
||||
#if PTHREAD_SIGMASK_INEFFECTIVE
|
||||
# include <string.h>
|
||||
#endif
|
||||
# include <errno.h>
|
||||
# include <stddef.h>
|
||||
|
||||
# if PTHREAD_SIGMASK_INEFFECTIVE
|
||||
# include <string.h>
|
||||
# endif
|
||||
|
||||
int
|
||||
pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
|
||||
#undef pthread_sigmask
|
||||
# undef pthread_sigmask
|
||||
{
|
||||
#if HAVE_PTHREAD_SIGMASK
|
||||
# if PTHREAD_SIGMASK_INEFFECTIVE
|
||||
# if HAVE_PTHREAD_SIGMASK && !PTHREAD_SIGMASK_NOT_IN_LIBC
|
||||
# if PTHREAD_SIGMASK_INEFFECTIVE
|
||||
sigset_t omask;
|
||||
sigset_t *old_mask_ptr = &omask;
|
||||
sigemptyset (&omask);
|
||||
|
|
@ -40,13 +43,13 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
|
|||
sigaddset (&omask, SIGILL);
|
||||
sigset_t omask_copy;
|
||||
memcpy (&omask_copy, &omask, sizeof omask);
|
||||
# else
|
||||
# else
|
||||
sigset_t *old_mask_ptr = old_mask;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
int ret = pthread_sigmask (how, new_mask, old_mask_ptr);
|
||||
|
||||
# if PTHREAD_SIGMASK_INEFFECTIVE
|
||||
# if PTHREAD_SIGMASK_INEFFECTIVE
|
||||
if (ret == 0)
|
||||
{
|
||||
/* Detect whether pthread_sigmask is currently ineffective.
|
||||
|
|
@ -64,14 +67,18 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
|
|||
if (old_mask)
|
||||
memcpy (old_mask, &omask, sizeof omask);
|
||||
}
|
||||
# endif
|
||||
# if PTHREAD_SIGMASK_FAILS_WITH_ERRNO
|
||||
# endif
|
||||
# if PTHREAD_SIGMASK_FAILS_WITH_ERRNO
|
||||
if (ret == -1)
|
||||
return errno;
|
||||
# endif
|
||||
# endif
|
||||
return ret;
|
||||
#else
|
||||
# else
|
||||
int ret = sigprocmask (how, new_mask, old_mask);
|
||||
return (ret < 0 ? errno : 0);
|
||||
#endif
|
||||
/* Test for ret != 0, not ret < 0, as a workaround against NetBSD bug
|
||||
<https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57213>. */
|
||||
return (ret != 0 ? errno : 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ char *extract_trimmed_name (const STRUCT_UTMP *ut)
|
|||
If OPTIONS & READ_UTMP_NO_BOOT_TIME is nonzero, omit the boot time
|
||||
entries.
|
||||
|
||||
This function is not multithread-safe, since on many platforms it
|
||||
This function is not thread-safe, since on many platforms it
|
||||
invokes the functions setutxent, getutxent, endutxent. These
|
||||
functions are needed because they may lock FILE (so that we don't
|
||||
read garbage when a concurrent process writes to FILE), but their
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@
|
|||
# include <locale/weight.h>
|
||||
#endif
|
||||
|
||||
/* The localeinfo-related code fixes glibc bug 20381.
|
||||
Someday this fix should be merged into glibc. */
|
||||
#if !defined _LIBC && !defined _REGEX_AVOID_UCHAR_H
|
||||
# include "localeinfo.h"
|
||||
#endif
|
||||
|
||||
static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
|
||||
size_t length, reg_syntax_t syntax);
|
||||
static void re_compile_fastmap_iter (regex_t *bufp,
|
||||
|
|
@ -267,11 +273,31 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
|
|||
weak_alias (__re_compile_fastmap, re_compile_fastmap)
|
||||
|
||||
static __always_inline void
|
||||
re_set_fastmap (char *fastmap, bool icase, int ch)
|
||||
re_set_fastmap (char *fastmap, unsigned char ch)
|
||||
{
|
||||
fastmap[ch] = 1;
|
||||
if (icase)
|
||||
fastmap[tolower (ch)] = 1;
|
||||
}
|
||||
|
||||
/* Record in FASTMAP the initial byte of the representations of all
|
||||
characters that match WC ignoring case, other than WC itself.
|
||||
Use MBS as a scratch state. */
|
||||
|
||||
static void
|
||||
re_set_fastmap_icase (char *fastmap, wchar_t wc, mbstate_t *mbs)
|
||||
{
|
||||
#if defined _LIBC || defined _REGEX_AVOID_UCHAR_H
|
||||
wchar_t folded[1] = {__towlower (wc)};
|
||||
int nfolded = folded[0] != wc;
|
||||
#else
|
||||
wchar_t folded[CASE_FOLDED_BUFSIZE];
|
||||
int nfolded = case_folded_counterparts (wc, folded);
|
||||
#endif
|
||||
for (int i = 0; i < nfolded; i++)
|
||||
{
|
||||
char buf[MB_LEN_MAX];
|
||||
if (__wcrtomb (buf, folded[i], mbs) != (size_t) -1)
|
||||
re_set_fastmap (fastmap, buf[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper function for re_compile_fastmap.
|
||||
|
|
@ -283,7 +309,6 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
{
|
||||
re_dfa_t *dfa = bufp->buffer;
|
||||
Idx node_cnt;
|
||||
bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
|
||||
for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
|
||||
{
|
||||
Idx node = init_state->nodes.elems[node_cnt];
|
||||
|
|
@ -291,8 +316,8 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
|
||||
if (type == CHARACTER)
|
||||
{
|
||||
re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
|
||||
if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
|
||||
re_set_fastmap (fastmap, dfa->nodes[node].opr.c);
|
||||
if (bufp->syntax & RE_ICASE)
|
||||
{
|
||||
unsigned char buf[MB_LEN_MAX];
|
||||
unsigned char *p;
|
||||
|
|
@ -307,10 +332,8 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
*p++ = dfa->nodes[node].opr.c;
|
||||
memset (&state, '\0', sizeof (state));
|
||||
if (__mbrtowc (&wc, (const char *) buf, p - buf,
|
||||
&state) == p - buf
|
||||
&& (__wcrtomb ((char *) buf, __towlower (wc), &state)
|
||||
!= (size_t) -1))
|
||||
re_set_fastmap (fastmap, false, buf[0]);
|
||||
&state) == p - buf)
|
||||
re_set_fastmap_icase (fastmap, wc, &state);
|
||||
}
|
||||
}
|
||||
else if (type == SIMPLE_BRACKET)
|
||||
|
|
@ -322,7 +345,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
bitset_word_t w = dfa->nodes[node].opr.sbcset[i];
|
||||
for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
|
||||
if (w & ((bitset_word_t) 1 << j))
|
||||
re_set_fastmap (fastmap, icase, ch);
|
||||
re_set_fastmap (fastmap, ch);
|
||||
}
|
||||
}
|
||||
else if (type == COMPLEX_BRACKET)
|
||||
|
|
@ -344,7 +367,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
|
||||
for (i = 0; i < SBC_MAX; ++i)
|
||||
if (table[i] < 0)
|
||||
re_set_fastmap (fastmap, icase, i);
|
||||
re_set_fastmap (fastmap, i);
|
||||
}
|
||||
#endif /* _LIBC */
|
||||
|
||||
|
|
@ -365,7 +388,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
mbstate_t mbs;
|
||||
memset (&mbs, 0, sizeof (mbs));
|
||||
if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2)
|
||||
re_set_fastmap (fastmap, false, (int) c);
|
||||
re_set_fastmap (fastmap, c);
|
||||
}
|
||||
while (++c != 0);
|
||||
}
|
||||
|
|
@ -375,17 +398,13 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
|
|||
/* ... Else catch all bytes which can start the mbchars. */
|
||||
for (i = 0; i < cset->nmbchars; ++i)
|
||||
{
|
||||
char buf[256];
|
||||
char buf[MB_LEN_MAX];
|
||||
mbstate_t state;
|
||||
memset (&state, '\0', sizeof (state));
|
||||
if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
|
||||
re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
|
||||
if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
|
||||
{
|
||||
if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state)
|
||||
!= (size_t) -1)
|
||||
re_set_fastmap (fastmap, false, *(unsigned char *) buf);
|
||||
}
|
||||
re_set_fastmap (fastmap, buf[0]);
|
||||
if (bufp->syntax & RE_ICASE)
|
||||
re_set_fastmap_icase (fastmap, cset->mbchars[i], &state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -499,7 +518,7 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
|
|||
{
|
||||
const char *msg;
|
||||
size_t msg_size;
|
||||
int nerrcodes = sizeof __re_error_msgid_idx / sizeof __re_error_msgid_idx[0];
|
||||
int nerrcodes = countof (__re_error_msgid_idx);
|
||||
|
||||
if (__glibc_unlikely (errcode < 0 || errcode >= nerrcodes))
|
||||
/* Only error codes returned by the rest of the code should be passed
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define __STDC_WANT_IEC_60559_BFP_EXT__
|
||||
|
||||
#ifndef _LIBC
|
||||
# define _GL_USE_STDLIB_ALLOC 1
|
||||
# include <libc-config.h>
|
||||
|
||||
# if __GNUC_PREREQ (4, 6)
|
||||
|
|
|
|||
10
lib/regex.h
10
lib/regex.h
|
|
@ -645,15 +645,15 @@ extern int re_exec (const char *);
|
|||
array_name[restrict]
|
||||
use glibc's __restrict_arr if available.
|
||||
Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode).
|
||||
Other ISO C99 compilers support it as well. */
|
||||
Other ISO C99 compilers support it as well, except for MSVC. */
|
||||
#ifndef _Restrict_arr_
|
||||
# ifdef __restrict_arr
|
||||
# define _Restrict_arr_ __restrict_arr
|
||||
# else
|
||||
# if ((199901L <= __STDC_VERSION__ \
|
||||
|| 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
|
||||
|| __clang_major__ >= 3) \
|
||||
&& !defined __cplusplus)
|
||||
# if (((199901L <= __STDC_VERSION__ && !defined _MSC_VER) \
|
||||
|| 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
|
||||
|| __clang_major__ >= 3) \
|
||||
&& !defined __cplusplus)
|
||||
# define _Restrict_arr_ _Restrict_
|
||||
# else
|
||||
# define _Restrict_arr_
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
|
|||
{
|
||||
size_t mbcdlen;
|
||||
|
||||
mbcdlen = __wcrtomb ((char *) buf, wcu, &prev_st);
|
||||
mbcdlen = __wcrtomb (buf, wcu, &prev_st);
|
||||
if (__glibc_likely (mbclen == mbcdlen))
|
||||
memcpy (pstr->mbs + byte_idx, buf, mbclen);
|
||||
else if (mbcdlen != (size_t) -1)
|
||||
|
|
@ -1241,8 +1241,8 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
|
|||
}
|
||||
|
||||
/* Insert the new element ELEM to the re_node_set* SET.
|
||||
SET should not already have ELEM.
|
||||
Return true if successful. */
|
||||
SET is not expected to already contain ELEM, but tolerate
|
||||
duplicates as a no-op. Return true if successful. */
|
||||
|
||||
static bool
|
||||
__attribute_warn_unused_result__
|
||||
|
|
@ -1285,8 +1285,16 @@ re_node_set_insert (re_node_set *set, Idx elem)
|
|||
else
|
||||
{
|
||||
for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
|
||||
set->elems[idx] = set->elems[idx - 1];
|
||||
DEBUG_ASSERT (set->elems[idx - 1] < elem);
|
||||
{
|
||||
set->elems[idx] = set->elems[idx - 1];
|
||||
/* Although we already guaranteed that idx is at least 2 here,
|
||||
add an assertion to pacify GCC 16.1.1 -Wanalyzer-out-of-bounds
|
||||
when _REGEX_AVOID_UCHAR_H is defined. */
|
||||
DEBUG_ASSERT (1 < idx);
|
||||
}
|
||||
/* Already in set. Return early. */
|
||||
if (__glibc_unlikely (set->elems[idx - 1] == elem))
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Insert the new element. */
|
||||
|
|
|
|||
|
|
@ -27,9 +27,8 @@
|
|||
|
||||
#include <langinfo.h>
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
#include <stdckdint.h>
|
||||
#include <stdcountof.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _LIBC
|
||||
|
|
@ -120,22 +119,47 @@
|
|||
#define NEWLINE_CHAR '\n'
|
||||
#define WIDE_NEWLINE_CHAR L'\n'
|
||||
|
||||
/* Rename to standard API for using out of glibc. */
|
||||
/* Use Gnulib <uchar.h> if outside glibc and not avoided by the app. */
|
||||
#if defined _LIBC || defined _REGEX_AVOID_UCHAR_H
|
||||
# include <wchar.h>
|
||||
# include <wctype.h>
|
||||
#else
|
||||
# include <uchar.h>
|
||||
# undef wctype_t
|
||||
# define wchar_t char32_t
|
||||
# define wctype_t c32_type_test_t
|
||||
#endif
|
||||
|
||||
#ifndef _LIBC
|
||||
# undef __wctype
|
||||
# undef __iswalnum
|
||||
# undef __iswctype
|
||||
# undef __towlower
|
||||
# undef __towupper
|
||||
# define __wctype wctype
|
||||
# define __iswalnum iswalnum
|
||||
# define __iswctype iswctype
|
||||
# define __towlower towlower
|
||||
# define __towupper towupper
|
||||
# define __btowc btowc
|
||||
# define __mbrtowc mbrtowc
|
||||
# define __wcrtomb wcrtomb
|
||||
# undef __btowc
|
||||
# undef __mbrtowc
|
||||
# undef __wcrtomb
|
||||
# undef __regfree
|
||||
# define __regfree regfree
|
||||
# ifdef _REGEX_AVOID_UCHAR_H
|
||||
# define __wctype wctype
|
||||
# define __iswalnum iswalnum
|
||||
# define __iswctype iswctype
|
||||
# define __towlower towlower
|
||||
# define __towupper towupper
|
||||
# define __btowc btowc
|
||||
# define __mbrtowc mbrtowc
|
||||
# define __wcrtomb wcrtomb
|
||||
# else
|
||||
# define __wctype c32_get_type_test
|
||||
# define __iswalnum c32isalnum
|
||||
# define __iswctype c32_apply_type_test
|
||||
# define __towlower c32tolower
|
||||
# define __towupper c32toupper
|
||||
# define __btowc btoc32
|
||||
# define __mbrtowc mbrtoc32
|
||||
# define __wcrtomb c32rtomb
|
||||
# endif
|
||||
#endif /* not _LIBC */
|
||||
|
||||
/* Types related to integers. Unless protected by #ifdef _LIBC, the
|
||||
|
|
@ -171,7 +195,11 @@
|
|||
reindenting a lot of regex code that formerly used 'int'. */
|
||||
typedef regoff_t Idx;
|
||||
#ifdef _REGEX_LARGE_OFFSETS
|
||||
# define IDX_MAX SSIZE_MAX
|
||||
# ifdef SSIZE_MAX
|
||||
# define IDX_MAX SSIZE_MAX
|
||||
# else
|
||||
# define IDX_MAX ((Idx) ((size_t) -1 / 2))
|
||||
# endif
|
||||
#else
|
||||
# define IDX_MAX INT_MAX
|
||||
#endif
|
||||
|
|
@ -435,7 +463,11 @@ typedef struct re_dfa_t re_dfa_t;
|
|||
# define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
|
||||
#if defined _LIBC || HAVE_MALLOC_0_NONNULL
|
||||
# define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
|
||||
#else
|
||||
# define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t) + ((n) == 0)))
|
||||
#endif
|
||||
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
|
||||
#define re_free(p) free (p)
|
||||
|
||||
|
|
@ -772,8 +804,8 @@ __attribute__ ((pure, unused))
|
|||
re_string_wchar_at (const re_string_t *pstr, Idx idx)
|
||||
{
|
||||
if (pstr->mb_cur_max == 1)
|
||||
return (wint_t) pstr->mbs[idx];
|
||||
return (wint_t) pstr->wcs[idx];
|
||||
return pstr->mbs[idx];
|
||||
return pstr->wcs[idx];
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
|
|
|
|||
125
lib/regexec.c
125
lib/regexec.c
|
|
@ -627,6 +627,8 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
|
|||
/* We must check the longest matching, if nmatch > 0. */
|
||||
fl_longest_match = (nmatch != 0 || dfa->nbackref);
|
||||
|
||||
re_dfastate_t **save_state_log = NULL;
|
||||
|
||||
err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1,
|
||||
preg->translate, (preg->syntax & RE_ICASE) != 0,
|
||||
dfa);
|
||||
|
|
@ -802,11 +804,32 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
|
|||
if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match)
|
||||
|| dfa->nbackref)
|
||||
{
|
||||
/* Save state_log before pruning, in case set_regs
|
||||
later fails and we need to retry with a shorter
|
||||
match. */
|
||||
re_free (save_state_log);
|
||||
save_state_log = NULL;
|
||||
if (!preg->no_sub && nmatch > 1 && dfa->nbackref)
|
||||
{
|
||||
save_state_log
|
||||
= re_malloc (re_dfastate_t *,
|
||||
mctx.match_last + 1);
|
||||
if (__glibc_unlikely (save_state_log == NULL))
|
||||
{
|
||||
err = REG_ESPACE;
|
||||
goto free_return;
|
||||
}
|
||||
memcpy (save_state_log, mctx.state_log,
|
||||
sizeof (re_dfastate_t *)
|
||||
* (mctx.match_last + 1));
|
||||
}
|
||||
err = prune_impossible_nodes (&mctx);
|
||||
if (err == REG_NOERROR)
|
||||
break;
|
||||
if (__glibc_unlikely (err != REG_NOMATCH))
|
||||
goto free_return;
|
||||
re_free (save_state_log);
|
||||
save_state_log = NULL;
|
||||
match_last = -1;
|
||||
}
|
||||
else
|
||||
|
|
@ -825,24 +848,79 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
|
|||
{
|
||||
Idx reg_idx;
|
||||
|
||||
/* Initialize registers. */
|
||||
for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)
|
||||
pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1;
|
||||
|
||||
/* Set the points where matching start/end. */
|
||||
pmatch[0].rm_so = 0;
|
||||
pmatch[0].rm_eo = mctx.match_last;
|
||||
/* FIXME: This function should fail if mctx.match_last exceeds
|
||||
the maximum possible regoff_t value. We need a new error
|
||||
code REG_OVERFLOW. */
|
||||
|
||||
if (!preg->no_sub && nmatch > 1)
|
||||
/* When set_regs fails for a backref pattern, the structural
|
||||
match at match_last has no valid register assignment. Try
|
||||
shorter match lengths, since a valid shorter match may
|
||||
exist (e.g., all groups matching empty). */
|
||||
for (;;)
|
||||
{
|
||||
/* Initialize registers. */
|
||||
for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)
|
||||
pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1;
|
||||
pmatch[0].rm_so = 0;
|
||||
pmatch[0].rm_eo = mctx.match_last;
|
||||
|
||||
if (preg->no_sub || nmatch <= 1)
|
||||
break;
|
||||
|
||||
err = set_regs (preg, &mctx, nmatch, pmatch,
|
||||
dfa->has_plural_match && dfa->nbackref > 0);
|
||||
if (__glibc_likely (err == REG_NOERROR)
|
||||
|| save_state_log == NULL
|
||||
|| err != REG_NOMATCH)
|
||||
break;
|
||||
|
||||
/* set_regs failed; try a shorter match_last. */
|
||||
Idx ml = mctx.match_last;
|
||||
re_free (mctx.state_log);
|
||||
do
|
||||
{
|
||||
--ml;
|
||||
if (ml < 0)
|
||||
break;
|
||||
}
|
||||
while (save_state_log[ml] == NULL
|
||||
|| !save_state_log[ml]->halt
|
||||
|| !check_halt_state_context
|
||||
(&mctx, save_state_log[ml], ml));
|
||||
if (ml < 0)
|
||||
{
|
||||
err = REG_NOMATCH;
|
||||
mctx.state_log = save_state_log;
|
||||
save_state_log = NULL;
|
||||
break;
|
||||
}
|
||||
mctx.state_log
|
||||
= re_malloc (re_dfastate_t *, ml + 1);
|
||||
if (__glibc_unlikely (mctx.state_log == NULL))
|
||||
{
|
||||
mctx.state_log = save_state_log;
|
||||
save_state_log = NULL;
|
||||
err = REG_ESPACE;
|
||||
break;
|
||||
}
|
||||
memcpy (mctx.state_log, save_state_log,
|
||||
sizeof (re_dfastate_t *) * (ml + 1));
|
||||
mctx.match_last = ml;
|
||||
mctx.last_node
|
||||
= check_halt_state_context
|
||||
(&mctx, save_state_log[ml], ml);
|
||||
err = prune_impossible_nodes (&mctx);
|
||||
if (__glibc_unlikely (err != REG_NOERROR))
|
||||
goto free_return;
|
||||
{
|
||||
if (err == REG_NOMATCH)
|
||||
{
|
||||
re_free (mctx.state_log);
|
||||
mctx.state_log = save_state_log;
|
||||
save_state_log = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
re_free (save_state_log);
|
||||
save_state_log = NULL;
|
||||
if (__glibc_unlikely (err != REG_NOERROR))
|
||||
goto free_return;
|
||||
|
||||
/* At last, add the offset to each register, since we slid
|
||||
the buffers so that we could assume that the matching starts
|
||||
|
|
@ -882,6 +960,7 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
|
|||
}
|
||||
|
||||
free_return:
|
||||
re_free (save_state_log);
|
||||
re_free (mctx.state_log);
|
||||
if (dfa->nbackref)
|
||||
match_ctx_free (&mctx);
|
||||
|
|
@ -934,7 +1013,7 @@ prune_impossible_nodes (re_match_context_t *mctx)
|
|||
goto free_return;
|
||||
if (sifted_states[0] != NULL || lim_states[0] != NULL)
|
||||
break;
|
||||
do
|
||||
for (;;)
|
||||
{
|
||||
--match_last;
|
||||
if (match_last < 0)
|
||||
|
|
@ -942,11 +1021,17 @@ prune_impossible_nodes (re_match_context_t *mctx)
|
|||
ret = REG_NOMATCH;
|
||||
goto free_return;
|
||||
}
|
||||
} while (mctx->state_log[match_last] == NULL
|
||||
|| !mctx->state_log[match_last]->halt);
|
||||
halt_node = check_halt_state_context (mctx,
|
||||
mctx->state_log[match_last],
|
||||
match_last);
|
||||
if (mctx->state_log[match_last] != NULL
|
||||
&& mctx->state_log[match_last]->halt)
|
||||
{
|
||||
halt_node
|
||||
= check_halt_state_context (mctx,
|
||||
mctx->state_log[match_last],
|
||||
match_last);
|
||||
if (halt_node)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = merge_state_array (dfa, sifted_states, lim_states,
|
||||
match_last + 1);
|
||||
|
|
@ -2256,7 +2341,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
|
|||
mctx->state_log[cur_idx] = next_state;
|
||||
mctx->state_log_top = cur_idx;
|
||||
}
|
||||
else if (mctx->state_log[cur_idx] == 0)
|
||||
else if (mctx->state_log[cur_idx] == NULL)
|
||||
{
|
||||
mctx->state_log[cur_idx] = next_state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ extern bool scratch_buffer_set_array_size (struct scratch_buffer *buffer,
|
|||
/* The implementation is imported from glibc. */
|
||||
|
||||
/* Avoid possible conflicts with symbols exported by the GNU libc. */
|
||||
#define __libc_scratch_buffer_grow gl_scratch_buffer_grow
|
||||
#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve
|
||||
#define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size
|
||||
#define __libc_scratch_buffer_grow _gl_scratch_buffer_grow
|
||||
#define __libc_scratch_buffer_grow_preserve _gl_scratch_buffer_grow_preserve
|
||||
#define __libc_scratch_buffer_set_array_size _gl_scratch_buffer_set_array_size
|
||||
|
||||
#ifndef _GL_LIKELY
|
||||
/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "acl.h"
|
||||
|
||||
#include <stdcountof.h>
|
||||
|
||||
#include "acl-internal.h"
|
||||
#include "minmax.h"
|
||||
|
||||
|
|
@ -251,11 +253,9 @@ set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
|
|||
|
||||
int ret;
|
||||
if (desc != -1)
|
||||
ret = facl (desc, SETACL,
|
||||
sizeof (entries) / sizeof (aclent_t), entries);
|
||||
ret = facl (desc, SETACL, countof (entries), entries);
|
||||
else
|
||||
ret = acl (name, SETACL,
|
||||
sizeof (entries) / sizeof (aclent_t), entries);
|
||||
ret = acl (name, SETACL, countof (entries), entries);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (errno == ENOSYS || errno == EOPNOTSUPP)
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ sha1_process_block (void const *restrict buffer, size_t len,
|
|||
ctx->total[0] += lolen;
|
||||
ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
|
||||
|
||||
#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
|
||||
#define rol(x, n) (((x) << (n)) | ((uint32_t) {(x)} >> (32 - (n))))
|
||||
|
||||
#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
|
||||
^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <signal.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdcountof.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -260,8 +261,6 @@ static struct numname { int num; char const name[8]; } numname_table[] =
|
|||
{ 0, "EXIT" }
|
||||
};
|
||||
|
||||
#define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0])
|
||||
|
||||
/* ISDIGIT differs from isdigit, as follows:
|
||||
- Its arg may be any int or unsigned int; it need not be an unsigned char
|
||||
or EOF.
|
||||
|
|
@ -286,7 +285,7 @@ str2signum (char const *signame)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < NUMNAME_ENTRIES; i++)
|
||||
for (int i = 0; i < countof (numname_table); i++)
|
||||
if (streq (numname_table[i].name, signame))
|
||||
return numname_table[i].num;
|
||||
|
||||
|
|
@ -331,7 +330,7 @@ str2sig (char const *signame, int *signum)
|
|||
int
|
||||
sig2str (int signum, char *signame)
|
||||
{
|
||||
for (unsigned int i = 0; i < NUMNAME_ENTRIES; i++)
|
||||
for (int i = 0; i < countof (numname_table); i++)
|
||||
if (numname_table[i].num == signum)
|
||||
{
|
||||
strcpy (signame, numname_table[i].name);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
/* Deactivate the mingw <pthread_signal.h>, that provides an unusable definition
|
||||
of pthread_sigmask(). We need to do this before including <signal.h>. */
|
||||
#ifndef WIN_PTHREADS_SIGNAL_H
|
||||
#define WIN_PTHREADS_SIGNAL_H
|
||||
#endif
|
||||
|
||||
#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
|
||||
/* Special invocation convention:
|
||||
- Inside glibc header files.
|
||||
|
|
@ -68,12 +74,13 @@
|
|||
|
||||
/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, Solaris 2.6, Android,
|
||||
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) \
|
||||
&& ((defined __APPLE__ && defined __MACH__) \
|
||||
|| (defined __FreeBSD__ && __FreeBSD__ < 8) \
|
||||
|| (defined __OpenBSD__ && OpenBSD < 201205) \
|
||||
|| defined __sun || defined __ANDROID__ \
|
||||
|| (defined __sun && !defined __cplusplus) \
|
||||
|| defined __ANDROID__ \
|
||||
|| defined __KLIBC__) \
|
||||
&& ! defined __GLIBC__
|
||||
# include <pthread.h>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <stdckdint.h>
|
||||
#include <stdcountof.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
|
@ -232,7 +233,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st)
|
|||
short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim),
|
||||
STAT_TIMESPEC_OFFSETOF (st_mtim),
|
||||
STAT_TIMESPEC_OFFSETOF (st_ctim) };
|
||||
for (int i = 0; i < sizeof ts_off / sizeof *ts_off; i++)
|
||||
for (int i = 0; i < countof (ts_off); i++)
|
||||
{
|
||||
struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]);
|
||||
long int q = ts->tv_nsec / timespec_hz;
|
||||
|
|
|
|||
2243
lib/stdbit.in.h
2243
lib/stdbit.in.h
File diff suppressed because it is too large
Load diff
|
|
@ -19,5 +19,5 @@
|
|||
#include <stdbit.h>
|
||||
|
||||
#if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
|
||||
signed char __gl_stdbit_popcount_support;
|
||||
signed char _gl_stdbit_popcount_support;
|
||||
#endif
|
||||
|
|
|
|||
19
lib/stdc_memreverse8u.c
Normal file
19
lib/stdc_memreverse8u.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* stdc_memreverse8u* functions.
|
||||
Copyright (C) 2026 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/>. */
|
||||
|
||||
#define _GL_STDC_MEMREVERSE8U_INLINE _GL_EXTERN_INLINE
|
||||
#include <config.h>
|
||||
#include <stdbit.h>
|
||||
124
lib/stdcountof.in.h
Normal file
124
lib/stdcountof.in.h
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/* Copyright 2025-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 program 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/>. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>, 2025. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_STDCOUNTOF_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if (defined __cplusplus ? @CXX_HAVE_STDCOUNTOF_H@ : @HAVE_STDCOUNTOF_H@)
|
||||
# @INCLUDE_NEXT@ @NEXT_STDCOUNTOF_H@
|
||||
#else
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_STDCOUNTOF_H
|
||||
#define _@GUARD_PREFIX@_STDCOUNTOF_H
|
||||
|
||||
/* This file uses _GL_GNUC_PREREQ. */
|
||||
#if !_GL_CONFIG_H_INCLUDED
|
||||
#error "Please include config.h first."
|
||||
#endif
|
||||
|
||||
/* Get size_t. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* Returns the number of elements of the array A, as a value of type size_t.
|
||||
|
||||
Example declarations of arrays:
|
||||
extern int a[];
|
||||
extern int a[10];
|
||||
static int a[10][20];
|
||||
void func () { int a[10]; ... }
|
||||
It works for arrays that are declared outside functions and for local
|
||||
variables of array type. It does *not* work for function parameters
|
||||
of array type, because they are actually parameters of pointer type.
|
||||
In this case, i.e. if A is a pointer, e.g. in
|
||||
void func (int a[10]) { ... }
|
||||
this macro attempts to produce an error.
|
||||
*/
|
||||
#define countof(...) \
|
||||
((size_t) (sizeof (__VA_ARGS__) / sizeof (__VA_ARGS__)[0] \
|
||||
+ 0 * _gl_verify_is_array (__VA_ARGS__)))
|
||||
|
||||
/* Attempts to verify that A is an array. */
|
||||
#if defined __cplusplus
|
||||
/* Borrowed from verify.h. */
|
||||
# if !GNULIB_defined_struct__gl_verify_type
|
||||
template <int w>
|
||||
struct _gl_verify_type {
|
||||
unsigned int _gl_verify_error_if_negative: w;
|
||||
};
|
||||
# define GNULIB_defined_struct__gl_verify_type 1
|
||||
# endif
|
||||
# if __cplusplus >= 201103L
|
||||
# if 1
|
||||
/* Use decltype. */
|
||||
/* Default case. */
|
||||
template <typename T>
|
||||
struct _gl_array_type_test { static const int is_array = -1; };
|
||||
/* Unbounded arrays. */
|
||||
template <typename T>
|
||||
struct _gl_array_type_test<T[]> { static const int is_array = 1; };
|
||||
/* Bounded arrays. */
|
||||
template <typename T, size_t N>
|
||||
struct _gl_array_type_test<T[N]> { static const int is_array = 1; };
|
||||
/* String literals. */
|
||||
template <typename T, size_t N>
|
||||
struct _gl_array_type_test<T const (&)[N]> { static const int is_array = 1; };
|
||||
# define _gl_verify_is_array(...) \
|
||||
sizeof (_gl_verify_type<_gl_array_type_test<decltype(__VA_ARGS__)>::is_array>)
|
||||
# else
|
||||
/* Use template argument deduction.
|
||||
Use sizeof to get a constant expression from an unknown type.
|
||||
Note: This approach does not work for countof (((int[]) { a, b, c })). */
|
||||
/* Default case. */
|
||||
template <typename T>
|
||||
struct _gl_array_type_test { double large; };
|
||||
/* Unbounded arrays. */
|
||||
template <typename T>
|
||||
struct _gl_array_type_test<T[]> { char small; };
|
||||
/* Bounded arrays. */
|
||||
template <typename T, size_t N>
|
||||
struct _gl_array_type_test<T[N]> { char small; };
|
||||
/* The T& parameter is essential here: it prevents decay (array-to-pointer
|
||||
conversion). */
|
||||
template <typename T> _gl_array_type_test<T> _gl_array_type_test_helper(T&);
|
||||
# define _gl_verify_is_array(...) \
|
||||
sizeof (_gl_verify_type<(sizeof (_gl_array_type_test_helper(__VA_ARGS__)) < sizeof (double) ? 1 : -1)>)
|
||||
# endif
|
||||
# else
|
||||
/* The compiler does not have the necessary functionality. */
|
||||
# define _gl_verify_is_array(...) 0
|
||||
# endif
|
||||
#else
|
||||
/* In C, we can use typeof and __builtin_types_compatible_p. */
|
||||
/* Work around clang bug <https://github.com/llvm/llvm-project/issues/143284>. */
|
||||
# if (_GL_GNUC_PREREQ (3, 1) && ! defined __clang__ /* || defined __clang__ */) \
|
||||
&& !(defined __STRICT_ANSI__ && __STDC_VERSION__ < 202311L) /* but not with -std=c99 or -std=c11 */
|
||||
# define _gl_verify_is_array(...) \
|
||||
sizeof (struct { unsigned int _gl_verify_error_if_negative : __builtin_types_compatible_p (typeof (__VA_ARGS__), typeof (&*(__VA_ARGS__))) ? -1 : 1; })
|
||||
# else
|
||||
/* The compiler does not have the necessary built-ins. */
|
||||
# define _gl_verify_is_array(...) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_STDCOUNTOF_H */
|
||||
#endif
|
||||
#endif /* _@GUARD_PREFIX@_STDCOUNTOF_H */
|
||||
|
|
@ -56,7 +56,7 @@ workaround_fwrite0 (char *s, size_t n, FILE *fp)
|
|||
}
|
||||
|
||||
size_t
|
||||
gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp)
|
||||
_gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp)
|
||||
{
|
||||
size_t nbytes;
|
||||
if (ckd_mul (&nbytes, size, nmemb) || nbytes == 0)
|
||||
|
|
@ -133,7 +133,7 @@ local_vasprintf (char **resultp, const char *format, va_list args)
|
|||
__mingw_*printf. */
|
||||
|
||||
int
|
||||
gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...)
|
||||
_gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
|
|
@ -151,7 +151,7 @@ gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...)
|
|||
}
|
||||
|
||||
int
|
||||
gl_consolesafe_printf (const char *restrict format, ...)
|
||||
_gl_consolesafe_printf (const char *restrict format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
|
|
@ -169,8 +169,8 @@ gl_consolesafe_printf (const char *restrict format, ...)
|
|||
}
|
||||
|
||||
int
|
||||
gl_consolesafe_vfprintf (FILE *restrict fp,
|
||||
const char *restrict format, va_list args)
|
||||
_gl_consolesafe_vfprintf (FILE *restrict fp,
|
||||
const char *restrict format, va_list args)
|
||||
{
|
||||
char *tmpstring;
|
||||
int result = vasprintf (&tmpstring, format, args);
|
||||
|
|
@ -185,7 +185,7 @@ gl_consolesafe_vfprintf (FILE *restrict fp,
|
|||
}
|
||||
|
||||
int
|
||||
gl_consolesafe_vprintf (const char *restrict format, va_list args)
|
||||
_gl_consolesafe_vprintf (const char *restrict format, va_list args)
|
||||
{
|
||||
char *tmpstring;
|
||||
int result = vasprintf (&tmpstring, format, args);
|
||||
|
|
|
|||
|
|
@ -122,6 +122,20 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
|
||||
can be freed via 'free'; it can be used only after declaring 'free'. */
|
||||
/* Applies to: functions. Cannot be used on inline functions. */
|
||||
#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
|
||||
# if defined __cplusplus && defined __GNUC__ && !defined __clang__
|
||||
/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
|
||||
# define _GL_ATTRIBUTE_DEALLOC_FREE \
|
||||
_GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
|
||||
# else
|
||||
# define _GL_ATTRIBUTE_DEALLOC_FREE \
|
||||
_GL_ATTRIBUTE_DEALLOC (free, 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The __attribute__ feature is available in gcc versions 2.5 and later.
|
||||
The __-protected variants of the attributes 'format' and 'printf' are
|
||||
accepted by gcc versions 2.6.4 (effectively 2.7) and later.
|
||||
|
|
@ -231,6 +245,50 @@
|
|||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
|
||||
been included yet. */
|
||||
#if @GNULIB_FREE_POSIX@
|
||||
# if (@REPLACE_FREE@ && !defined free \
|
||||
&& !(defined __cplusplus && defined GNULIB_NAMESPACE))
|
||||
/* We can't do '#define free rpl_free' here. */
|
||||
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
|
||||
_GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW;
|
||||
# else
|
||||
_GL_EXTERN_C void rpl_free (void *);
|
||||
# endif
|
||||
# undef _GL_ATTRIBUTE_DEALLOC_FREE
|
||||
# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
|
||||
# else
|
||||
# if defined _MSC_VER && !defined free
|
||||
_GL_EXTERN_C
|
||||
# if defined _DLL
|
||||
__declspec (dllimport)
|
||||
# endif
|
||||
void __cdecl free (void *);
|
||||
# else
|
||||
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
|
||||
_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
|
||||
# else
|
||||
_GL_EXTERN_C void free (void *);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# if defined _MSC_VER && !defined free
|
||||
_GL_EXTERN_C
|
||||
# if defined _DLL
|
||||
__declspec (dllimport)
|
||||
# endif
|
||||
void __cdecl free (void *);
|
||||
# else
|
||||
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
|
||||
_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
|
||||
# else
|
||||
_GL_EXTERN_C void free (void *);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Macros for stringification. */
|
||||
#define _GL_STDIO_STRINGIZE(token) #token
|
||||
#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
|
||||
|
|
@ -273,24 +331,24 @@
|
|||
|
||||
#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
|
||||
/* Workarounds against msvcrt bugs. */
|
||||
_GL_FUNCDECL_SYS (gl_consolesafe_fwrite, size_t,
|
||||
_GL_FUNCDECL_SYS (_gl_consolesafe_fwrite, size_t,
|
||||
(const void *ptr, size_t size, size_t nmemb, FILE *fp),
|
||||
_GL_ARG_NONNULL ((1, 4)));
|
||||
# if defined __MINGW32__
|
||||
_GL_FUNCDECL_SYS (gl_consolesafe_fprintf, int,
|
||||
_GL_FUNCDECL_SYS (_gl_consolesafe_fprintf, int,
|
||||
(FILE *restrict fp, const char *restrict format, ...),
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
|
||||
_GL_ARG_NONNULL ((1, 2)));
|
||||
_GL_FUNCDECL_SYS (gl_consolesafe_printf, int,
|
||||
_GL_FUNCDECL_SYS (_gl_consolesafe_printf, int,
|
||||
(const char *restrict format, ...),
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_FUNCDECL_SYS (gl_consolesafe_vfprintf, int,
|
||||
_GL_FUNCDECL_SYS (_gl_consolesafe_vfprintf, int,
|
||||
(FILE *restrict fp,
|
||||
const char *restrict format, va_list args),
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
|
||||
_GL_ARG_NONNULL ((1, 2)));
|
||||
_GL_FUNCDECL_SYS (gl_consolesafe_vprintf, int,
|
||||
_GL_FUNCDECL_SYS (_gl_consolesafe_vprintf, int,
|
||||
(const char *restrict format, va_list args),
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
|
|
@ -633,7 +691,7 @@ _GL_CXXALIASWARN (fprintf);
|
|||
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef fprintf
|
||||
# define fprintf gl_consolesafe_fprintf
|
||||
# define fprintf _gl_consolesafe_fprintf
|
||||
# endif
|
||||
#endif
|
||||
#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
|
||||
|
|
@ -985,7 +1043,7 @@ _GL_CXXALIASWARN (fwrite);
|
|||
#elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef fwrite
|
||||
# define fwrite gl_consolesafe_fwrite
|
||||
# define fwrite _gl_consolesafe_fwrite
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -1371,7 +1429,7 @@ _GL_CXXALIASWARN (printf);
|
|||
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef printf
|
||||
# define printf gl_consolesafe_printf
|
||||
# define printf _gl_consolesafe_printf
|
||||
# endif
|
||||
#endif
|
||||
#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
|
||||
|
|
@ -1808,6 +1866,26 @@ _GL_CXXALIAS_SYS (vasprintf, int,
|
|||
_GL_CXXALIASWARN (vasprintf);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VAPRINTF@
|
||||
/* Write formatted output to a string dynamically allocated with malloc().
|
||||
Return the resulting string. Upon memory allocation error, or some
|
||||
other error, return NULL, with errno set. */
|
||||
_GL_FUNCDECL_SYS (aprintf, char *,
|
||||
(const char *format, ...),
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
|
||||
_GL_ARG_NONNULL ((1))
|
||||
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
||||
_GL_CXXALIAS_SYS (aprintf, char *,
|
||||
(const char *format, ...));
|
||||
_GL_FUNCDECL_SYS (vaprintf, char *,
|
||||
(const char *format, va_list args),
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
|
||||
_GL_ARG_NONNULL ((1))
|
||||
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
||||
_GL_CXXALIAS_SYS (vaprintf, char *,
|
||||
(const char *format, va_list args));
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VDZPRINTF@
|
||||
/* Prints formatted output to file descriptor FD.
|
||||
Returns the number of bytes written to the file descriptor. Upon
|
||||
|
|
@ -1918,7 +1996,7 @@ _GL_CXXALIASWARN (vfprintf);
|
|||
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef vfprintf
|
||||
# define vfprintf gl_consolesafe_vfprintf
|
||||
# define vfprintf _gl_consolesafe_vfprintf
|
||||
# endif
|
||||
#endif
|
||||
#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
|
||||
|
|
@ -2001,7 +2079,7 @@ _GL_CXXALIASWARN (vprintf);
|
|||
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef vprintf
|
||||
# define vprintf gl_consolesafe_vprintf
|
||||
# define vprintf _gl_consolesafe_vprintf
|
||||
# endif
|
||||
#endif
|
||||
#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
|
|||
#if @REPLACE_MB_CUR_MAX@
|
||||
# if !GNULIB_defined_MB_CUR_MAX
|
||||
_GL_STDLIB_INLINE size_t
|
||||
gl_MB_CUR_MAX (void)
|
||||
_gl_MB_CUR_MAX (void)
|
||||
{
|
||||
# if 0 < @REPLACE_MB_CUR_MAX@
|
||||
return @REPLACE_MB_CUR_MAX@;
|
||||
|
|
@ -768,7 +768,7 @@ gl_MB_CUR_MAX (void)
|
|||
# endif
|
||||
}
|
||||
# undef MB_CUR_MAX
|
||||
# define MB_CUR_MAX gl_MB_CUR_MAX ()
|
||||
# define MB_CUR_MAX _gl_MB_CUR_MAX ()
|
||||
# define GNULIB_defined_MB_CUR_MAX 1
|
||||
# endif
|
||||
#endif
|
||||
|
|
@ -1458,7 +1458,7 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
|
|||
|
||||
#if @GNULIB_REALLOC_POSIX@
|
||||
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
|
||||
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
|
||||
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2 && !_GL_INLINE_RPL_REALLOC
|
||||
# define _GL_INLINE_RPL_REALLOC 1
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@
|
|||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <stdckdint.h>
|
||||
#include <stdcountof.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -1882,7 +1883,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
|||
#endif
|
||||
}
|
||||
|
||||
bufp = buf + sizeof (buf) / sizeof (buf[0]);
|
||||
bufp = buf + countof (buf);
|
||||
|
||||
if (negative_number)
|
||||
u_number_value = - u_number_value;
|
||||
|
|
@ -1913,7 +1914,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
|||
CHAR_T sign_char = (negative_number ? L_('-')
|
||||
: always_output_a_sign ? L_('+')
|
||||
: 0);
|
||||
int number_bytes = buf + sizeof buf / sizeof buf[0] - bufp;
|
||||
int number_bytes = buf + countof (buf) - bufp;
|
||||
int number_digits = number_bytes;
|
||||
#if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME
|
||||
if (digits_base >= 0x100)
|
||||
|
|
@ -2098,7 +2099,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
|||
/* Generate string value for T using time_t arithmetic;
|
||||
this works even if sizeof (long) < sizeof (time_t). */
|
||||
|
||||
bufp = buf + sizeof (buf) / sizeof (buf[0]);
|
||||
bufp = buf + countof (buf);
|
||||
negative_number = t < 0;
|
||||
|
||||
do
|
||||
|
|
|
|||
|
|
@ -420,16 +420,19 @@ _GL_WARN_ON_USE_CXX (memchr,
|
|||
|
||||
/* Are S1 and S2, of size N, bytewise equal? */
|
||||
#if @GNULIB_MEMEQ@ && !@HAVE_DECL_MEMEQ@
|
||||
# ifdef __cplusplus
|
||||
# if !GNULIB_defined_memeq
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# endif
|
||||
_GL_MEMEQ_INLINE bool
|
||||
memeq (void const *__s1, void const *__s2, size_t __n)
|
||||
{
|
||||
return !memcmp (__s1, __s2, __n);
|
||||
}
|
||||
# ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# define GNULIB_defined_memeq 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -805,16 +808,19 @@ _GL_CXXALIASWARN (strdup);
|
|||
|
||||
/* Are strings S1 and S2 equal? */
|
||||
#if @GNULIB_STREQ@ && !@HAVE_DECL_STREQ@
|
||||
# ifdef __cplusplus
|
||||
# if !GNULIB_defined_streq
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# endif
|
||||
_GL_STREQ_INLINE bool
|
||||
streq (char const *__s1, char const *__s2)
|
||||
{
|
||||
return !strcmp (__s1, __s2);
|
||||
}
|
||||
# ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# define GNULIB_defined_streq 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -1041,7 +1047,7 @@ _GL_WARN_ON_USE_CXX (strrchr,
|
|||
If *STRINGP was already NULL, nothing happens.
|
||||
Return the old value of *STRINGP.
|
||||
|
||||
This is a variant of strtok() that is multithread-safe and supports
|
||||
This is a variant of strtok() that is thread-safe and supports
|
||||
empty fields.
|
||||
|
||||
Caveat: It modifies the original string.
|
||||
|
|
@ -1179,7 +1185,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
|
|||
x = strtok_r(NULL, "=", &sp); // x = NULL
|
||||
// s = "abc\0-def\0"
|
||||
|
||||
This is a variant of strtok() that is multithread-safe.
|
||||
This is a variant of strtok() that is thread-safe.
|
||||
|
||||
For the POSIX documentation for this function, see:
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html
|
||||
|
|
@ -1245,13 +1251,14 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
|
|||
string + strlen (string)
|
||||
or to
|
||||
strchr (string, '\0'). */
|
||||
# ifdef __cplusplus
|
||||
# if !GNULIB_defined_strnul
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
_GL_STRNUL_INLINE const char *gl_strnul (const char *string)
|
||||
# endif
|
||||
_GL_STRNUL_INLINE const char *_gl_strnul (const char *string)
|
||||
_GL_ATTRIBUTE_PURE
|
||||
_GL_ARG_NONNULL ((1));
|
||||
_GL_STRNUL_INLINE const char *gl_strnul (const char *string)
|
||||
_GL_STRNUL_INLINE const char *_gl_strnul (const char *string)
|
||||
{
|
||||
/* In gcc >= 7 or clang >= 4, we could use the expression
|
||||
strchr (string, '\0')
|
||||
|
|
@ -1261,22 +1268,24 @@ _GL_STRNUL_INLINE const char *gl_strnul (const char *string)
|
|||
option '-fno-builtin' is in use. */
|
||||
return string + strlen (string);
|
||||
}
|
||||
# ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# ifdef __cplusplus
|
||||
# endif
|
||||
# ifdef __cplusplus
|
||||
extern "C++" { /* needed for AIX and Solaris 10 */
|
||||
_GL_BEGIN_NAMESPACE
|
||||
template <typename T> T strnul (T);
|
||||
template <> inline const char *strnul<const char *> (const char *s)
|
||||
{ return gl_strnul (s); }
|
||||
{ return _gl_strnul (s); }
|
||||
template <> inline char *strnul< char *> ( char *s)
|
||||
{ return const_cast<char *>(gl_strnul (s)); }
|
||||
{ return const_cast<char *>(_gl_strnul (s)); }
|
||||
_GL_END_NAMESPACE
|
||||
# else
|
||||
# if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __cplusplus) \
|
||||
|| (defined __clang__ && __clang_major__ >= 3) \
|
||||
|| (defined __SUNPRO_C && __SUNPRO_C >= 0x5150) \
|
||||
|| (__STDC_VERSION__ >= 201112L && !defined __GNUC__)
|
||||
}
|
||||
# else
|
||||
# if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __cplusplus) \
|
||||
|| (defined __clang__ && __clang_major__ >= 3) \
|
||||
|| (defined __SUNPRO_C && __SUNPRO_C >= 0x5150) \
|
||||
|| (__STDC_VERSION__ >= 201112L && !defined __GNUC__)
|
||||
/* The compiler supports _Generic from ISO C11. */
|
||||
/* Since in C (but not in C++!), any function that accepts a '[const] char *'
|
||||
also accepts a '[const] void *' as argument, we make sure that the function-
|
||||
|
|
@ -1284,14 +1293,16 @@ _GL_END_NAMESPACE
|
|||
char *, void * -> void *
|
||||
const char *, const void * -> const void *
|
||||
This mapping is done through the conditional expression. */
|
||||
# define strnul(s) \
|
||||
_Generic (1 ? (s) : (void *) 99, \
|
||||
void * : (char *) gl_strnul (s), \
|
||||
const void * : gl_strnul (s))
|
||||
# else
|
||||
# define strnul(s) \
|
||||
((char *) gl_strnul (s))
|
||||
# define strnul(s) \
|
||||
_Generic (1 ? (s) : (void *) 99, \
|
||||
void * : (char *) _gl_strnul (s), \
|
||||
const void * : _gl_strnul (s))
|
||||
# else
|
||||
# define strnul(s) \
|
||||
((char *) _gl_strnul (s))
|
||||
# endif
|
||||
# endif
|
||||
# define GNULIB_defined_strnul 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -1400,7 +1411,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
|
|||
/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
|
||||
compiler warnings for 'const' related mistakes. */
|
||||
# ifdef __cplusplus
|
||||
extern "C++" { /* needed for AIX */
|
||||
extern "C++" { /* needed for AIX and Solaris 10 */
|
||||
template <typename T>
|
||||
T * mbsstr_template (T* haystack, const char *needle);
|
||||
template <>
|
||||
|
|
@ -1468,7 +1479,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
|
|||
/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
|
||||
compiler warnings for 'const' related mistakes. */
|
||||
# ifdef __cplusplus
|
||||
extern "C++" { /* needed for AIX */
|
||||
extern "C++" { /* needed for AIX and Solaris 10 */
|
||||
template <typename T>
|
||||
T * mbspcasecmp_template (T* string, const char *prefix);
|
||||
template <>
|
||||
|
|
@ -1506,7 +1517,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
|
|||
/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
|
||||
compiler warnings for 'const' related mistakes. */
|
||||
# ifdef __cplusplus
|
||||
extern "C++" { /* needed for AIX */
|
||||
extern "C++" { /* needed for AIX and Solaris 10 */
|
||||
template <typename T>
|
||||
T * mbscasestr_template (T* haystack, const char *needle);
|
||||
template <>
|
||||
|
|
@ -1655,7 +1666,7 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
|
|||
"use gnulib module strerror to guarantee non-NULL result");
|
||||
#endif
|
||||
|
||||
/* Map any int, typically from errno, into an error message. Multithread-safe.
|
||||
/* Map any int, typically from errno, into an error message. Thread-safe.
|
||||
Uses the POSIX declaration, not the glibc declaration. */
|
||||
#if @GNULIB_STRERROR_R@
|
||||
# if @REPLACE_STRERROR_R@
|
||||
|
|
@ -1711,7 +1722,7 @@ _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* Map any int, typically from errno, into an error message. Multithread-safe,
|
||||
/* Map any int, typically from errno, into an error message. Thread-safe,
|
||||
with locale_t argument.
|
||||
Not portable! Only provided by gnulib. */
|
||||
#if @GNULIB_STRERROR_L@
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* gl_strnul function.
|
||||
/* _gl_strnul function.
|
||||
Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -111,9 +111,11 @@ random_bits (random_value *r, random_value s)
|
|||
__clock_gettime64 (CLOCK_REALTIME, &tv);
|
||||
v = mix_random_values (v, tv.tv_sec);
|
||||
v = mix_random_values (v, tv.tv_nsec);
|
||||
#else
|
||||
v = mix_random_values (v, clock ());
|
||||
#endif
|
||||
|
||||
*r = mix_random_values (v, clock ());
|
||||
*r = v;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <time.h>
|
||||
|
||||
/* The replacement functions in this file are only used on native Windows.
|
||||
They are multithread-safe, because the gmtime() and localtime() functions
|
||||
They are thread-safe, because the gmtime() and localtime() functions
|
||||
on native Windows — both in the ucrt and in the older MSVCRT — return a
|
||||
pointer to a 'struct tm' in thread-local memory. */
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
/* Written by Paul Eggert. */
|
||||
|
||||
/* Although this module is not thread-safe, any races should be fairly
|
||||
rare and reasonably benign. For complete thread-safety, use a C
|
||||
rare and reasonably benign. For complete thread safety, use a C
|
||||
library with a working timezone_t type, so that this module is not
|
||||
needed. */
|
||||
|
||||
|
|
@ -118,7 +118,8 @@ save_abbr (timezone_t tz, struct tm *tm)
|
|||
{
|
||||
# if HAVE_STRUCT_TM_TM_ZONE
|
||||
char const *zone = tm->tm_zone;
|
||||
char *zone_copy = (char *) "";
|
||||
static char const mt[] = "";
|
||||
char *zone_copy = (char *) mt;
|
||||
|
||||
/* No need to replace null zones, or zones within the struct tm. */
|
||||
if (!zone || ((char *) tm <= zone && zone < (char *) (tm + 1)))
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ extern "C" {
|
|||
/* Native implementations are trivial. See below for comments on what
|
||||
these operations do. */
|
||||
typedef uint64_t u64;
|
||||
# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
|
||||
# define u64init(hi, lo) u64hilo (hi, lo)
|
||||
# define u64lo(x) ((u64) (x))
|
||||
# define u64getlo(x) ((uint32_t) ((x) & UINT32_MAX))
|
||||
# define u64hilo(hi, lo) ((u64) {((u64) {(hi)} << 32) + (lo)})
|
||||
# define u64init(hi, lo) (((u64) (hi) << 32) + (lo))
|
||||
# define u64lo(x) ((u64) {(x)})
|
||||
# define u64getlo(x) ((uint32_t) {(x) & UINT32_MAX})
|
||||
# define u64size(x) u64lo (x)
|
||||
# define u64not(x) (~(x))
|
||||
# define u64lt(x, y) ((x) < (y))
|
||||
|
|
|
|||
10
m4/free.m4
10
m4/free.m4
|
|
@ -1,5 +1,5 @@
|
|||
# free.m4
|
||||
# serial 6
|
||||
# serial 7
|
||||
dnl Copyright (C) 2003-2005, 2009-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -18,6 +18,9 @@ AC_DEFUN([gl_FUNC_FREE],
|
|||
dnl So far, we know of three platforms that do this:
|
||||
dnl * glibc >= 2.33, thanks to the fix for this bug:
|
||||
dnl <https://sourceware.org/PR17924>
|
||||
dnl * musl >= 1.2.3, thanks to these commits:
|
||||
dnl <https://git.musl-libc.org/cgit/musl/commit/?id=9b77aaca86b53c367f23505c24dd3c02e240efad>
|
||||
dnl <https://git.musl-libc.org/cgit/musl/commit/?id=2010df0d64570db4ce29cc7df0e31f81aa26ae4a>
|
||||
dnl * OpenBSD >= 4.5, thanks to this commit:
|
||||
dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h>
|
||||
dnl * Solaris, because its malloc() implementation is based on brk(),
|
||||
|
|
@ -26,11 +29,14 @@ AC_DEFUN([gl_FUNC_FREE],
|
|||
dnl documentation, or by code inspection of the free() implementation in libc.
|
||||
AC_CACHE_CHECK([whether free is known to preserve errno],
|
||||
[gl_cv_func_free_preserves_errno],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_REQUIRE([gl_MUSL_LIBC])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
]],
|
||||
[[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__)
|
||||
#elif defined MUSL_LIBC && defined SEEK_DATA /* musl >= 1.2.3 */
|
||||
#elif defined __OpenBSD__
|
||||
#elif defined __sun
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# gettext_h.m4
|
||||
# serial 1
|
||||
# serial 3
|
||||
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# gnulib-common.m4
|
||||
# serial 115
|
||||
# serial 122
|
||||
dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -436,6 +436,23 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* _GL_ATTRIBUTE_COUNTED_BY (C) declares that the number of elements of
|
||||
the field is given by C, which must be another field in the same struct.
|
||||
The programmer is responsible for guaranteeing some invariants; see
|
||||
<https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html> for details. */
|
||||
/* Applies to struct fields of type array or pointer (to data). */
|
||||
#ifndef _GL_ATTRIBUTE_COUNTED_BY
|
||||
/* This attributes is supported
|
||||
- for fields of array type: by gcc >= 16, clang >= 18,
|
||||
- for fields of pointer type: by gcc when <https://gcc.gnu.org/PR125072>
|
||||
will be fixed, clang >= 19. */
|
||||
# if defined __clang__ && __clang_major__ >= 19
|
||||
# define _GL_ATTRIBUTE_COUNTED_BY(c) __attribute__ ((__counted_by__ (c)))
|
||||
# else
|
||||
# define _GL_ATTRIBUTE_COUNTED_BY(c)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
|
||||
that can be freed by passing them as the Ith argument to the
|
||||
function F.
|
||||
|
|
@ -892,7 +909,7 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* The following attributes enable detection of multithread-safety problems
|
||||
/* The following attributes enable detection of thread safety problems
|
||||
and resource leaks at compile-time, by clang ≥ 15, when the warning option
|
||||
-Wthread-safety is enabled. For usage, see
|
||||
<https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
|
||||
|
|
@ -1234,9 +1251,9 @@ Amsterdam
|
|||
])
|
||||
|
||||
# AC_C_RESTRICT
|
||||
# This definition is copied from post-2.70 Autoconf and overrides the
|
||||
# AC_C_RESTRICT macro from autoconf 2.60..2.70.
|
||||
m4_version_prereq([2.70.1], [], [
|
||||
# This definition is copied from post-2.73 Autoconf and overrides the
|
||||
# AC_C_RESTRICT macro from autoconf 2.60..2.73.
|
||||
m4_version_prereq([2.73.1], [], [
|
||||
AC_DEFUN([AC_C_RESTRICT],
|
||||
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
|
||||
[ac_cv_c_restrict=no
|
||||
|
|
@ -1262,9 +1279,14 @@ AC_DEFUN([AC_C_RESTRICT],
|
|||
])
|
||||
AH_VERBATIM([restrict],
|
||||
[/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported only directly. */
|
||||
nothing if this is not supported. In particular it is not supported
|
||||
in MSVC 14.44 and in g++ 7 on Solaris 11, although these compilers
|
||||
define __STDC_VERSION__ to 199901L.
|
||||
Do not define if restrict is supported directly. */
|
||||
#if ! (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
|
||||
&& !defined _MSC_VER && !defined __cplusplus)
|
||||
#undef restrict
|
||||
#endif
|
||||
/* Work around a bug in older versions of Sun C++, which did not
|
||||
#define __restrict__ or support _Restrict or __restrict__
|
||||
even though the corresponding Sun C compiler ended up with
|
||||
|
|
@ -1425,6 +1447,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
|
|||
dnl -Wno-pedantic >= 4.8 >= 3.9
|
||||
dnl -Wno-sign-compare >= 3 >= 3.9
|
||||
dnl -Wno-sign-conversion >= 4.3 >= 3.9
|
||||
dnl -Wno-string-plus-int - >= 3.9
|
||||
dnl -Wno-tautological-out-of-range-compare - >= 3.9
|
||||
dnl -Wno-type-limits >= 4.3 >= 3.9
|
||||
dnl -Wno-undef >= 3 >= 3.9
|
||||
|
|
@ -1453,6 +1476,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
|
|||
-Wno-pedantic
|
||||
#endif
|
||||
#if 3 < __clang_major__ + (9 <= __clang_minor__)
|
||||
-Wno-string-plus-int
|
||||
-Wno-tautological-constant-out-of-range-compare
|
||||
#endif
|
||||
#if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
|
||||
|
|
|
|||
|
|
@ -188,8 +188,10 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module stdc_bit_width:
|
||||
# Code from module stdc_count_ones:
|
||||
# Code from module stdc_leading_zeros:
|
||||
# Code from module stdc_memreverse8u:
|
||||
# Code from module stdc_trailing_zeros:
|
||||
# Code from module stdckdint-h:
|
||||
# Code from module stdcountof-h:
|
||||
# Code from module stddef-h:
|
||||
# Code from module stdint-h:
|
||||
# Code from module stdio-h:
|
||||
|
|
@ -554,16 +556,19 @@ AC_DEFUN([gl_INIT],
|
|||
gl_CONDITIONAL_HEADER([stdbit.h])
|
||||
AC_PROG_MKDIR_P
|
||||
AC_REQUIRE([gl_STDBIT_H])
|
||||
GL_STDC_BIT_WIDTH=1
|
||||
gl_STDBIT_MODULE_INDICATOR([stdc_bit_width])
|
||||
AC_REQUIRE([gl_STDBIT_H])
|
||||
GL_STDC_COUNT_ONES=1
|
||||
gl_STDBIT_MODULE_INDICATOR([stdc_count_ones])
|
||||
AC_REQUIRE([gl_STDBIT_H])
|
||||
GL_STDC_LEADING_ZEROS=1
|
||||
gl_STDBIT_MODULE_INDICATOR([stdc_leading_zeros])
|
||||
AC_REQUIRE([gl_STDBIT_H])
|
||||
GL_STDC_TRAILING_ZEROS=1
|
||||
gl_STDBIT_MODULE_INDICATOR([stdc_trailing_zeros])
|
||||
gl_STDCKDINT_H
|
||||
gl_CONDITIONAL_HEADER([stdckdint.h])
|
||||
AC_PROG_MKDIR_P
|
||||
gl_STDCOUNTOF_H
|
||||
gl_CONDITIONAL_HEADER([stdcountof.h])
|
||||
AC_PROG_MKDIR_P
|
||||
gl_STDDEF_H
|
||||
gl_STDDEF_H_REQUIRE_DEFAULTS
|
||||
gl_CONDITIONAL_HEADER([stddef.h])
|
||||
|
|
@ -614,7 +619,7 @@ AC_DEFUN([gl_INIT],
|
|||
;;
|
||||
esac
|
||||
gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1])
|
||||
AC_CHECK_FUNCS([vasprintf])
|
||||
AC_CHECK_FUNCS_ONCE([vasprintf])
|
||||
gl_STDLIB_H
|
||||
gl_STDLIB_H_REQUIRE_DEFAULTS
|
||||
AC_PROG_MKDIR_P
|
||||
|
|
@ -694,10 +699,8 @@ AC_DEFUN([gl_INIT],
|
|||
[Define to 1 if you want the FILE stream functions getc, putc, etc.
|
||||
to use unlocked I/O if available, throughout the package.
|
||||
Unlocked I/O can improve performance, sometimes dramatically.
|
||||
But unlocked I/O is safe only in single-threaded programs,
|
||||
as well as in multithreaded programs for which you can guarantee that
|
||||
every FILE stream, including stdin, stdout, stderr, is used only
|
||||
in a single thread.])
|
||||
But unlocked I/O is safe only in processes in which two threads
|
||||
never simultaneously access the same FILE stream.])
|
||||
AC_DEFINE([USE_UNLOCKED_IO], [GNULIB_STDIO_SINGLE_THREAD],
|
||||
[An alias of GNULIB_STDIO_SINGLE_THREAD.])
|
||||
gl_FUNC_GLIBC_UNLOCKED_IO
|
||||
|
|
@ -727,6 +730,7 @@ AC_DEFUN([gl_INIT],
|
|||
gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false
|
||||
gl_gnulib_enabled_rawmemchr=false
|
||||
gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false
|
||||
gl_gnulib_enabled_stdc_memreverse8u=false
|
||||
gl_gnulib_enabled_strtoll=false
|
||||
gl_gnulib_enabled_utimens=false
|
||||
gl_gnulib_enabled_verify=false
|
||||
|
|
@ -945,6 +949,14 @@ AC_DEFUN([gl_INIT],
|
|||
gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true
|
||||
fi
|
||||
}
|
||||
func_gl_gnulib_m4code_stdc_memreverse8u ()
|
||||
{
|
||||
if $gl_gnulib_enabled_stdc_memreverse8u; then :; else
|
||||
AC_REQUIRE([gl_STDBIT_H])
|
||||
gl_STDBIT_MODULE_INDICATOR([stdc_memreverse8u])
|
||||
gl_gnulib_enabled_stdc_memreverse8u=true
|
||||
fi
|
||||
}
|
||||
func_gl_gnulib_m4code_strtoll ()
|
||||
{
|
||||
if $gl_gnulib_enabled_strtoll; then :; else
|
||||
|
|
@ -972,6 +984,9 @@ AC_DEFUN([gl_INIT],
|
|||
gl_gnulib_enabled_verify=true
|
||||
fi
|
||||
}
|
||||
if $GL_GENERATE_BYTESWAP_H; then
|
||||
func_gl_gnulib_m4code_stdc_memreverse8u
|
||||
fi
|
||||
if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
|
||||
func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c
|
||||
fi
|
||||
|
|
@ -1087,6 +1102,7 @@ AC_DEFUN([gl_INIT],
|
|||
AM_CONDITIONAL([gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7], [$gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_rawmemchr], [$gl_gnulib_enabled_rawmemchr])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_stdc_memreverse8u], [$gl_gnulib_enabled_stdc_memreverse8u])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens])
|
||||
AM_CONDITIONAL([gl_GNULIB_ENABLED_verify], [$gl_gnulib_enabled_verify])
|
||||
|
|
@ -1463,13 +1479,14 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/signal.in.h
|
||||
lib/stat-time.c
|
||||
lib/stat-time.h
|
||||
lib/stdbit.c
|
||||
lib/stdbit.in.h
|
||||
lib/stdc_bit_width.c
|
||||
lib/stdc_count_ones.c
|
||||
lib/stdc_leading_zeros.c
|
||||
lib/stdc_memreverse8u.c
|
||||
lib/stdc_trailing_zeros.c
|
||||
lib/stdckdint.in.h
|
||||
lib/stdcountof.in.h
|
||||
lib/stddef.in.h
|
||||
lib/stdint.in.h
|
||||
lib/stdio-consolesafe.c
|
||||
|
|
@ -1633,6 +1650,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/stdalign.m4
|
||||
m4/stdbit_h.m4
|
||||
m4/stdckdint_h.m4
|
||||
m4/stdcountof_h.m4
|
||||
m4/stddef_h.m4
|
||||
m4/stdint.m4
|
||||
m4/stdio_h.m4
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# manywarnings.m4
|
||||
# serial 32
|
||||
# serial 35
|
||||
dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -97,7 +97,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
|
|||
# export LC_ALL=C && comm -3 \
|
||||
# <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
|
||||
# awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
|
||||
# <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
|
||||
# <((gcc --help=c,warnings && gcc --help=common,warnings) \
|
||||
# | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
|
||||
|
||||
$1=
|
||||
for gl_manywarn_item in -fanalyzer -fstrict-flex-arrays \
|
||||
|
|
@ -112,9 +113,11 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
|
|||
-Wextra \
|
||||
-Wflex-array-member-not-at-end \
|
||||
-Wformat-signedness \
|
||||
-Wfree-labels \
|
||||
-Winit-self \
|
||||
-Winline \
|
||||
-Winvalid-pch \
|
||||
-Wkeyword-macro \
|
||||
-Wlogical-op \
|
||||
-Wmissing-declarations \
|
||||
-Wmissing-include-dirs \
|
||||
|
|
@ -162,6 +165,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
|
|||
AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
|
||||
AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
|
||||
AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
|
||||
AS_VAR_APPEND([$1], [' -Wstringop-overflow=4'])
|
||||
AS_VAR_APPEND([$1], [' -Wuse-after-free=3'])
|
||||
AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
|
||||
AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
|
||||
|
|
@ -180,6 +184,15 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
|
|||
AS_VAR_APPEND([$1], [' -fno-common'])
|
||||
;;
|
||||
esac
|
||||
case $gl_gcc_version in
|
||||
gcc*' ('*') '?.* | gcc*' ('*') '1[[0-3]].*)
|
||||
# In GCC < 14 the option either does not exist,
|
||||
# or is accepted but always warns.
|
||||
;;
|
||||
*)
|
||||
AS_VAR_APPEND([$1], [' -Wuseless-cast'])
|
||||
;;
|
||||
esac
|
||||
case $gl_gcc_version in
|
||||
gcc*' ('*') '?.* | gcc*' ('*') '1[[0-4]].*)
|
||||
# In GCC < 15 the option either does not exist,
|
||||
|
|
@ -194,6 +207,20 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
|
|||
# These options are not supported by gcc, but are useful with clang.
|
||||
AS_VAR_APPEND([$1], [' -Wthread-safety'])
|
||||
|
||||
# These options are not supported by gcc, only by clang. clang enables
|
||||
# them by default, but they are never useful. So, disable them.
|
||||
# Note! This applies *only* to options that are really never useful.
|
||||
# When in doubt, let the package maintainer decide. The principle
|
||||
# of this module is to enable *all* possible warnings and then allow
|
||||
# the package maintainer to disable warnings they find not useful
|
||||
# in the context of their package.
|
||||
# Gnulib uses #include_next in many .h files.
|
||||
AS_VAR_APPEND([$1], [' -Wno-gnu-include-next'])
|
||||
# C programmers know what '+' does. These warning options are targeted
|
||||
# at fresh C programmers that are used to JavaScript, Java, or C#.
|
||||
AS_VAR_APPEND([$1], [' -Wno-string-plus-int'])
|
||||
AS_VAR_APPEND([$1], [' -Wno-string-plus-char'])
|
||||
|
||||
# Disable specific options as needed.
|
||||
if test "$gl_cv_cc_nomfi_needed" = yes; then
|
||||
AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# pthread_sigmask.m4
|
||||
# serial 24
|
||||
# serial 26
|
||||
dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
|
|||
[AC_EGREP_CPP([headers_define_pthread_sigmask], [
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#ifdef pthread_sigmask
|
||||
#if defined _WIN32 && defined pthread_sigmask
|
||||
headers_define_pthread_sigmask
|
||||
#endif],
|
||||
[gl_cv_func_pthread_sigmask_macro=yes],
|
||||
|
|
@ -103,6 +103,27 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
|
|||
])
|
||||
fi
|
||||
|
||||
dnl We want to be able to use pthread_sigmask as a thread-safe
|
||||
dnl replacement of sigprocmask, in both single-threaded and multithreaded
|
||||
dnl processes. Therefore enforce PTHREAD_SIGMASK_LIB to be empty, whenever
|
||||
dnl possible.
|
||||
if test -n "$PTHREAD_SIGMASK_LIB"; then
|
||||
dnl We get here on glibc ≤ 2.31, NetBSD, OpenBSD ≤ 5.8, AIX.
|
||||
dnl Except on AIX, pthread_sigmask and sigprocmask are equivalent.
|
||||
dnl Whereas on AIX, sigprocmask is not allowed in multithreaded processes
|
||||
dnl <https://www.ibm.com/docs/en/aix/7.2.0?topic=s-sigprocmask-sigsetmask-sigblock-subroutine>.
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
case "$host_os" in
|
||||
aix*) ;;
|
||||
*)
|
||||
REPLACE_PTHREAD_SIGMASK=1
|
||||
AC_DEFINE([PTHREAD_SIGMASK_NOT_IN_LIBC], [1],
|
||||
[Define to 1 if pthread_sigmask requires linking with some library.])
|
||||
PTHREAD_SIGMASK_LIB=
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST([PTHREAD_SIGMASK_LIB])
|
||||
dnl For backward compatibility.
|
||||
LIB_PTHREAD_SIGMASK="$PTHREAD_SIGMASK_LIB"
|
||||
|
|
@ -163,6 +184,8 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
|
|||
|
||||
dnl On Cygwin 1.7.5, the pthread_sigmask() has a wrong return value
|
||||
dnl convention: Upon failure, it returns -1 and sets errno.
|
||||
dnl Likewise on NetBSD 9.3, when libpthread is not in use; see
|
||||
dnl https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57214 .
|
||||
AC_CACHE_CHECK([whether pthread_sigmask returns error numbers],
|
||||
[gl_cv_func_pthread_sigmask_return_works],
|
||||
[
|
||||
|
|
|
|||
35
m4/regex.m4
35
m4/regex.m4
|
|
@ -1,5 +1,5 @@
|
|||
# regex.m4
|
||||
# serial 81
|
||||
# serial 82
|
||||
dnl Copyright (C) 1996-2001, 2003-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -318,6 +318,39 @@ AC_DEFUN([gl_REGEX],
|
|||
free (regs.end);
|
||||
}
|
||||
|
||||
/* These tests are derived from bug#68725, reported by
|
||||
Ed Morton. The regex uses backrefs with optional groups
|
||||
to detect palindromes. */
|
||||
{
|
||||
regex_t re68725;
|
||||
i = regcomp (&re68725,
|
||||
"^(.?)(.?).?\\\\2\\\\1$",
|
||||
REG_EXTENDED);
|
||||
if (i)
|
||||
result |= 64;
|
||||
else
|
||||
{
|
||||
regmatch_t pm[3];
|
||||
/* "ab" is not a palindrome, so must not match
|
||||
with $. */
|
||||
if (regexec (&re68725, "ab", 1, pm, 0) == 0)
|
||||
result |= 64;
|
||||
/* Without $, a shorter match (e.g., empty or "a")
|
||||
is valid at position 0. Ensure set_regs retries
|
||||
with a shorter match_last when the longest
|
||||
structural match fails content validation. */
|
||||
regfree (&re68725);
|
||||
i = regcomp (&re68725,
|
||||
"^(.?)(.?).?\\\\2\\\\1",
|
||||
REG_EXTENDED);
|
||||
if (i)
|
||||
result |= 64;
|
||||
else if (regexec (&re68725, "ab", 3, pm, 0) != 0)
|
||||
result |= 64;
|
||||
regfree (&re68725);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* It would be nice to reject hosts whose regoff_t values are too
|
||||
narrow (including glibc on hosts with 64-bit ptrdiff_t and
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# stdbit_h.m4
|
||||
# serial 2
|
||||
# serial 14
|
||||
dnl Copyright 2024-2026 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,27 +12,74 @@ AC_DEFUN_ONCE([gl_STDBIT_H],
|
|||
[
|
||||
AC_REQUIRE([gl_BIGENDIAN])
|
||||
|
||||
AC_CHECK_HEADERS_ONCE([stdbit.h])
|
||||
if test $ac_cv_header_stdbit_h = yes; then
|
||||
GL_GENERATE_STDBIT_H=false
|
||||
gl_CHECK_NEXT_HEADERS([stdbit.h])
|
||||
if test "$ac_cv_header_stdbit_h" = yes; then
|
||||
HAVE_STDBIT_H=1
|
||||
else
|
||||
HAVE_STDBIT_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_STDBIT_H])
|
||||
AM_CONDITIONAL([GL_HAVE_STDBIT_H], [test "$ac_cv_header_stdbit_h" = yes])
|
||||
|
||||
if test "$ac_cv_header_stdbit_h" = yes; then
|
||||
dnl We may have a stdbit.h without C2y features.
|
||||
AC_CHECK_DECLS([stdc_rotate_left_uc], , , [[#include <stdbit.h>]])
|
||||
if test "$ac_cv_have_decl_stdc_rotate_left_uc" = no; then
|
||||
GL_GENERATE_STDBIT_H=true
|
||||
else
|
||||
GL_GENERATE_STDBIT_H=false
|
||||
fi
|
||||
else
|
||||
GL_GENERATE_STDBIT_H=true
|
||||
fi
|
||||
|
||||
dnl We don't use gl_MODULE_INDICATOR_INIT_VARIABLE here, because stdbit.in.h
|
||||
dnl does not use #include_next.
|
||||
GL_STDC_LEADING_ZEROS=0; AC_SUBST([GL_STDC_LEADING_ZEROS])
|
||||
GL_STDC_LEADING_ONES=0; AC_SUBST([GL_STDC_LEADING_ONES])
|
||||
GL_STDC_TRAILING_ZEROS=0; AC_SUBST([GL_STDC_TRAILING_ZEROS])
|
||||
GL_STDC_TRAILING_ONES=0; AC_SUBST([GL_STDC_TRAILING_ONES])
|
||||
GL_STDC_FIRST_LEADING_ZERO=0; AC_SUBST([GL_STDC_FIRST_LEADING_ZERO])
|
||||
GL_STDC_FIRST_LEADING_ONE=0; AC_SUBST([GL_STDC_FIRST_LEADING_ONE])
|
||||
GL_STDC_FIRST_TRAILING_ZERO=0; AC_SUBST([GL_STDC_FIRST_TRAILING_ZERO])
|
||||
GL_STDC_FIRST_TRAILING_ONE=0; AC_SUBST([GL_STDC_FIRST_TRAILING_ONE])
|
||||
GL_STDC_COUNT_ZEROS=0; AC_SUBST([GL_STDC_COUNT_ZEROS])
|
||||
GL_STDC_COUNT_ONES=0; AC_SUBST([GL_STDC_COUNT_ONES])
|
||||
GL_STDC_HAS_SINGLE_BIT=0; AC_SUBST([GL_STDC_HAS_SINGLE_BIT])
|
||||
GL_STDC_BIT_WIDTH=0; AC_SUBST([GL_STDC_BIT_WIDTH])
|
||||
GL_STDC_BIT_FLOOR=0; AC_SUBST([GL_STDC_BIT_FLOOR])
|
||||
GL_STDC_BIT_CEIL=0; AC_SUBST([GL_STDC_BIT_CEIL])
|
||||
])
|
||||
|
||||
# gl_STDBIT_MODULE_INDICATOR([modulename])
|
||||
# sets the shell variable that indicates the presence of the given module
|
||||
# to a C preprocessor expression that will evaluate to 1.
|
||||
# This macro invocation must not occur in macros that are AC_REQUIREd.
|
||||
AC_DEFUN([gl_STDBIT_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Ensure to expand the default settings once only.
|
||||
gl_STDBIT_H_REQUIRE_DEFAULTS
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
||||
dnl Define it also as a C macro, for the benefit of the unit tests.
|
||||
gl_MODULE_INDICATOR_FOR_TESTS([$1])
|
||||
])
|
||||
|
||||
# Initializes the default values for AC_SUBSTed shell variables.
|
||||
# This macro must not be AC_REQUIREd. It must only be invoked, and only
|
||||
# outside of macros or in macros that are not AC_REQUIREd.
|
||||
AC_DEFUN([gl_STDBIT_H_REQUIRE_DEFAULTS],
|
||||
[
|
||||
m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDBIT_H_MODULE_INDICATOR_DEFAULTS], [
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LEADING_ZEROS])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LEADING_ONES])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_TRAILING_ZEROS])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_TRAILING_ONES])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_LEADING_ZERO])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_LEADING_ONE])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_TRAILING_ZERO])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_TRAILING_ONE])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_COUNT_ZEROS])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_COUNT_ONES])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_HAS_SINGLE_BIT])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_WIDTH])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_FLOOR])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_CEIL])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_ROTATE_LEFT])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_ROTATE_RIGHT])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_MEMREVERSE8])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_MEMREVERSE8U])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LOAD8_ALIGNED])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LOAD8])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_STORE8_ALIGNED])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_STORE8])
|
||||
])
|
||||
m4_require(GL_MODULE_INDICATOR_PREFIX[_STDBIT_H_MODULE_INDICATOR_DEFAULTS])
|
||||
AC_REQUIRE([gl_STDBIT_H_DEFAULTS])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDBIT_H_DEFAULTS],
|
||||
[
|
||||
])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# stdckdint_h.m4
|
||||
# serial 1
|
||||
# serial 2
|
||||
dnl Copyright 2025-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -52,7 +52,7 @@ AC_DEFUN_ONCE([gl_STDCKDINT_H],
|
|||
HAVE_C_STDCKDINT_H=0
|
||||
HAVE_WORKING_C_STDCKDINT_H=0
|
||||
fi
|
||||
if test "$CXX" != no; then
|
||||
if test -n "$CXX" && test "$CXX" != no; then
|
||||
AC_CACHE_CHECK([whether stdckdint.h can be included in C++],
|
||||
[gl_cv_header_cxx_stdckdint_h],
|
||||
[dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
|
||||
|
|
@ -114,7 +114,7 @@ EOF
|
|||
AC_SUBST([HAVE_CXX_STDCKDINT_H])
|
||||
AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H])
|
||||
|
||||
if test "$CXX" != no; then
|
||||
if test -n "$CXX" && test "$CXX" != no; then
|
||||
dnl We might need the header for C or C++.
|
||||
if test $HAVE_C_STDCKDINT_H = 1 \
|
||||
&& test $HAVE_WORKING_C_STDCKDINT_H = 1 \
|
||||
|
|
|
|||
53
m4/stdcountof_h.m4
Normal file
53
m4/stdcountof_h.m4
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# stdcountof_h.m4
|
||||
# serial 3
|
||||
dnl Copyright 2025-2026 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 This file is offered as-is, without any warranty.
|
||||
|
||||
AC_DEFUN_ONCE([gl_STDCOUNTOF_H],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE([stdcountof.h])
|
||||
gl_CHECK_NEXT_HEADERS([stdcountof.h])
|
||||
if test $ac_cv_header_stdcountof_h = yes; then
|
||||
HAVE_STDCOUNTOF_H=1
|
||||
else
|
||||
HAVE_STDCOUNTOF_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_STDCOUNTOF_H])
|
||||
|
||||
dnl In clang 21, <stdcountof.h> exists but does not work in C++ mode, because
|
||||
dnl it uses _Countof, which is not a compiler built-in in C++ mode.
|
||||
m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
|
||||
CXX_HAVE_STDCOUNTOF_H=1
|
||||
if test -n "$CXX" && test "$CXX" != no; then
|
||||
AC_CACHE_CHECK([whether the C++ compiler has <stdcountof.h>],
|
||||
[gl_cv_cxx_have_stdcountof_h],
|
||||
[dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
|
||||
dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
|
||||
cat > conftest.cpp <<\EOF
|
||||
#include <stdcountof.h>
|
||||
int a[] = { 86, 47 };
|
||||
unsigned int a_n = countof (a);
|
||||
EOF
|
||||
gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
|
||||
if AC_TRY_EVAL([gl_command]); then
|
||||
gl_cv_cxx_have_stdcountof_h=yes
|
||||
else
|
||||
gl_cv_cxx_have_stdcountof_h=no
|
||||
fi
|
||||
rm -fr conftest*
|
||||
])
|
||||
if test $gl_cv_cxx_have_stdcountof_h != yes; then
|
||||
CXX_HAVE_STDCOUNTOF_H=0
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CXX_HAVE_STDCOUNTOF_H])
|
||||
|
||||
if test $HAVE_STDCOUNTOF_H = 1 && test $CXX_HAVE_STDCOUNTOF_H = 1; then
|
||||
GL_GENERATE_STDCOUNTOF_H=false
|
||||
else
|
||||
GL_GENERATE_STDCOUNTOF_H=true
|
||||
fi
|
||||
])
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# stdio_h.m4
|
||||
# serial 75
|
||||
# serial 76
|
||||
dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -182,6 +182,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
|
|||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VAPRINTF])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF])
|
||||
|
|
@ -208,6 +209,8 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
|
|||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1])
|
||||
])
|
||||
m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS])
|
||||
dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized.
|
||||
gl_STDLIB_H_REQUIRE_DEFAULTS
|
||||
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
|
||||
])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue