Merge branch 'savannah/master' into feature/igc3

This commit is contained in:
Pip Cet 2026-05-27 06:58:44 +00:00
commit 50c6d07035
281 changed files with 7473 additions and 3219 deletions

View file

@ -52,7 +52,7 @@ main (int argc, char **argv)
int opt, ncolors = 0, i; int opt, ncolors = 0, i;
XColor *allocated; XColor *allocated;
int nallocated; int nallocated;
XColor color; XColor color = {0};
Colormap cmap; Colormap cmap;
while ((opt = getopt (argc, argv, "n:")) != EOF) while ((opt = getopt (argc, argv, "n:")) != EOF)
@ -76,7 +76,6 @@ main (int argc, char **argv)
allocated = malloc (ncolors * sizeof *allocated); allocated = malloc (ncolors * sizeof *allocated);
nallocated = 0; nallocated = 0;
memset (&color, 0, sizeof color);
while (nallocated < ncolors while (nallocated < ncolors
&& color.red < 65536) && color.red < 65536)

View file

@ -1,21 +1,21 @@
// Use the ARRAYELTS macro where possible. // Use the countof macro where possible.
@@ @@
type T; type T;
T[] E; T[] E;
@@ @@
- (sizeof (E) / sizeof (E[...])) - (sizeof (E) / sizeof (E[...]))
+ ARRAYELTS (E) + countof (E)
@@ @@
type T; type T;
T[] E; T[] E;
@@ @@
- (sizeof (E) / sizeof (T)) - (sizeof (E) / sizeof (T))
+ ARRAYELTS (E) + countof (E)
@@ @@
type T; type T;
T[] E; T[] E;
@@ @@
- (sizeof (E) / sizeof (*E)) - (sizeof (E) / sizeof (*E))
+ ARRAYELTS (E) + countof (E)

View file

@ -50,7 +50,7 @@ GNULIB_MODULES='
qcopy-acl readlink readlinkat realloc-posix regex qcopy-acl readlink readlinkat realloc-posix regex
sig2str sigdescr_np socklen stat-time std-gnu23 sig2str sigdescr_np socklen stat-time std-gnu23
stdc_bit_width stdc_count_ones stdc_trailing_zeros stdc_bit_width stdc_count_ones stdc_trailing_zeros
stdckdint-h stddef-h stdio-h stdio-windows stdckdint-h stdcountof-h stddef-h stdio-h stdio-windows
stpcpy streq strnlen strtoimax symlink sys_stat-h sys_time-h stpcpy streq strnlen strtoimax symlink sys_stat-h sys_time-h
tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub
unlocked-io update-copyright utimensat unlocked-io update-copyright utimensat
@ -58,14 +58,18 @@ GNULIB_MODULES='
' '
AVOIDED_MODULES=' AVOIDED_MODULES='
access btowc chmod close crypto/af_alg dup fchdir fstat gnulib-i18n access btoc32
iswblank iswctype iswdigit iswxdigit langinfo-h libgmp-mpq c32_apply_type_test c32_get_type_test
localcharset locale-h localename-unsafe-limited lock c32isalnum c32rtomb c32tolower c32toupper
mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo chmod close crypto/af_alg dup fchdir fstat gnulib-i18n
openat-die opendir pthread-h raise langinfo-h libgmp-mpq
save-cwd select setenv sigprocmask stat std-gnu11 stdarg-h strncpy 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 threadlib tzset unsetenv utime utime-h
wchar-h wcrtomb wctype wctype-h wchar-h uchar-h
' '
GNULIB_TOOL_FLAGS=' GNULIB_TOOL_FLAGS='

View file

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # 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 # 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 # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -60,7 +60,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. 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 This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 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 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case $UNAME_SYSTEM in case $UNAME_SYSTEM in
Linux|GNU|GNU/*) Ironclad|Linux|GNU|GNU/*)
LIBC=unknown LIBC=unknown
set_cc_for_build set_cc_for_build
@ -167,6 +167,8 @@ Linux|GNU|GNU/*)
LIBC=gnu LIBC=gnu
#elif defined(__LLVM_LIBC__) #elif defined(__LLVM_LIBC__)
LIBC=llvm LIBC=llvm
#elif defined(__mlibc__)
LIBC=mlibc
#else #else
#include <stdarg.h> #include <stdarg.h>
/* First heuristic to detect musl libc. */ /* First heuristic to detect musl libc. */
@ -1186,6 +1188,9 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;; ;;
sw_64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
tile*:Linux:*:*) tile*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;; ;;
@ -1598,10 +1603,10 @@ EOF
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;; ;;
x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*) x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*)
GUESS=$UNAME_MACHINE-pc-ironclad-mlibc GUESS=$UNAME_MACHINE-pc-ironclad-$LIBC
;; ;;
*:[Ii]ronclad:*:*) *:[Ii]ronclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc GUESS=$UNAME_MACHINE-unknown-ironclad-$LIBC
;; ;;
esac esac

11
build-aux/config.sub vendored
View file

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # 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 # 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 # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) 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 This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -1432,6 +1432,7 @@ case $cpu-$vendor in
| sparcv9v \ | sparcv9v \
| spu \ | spu \
| sv1 \ | sv1 \
| sw_64 \
| sx* \ | sx* \
| tahoe \ | tahoe \
| thumbv7* \ | thumbv7* \
@ -1525,7 +1526,7 @@ EOF
;; ;;
ironclad*) ironclad*)
kernel=ironclad kernel=ironclad
os=`echo "$basic_os" | sed -e 's|ironclad|mlibc|'` os=`echo "$basic_os" | sed -e 's|ironclad|gnu|'`
;; ;;
linux*) linux*)
kernel=linux kernel=linux
@ -2220,7 +2221,7 @@ case $kernel-$os-$obj in
;; ;;
uclinux-uclibc*- | uclinux-gnu*- ) uclinux-uclibc*- | uclinux-gnu*- )
;; ;;
ironclad-mlibc*-) ironclad-gnu*- | ironclad-mlibc*- )
;; ;;
managarm-mlibc*- | managarm-kernel*- ) managarm-mlibc*- | managarm-kernel*- )
;; ;;

View file

@ -75,6 +75,7 @@ exec $awk \
} }
c_lower = "abcdefghijklmnopqrstuvwxyz" c_lower = "abcdefghijklmnopqrstuvwxyz"
unsafe_gnu_url = "(http|ftp)://([" c_lower ".]*\\.)?(gnu|fsf)\\.org" unsafe_gnu_url = "(http|ftp)://([" c_lower ".]*\\.)?(gnu|fsf)\\.org"
markdown_quotation = "(^|[^\\\\])`[^'\''`]+`"
} }
{ input[NR] = $0 } { input[NR] = $0 }
@ -92,11 +93,6 @@ exec $awk \
status = 1 status = 1
} }
/(^|[^\\])`[^'\''`]+`/ {
print "Markdown-style quotes in commit message"
status = 1
}
nlines == 0 && $0 !~ non_space { next } nlines == 0 && $0 !~ non_space { next }
{ nlines++ } { nlines++ }
@ -141,7 +137,7 @@ exec $awk \
status = 1 status = 1
} }
$0 ~ unsafe_gnu_url { $0 ~ unsafe_gnu_url || $0 ~ markdown_quotation {
needs_rewriting = 1 needs_rewriting = 1
} }
@ -167,7 +163,13 @@ exec $awk \
suffix = substr(line, RSTART) suffix = substr(line, RSTART)
line = prefix "https:" substr(suffix, 5 + (suffix ~ /^http:/)) line = prefix "https:" substr(suffix, 5 + (suffix ~ /^http:/))
} }
print line >file while (match(line, markdown_quotation)) {
prefix = substr(line, 1, RSTART)
within = substr(line, RSTART + 2, RLENGTH - 3)
suffix = substr(line, RSTART + RLENGTH)
line = prefix "'\''" within "'\''" suffix
}
print line >file
} }
if (close(file) != 0) { if (close(file) != 0) {
print "Cannot rewrite: " file print "Cannot rewrite: " file

View file

@ -1635,6 +1635,10 @@ AC_DEFUN([gt_TYPE_WINT_T],
AC_DEFUN([gl_TYPE_OFF64_T], AC_DEFUN([gl_TYPE_OFF64_T],
[HAVE_OFF64_T=1 [HAVE_OFF64_T=1
AC_SUBST([HAVE_OFF64_T])]) 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. # Initialize gnulib right after choosing the compiler.
dnl Amongst other things, this sets AR and ARFLAGS. dnl Amongst other things, this sets AR and ARFLAGS.

View file

@ -3250,7 +3250,8 @@ In Erlang code, the tags are the functions, records and macros defined
in the file. in the file.
@item @item
In Fortran code, functions, subroutines and block data are tags. In Fortran code, modules, subroutines, functions, entries and block data
are tags.
@item @item
In Go code, packages, functions, and types are tags. In Go code, packages, functions, and types are tags.

View file

@ -2202,24 +2202,20 @@ variable @code{isearch-lazy-highlight} to @code{nil} disables this
highlighting. Here are some other variables that customize the lazy highlighting. Here are some other variables that customize the lazy
highlighting: highlighting:
@table @code @vtable @code
@item lazy-highlight-initial-delay @item lazy-highlight-initial-delay
@vindex lazy-highlight-initial-delay
Time in seconds to wait before highlighting visible matches. Time in seconds to wait before highlighting visible matches.
Applies only if the search string is less than Applies only if the search string is less than
@code{lazy-highlight-no-delay-length} characters long. @code{lazy-highlight-no-delay-length} characters long.
@item lazy-highlight-no-delay-length @item lazy-highlight-no-delay-length
@vindex lazy-highlight-no-delay-length
For search strings at least as long as the value of this variable, For search strings at least as long as the value of this variable,
lazy highlighting of matches starts immediately. lazy highlighting of matches starts immediately.
@item lazy-highlight-interval @item lazy-highlight-interval
@vindex lazy-highlight-interval
Time in seconds between highlighting successive matches. Time in seconds between highlighting successive matches.
@item lazy-highlight-max-at-a-time @item lazy-highlight-max-at-a-time
@vindex lazy-highlight-max-at-a-time
The maximum number of matches to highlight before checking for input. The maximum number of matches to highlight before checking for input.
A large number can take some time to highlight, so if you want to A large number can take some time to highlight, so if you want to
continue searching and type @kbd{C-s} or @kbd{C-r} during that time, continue searching and type @kbd{C-s} or @kbd{C-r} during that time,
@ -2227,17 +2223,28 @@ Emacs will not respond until it finishes highlighting all those
matches. Thus, smaller values make Emacs more responsive. matches. Thus, smaller values make Emacs more responsive.
@item isearch-lazy-count @item isearch-lazy-count
@vindex isearch-lazy-count
Show the current match number and the total number of matches in the Show the current match number and the total number of matches in the
search prompt. search prompt.
@item lazy-count-prefix-format @item lazy-count-prefix-format
@itemx lazy-count-suffix-format @itemx lazy-count-suffix-format
@vindex lazy-count-prefix-format
@vindex lazy-count-suffix-format
These two variables determine the format of showing the current and These two variables determine the format of showing the current and
the total number of matches for @code{isearch-lazy-count}. the total number of matches for @code{isearch-lazy-count}.
@end table
@item lazy-highlight-buffer
If non-@code{nil}, lazy highlighting highlights the matches in the
entire buffer, not only those visible on display of the current window
(so, for example, they will also become visible in other windows showing
the same buffer).
@item lazy-highlight-buffer-max-at-a-time
Like @code{lazy-highlight-max-at-a-time}, but used for highlighting
matches not currently visible in the window when
@code{lazy-highlight-buffer} is non-@code{nil}. It defaults to 200; set
to @code{nil} to highlight all the matches in a buffer without checking
for input. @strong{Warning:} this could make Emacs not responsive when
searching large buffers.
@end vtable
@vindex search-nonincremental-instead @vindex search-nonincremental-instead
Normally, entering @key{RET} within incremental search when the Normally, entering @key{RET} within incremental search when the

View file

@ -3538,6 +3538,11 @@ attributes, Emacs applies the face attributes of the ``underlying''
buffer text. Note that this is so even if the overlay or display buffer text. Note that this is so even if the overlay or display
string is displayed in the display margins (@pxref{Display Margins}). string is displayed in the display margins (@pxref{Display Margins}).
@item
If the text is to be shown in the display margins, and any given
attribute has not been specified during the preceding steps, Emacs
applies the attribute of the @code{margin} face.
@item @item
If any given attribute has not been specified during the preceding If any given attribute has not been specified during the preceding
steps, Emacs applies the attribute of the @code{default} face. steps, Emacs applies the attribute of the @code{default} face.

View file

@ -3042,6 +3042,7 @@ followed by the text properties. If @var{object} is a string, only
text properties are considered, since strings never have overlays. text properties are considered, since strings never have overlays.
@end defun @end defun
@anchor{Boundaries of text and overlay properties}
@defun get-pos-property position prop &optional object @defun get-pos-property position prop &optional object
This function is like @code{get-char-property}, except that it pays This function is like @code{get-char-property}, except that it pays
attention to properties' stickiness and overlays' advancement settings attention to properties' stickiness and overlays' advancement settings
@ -4019,6 +4020,10 @@ The movement can be @code{entered} or @code{left}, depending on whether
the cursor is entering the text that has this property or leaving it, or the cursor is entering the text that has this property or leaving it, or
@code{moved} when the cursor moved within that text. @code{moved} when the cursor moved within that text.
Other values for the direction should be ignored. Other values for the direction should be ignored.
Whether the boundary positions (at the beginning and end of an overlay or
a stretch of text-property) are considered as inside or outside follows
the same rules as for @code{get-pos-property}, @pxref{Boundaries of
text and overlay properties}.
The functions are called only when the minor mode The functions are called only when the minor mode
@code{cursor-sensor-mode} is turned on. @code{cursor-sensor-mode} is turned on.

View file

@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex. % Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
% %
\def\texinfoversion{2025-12-23.13} \def\texinfoversion{2026-04-26.12}
% %
% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc. % Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
% %
@ -348,7 +348,6 @@
% before the \shipout runs. % before the \shipout runs.
% %
\atdummies % don't expand commands in the output. \atdummies % don't expand commands in the output.
\turnoffactive
\shipout\vbox{% \shipout\vbox{%
% Do this early so pdf references go to the beginning of the page. % Do this early so pdf references go to the beginning of the page.
\ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
@ -5321,14 +5320,13 @@
\def\indexisfl{fl} \def\indexisfl{fl}
% Definition for writing index entry sort key. % Definition for writing index entry sort key.
{ \def\indexwritesortas{%
\catcode`\-=13
\gdef\indexwritesortas{%
\begingroup \begingroup
\indexnonalnumreappear \indexnonalnumreappear
\indexwritesortasxxx} \indexwritesortasxxx
\gdef\indexwritesortasxxx#1{% }
\xdef\indexsortkey{#1}\endgroup} \def\indexwritesortasxxx#1{%
\xdef\indexsortkey{#1}\endgroup
} }
\def\indexwriteseealso#1{ \def\indexwriteseealso#1{
@ -5359,6 +5357,51 @@
\expandafter\doindexsegment#1\subentry\finish\subentry \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 % append the results from the next segment
\def\doindexsegment#1\subentry{% \def\doindexsegment#1\subentry{%
\def\segment{#1}% \def\segment{#1}%
@ -5378,9 +5421,6 @@
% Get the string to sort by. Process the segment with all % Get the string to sort by. Process the segment with all
% font commands turned off. % font commands turned off.
\bgroup \bgroup
\let\sortas\indexwritesortas
\let\seealso\indexwriteseealso
\let\seeentry\indexwriteseeentry
\indexnofonts \indexnofonts
% The braces around the commands are recognized by texindex. % The braces around the commands are recognized by texindex.
\def\lbracechar{{\string\indexlbrace}}% \def\lbracechar{{\string\indexlbrace}}%
@ -5394,11 +5434,10 @@
% %
\let\indexsortkey\empty \let\indexsortkey\empty
\global\let\pagenumbertext\empty \global\let\pagenumbertext\empty
% Execute the segment and throw away the typeset output. This executes \extractindexcommands\segment
% any @sortas or @seealso commands in this segment.
\setbox\dummybox = \hbox{\segment}%
\ifx\indexsortkey\empty{% \ifx\indexsortkey\empty{%
\indexnonalnumdisappear \indexnonalnumdisappear
\inindexsortkeytrue
\xdef\trimmed{\segment}% \xdef\trimmed{\segment}%
\xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
\xdef\indexsortkey{\trimmed}% \xdef\indexsortkey{\trimmed}%
@ -5419,7 +5458,6 @@
\fi \fi
} }
\def\isfinish{\finish}% \def\isfinish{\finish}%
\newbox\dummybox % used above
\let\subentry\relax \let\subentry\relax
@ -7007,6 +7045,7 @@
\newdimen\curchapmax \newdimen\curchapmax
\newdimen\cursecmax \newdimen\cursecmax
\newdimen\curssecmax \newdimen\curssecmax
\newbox\dummybox % used above
% set #1 to the maximum section width for #2 % set #1 to the maximum section width for #2
@ -10231,6 +10270,15 @@
\global\righthyphenmin = #3\relax \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. % XeTeX and LuaTeX can handle Unicode natively.
% Their default I/O uses UTF-8 sequences instead of a byte-wise operation. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
@ -10673,6 +10721,38 @@
\newif\ifutfviiidefinedwarning \newif\ifutfviiidefinedwarning
\utfviiidefinedwarningtrue \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 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
\begingroup \begingroup
\catcode`\~13 \catcode`\~13
@ -10691,8 +10771,8 @@
\expandafter\UTFviiiLoop \expandafter\UTFviiiLoop
\fi} \fi}
% %
% For bytes other than the first in a UTF-8 sequence. Not expected to % UTF-8 continuation bytes (10XX XXXX) or unused (hex C1, C2).
% be expanded except when writing to auxiliary files. % Not expected to be expanded except when writing to auxiliary files.
\countUTFx = "80 \countUTFx = "80
\countUTFy = "C2 \countUTFy = "C2
\def\UTFviiiTmp{% \def\UTFviiiTmp{%
@ -10704,7 +10784,9 @@
\countUTFy = "E0 \countUTFy = "E0
\def\UTFviiiTmp{% \def\UTFviiiTmp{%
\gdef~{% \gdef~{%
\ifpassthroughchars $% \ifpassthroughchars
\ifinindexsortkey\swapnestedfi\UTFviiiSortkeyTwo\fi
$%
\else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}% \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
\UTFviiiLoop \UTFviiiLoop
@ -10712,7 +10794,9 @@
\countUTFy = "F0 \countUTFy = "F0
\def\UTFviiiTmp{% \def\UTFviiiTmp{%
\gdef~{% \gdef~{%
\ifpassthroughchars $% \ifpassthroughchars
\ifinindexsortkey\swapnestedfi\UTFviiiSortkeyThree\fi
$%
\else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}% \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
\UTFviiiLoop \UTFviiiLoop
@ -10720,7 +10804,9 @@
\countUTFy = "F4 \countUTFy = "F4
\def\UTFviiiTmp{% \def\UTFviiiTmp{%
\gdef~{% \gdef~{%
\ifpassthroughchars $% \ifpassthroughchars
\ifinindexsortkey\swapnestedfi\UTFviiiSortkeyFour\fi
$%
\else\expandafter\UTFviiiFourOctets\expandafter$\fi \else\expandafter\UTFviiiFourOctets\expandafter$\fi
}}% }}%
\UTFviiiLoop \UTFviiiLoop
@ -10814,7 +10900,7 @@
\parseXMLCharref \parseXMLCharref
% %
% Completely expand \UTFviiiTmp, which looks like: % Completely expand \UTFviiiTmp, which looks like:
% 1. \UTFviiTwoOctetsName B1 B2 % 1. \UTFviiiTwoOctetsName B1 B2
% 2. \csname u8:B1 \string B2 \endcsname % 2. \csname u8:B1 \string B2 \endcsname
% 3. \u8: B1 B2 (a single control sequence token) % 3. \u8: B1 B2 (a single control sequence token)
\xdef\UTFviiiTmp{\UTFviiiTmp}% \xdef\UTFviiiTmp{\UTFviiiTmp}%
@ -10891,6 +10977,55 @@
\uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
\endgroup \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), % For native Unicode handling (XeTeX and LuaTeX),
% provide a definition macro that sets a catcode to `other' non-globally % provide a definition macro that sets a catcode to `other' non-globally
% %
@ -11054,73 +11189,73 @@
\DeclareUnicodeCharacter{00BE}{$3\over4$}% \DeclareUnicodeCharacter{00BE}{$3\over4$}%
\DeclareUnicodeCharacter{00BF}{\questiondown}% \DeclareUnicodeCharacter{00BF}{\questiondown}%
% %
\DeclareUnicodeCharacter{00C0}{\`A}% \DeclareUnicodeCharacterSK{00C0}{\`A}%
\DeclareUnicodeCharacter{00C1}{\'A}% \DeclareUnicodeCharacterSK{00C1}{\'A}%
\DeclareUnicodeCharacter{00C2}{\^A}% \DeclareUnicodeCharacterSK{00C2}{\^A}%
\DeclareUnicodeCharacter{00C3}{\~A}% \DeclareUnicodeCharacterSK{00C3}{\~A}%
\DeclareUnicodeCharacter{00C4}{\"A}% \DeclareUnicodeCharacterSK{00C4}{\"A}%
\DeclareUnicodeCharacter{00C5}{\AA}% \DeclareUnicodeCharacterSK{00C5}{\AA}%
\DeclareUnicodeCharacter{00C6}{\AE}% \DeclareUnicodeCharacterSK{00C6}{\AE}%
\DeclareUnicodeCharacter{00C7}{\cedilla{C}}% \DeclareUnicodeCharacterSK{00C7}{\cedilla{C}}%
\DeclareUnicodeCharacter{00C8}{\`E}% \DeclareUnicodeCharacterSK{00C8}{\`E}%
\DeclareUnicodeCharacter{00C9}{\'E}% \DeclareUnicodeCharacterSK{00C9}{\'E}%
\DeclareUnicodeCharacter{00CA}{\^E}% \DeclareUnicodeCharacterSK{00CA}{\^E}%
\DeclareUnicodeCharacter{00CB}{\"E}% \DeclareUnicodeCharacterSK{00CB}{\"E}%
\DeclareUnicodeCharacter{00CC}{\`I}% \DeclareUnicodeCharacterSK{00CC}{\`I}%
\DeclareUnicodeCharacter{00CD}{\'I}% \DeclareUnicodeCharacterSK{00CD}{\'I}%
\DeclareUnicodeCharacter{00CE}{\^I}% \DeclareUnicodeCharacterSK{00CE}{\^I}%
\DeclareUnicodeCharacter{00CF}{\"I}% \DeclareUnicodeCharacterSK{00CF}{\"I}%
% %
\DeclareUnicodeCharacter{00D0}{\DH}% \DeclareUnicodeCharacterSK{00D0}{\DH}%
\DeclareUnicodeCharacter{00D1}{\~N}% \DeclareUnicodeCharacterSK{00D1}{\~N}%
\DeclareUnicodeCharacter{00D2}{\`O}% \DeclareUnicodeCharacterSK{00D2}{\`O}%
\DeclareUnicodeCharacter{00D3}{\'O}% \DeclareUnicodeCharacterSK{00D3}{\'O}%
\DeclareUnicodeCharacter{00D4}{\^O}% \DeclareUnicodeCharacterSK{00D4}{\^O}%
\DeclareUnicodeCharacter{00D5}{\~O}% \DeclareUnicodeCharacterSK{00D5}{\~O}%
\DeclareUnicodeCharacter{00D6}{\"O}% \DeclareUnicodeCharacterSK{00D6}{\"O}%
\DeclareUnicodeCharacter{00D7}{\ensuremath\times}% \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
\DeclareUnicodeCharacter{00D8}{\O}% \DeclareUnicodeCharacterSK{00D8}{\O}%
\DeclareUnicodeCharacter{00D9}{\`U}% \DeclareUnicodeCharacterSK{00D9}{\`U}%
\DeclareUnicodeCharacter{00DA}{\'U}% \DeclareUnicodeCharacterSK{00DA}{\'U}%
\DeclareUnicodeCharacter{00DB}{\^U}% \DeclareUnicodeCharacterSK{00DB}{\^U}%
\DeclareUnicodeCharacter{00DC}{\"U}% \DeclareUnicodeCharacterSK{00DC}{\"U}%
\DeclareUnicodeCharacter{00DD}{\'Y}% \DeclareUnicodeCharacterSK{00DD}{\'Y}%
\DeclareUnicodeCharacter{00DE}{\TH}% \DeclareUnicodeCharacter{00DE}{\TH}%
\DeclareUnicodeCharacter{00DF}{\ss}% \DeclareUnicodeCharacterSK{00DF}{\ss}%
% %
\DeclareUnicodeCharacter{00E0}{\`a}% \DeclareUnicodeCharacterSK{00E0}{\`a}%
\DeclareUnicodeCharacter{00E1}{\'a}% \DeclareUnicodeCharacterSK{00E1}{\'a}%
\DeclareUnicodeCharacter{00E2}{\^a}% \DeclareUnicodeCharacterSK{00E2}{\^a}%
\DeclareUnicodeCharacter{00E3}{\~a}% \DeclareUnicodeCharacterSK{00E3}{\~a}%
\DeclareUnicodeCharacter{00E4}{\"a}% \DeclareUnicodeCharacterSK{00E4}{\"a}%
\DeclareUnicodeCharacter{00E5}{\aa}% \DeclareUnicodeCharacterSK{00E5}{\aa}%
\DeclareUnicodeCharacter{00E6}{\ae}% \DeclareUnicodeCharacterSK{00E6}{\ae}%
\DeclareUnicodeCharacter{00E7}{\cedilla{c}}% \DeclareUnicodeCharacterSK{00E7}{\cedilla{c}}%
\DeclareUnicodeCharacter{00E8}{\`e}% \DeclareUnicodeCharacterSK{00E8}{\`e}%
\DeclareUnicodeCharacter{00E9}{\'e}% \DeclareUnicodeCharacterSK{00E9}{\'e}%
\DeclareUnicodeCharacter{00EA}{\^e}% \DeclareUnicodeCharacterSK{00EA}{\^e}%
\DeclareUnicodeCharacter{00EB}{\"e}% \DeclareUnicodeCharacterSK{00EB}{\"e}%
\DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}% \DeclareUnicodeCharacterSK{00EC}{\`{\dotless{i}}}%
\DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}% \DeclareUnicodeCharacterSK{00ED}{\'{\dotless{i}}}%
\DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}% \DeclareUnicodeCharacterSK{00EE}{\^{\dotless{i}}}%
\DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}% \DeclareUnicodeCharacterSK{00EF}{\"{\dotless{i}}}%
% %
\DeclareUnicodeCharacter{00F0}{\dh}% \DeclareUnicodeCharacterSK{00F0}{\dh}%
\DeclareUnicodeCharacter{00F1}{\~n}% \DeclareUnicodeCharacterSK{00F1}{\~n}%
\DeclareUnicodeCharacter{00F2}{\`o}% \DeclareUnicodeCharacterSK{00F2}{\`o}%
\DeclareUnicodeCharacter{00F3}{\'o}% \DeclareUnicodeCharacterSK{00F3}{\'o}%
\DeclareUnicodeCharacter{00F4}{\^o}% \DeclareUnicodeCharacterSK{00F4}{\^o}%
\DeclareUnicodeCharacter{00F5}{\~o}% \DeclareUnicodeCharacterSK{00F5}{\~o}%
\DeclareUnicodeCharacter{00F6}{\"o}% \DeclareUnicodeCharacterSK{00F6}{\"o}%
\DeclareUnicodeCharacter{00F7}{\ensuremath\div}% \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
\DeclareUnicodeCharacter{00F8}{\o}% \DeclareUnicodeCharacterSK{00F8}{\o}%
\DeclareUnicodeCharacter{00F9}{\`u}% \DeclareUnicodeCharacterSK{00F9}{\`u}%
\DeclareUnicodeCharacter{00FA}{\'u}% \DeclareUnicodeCharacterSK{00FA}{\'u}%
\DeclareUnicodeCharacter{00FB}{\^u}% \DeclareUnicodeCharacterSK{00FB}{\^u}%
\DeclareUnicodeCharacter{00FC}{\"u}% \DeclareUnicodeCharacterSK{00FC}{\"u}%
\DeclareUnicodeCharacter{00FD}{\'y}% \DeclareUnicodeCharacterSK{00FD}{\'y}%
\DeclareUnicodeCharacter{00FE}{\th}% \DeclareUnicodeCharacter{00FE}{\th}%
\DeclareUnicodeCharacter{00FF}{\"y}% \DeclareUnicodeCharacterSK{00FF}{\"y}%
% %
\DeclareUnicodeCharacter{0100}{\=A}% \DeclareUnicodeCharacter{0100}{\=A}%
\DeclareUnicodeCharacter{0101}{\=a}% \DeclareUnicodeCharacter{0101}{\=a}%
@ -11719,6 +11854,9 @@
\newif\ifpassthroughchars \newif\ifpassthroughchars
\passthroughcharsfalse \passthroughcharsfalse
\newif\ifinindexsortkey
\inindexsortkeyfalse
% For native Unicode handling (XeTeX and LuaTeX), % For native Unicode handling (XeTeX and LuaTeX),
% provide a definition macro to replace/pass-through a Unicode character % provide a definition macro to replace/pass-through a Unicode character
% %
@ -11730,7 +11868,15 @@
\uccode`\~="##2\relax \uccode`\~="##2\relax
\uppercase{\gdef~}{% \uppercase{\gdef~}{%
\ifpassthroughchars \ifpassthroughchars
##1% \ifinindexsortkey
\expandafter\ifx\csname usort:#1\endcsname\relax
{##1}%
\else
\csname usort:#1\endcsname
\fi
\else
##1%
\fi
\else \else
##3% ##3%
\fi \fi

View file

@ -6435,6 +6435,13 @@ You can change this directory by setting the user option
"XDG_RUNTIME_DIR")}. "XDG_RUNTIME_DIR")}.
@item
I get an error @samp{Method `gdrive' not supported by GVFS}.
@samp{google-drive} has been disabled in @acronym{GNOME} 50. It is
not clear yet whether and when it will be reenabled.
@c @uref{https://discourse.gnome.org/t/google-drive-in-gnome-50/34417}
@item @item
How to ignore errors when changing file attributes? How to ignore errors when changing file attributes?

View file

@ -169,6 +169,12 @@ behavior, customize 'find-function-mode-lower-precedence' to non-nil.
--- ---
** 'find-function' can now find 'cl-defmethod' invocations inside macros. ** 'find-function' can now find 'cl-defmethod' invocations inside macros.
---
** New minor mode 'prettify-special-glyphs-mode'.
The new minor mode prettifies the special character glyphs (truncation
and continuation) on TTY frames (and GUI frames without fringes). You
can customize the associated new face 'special-glyphs'.
** Minibuffer and Completions ** Minibuffer and Completions
+++ +++
@ -3931,7 +3937,13 @@ A major mode based on 'conf-mode' for editing ".npmrc" files.
** New major modes based on the tree-sitter library ** New major modes based on the tree-sitter library
*** New major mode 'markdown-ts-mode'. *** New major mode 'markdown-ts-mode'.
A major mode based on the tree-sitter library for editing Markdown files. A major mode based on the tree-sitter library for editing Markdown
files. Markdown files are visited using this mode when the required
tree-sitter grammars ('markdown' and 'markdown-inline') are available,
or when the user has opted in via 'treesit-enabled-modes'. Otherwise,
Markdown files fall back to 'text-mode'.
To install the grammars, use 'M-x markdown-ts-mode-install-parsers'.
*** New major mode 'mhtml-ts-mode'. *** New major mode 'mhtml-ts-mode'.
An optional major mode based on the tree-sitter library for editing HTML An optional major mode based on the tree-sitter library for editing HTML
@ -3987,6 +3999,21 @@ all versions, sleep events require Windows 8 or later).
* Incompatible Lisp Changes in Emacs 31.1 * Incompatible Lisp Changes in Emacs 31.1
+++
** Boundaries of 'cursor-sensor-functions' now obey stickiness.
'cursor-sensor-mode' now uses 'get-pos-property' to decide whether a
boundary is considered as inside or outside.
This means that by default, the boundaries have changed: the end
position of a stretch of a 'cursor-sensor-functions' text property
used to be considered outside of the stretch whereas it is now
considered as inside. You can recover the previous behavior by
controlling the stickiness, for example with a call like:
(add-text-properties BEG END
'(cursor-sensor-functions (MY-FUNCTION)
rear-nonsticky (cursor-sensor-functions)))
+++ +++
** 'makunbound' on a variable alias undoes the alias. ** 'makunbound' on a variable alias undoes the alias.
Previously, it had the effect of applying the 'makunbound' on the Previously, it had the effect of applying the 'makunbound' on the

View file

@ -2649,6 +2649,45 @@ all such characters will look the same on display, and the only way of
knowing what is the real codepoint in the buffer is to go to the knowing what is the real codepoint in the buffer is to go to the
character and type "C-u C-x =". character and type "C-u C-x =".
*** Display problems with Emoji on text terminals
Some text-mode terminals cause problems with Emoji sequences: when
displaying them, the Emacs text-mode frame could show gaps, misalignment
between the display and cursor motion, and other visual artifacts and
display problems.
This can happen if the terminal and Emacs differ in their notions of how
many columns (a.k.a. "character cells") a given sequence of characters
takes on the screen when displayed. As one example, Emoji sequences
that begin with a non-Emoji character and end in U+FE0F VARIATION
SELECTOR 16 are composed on display into an Emoji glyph, but the width
of this glyph is up to the terminal and the font it uses to show the
Emoji. If the non-Emoji character that begins the sequence has the
width 1, Emacs will think that its composition with VS-16 also takes 1
column on the screen, because VS-16 has width of zero. But some
terminals which support Emoji sequences will show a double-width Emoji
glyph in this case, without any way for Emacs to know that. This causes
cursor addressing to get out of sync and eventually messes up the
display. In particular, Kitty, Alacritty, Ghostty, and some other
terminal emulators are known to behave like that.
Similar problems can happen with composition of characters other than
Emoji.
The solution is to disable 'auto-composition-mode' on these
terminals, for example, like this:
(setq auto-composition-mode "alacritty")
This disables 'auto-composition-mode' on frames that display on
terminals of the named type. More generally, customizing the
'auto-composition-mode' variable to have as value a string that the
'tty-type' function returns on a terminal will disable compositions in
windows shown on terminals of that type. (You can also disable
'auto-composition-mode' globally, if all your frames are on terminals
that have this problem, by setting 'auto-composition-mode' to the nil
value.)
*** Messed-up display on the Kitty text terminal *** Messed-up display on the Kitty text terminal
This terminal has its own peculiar ideas about display of unusual This terminal has its own peculiar ideas about display of unusual
@ -2674,33 +2713,6 @@ Another workaround is to set 'nobreak-char-ascii-display' to a non-nil
value, which will cause any non-ASCII space and hyphen characters to value, which will cause any non-ASCII space and hyphen characters to
be displayed as their ASCII counterparts, with a special face. be displayed as their ASCII counterparts, with a special face.
Kitty also differs from many other character terminals in how it
handles character compositions. As one example, Emoji sequences that
begin with a non-Emoji character and end in U+FE0F VARIATION SELECTOR
16 should be composed into an Emoji glyph; Kitty assumes that all such
Emoji glyphs have 2-column width, whereas Emacs and many other text
terminals display them as 1-column glyphs. Again, this causes cursor
addressing to get out of sync and eventually messes up the display.
One possible workaround for problems caused by character composition
is to turn off 'auto-composition-mode' on Kitty terminals, e.g. by
customizing the 'auto-composition-mode' variable to have as value a
string that the 'tty-type' function returns on those terminals.
*** Display artifacts on the Alacritty text terminal
This terminal is known to cause problems with Emoji sequences: when
displaying them, the Emacs text-mode frame could show gaps and other
visual artifacts.
The solution is to disable 'auto-composition-mode' on these
terminals, for example, like this:
(setq auto-composition-mode "alacritty")
This disables 'auto-composition-mode' on frames that display on
terminals of this type.
** Screen readers get confused about character position ** Screen readers get confused about character position
The Emacs display code sometimes emits TAB characters purely for motion The Emacs display code sometimes emits TAB characters purely for motion
@ -2713,6 +2725,12 @@ This can confuse screen reader software under certain terminal emulators
in the terminal before starting Emacs may mitigate this. See also the in the terminal before starting Emacs may mitigate this. See also the
discussion in Bug#78474 <https://debbugs.gnu.org/78474>. discussion in Bug#78474 <https://debbugs.gnu.org/78474>.
Starting from version 31.1, Emacs by default no longer outputs series of
TAB characters followed by BACKSPACE, which used to confuse some of the
screen readers. If you encounter some problems in this area, verify
that the variable 'tty-cursor-movement-use-TAB-BS' is set to its default
nil value.
* Runtime problems specific to individual Unix variants * Runtime problems specific to individual Unix variants
** GNU/Linux ** GNU/Linux

View file

@ -0,0 +1,19 @@
COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES -*- coding: utf-8 -*-
The following icons were derived from GIMP 3.2.X icons, modified for
Emacs by Elías Gabriel Pérez <eg642616@gmail.com>.
Copyright (C) 2026 Free Software Foundation, Inc.
License: GNU General Public License version 3 or later (see COPYING)
char-for-spray.xpm char-for-spray.pbm
char-to-fill.xpm char-to-fill.pbm
ellipse.xpm ellipse.pbm
eraser.xpm eraser.pbm
fill.xpm fill.pbm
line.xpm line.pbm
pen.xpm pen.pbm
poly-line.xpm poly-line.pbm
rectangle.xpm rectangle.pbm
spray.xpm spray.pbm
square.xpm square.pbm
text.xpm text.pbm

Binary file not shown.

View file

@ -0,0 +1,281 @@
/* XPM */
static char * char_for_spray_xpm[] = {
"26 24 254 2",
" c None",
". c #A1A39E",
"+ c #CDCECC",
"@ c #CFD0CD",
"# c #CDCDCB",
"$ c #A1A29F",
"% c #E1E1DF",
"& c #CCCEC8",
"* c #C8CAC4",
"= c #E0E1DF",
"- c #959691",
"; c #E4E5E3",
"> c #CACCC7",
", c #BDBEBA",
"' c #ABADA9",
") c #BDBFBB",
"! c #939792",
"~ c #E6E7E4",
"{ c #CCCEC9",
"] c #575856",
"^ c #333432",
"/ c #444543",
"( c #212120",
"_ c #4E4E4C",
": c #CBCDC8",
"< c #959792",
"[ c #E7E8E5",
"} c #CED0CB",
"| c #282827",
"1 c #959793",
"2 c #E8E9E6",
"3 c #D0D2CD",
"4 c #9A9C98",
"5 c #3B3B3A",
"6 c #2F302F",
"7 c #373837",
"8 c #141413",
"9 c #767775",
"0 c #CDCFCA",
"a c #000000",
"b c #C9CBC6",
"c c #E9EAE7",
"d c #C7C9C4",
"e c #090909",
"f c #AAACA8",
"g c #D2D4CF",
"h c #3C3D3B",
"i c #737472",
"j c #CFD1CC",
"k c #959893",
"l c #EAEBE9",
"m c #C0C1BD",
"n c #050505",
"o c #BEBEBB",
"p c #D5D6D2",
"q c #A5A6A3",
"r c #060606",
"s c #757573",
"t c #D2D3CF",
"u c #8B8B89",
"v c #2E2E2D",
"w c #393938",
"x c #B4B4B1",
"y c #DDDEDC",
"z c #494D4C",
"A c #2F3235",
"B c #979893",
"C c #EBECEA",
"D c #D7D8D4",
"E c #767774",
"F c #1E1E1E",
"G c #313130",
"H c #50504F",
"I c #5E5E5C",
"J c #898A88",
"K c #D4D5D1",
"L c #5D5D5B",
"M c #030303",
"N c #232322",
"O c #C4C5C2",
"P c #686B6B",
"Q c #4A4D4D",
"R c #303537",
"S c #979895",
"T c #ECEDEB",
"U c #D9DAD6",
"V c #D6D7D3",
"W c #BBBCB9",
"X c #414140",
"Y c #0D1012",
"Z c #5C605F",
"` c #575A58",
" . c #323939",
".. c #EDEEEC",
"+. c #DBDCD8",
"@. c #D8D9D5",
"#. c #010101",
"$. c #C4C4C1",
"%. c #4D4D4C",
"&. c #333839",
"*. c #555957",
"=. c #454948",
"-. c #3B4040",
";. c #2F3536",
">. c #979A95",
",. c #EEEFED",
"'. c #DDDEDA",
"). c #AFB0AD",
"!. c #474746",
"~. c #424241",
"{. c #373736",
"]. c #A8A9A6",
"^. c #DADBD7",
"/. c #171A1C",
"(. c #303538",
"_. c #7A7C7A",
":. c #34393A",
"<. c #525654",
"[. c #3E4343",
"}. c #6D716E",
"|. c #989A95",
"1. c #EFF0EE",
"2. c #DFE0DD",
"3. c #A4A4A2",
"4. c #111110",
"5. c #BCBDBA",
"6. c #40403F",
"7. c #939492",
"8. c #DBDCDA",
"9. c #000101",
"0. c #293030",
"a. c #3D4242",
"b. c #434848",
"c. c #484C4B",
"d. c #353B3B",
"e. c #B3B4B3",
"f. c #989A97",
"g. c #F0F1EF",
"h. c #E1E2DF",
"i. c #DEDFDC",
"j. c #181818",
"k. c #737372",
"l. c #B5B6B3",
"m. c #D2D3D0",
"n. c #BABBB8",
"o. c #696B68",
"p. c #6B6D6D",
"q. c #3B4141",
"r. c #A8A9A7",
"s. c #F1F2F0",
"t. c #E3E4E1",
"u. c #A9AAA8",
"v. c #B9BAB8",
"w. c #D3D5D2",
"x. c #818380",
"y. c #C1C1C1",
"z. c #DEDEDE",
"A. c #A4A4A3",
"B. c #878988",
"C. c #9A9B97",
"D. c #F3F3F1",
"E. c #E6E6E3",
"F. c #939391",
"G. c #DDDDDA",
"H. c #E3E3E0",
"I. c #D9D9D7",
"J. c #D5D5D2",
"K. c #888986",
"L. c #CCCCCC",
"M. c #E4E4E4",
"N. c #BFBFBE",
"O. c #B5B5B5",
"P. c #7C7C7B",
"Q. c #CBCBC9",
"R. c #232323",
"S. c #F4F4F2",
"T. c #E8E8E5",
"U. c #AEAEAC",
"V. c #CACAC7",
"W. c #747473",
"X. c #737371",
"Y. c #E7E7E4",
"Z. c #C3C3C0",
"`. c #A3A5A3",
" + c #E6E6E5",
".+ c #A3A4A2",
"++ c #7A7B79",
"@+ c #ADAEAD",
"#+ c #8F8F8F",
"$+ c #AFAFAD",
"%+ c #8B8B88",
"&+ c #5D5D5D",
"*+ c #585858",
"=+ c #9A9B98",
"-+ c #F5F5F4",
";+ c #EAEAE8",
">+ c #666665",
",+ c #2D2D2D",
"'+ c #767675",
")+ c #575756",
"!+ c #6C6C6B",
"~+ c #E7E7E5",
"{+ c #757774",
"]+ c #B0B3AD",
"^+ c #A0A19E",
"/+ c #B0B0AE",
"(+ c #BBBBB9",
"_+ c #6A6B68",
":+ c #626262",
"<+ c #C3C3C2",
"[+ c #595959",
"}+ c #7F7F7F",
"|+ c #9B9D99",
"1+ c #ECECEA",
"2+ c #E5E5E3",
"3+ c #C9C9C7",
"4+ c #E3E3E1",
"5+ c #777775",
"6+ c #939591",
"7+ c #B9BAB7",
"8+ c #4D4E4D",
"9+ c #767676",
"0+ c #747474",
"a+ c #777777",
"b+ c #545454",
"c+ c #EBEBEA",
"d+ c #EFEFED",
"e+ c #EEEEEC",
"f+ c #E8E9E8",
"g+ c #9AA2B5",
"h+ c #BDBDBB",
"i+ c #B7B8B5",
"j+ c #EBEBE9",
"k+ c #EDEDEB",
"l+ c #C0C0BE",
"m+ c #4B4B4A",
"n+ c #595958",
"o+ c #3F3F3F",
"p+ c #969894",
"q+ c #D0D1D0",
"r+ c #D9D9D8",
"s+ c #DADAD9",
"t+ c #C6C8CB",
"u+ c #A5ABB8",
"v+ c #466293",
"w+ c #818DA6",
"x+ c #D7D7D6",
"y+ c #D8D8D7",
"z+ c #939390",
"A+ c #375A8F",
"B+ c #38598F",
"C+ c #37578C",
"D+ c #37588E",
"E+ c #355887",
" ",
" . + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # $ ",
" % & * * * * * * * * * * * * * * * * & = ",
" - ; > > , ' ) > > > > > > > > > > > > > ; - ",
" ! ~ { ] ^ / ( _ : { { { { { { { { { { { ~ ! ",
" < [ } > } } { | 1 } } } } } } } } } } } [ < ",
" < 2 3 4 5 6 7 8 9 3 3 3 0 a a b 3 3 3 3 2 < ",
" 1 c d e f g g h i g g g j a a : g g g g c 1 ",
" k l m n o p q r s p p p t a a u v w x p y z A ",
" B C D E F G H I J D D D K a a G L M N O P Q R ",
" S T U U U U U U U U U U V a a W U X Y Z ` z . ",
" S ..+.+.+.+.+.+.+.+.+.+.@.a #.$.D %.&.*.=.-.;. ",
" >.,.'.'.'.'.).!.H ~.{.].^.a /.(._.:.<.z [.}. ",
" |.1.2.2.2.3.4.5.2.2.6.7.8.9.0.:.a.b.c.d.e.|. ",
" f.g.h.h.i.j.k.h.h.h.l.m.h.m.n.o.e.p.q.r...f. ",
" f.s.t.t.u.a v.t.t.t.t.t.t.w.x.y.z.A.B.t.s.f. ",
" C.D.E.E.F.a G.E.E.H.I.E.J.K.L.M.N.O.P.Q.D.C. R.",
" C.S.T.T.U.a V.T.T.W.X.Y.Z.`. +.+++@+#+$+D.%+&+*+",
" =+-+;+;+;+>+,+'+)+!+~+% {+]+^+/+(+_+#+:+<+[+}+ ",
" |+-+1+1+1+1+2+3+4+1+1+4+5+6+7+1+1+(+8+9+0+a+b+ ",
" c+d+e+e+e+e+e+e+T f+g+h+i+j+e+e+k+l+m+n+o+ ",
" p+q+r+s+r+r+r+t+u+v+w+x+y+r+r+r+s+y+# z+ ",
" A+B+C+ ",
" D+E+ "};

Binary file not shown.

View file

@ -0,0 +1,301 @@
/* XPM */
static char * char_to_fill_xpm[] = {
"26 24 274 2",
" c None",
". c #A1A39E",
"+ c #CDCECC",
"@ c #CFD0CD",
"# c #CDCDCB",
"$ c #A1A29F",
"% c #E1E1DF",
"& c #CCCEC8",
"* c #C8CAC4",
"= c #E0E1DF",
"- c #959691",
"; c #E4E5E3",
"> c #CACCC7",
", c #BDBEBA",
"' c #ABADA9",
") c #BDBFBB",
"! c #939792",
"~ c #E6E7E4",
"{ c #CCCEC9",
"] c #575856",
"^ c #333432",
"/ c #444543",
"( c #212120",
"_ c #4E4E4C",
": c #CBCDC8",
"< c #959792",
"[ c #E7E8E5",
"} c #CED0CB",
"| c #282827",
"1 c #959793",
"2 c #E8E9E6",
"3 c #D0D2CD",
"4 c #9A9C98",
"5 c #3B3B3A",
"6 c #2F302F",
"7 c #373837",
"8 c #141413",
"9 c #767775",
"0 c #CDCFCA",
"a c #000000",
"b c #C9CBC6",
"c c #E9EAE7",
"d c #C7C9C4",
"e c #090909",
"f c #AAACA8",
"g c #D2D4CF",
"h c #3C3D3B",
"i c #737472",
"j c #CFD1CC",
"k c #959893",
"l c #EAEBE9",
"m c #C0C1BD",
"n c #050505",
"o c #BEBEBB",
"p c #D5D6D2",
"q c #A5A6A3",
"r c #060606",
"s c #757573",
"t c #D2D3CF",
"u c #8B8B89",
"v c #2E2E2D",
"w c #393938",
"x c #B4B4B1",
"y c #979893",
"z c #EBECEA",
"A c #D7D8D4",
"B c #767774",
"C c #1E1E1E",
"D c #313130",
"E c #50504F",
"F c #5E5E5C",
"G c #898A88",
"H c #D4D5D1",
"I c #5D5D5B",
"J c #30312E",
"K c #454744",
"L c #979995",
"M c #C7C8C6",
"N c #979895",
"O c #ECEDEB",
"P c #D9DAD6",
"Q c #D6D7D3",
"R c #BBBCB9",
"S c #BEBFBB",
"T c #4D4E4C",
"U c #353533",
"V c #A2A3A0",
"W c #B2B4B1",
"X c #80817E",
"Y c #EDEEEC",
"Z c #DBDCD8",
"` c #D8D9D5",
" . c #CCCCC9",
".. c #ADAEAB",
"+. c #5D5E5C",
"@. c #858684",
"#. c #969795",
"$. c #DDDEDC",
"%. c #747673",
"&. c #979A95",
"*. c #EEEFED",
"=. c #DDDEDA",
"-. c #AFB0AD",
";. c #474746",
">. c #424241",
",. c #373736",
"'. c #A8A9A6",
"). c #DADBD7",
"!. c #0A0A09",
"~. c #70706E",
"{. c #787A77",
"]. c #C5C5C4",
"^. c #E8E8E8",
"/. c #BABBB9",
"(. c #747773",
"_. c #989A95",
":. c #EFF0EE",
"<. c #DFE0DD",
"[. c #A4A4A2",
"}. c #111110",
"|. c #BCBDBA",
"1. c #C8CBCE",
"2. c #4A5269",
"3. c #808592",
"4. c #B7BAC2",
"5. c #363C4A",
"6. c #6B6D6C",
"7. c #BABAB9",
"8. c #ADAEAD",
"9. c #D1D1D1",
"0. c #DBDBDB",
"a. c #9EA09E",
"b. c #737571",
"c. c #989A97",
"d. c #F0F1EF",
"e. c #E1E2DF",
"f. c #DEDFDC",
"g. c #181818",
"h. c #737372",
"i. c #C4C7CC",
"j. c #91A1C0",
"k. c #8AA6D0",
"l. c #7190BF",
"m. c #667289",
"n. c #A6A9AD",
"o. c #E7E7E7",
"p. c #F2F3F3",
"q. c #B5B6B5",
"r. c #C0C0C0",
"s. c #D0D0D0",
"t. c #D8D8D8",
"u. c #C5C6C5",
"v. c #757774",
"w. c #F1F2F0",
"x. c #E3E4E1",
"y. c #A9AAA8",
"z. c #B9BAB8",
"A. c #B1B5C1",
"B. c #AABFDE",
"C. c #95AED0",
"D. c #7F868F",
"E. c #D2D3D3",
"F. c #F2F2F2",
"G. c #F9F9F9",
"H. c #797A78",
"I. c #C7C7C6",
"J. c #CDCDCD",
"K. c #E0E0E0",
"L. c #949593",
"M. c #9A9B97",
"N. c #F3F3F1",
"O. c #E6E6E3",
"P. c #939391",
"Q. c #DDDDDA",
"R. c #B0B4C0",
"S. c #AFC5E3",
"T. c #93AACC",
"U. c #A4A5A8",
"V. c #EAEAEA",
"W. c #F0F0F0",
"X. c #8B8C8A",
"Y. c #8F908F",
"Z. c #8E8F8E",
"`. c #959795",
" + c #D2D2D2",
".+ c #D0D1D0",
"++ c #F4F4F2",
"@+ c #E8E8E5",
"#+ c #AEAEAC",
"$+ c #CACAC7",
"%+ c #B0C5E3",
"&+ c #94AED6",
"*+ c #787D8A",
"=+ c #D9DAD9",
"-+ c #DFDFDF",
";+ c #E6E6E6",
">+ c #959594",
",+ c #8D8E8C",
"'+ c #A4A5A4",
")+ c #CECECE",
"!+ c #DBDBDA",
"~+ c #A5A6A4",
"{+ c #9A9B98",
"]+ c #F5F5F4",
"^+ c #EAEAE8",
"/+ c #666665",
"(+ c #2D2D2D",
"_+ c #767675",
":+ c #58617C",
"<+ c #B0B4BC",
"[+ c #A4A5A3",
"}+ c #DEDEDE",
"|+ c #AFB0AF",
"1+ c #B1B2B1",
"2+ c #E1E1E0",
"3+ c #DDDDDD",
"4+ c #D3D3D3",
"5+ c #757673",
"6+ c #9B9D99",
"7+ c #ECECEA",
"8+ c #E5E5E3",
"9+ c #C9C9C7",
"0+ c #AEB2BF",
"a+ c #93ADD5",
"b+ c #C4C6CE",
"c+ c #C3C3C1",
"d+ c #C8C8C7",
"e+ c #F8F8F8",
"f+ c #F7F7F7",
"g+ c #EDEDED",
"h+ c #E3E3E3",
"i+ c #D9D9D9",
"j+ c #D7D7D7",
"k+ c #777875",
"l+ c #EBEBEA",
"m+ c #EFEFED",
"n+ c #EEEEEC",
"o+ c #BEC2CC",
"p+ c #9AADCF",
"q+ c #8AA0C8",
"r+ c #CCCED4",
"s+ c #B4B4B2",
"t+ c #EFEFEF",
"u+ c #FAFAFA",
"v+ c #F3F3F3",
"w+ c #E1E2E1",
"x+ c #9C9D9B",
"y+ c #656764",
"z+ c #969894",
"A+ c #D9D9D8",
"B+ c #DADAD9",
"C+ c #CECFD2",
"D+ c #A6ABBA",
"E+ c #AAAEBD",
"F+ c #D1D2D3",
"G+ c #BBBBBA",
"H+ c #CFCFCF",
"I+ c #DCDCDC",
"J+ c #EAEBEA",
"K+ c #C6C7C6",
"L+ c #7A7A78",
"M+ c #838583",
"N+ c #E6E6E5",
"O+ c #E1E1E1",
"P+ c #D6D6D5",
"Q+ c #979896",
"R+ c #636561",
"S+ c #50534B",
"T+ c #595C57",
"U+ c #A1A3A1",
"V+ c #DDDEDD",
"W+ c #6D6E6B",
"X+ c #50534C",
"Y+ c #4F524A",
" ",
" . + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # $ ",
" % & * * * * * * * * * * * * * * * * & = ",
" - ; > > , ' ) > > > > > > > > > > > > > ; - ",
" ! ~ { ] ^ / ( _ : { { { { { { { { { { { ~ ! ",
" < [ } > } } { | 1 } } } } } } } } } } } [ < ",
" < 2 3 4 5 6 7 8 9 3 3 3 0 a a b 3 3 3 3 2 < ",
" 1 c d e f g g h i g g g j a a : g g g g c 1 ",
" k l m n o p q r s p p p t a a u v w x p l k ",
" y z A B C D E F G A A A H a a D I J K L M - ",
" N O P P P P P P P P P P Q a a R S T U V W X ",
" N Y Z Z Z Z Z Z Z Z Z Z ` a a ...+.@.#.$.%. ",
" &.*.=.=.=.=.-.;.E >.,.'.).a !.~.{.].^./.+ (. ",
" _.:.<.<.<.[.}.|.$.1.2.3.4.5.6.7.8.].9.0.a.b. ",
" c.d.e.e.f.g.h.e.i.j.k.l.m.n.o.p.q.r.s.t.u.v. ",
" c.w.x.x.y.a z.x.A.B.C.D.E.F.G.t.H.@.I.J.K.L. ",
" M.N.O.O.P.a Q.O.R.S.T.U.V.K.W.X.Y.Z.`. +9..+H. ",
" M.++@+@+#+a $+@+A.%+&+*+=+-+;+>+,+G '+t.)+!+~+ ",
" {+]+^+^+^+/+(+_+:+%+&+<+[+;+}+K.|+1+2+3+4+ + +5+",
" 6+]+7+7+7+7+8+9+0+S.a+b+c+d+-+;+e+f+g+h+i+j+h+k+",
" l+m+n+n+n+n+n+o+p+q+r+8+s+3+3+t+u+v+V.o.w+x+y+",
" z+.+A+B+A+A+A+C+D+E+F+A+G+H+I+h+f+G.J+K+L+ ",
" M+N+O+F.P+Q+R+ ",
" S+S+T+U+V+x+W+X+Y+S+ "};

Binary file not shown.

View file

@ -0,0 +1,29 @@
/* XPM */
static char * ellipse_xpm[] = {
"24 24 2 1",
" c None",
". c #204A88",
" ",
" ....... ",
" ........... ",
" ... ... ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" ... ... ",
" ........... ",
" ....... ",
" ",
" "};

Binary file not shown.

View file

@ -0,0 +1,138 @@
/* XPM */
static char * eraser_xpm[] = {
"24 24 111 2",
" c None",
". c #ED2F2F",
"+ c #EF2929",
"@ c #EF2C2B",
"# c #ED3030",
"$ c #EE2C2C",
"% c #EF6968",
"& c #EDD0CC",
"* c #EDD6D1",
"= c #EDCFCB",
"- c #EE5252",
"; c #EF3535",
"> c #EDCEC8",
", c #E4B6AE",
"' c #E1ABA2",
") c #E1ACA2",
"! c #EDCFCA",
"~ c #F28D8B",
"{ c #EF2D2D",
"] c #EF2E2E",
"^ c #EEA29F",
"/ c #EAC5BE",
"( c #E2ABA2",
"_ c #E6BBB3",
": c #EEC5C2",
"< c #F49491",
"[ c #F03F3E",
"} c #EE5857",
"| c #EDD1CC",
"1 c #E3AEA5",
"2 c #E2AAA1",
"3 c #E2ABA1",
"4 c #ECCEC9",
"5 c #F3A2A0",
"6 c #F59290",
"7 c #F05453",
"8 c #F02F2E",
"9 c #EFC3BF",
"0 c #E6BAB3",
"a c #E3A9A1",
"b c #EEC5C1",
"c c #F5908D",
"d c #F48C8A",
"e c #ED2E2E",
"f c #ED2C2C",
"g c #EF8B89",
"h c #EBC9C3",
"i c #E3A9A0",
"j c #E3AAA0",
"k c #EDCDC8",
"l c #F49F9D",
"m c #F58F8C",
"n c #F15F5E",
"o c #DB2B2B",
"p c #EF4242",
"q c #EDD1CB",
"r c #E5B0A8",
"s c #E4A8A0",
"t c #E7B9B2",
"u c #EFC4C0",
"v c #F68C8A",
"w c #F68A88",
"x c #EC302F",
"y c #F02E2E",
"z c #F0B3B0",
"A c #E9BEB6",
"B c #E5A89F",
"C c #E5A99F",
"D c #EDCEC9",
"E c #F49D9A",
"F c #F68B89",
"G c #F26463",
"H c #DC2B2B",
"I c #EE2A2A",
"J c #EDD5D1",
"K c #E6A8A1",
"L c #E5A79F",
"M c #E8B8B1",
"N c #F78886",
"O c #F68886",
"P c #EC3131",
"Q c #EDD2CD",
"R c #F59794",
"S c #F78785",
"T c #F46766",
"U c #E32C2C",
"V c #FB7575",
"W c #FA7776",
"X c #FA7877",
"Y c #FA7979",
"Z c #FA7A7A",
"` c #F97C7B",
" . c #F97D7C",
".. c #F97E7D",
"+. c #F97F7E",
"@. c #F88180",
"#. c #F88281",
"$. c #F88382",
"%. c #F88583",
"&. c #F78684",
"*. c #EC3636",
"=. c #FB7474",
"-. c #F56A68",
";. c #E52B2B",
">. c #EE2B2B",
",. c #F86363",
"'. c #F77D7C",
"). c #ED3636",
"!. c #A01B1B",
"~. c #ED2B2B",
"{. c #C82727",
" ",
" ",
" ",
" ",
" . + + + + + + + + + + @ # ",
" $ % & * * * * * * * * * = - ",
" ; > , ' ' ' ' ' ' ' ' ) ! ~ { ",
" ] ^ / ( ( ( ( ( ( ( ( ( _ : < [ ",
" } | 1 2 2 2 2 2 2 2 2 3 4 5 6 7 ",
" 8 9 0 a a a a a a a a a 0 b c d e ",
" f g h i i i i i i i i i j k l m n o ",
" p q r s s s s s s s s s t u v w x ",
" y z A B B B B B B B B B C D E F G H ",
" I J K L L L L L L L L L M 9 N O P ",
" + * * * * * * * * * * * Q R S T U ",
" + V W X Y Z ` ...+.@.#.$.%.&.*. ",
" + =.V W X Y Z ` ...+.@.#.$.-.;. ",
" >.,.=.V W X Y Z ` ...+.@.'.).!. ",
" ~.+ + + + + + + + + + + ~.{. ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

View file

@ -0,0 +1,186 @@
/* XPM */
static char * fill_xpm[] = {
"24 24 159 2",
" c None",
". c #555753",
"+ c #585A56",
"@ c #595A57",
"# c #555653",
"$ c #5A5C59",
"% c #9FA09F",
"& c #A8A9A8",
"* c #595B57",
"= c #5C5F5B",
"- c #565854",
"; c #E3E3E2",
"> c #F2F2F2",
", c #F6F6F6",
"' c #676965",
") c #595B58",
"! c #626460",
"~ c #D2D3D2",
"{ c #DDDDDD",
"] c #CBCBCB",
"^ c #DFDFDF",
"/ c #CDCECD",
"( c #5A5C57",
"_ c #5F719F",
": c #596C9B",
"< c #586A9A",
"[ c #566485",
"} c #5C5F61",
"| c #B0B2B1",
"1 c #FAFAFA",
"2 c #F3F3F3",
"3 c #D1D2D1",
"4 c #CFCFCF",
"5 c #C9C9C9",
"6 c #F5F5F5",
"7 c #777976",
"8 c #5E709F",
"9 c #8B9FC4",
"0 c #A0BCE3",
"a c #8DB2E2",
"b c #6E92C2",
"c c #5C636E",
"d c #838684",
"e c #F4F4F4",
"f c #FDFDFD",
"g c #E9E9E9",
"h c #D6D6D6",
"i c #D3D3D3",
"j c #CCCCCC",
"k c #D7D7D7",
"l c #E0E0E0",
"m c #5B6D9C",
"n c #BACFEB",
"o c #A4C0E5",
"p c #677589",
"q c #666866",
"r c #D6D7D6",
"s c #FBFBFB",
"t c #F7F7F7",
"u c #FCFCFC",
"v c #EEEEEE",
"w c #858683",
"x c #575855",
"y c #838582",
"z c #D1D1D1",
"A c #D0D0D0",
"B c #C8C8C8",
"C c #F0F0F0",
"D c #838481",
"E c #C0D5F0",
"F c #A3BEE2",
"G c #585B5B",
"H c #E5E5E5",
"I c #ECECEC",
"J c #8D8E8B",
"K c #666865",
"L c #8A8B8A",
"M c #6E6F6D",
"N c #7E807D",
"O c #D4D4D4",
"P c #CDCDCD",
"Q c #EDEEED",
"R c #5D5F5B",
"S c #A6C3E9",
"T c #57637D",
"U c #90918E",
"V c #E4E4E4",
"W c #6D6E6B",
"X c #8B8C8B",
"Y c #BBBBBB",
"Z c #A3A4A3",
"` c #666864",
" . c #D8D8D8",
".. c #A8AAA7",
"+. c #A6C2E9",
"@. c #576999",
"#. c #5A5B58",
"$. c #E2E2E2",
"%. c #DCDCDC",
"&. c #EBEBEB",
"*. c #8D8E8C",
"=. c #6B6C6A",
"-. c #9FA09E",
";. c #747673",
">. c #898B88",
",. c #D5D5D5",
"'. c #A5C2E8",
"). c #7B7D7A",
"!. c #969895",
"~. c #727470",
"{. c #8C8D8B",
"]. c #E1E1E1",
"^. c #D9D9D9",
"/. c #D2D2D2",
"(. c #CACACA",
"_. c #BFC0BF",
":. c #5B5C58",
"<. c #DADADA",
"[. c #CECECE",
"}. c #5B5D58",
"|. c #A4C1E7",
"1. c #6D6F6C",
"2. c #F8F8F8",
"3. c #EFEFEF",
"4. c #FEFEFE",
"5. c #EAEAEA",
"6. c #E3E3E3",
"7. c #5A5C58",
"8. c #5D6F9E",
"9. c #A2B6D7",
"0. c #92ACD4",
"a. c #5A6D9D",
"b. c #595B56",
"c. c #C7C7C6",
"d. c #E7E7E7",
"e. c #EDEDED",
"f. c #C9CAC9",
"g. c #5F605C",
"h. c #5C6E9D",
"i. c #5B6D9D",
"j. c #646662",
"k. c #F9F9F9",
"l. c #797A77",
"m. c #5B5C59",
"n. c #B6B7B6",
"o. c #E8E8E8",
"p. c #A3A5A3",
"q. c #5D5F5C",
"r. c #F4F4F3",
"s. c #DBDBDB",
"t. c #CFCFCE",
"u. c #666763",
"v. c #535650",
"w. c #535652",
"x. c #838683",
"y. c #F6F7F6",
"z. c #E0E0DF",
"A. c #797A76",
"B. c #50554D",
" ",
" . . . . ",
" . . . . ",
" . + @ . ",
" # $ % & * . ",
" = - ; > , ' . ",
" ) ! ~ * { ] ^ / ( . ",
" _ : < < < [ } | 1 2 + 3 4 5 6 7 # ",
" 8 9 0 a b c d e f 2 g + h i j k l . ",
" m n o p q r s t u v w x y z A B C D ",
" < E F G H v ^ I s J K L M N O P z Q R ",
" < E S T U 6 h V > W X Y Z ` .z 5 g .. ",
" < E +.@.#.$.l %.&.*.=.-.;.>.%.,.P j e ! ",
" < E '.< ).t ,.$.I !.~.{.$.].^./.(.$._.* ",
" < E '.< :.,.$.<.g t s 2 I H { h [.P > }. ",
" < E |.< 1.2.O ].3.4.2.C g ].<.,.5.6.7. ",
" 8.9.0.a. b.c.H ^.d.6 u e e.H g 2.f.g. ",
" h.i. j.t O ^ e.u k.2 k.5.l.m. ",
" + n.o.k H e 4.k.p.R ",
" q.r.s.o.1 t.u.v. ",
" w.x.y.z.A.* ",
" - ( #.B. ",
" ",
" "};

Binary file not shown.

View file

@ -0,0 +1,29 @@
/* XPM */
static char * line_xpm[] = {
"24 24 2 1",
" c None",
". c #204A88",
" ",
" . ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" ... ",
" . ",
" "};

Binary file not shown.

View file

@ -0,0 +1,130 @@
/* XPM */
static char * pen_xpm[] = {
"24 24 103 2",
" c None",
". c #683907",
"+ c #764108",
"@ c #6B3B07",
"# c #673907",
"$ c #985B1B",
"% c #854A0A",
"& c #9C652C",
"* c #D48E45",
"= c #6B3D0D",
"- c #673908",
"; c #95632D",
"> c #E49745",
", c #996731",
"' c #885C2D",
") c #E79137",
"! c #B67836",
"~ c #71471B",
"{ c #7B5226",
"] c #D48839",
"^ c #BB6C19",
"/ c #8C653A",
"( c #693A09",
"_ c #764D1F",
": c #C1803B",
"< c #C97113",
"[ c #956430",
"} c #7C5021",
"| c #734719",
"1 c #AF763C",
"2 c #DB7C18",
"3 c #985916",
"4 c #876239",
"5 c #6A3B09",
"6 c #6E4213",
"7 c #9B6D3C",
"8 c #E8851D",
"9 c #A45B0D",
"0 c #785631",
"a c #86541E",
"b c #837868",
"c c #897862",
"d c #CB7B27",
"e c #B6640E",
"f c #7D5223",
"g c #976632",
"h c #8A8C88",
"i c #B2B3B1",
"j c #AEAFAC",
"k c #8A8A83",
"l c #845B2E",
"m c #966A3B",
"n c #70400D",
"o c #92948F",
"p c #F4F4F4",
"q c #E7E7E7",
"r c #ADADAC",
"s c #898982",
"t c #845A2B",
"u c #6D3C07",
"v c #8B8E89",
"w c #C8C8C7",
"x c #F9F9F9",
"y c #C6C6C6",
"z c #A3A3A3",
"A c #9FA19D",
"B c #868073",
"C c #8B8D88",
"D c #F6F6F6",
"E c #E0E0E0",
"F c #AFAFAF",
"G c #A6A7A5",
"H c #8C8E89",
"I c #898D88",
"J c #C1C2C0",
"K c #F8F8F8",
"L c #BBBBBB",
"M c #9E9F9D",
"N c #8B8C88",
"O c #1E1E1E",
"P c #3E3E3D",
"Q c #595958",
"R c #A2A2A2",
"S c #999A98",
"T c #161616",
"U c #757575",
"V c #848484",
"W c #3F3F3F",
"X c #202020",
"Y c #6E706B",
"Z c #000000",
"` c #1A1A1A",
" . c #929292",
".. c #484848",
"+. c #242424",
"@. c #101010",
"#. c #0D0D0D",
"$. c #2B2B2B",
"%. c #3B3B3B",
"&. c #303030",
"*. c #0A0A0A",
"=. c #141414",
"-. c #0E0E0E",
" ",
" . ",
" . + @ ",
" # $ % ",
" # & * = ",
" - ; > , # ",
" # ' ) ! ~ ",
" # { ] ^ / ( ",
" # _ : < [ } ",
" # | 1 2 3 4 5 ",
" 6 7 8 9 0 a @ ",
" b c d e f g @ ",
" h i j k l m n ",
" o p q r s t u ",
" v w x y z A B ",
" C D E F G H ",
" I J K L M N ",
" O P Q R S C ",
" T U V W X Y ",
" Z ` .z ..+.@. ",
" Z Z #.$.%.&.T ",
" Z Z Z *.=.-.Z ",
" Z Z Z Z Z Z Z ",
" "};

Binary file not shown.

View file

@ -0,0 +1,29 @@
/* XPM */
static char * poly_line_xpm[] = {
"24 24 2 1",
" c None",
". c #204A88",
" ",
" ... ",
" ........ ",
" .. ........... ",
" .. ........... ",
" .. ........ ",
" . ... ",
" .. .. ",
" .. . ",
" .. .. ",
" .. .. ",
" .. . ",
" . .. .. ",
" . ..... .. ",
" . . .... . ",
" . .. ..... ",
" .. . .. ",
" .. .. ",
" ... ",
" .. ",
" .. ",
" . ",
" ",
" "};

Binary file not shown.

View file

@ -0,0 +1,30 @@
/* XPM */
static char * rectangle_xpm[] = {
"24 24 3 1",
" c None",
". c #204A88",
"+ c #719FCF",
" ",
" ",
" ",
" ",
" ",
" ...................... ",
" ...................... ",
" ..++++++++++++++++++.. ",
" ..++++++++++++++++++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++++++++++++++++++.. ",
" ..++++++++++++++++++.. ",
" ...................... ",
" ...................... ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

View file

@ -0,0 +1,139 @@
/* XPM */
static char * spray_xpm[] = {
"24 24 112 2",
" c None",
". c #2D3335",
"+ c #2F3235",
"@ c #3F4444",
"# c #33383A",
"$ c #2D3336",
"% c #414646",
"& c #6B6D6A",
"* c #303638",
"= c #2F3536",
"- c #6B6D69",
"; c #313739",
"> c #3B413F",
", c #2D3435",
"' c #6A6C69",
") c #323739",
"! c #2E3436",
"~ c #2C3434",
"{ c #696C69",
"] c #3C4140",
"^ c #2D3537",
"/ c #353A3A",
"( c #696B68",
"_ c #323839",
": c #2D3434",
"< c #2F3436",
"[ c #4B4E4B",
"} c #393F3F",
"| c #444949",
"1 c #545651",
"2 c #838482",
"3 c #DADADA",
"4 c #33393A",
"5 c #545752",
"6 c #EEEEEE",
"7 c #DDDDDD",
"8 c #999A98",
"9 c #3B3F40",
"0 c #F5F5F5",
"a c #E4E4E4",
"b c #B4B5B3",
"c c #AEAEAD",
"d c #4E504E",
"e c #545652",
"f c #80827F",
"g c #F9F9F9",
"h c #EBEBEB",
"i c #A2A3A1",
"j c #C2C2C2",
"k c #C1C1C1",
"l c #747474",
"m c #313531",
"n c #1A1A1A",
"o c #252525",
"p c #555652",
"q c #D2D3D2",
"r c #F1F1F1",
"s c #A3A4A2",
"t c #565753",
"u c #6A6D69",
"v c #B9B9B9",
"w c #ABABAB",
"x c #313231",
"y c #303030",
"z c #7E7E7E",
"A c #585855",
"B c #777C73",
"C c #C4C7C1",
"D c #A6A7A5",
"E c #565754",
"F c #555753",
"G c #5D5F5C",
"H c #A7A7A7",
"I c #797979",
"J c #121212",
"K c #131313",
"L c #898989",
"M c #545653",
"N c #D0D0CE",
"O c #ABAEA7",
"P c #60635E",
"Q c #3D3F3A",
"R c #494B49",
"S c #949494",
"T c #636363",
"U c #3E3E3E",
"V c #7D7D7D",
"W c #757575",
"X c #555551",
"Y c #5C5F59",
"Z c #222522",
"` c #393939",
" . c #8E8E8E",
".. c #919191",
"+. c #818181",
"@. c #292929",
"#. c #365990",
"$. c #52524E",
"%. c #080D08",
"&. c #050505",
"*. c #101010",
"=. c #1B1B1B",
"-. c #385A90",
";. c #375A90",
">. c #375A8F",
",. c #365A90",
"'. c #385990",
"). c #37588F",
"!. c #375A8D",
"~. c #37598E",
"{. c #37568D",
"]. c #355A8D",
" ",
" ",
" . + ",
" . @ # . ",
" $ % & * = ",
" $ % - ; > , ",
" . % ' ) > ! ",
" $ ~ . % { ) ] ! ",
" , $ ^ / % ( _ > ! ",
" : < [ } | _ > , ",
" 1 2 3 % 4 ! ",
" 5 2 6 7 8 9 ",
" 5 2 0 a b c d ",
" e f g h i j k l m n o ",
" p q r s t u v w x y z ",
" A B C D E F G H I J K L ",
" M N O P Q R S T U V W ",
" X ' Y Z ` ...+.@. ",
" #. $. %.&.*.=. ",
" -.;.>. ",
" ,.-.'.). ",
" !.~.~. ",
" {.]. ",
" "};

Binary file not shown.

View file

@ -0,0 +1,30 @@
/* XPM */
static char * square_xpm[] = {
"24 24 3 1",
" c None",
". c #204A88",
"+ c #719FCF",
" ",
" ",
" ..................... ",
" ..................... ",
" ..+++++++++++++++++.. ",
" ..+++++++++++++++++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..++ ++.. ",
" ..+++++++++++++++++.. ",
" ..+++++++++++++++++.. ",
" ..................... ",
" ..................... ",
" "};

Binary file not shown.

View file

@ -0,0 +1,164 @@
/* XPM */
static char * text_xpm[] = {
"24 24 137 2",
" c None",
". c #9C9C9C",
"+ c #585858",
"@ c #828282",
"# c #BEBEBE",
"$ c #BFBFBF",
"% c #272727",
"& c #393939",
"* c #4E4E4E",
"= c #4C4C4C",
"- c #4B4B4B",
"; c #444444",
"> c #070707",
", c #B3B3B3",
"' c #A0A0A0",
") c #121212",
"! c #949494",
"~ c #808080",
"{ c #7D7D7D",
"] c #7A7A7A",
"^ c #787878",
"/ c #212121",
"( c #717171",
"_ c #BDBDBD",
": c #505050",
"< c #838383",
"[ c #545454",
"} c #515151",
"| c #4D4D4D",
"1 c #4A4A4A",
"2 c #5A5A5A",
"3 c #363636",
"4 c #252525",
"5 c #BABABA",
"6 c #0E0E0E",
"7 c #818181",
"8 c #656565",
"9 c #474747",
"0 c #3F3F3F",
"a c #050505",
"b c #9F9F9F",
"c c #7B7B7B",
"d c #2C2C2C",
"e c #8B8B8B",
"f c #484848",
"g c #373737",
"h c #353535",
"i c #3E3E3E",
"j c #3B3B3B",
"k c #161616",
"l c #535353",
"m c #2D2D2D",
"n c #626262",
"o c #6C6C6C",
"p c #464646",
"q c #424242",
"r c #141414",
"s c #131313",
"t c #383838",
"u c #313131",
"v c #222222",
"w c #0D0D0D",
"x c #A3A3A3",
"y c #0C0C0C",
"z c #878787",
"A c #404040",
"B c #030303",
"C c #040404",
"D c #2A2A2A",
"E c #2F2F2F",
"F c #2B2B2B",
"G c #282828",
"H c #0A0A0A",
"I c #575757",
"J c #434343",
"K c #767676",
"L c #3A3A3A",
"M c #1D1D1D",
"N c #333333",
"O c #3D3D3D",
"P c #292929",
"Q c #262626",
"R c #101010",
"S c #0F0F0F",
"T c #707070",
"U c #343434",
"V c #7C7C7C",
"W c #888888",
"X c #080808",
"Y c #202020",
"Z c #1F1F1F",
"` c #1B1B1B",
" . c #ADADAD",
".. c #232323",
"+. c #7F7F7F",
"@. c #323232",
"#. c #242424",
"$. c #B1B1B1",
"%. c #151515",
"&. c #676767",
"*. c #C0C0C0",
"=. c #5F5F5F",
"-. c #616161",
";. c #1A1A1A",
">. c #A9A9A9",
",. c #777777",
"'. c #ABABAB",
"). c #020202",
"!. c #1C1C1C",
"~. c #1E1E1E",
"{. c #969696",
"]. c #696969",
"^. c #010101",
"/. c #000000",
"(. c #606060",
"_. c #595959",
":. c #181818",
"<. c #B6B6B6",
"[. c #8A8A8A",
"}. c #060606",
"|. c #111111",
"1. c #494949",
"2. c #6B6B6B",
"3. c #909090",
"4. c #A6A6A6",
"5. c #666666",
"6. c #B5B5B5",
"7. c #5E5E5E",
"8. c #191919",
"9. c #686868",
"0. c #979797",
"a. c #090909",
"b. c #B4B4B4",
"c. c #B9B9B9",
"d. c #8C8C8C",
"e. c #8E8E8E",
"f. c #B8B8B8",
" ",
" ",
" . + + + + + + @ # ",
" $ % & * * = - ; > , ",
" ' ) ! ~ { ] ^ ~ / ( ",
" _ : : < [ } | 1 2 3 4 $ ",
" 5 6 7 8 * - 9 ; ; 0 a b ",
" c d e | f g h i j g k l ",
" _ m n o p q r s t h u v w 5 ",
" x y z | A h B C D E F G H < ",
" I J K i L M N O k P Q v R 3 $ ",
" 5 S T [ t U w V W X v Y Z ` B . ",
" < ..+.g @.#.> $. r %.Z Z Z 6 &. ",
" *.N } =.E d s p -.S Z Z Z r ;.$ ",
" >.X ,.j P 4 > < '.'.. ).!.Z Z ~.a {. ",
" =.g ].% #.` ^./././././.%.Z Z Z R 1 ",
" _ r (.O / Z 3 _._._._._._.; Z Z Z :.X <. ",
" [.:.=./ Z Z / % % % % % % v Z Z Z Z y V ",
" & O j Z Z ) }.}.}.}.}.}.}.}.S Z Z Z |.d $ ",
" .}.1.#.Z Z y 2.{.{.{.{.{.{.3.).!.Z Z !.B 4. ",
" 5.#.t Z Z ;.C 6. # Q ) Z Z Z 6 7. ",
"$ 8.d P Z Z |.N 9.R Z Z Z %.s # ",
"0./.R S S S }.,. x ).H H H a./.{.",
"b.@ +.+.+.+.@ c. {.d.d.d.d.e.f."};

View file

@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <signal.h> #include <signal.h>
#include <stdcountof.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
@ -1538,9 +1539,6 @@ static int interesting_syscalls[] =
READLINKAT_SYSCALL, READLINKAT_SYSCALL,
}; };
/* Number of elements in an array. */
#define ARRAYELTS(arr) (sizeof (arr) / sizeof (arr)[0])
/* Install a secure computing filter that will notify attached tracers /* Install a secure computing filter that will notify attached tracers
when a system call of interest to this module is received. Value is when a system call of interest to this module is received. Value is
0 if successful, 1 otherwise. */ 0 if successful, 1 otherwise. */
@ -1548,7 +1546,7 @@ static int interesting_syscalls[] =
static int static int
establish_seccomp_filter (void) establish_seccomp_filter (void)
{ {
struct sock_filter statements[1 + ARRAYELTS (interesting_syscalls) + 2]; struct sock_filter statements[1 + countof (interesting_syscalls) + 2];
struct sock_fprog program; struct sock_fprog program;
int index, rc; int index, rc;
@ -1567,27 +1565,27 @@ establish_seccomp_filter (void)
statements[index] statements[index]
= ((struct sock_filter) = ((struct sock_filter)
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, EXEC_SYSCALL, BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, EXEC_SYSCALL,
ARRAYELTS (interesting_syscalls), 0)); index++; countof (interesting_syscalls), 0)); index++;
#ifdef OPEN_SYSCALL #ifdef OPEN_SYSCALL
statements[index] statements[index]
= ((struct sock_filter) = ((struct sock_filter)
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, OPEN_SYSCALL, BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, OPEN_SYSCALL,
ARRAYELTS (interesting_syscalls) - index + 1, 0)); index++; countof (interesting_syscalls) - index + 1, 0)); index++;
#endif /* OPEN_SYSCALL */ #endif /* OPEN_SYSCALL */
statements[index] statements[index]
= ((struct sock_filter) = ((struct sock_filter)
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, OPENAT_SYSCALL, BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, OPENAT_SYSCALL,
ARRAYELTS (interesting_syscalls) - index + 1, 0)); index++; countof (interesting_syscalls) - index + 1, 0)); index++;
#ifdef READLINK_SYSCALL #ifdef READLINK_SYSCALL
statements[index] statements[index]
= ((struct sock_filter) = ((struct sock_filter)
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, READLINK_SYSCALL, BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, READLINK_SYSCALL,
ARRAYELTS (interesting_syscalls) - index + 1, 0)); index++; countof (interesting_syscalls) - index + 1, 0)); index++;
#endif /* READLINK_SYSCALL */ #endif /* READLINK_SYSCALL */
statements[index] statements[index]
= ((struct sock_filter) = ((struct sock_filter)
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, READLINKAT_SYSCALL, BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, READLINKAT_SYSCALL,
ARRAYELTS (interesting_syscalls) - index + 1, 0)); index++; countof (interesting_syscalls) - index + 1, 0)); index++;
/* If not intercepted above, permit this system call to execute as /* If not intercepted above, permit this system call to execute as
normal. */ normal. */
@ -1600,7 +1598,7 @@ establish_seccomp_filter (void)
if (rc) if (rc)
return 1; return 1;
program.len = ARRAYELTS (statements); program.len = countof (statements);
program.filter = statements; program.filter = statements;
rc = prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &program); rc = prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &program);
if (rc) if (rc)

View file

@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#include <stdcountof.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -3612,7 +3614,7 @@ static _Noreturn void
usage (int error) usage (int error)
{ {
int i; int i;
for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++) for (i = 0; i < countof (usage_message); i++)
fputs (usage_message[i], stdout); fputs (usage_message[i], stdout);
exit (error ? EXIT_FAILURE : EXIT_SUCCESS); exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
} }

View file

@ -1034,10 +1034,12 @@ get_server_config (const char *config_file, struct sockaddr_in *server,
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
memset (server, 0, sizeof *server); *server = (struct sockaddr_in)
server->sin_family = AF_INET; {
server->sin_addr.s_addr = inet_addr (dotted); .sin_family = AF_INET,
server->sin_port = htons (atoi (port)); .sin_addr.s_addr = inet_addr (dotted),
.sin_port = htons (atoi (port))
};
free (dotted); free (dotted);
if (! fread (authentication, AUTH_KEY_LENGTH, 1, config)) if (! fread (authentication, AUTH_KEY_LENGTH, 1, config))

View file

@ -110,6 +110,7 @@ University of California, as described above. */
#include <unistd.h> #include <unistd.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdckdint.h> #include <stdckdint.h>
#include <stdcountof.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sysstdio.h> #include <sysstdio.h>
@ -652,9 +653,10 @@ static const char Forth_help [] =
constant, code, create, defer, value, variable, buffer:, field."; constant, code, create, defer, value, variable, buffer:, field.";
static const char *Fortran_suffixes [] = static const char *Fortran_suffixes [] =
{ "F", "f", "f90", "for", NULL }; { "F", "f", "for", "f90", "f95", "f03", "f08", NULL };
static const char Fortran_help [] = static const char Fortran_help [] =
"In Fortran code, functions, subroutines and block data are tags."; "In Fortran code, modules, subroutines, functions, entries\n\
and block data are tags.";
static const char *Go_suffixes [] = {"go", NULL}; static const char *Go_suffixes [] = {"go", NULL};
static const char Go_help [] = static const char Go_help [] =
@ -4567,6 +4569,10 @@ Fortran_functions (FILE *inf)
continue; continue;
switch (c_tolower (*dbp)) switch (c_tolower (*dbp))
{ {
case 'm':
if (nocase_tail ("module"))
F_getit (inf);
continue;
case 'f': case 'f':
if (nocase_tail ("function")) if (nocase_tail ("function"))
F_getit (inf); F_getit (inf);
@ -6649,6 +6655,14 @@ static const char *Mercury_decl_tags[] = {"type", "solver type", "pred",
"initialise", "finalise", "mutable", "module", "interface", "implementation", "initialise", "finalise", "mutable", "module", "interface", "implementation",
"import_module", "use_module", "include_module", "end_module", "some", "all"}; "import_module", "use_module", "include_module", "end_module", "some", "all"};
/* Return true if array of char BUF, of length LEN, equals STR. */
static bool
memstreq (char const *buf, ptrdiff_t len, char const *str)
{
return strlen (str) == len && memeq (buf, str, len);
}
static mercury_pos_t static mercury_pos_t
mercury_decl (char *s, size_t pos) mercury_decl (char *s, size_t pos)
{ {
@ -6656,43 +6670,40 @@ mercury_decl (char *s, size_t pos)
if (s == NULL) return null_pos; if (s == NULL) return null_pos;
size_t origpos; size_t origpos = pos;
origpos = pos; char *decl_type = s + origpos;
while (c_isalnum (s[pos]) || s[pos] == '_') while (c_isalnum (s[pos]) || s[pos] == '_')
pos++; pos++;
unsigned char decl_type_length = pos - origpos; ptrdiff_t decl_type_length = pos - origpos;
char buf[decl_type_length + 1];
memset (buf, 0, decl_type_length + 1);
/* Mercury declaration tags. Consume them, then check the declaration item /* Mercury declaration tags. Consume them, then check the declaration item
following :- is legitimate, then go on as in the prolog case. */ following :- is legitimate, then go on as in the prolog case. */
memcpy (buf, &s[origpos], decl_type_length);
bool found_decl_tag = false; bool found_decl_tag = false;
if (is_mercury_quantifier) if (is_mercury_quantifier)
{ {
if (strcmp (buf, "pred") != 0 && strcmp (buf, "func") != 0) /* Bad syntax. */ if (! (memstreq (decl_type, decl_type_length, "pred")
return null_pos; || memstreq (decl_type, decl_type_length, "func")))
return null_pos; /* Bad syntax. */
is_mercury_quantifier = false; /* Reset to base value. */ is_mercury_quantifier = false; /* Reset to base value. */
found_decl_tag = true; found_decl_tag = true;
} }
else else
{ {
for (int j = 0; j < sizeof (Mercury_decl_tags) / sizeof (char*); ++j) for (int j = 0; j < countof (Mercury_decl_tags); ++j)
{ {
if (strcmp (buf, Mercury_decl_tags[j]) == 0) if (memstreq (decl_type, decl_type_length, Mercury_decl_tags[j]))
{ {
found_decl_tag = true; found_decl_tag = true;
if (strcmp (buf, "type") == 0) if (memstreq (decl_type, decl_type_length, "type"))
is_mercury_type = true; is_mercury_type = true;
if (strcmp (buf, "some") == 0 if (memstreq (decl_type, decl_type_length, "some")
|| strcmp (buf, "all") == 0) || memstreq (decl_type, decl_type_length, "all"))
{ {
is_mercury_quantifier = true; is_mercury_quantifier = true;
} }
@ -6702,18 +6713,15 @@ mercury_decl (char *s, size_t pos)
else else
/* 'solver type' has a blank in the middle, /* 'solver type' has a blank in the middle,
so this is the hard case. */ so this is the hard case. */
if (strcmp (buf, "solver") == 0) if (memstreq (decl_type, decl_type_length, "solver"))
{ {
do do
pos++; pos++;
while (c_isalnum (s[pos]) || s[pos] == '_'); while (c_isalnum (s[pos]) || s[pos] == '_');
decl_type_length = pos - origpos; decl_type_length = pos - origpos;
char buf2[decl_type_length + 1];
memset (buf2, 0, decl_type_length + 1);
memcpy (buf2, &s[origpos], decl_type_length);
if (strcmp (buf2, "solver type") == 0) if (memstreq (decl_type, decl_type_length, "solver type"))
{ {
found_decl_tag = false; found_decl_tag = false;
break; /* Found declaration tag of rank j. */ break; /* Found declaration tag of rank j. */

View file

@ -37,6 +37,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdcountof.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -651,7 +652,7 @@ compare_globals (const void *a, const void *b)
/* Common symbols in decreasing popularity order. */ /* Common symbols in decreasing popularity order. */
static char const commonsym[][8] static char const commonsym[][8]
= { "nil", "t", "unbound", "error", "lambda" }; = { "nil", "t", "unbound", "error", "lambda" };
int ncommonsym = sizeof commonsym / sizeof *commonsym; int ncommonsym = countof (commonsym);
int ai = ncommonsym, bi = ncommonsym; int ai = ncommonsym, bi = ncommonsym;
for (int i = 0; i < ncommonsym; i++) for (int i = 0; i < ncommonsym; i++)
{ {

View file

@ -975,10 +975,8 @@ static int
socket_connection (char *host, int flags) socket_connection (char *host, int flags)
{ {
struct addrinfo *res, *it; struct addrinfo *res, *it;
struct addrinfo hints;
int ret; int ret;
struct servent *servent; struct servent *servent;
struct sockaddr_in addr;
char found_port = 0; char found_port = 0;
const char *service; const char *service;
int sock; int sock;
@ -1012,9 +1010,6 @@ socket_connection (char *host, int flags)
} }
#endif #endif
memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
/** "kpop" service is never used: look for 20060515 to see why **/ /** "kpop" service is never used: look for 20060515 to see why **/
#ifdef KERBEROS #ifdef KERBEROS
service = (flags & POP_NO_KERBEROS) ? POP_SERVICE : KPOP_SERVICE; service = (flags & POP_NO_KERBEROS) ? POP_SERVICE : KPOP_SERVICE;
@ -1022,6 +1017,8 @@ socket_connection (char *host, int flags)
service = POP_SERVICE; service = POP_SERVICE;
#endif #endif
struct sockaddr_in addr = {.sin_family = AF_INET};
#ifdef HESIOD #ifdef HESIOD
if (! (flags & POP_NO_HESIOD)) if (! (flags & POP_NO_HESIOD))
{ {
@ -1063,10 +1060,12 @@ socket_connection (char *host, int flags)
} }
memset (&hints, 0, sizeof (hints)); struct addrinfo hints =
hints.ai_socktype = SOCK_STREAM; {
hints.ai_flags = AI_CANONNAME; .ai_socktype = SOCK_STREAM,
hints.ai_family = AF_INET; .ai_flags = AI_CANONNAME,
.ai_family = AF_INET,
};
do do
{ {
ret = getaddrinfo (host, service, &hints, &res); ret = getaddrinfo (host, service, &hints, &res);

View file

@ -39,6 +39,7 @@ variants of those files that can be used to sandbox Emacs before
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdcountof.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
@ -119,7 +120,7 @@ set_attribute (enum scmp_filter_attr attr, uint32_t value)
do \ do \
{ \ { \
const struct scmp_arg_cmp arg_array[] = {__VA_ARGS__}; \ const struct scmp_arg_cmp arg_array[] = {__VA_ARGS__}; \
enum { arg_cnt = sizeof arg_array / sizeof *arg_array }; \ enum { arg_cnt = countof (arg_array) }; \
int status = seccomp_rule_add_array (ctx, action, syscall, \ int status = seccomp_rule_add_array (ctx, action, syscall, \
arg_cnt, arg_array); \ arg_cnt, arg_array); \
if (status < 0) \ if (status < 0) \

View file

@ -249,17 +249,19 @@ struct permission_context {
# elif defined GETACL /* Solaris, Cygwin < 2.5 */ # elif defined GETACL /* Solaris, Cygwin < 2.5 */
int count; int count;
aclent_t *entries; aclent_t *entries
_GL_ATTRIBUTE_COUNTED_BY (count);
# ifdef ACE_GETACL # ifdef ACE_GETACL
int ace_count; int ace_count;
ace_t *ace_entries; ace_t *ace_entries
_GL_ATTRIBUTE_COUNTED_BY (ace_count);
# endif # endif
# elif HAVE_GETACL /* HP-UX */ # elif HAVE_GETACL /* HP-UX */
struct acl_entry entries[NACLENTRIES]; struct acl_entry entries[NACLENTRIES] /* COUNTED_BY (count) */;
int count; int count;
# if HAVE_ACLV_H # if HAVE_ACLV_H
struct acl aclv_entries[NACLVENTRIES]; struct acl aclv_entries[NACLVENTRIES] /* COUNTED_BY (aclv_count) */;
int aclv_count; int aclv_count;
# endif # endif
@ -268,7 +270,7 @@ struct permission_context {
bool have_u; bool have_u;
# elif HAVE_ACLSORT /* NonStop Kernel */ # elif HAVE_ACLSORT /* NonStop Kernel */
struct acl entries[NACLENTRIES]; struct acl entries[NACLENTRIES] /* COUNTED_BY (count) */;
int count; int count;
# endif # endif

View file

@ -48,7 +48,7 @@ struct aclinfo
{ {
/* If 'size' is nonnegative, a buffer holding the concatenation /* If 'size' is nonnegative, a buffer holding the concatenation
of extended attribute names, each terminated by NUL 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; char *buf;
/* The number of useful bytes at the start of buf, counting trailing NULs. /* 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 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 but no longer relevant now), and a different value might be
better once experience is gained. For internal use only. */ better once experience is gained. For internal use only. */
char __gl_acl_ch[152]; char _gl_acl_ch[152];
} u; } u;
}; };

View file

@ -81,8 +81,8 @@
/* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE, /* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE,
_GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST, _GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST,
_GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR, _GL_ATTRIBUTE_COUNTED_BY, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED,
_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE, _GL_ATTRIBUTE_ERROR, _GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE,
_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF,
_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED, _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
@ -210,6 +210,19 @@
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH #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 for debugging information ================== */
/* Attributes regarding debugging information emitted by the compiler. */ /* Attributes regarding debugging information emitted by the compiler. */

View file

@ -32,7 +32,7 @@ set_binary_mode (int fd, int mode)
with console input or console output. */ with console input or console output. */
return O_TEXT; return O_TEXT;
else else
return __gl_setmode (fd, mode); return _gl_set_fd_mode (fd, mode);
} }
#endif #endif

View file

@ -38,9 +38,9 @@ _GL_INLINE_HEADER_BEGIN
#if O_BINARY #if O_BINARY
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ # if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
# include <io.h> /* declares setmode() */ # include <io.h> /* declares setmode() */
# define __gl_setmode setmode # define _gl_set_fd_mode setmode
# else # else
# define __gl_setmode _setmode # define _gl_set_fd_mode _setmode
# undef fileno # undef fileno
# define fileno _fileno # define fileno _fileno
# endif # endif
@ -49,7 +49,7 @@ _GL_INLINE_HEADER_BEGIN
/* Use a function rather than a macro, to avoid gcc warnings /* Use a function rather than a macro, to avoid gcc warnings
"warning: statement with no effect". */ "warning: statement with no effect". */
BINARY_IO_INLINE int 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; return O_BINARY;
} }
@ -72,7 +72,7 @@ extern int set_binary_mode (int fd, int mode);
BINARY_IO_INLINE int BINARY_IO_INLINE int
set_binary_mode (int fd, int mode) set_binary_mode (int fd, int mode)
{ {
return __gl_setmode (fd, mode); return _gl_set_fd_mode (fd, mode);
} }
#endif #endif

View file

@ -16,8 +16,6 @@
/* Written by Bruno Haible <bruno@clisp.org>. */ /* Written by Bruno Haible <bruno@clisp.org>. */
#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
#if defined __linux__ || defined __ANDROID__ #if defined __linux__ || defined __ANDROID__
/* Store the uptime counter, as managed by the Linux kernel, in *P_UPTIME. /* 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. */ modified when a user logs in, i.e. long after boot. */
"/var/run/utmp" /* seen on Alpine Linux with OpenRC */ "/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]; const char *filename = boot_touched_files[i];
struct stat statbuf; struct stat statbuf;
@ -214,7 +212,7 @@ get_openbsd_boot_time (struct timespec *p_boot_time)
"/var/db/host.random", "/var/db/host.random",
"/var/run/utmp" "/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]; const char *filename = boot_touched_files[i];
struct stat statbuf; struct stat statbuf;
@ -325,7 +323,7 @@ get_windows_boot_time (struct timespec *p_boot_time)
"C:\\pagefile.sys" "C:\\pagefile.sys"
#endif #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]; const char *filename = boot_touched_files[i];
struct stat statbuf; struct stat statbuf;

View file

@ -21,6 +21,7 @@
/* Specification. */ /* Specification. */
#include "boot-time.h" #include "boot-time.h"
#include <stdcountof.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <string.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 Solaris' utmpname returns 1 upon success -- which is contrary
to what the GNU libc version does. In addition, older GNU libc to what the GNU libc version does. In addition, older GNU libc
versions are actually void. */ 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 (); SET_UTMP_ENT ();

View file

@ -34,7 +34,7 @@ extern "C" {
The difference can matter in GNU/Linux, where times in /proc/stat The difference can matter in GNU/Linux, where times in /proc/stat
might be relative to boot time of the host, not the container. 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. invokes the functions setutxent, getutxent, endutxent.
These functions may lock a file like /var/log/wtmp (so that we 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), don't read garbage when a concurrent process writes to that file),

View file

@ -23,13 +23,14 @@
#error "Please include config.h first." #error "Please include config.h first."
#endif #endif
/* Define this now, rather than after including stdint.h, in case /* Define this now, rather than after including stdbit.h, in case stdbit.h
stdint.h recursively includes us. This is for Gnulib endian.h. */ recursively includes us via stdint.h. This is for Gnulib endian.h. */
#ifndef _GL_BYTESWAP_INLINE #ifndef _GL_BYTESWAP_INLINE
# define _GL_BYTESWAP_INLINE _GL_INLINE # define _GL_BYTESWAP_INLINE _GL_INLINE
#endif #endif
#include <stdint.h> #include <stdbit.h> /* for stdc_memreverse8u* */
#include <stdint.h> /* for UINT_LEAST64_MAX */
_GL_INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN
@ -37,38 +38,12 @@ _GL_INLINE_HEADER_BEGIN
extern "C" { extern "C" {
#endif #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 /* Given an unsigned 16-bit argument X, return the value corresponding to
X with reversed byte order. */ X with reversed byte order. */
_GL_BYTESWAP_INLINE uint_least16_t _GL_BYTESWAP_INLINE uint_least16_t
bswap_16 (uint_least16_t x) bswap_16 (uint_least16_t x)
{ {
#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 return stdc_memreverse8u16 (x);
return __builtin_bswap16 (x);
#else
uint_fast16_t mask = 0xff;
return ( (x & mask << 8 * 1) >> 8 * 1
| (x & mask << 8 * 0) << 8 * 1);
#endif
} }
/* Given an unsigned 32-bit argument X, return the value corresponding to /* 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 _GL_BYTESWAP_INLINE uint_least32_t
bswap_32 (uint_least32_t x) bswap_32 (uint_least32_t x)
{ {
#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 return stdc_memreverse8u32 (x);
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
} }
#ifdef UINT_LEAST64_MAX #ifdef UINT_LEAST64_MAX
@ -93,19 +60,7 @@ bswap_32 (uint_least32_t x)
_GL_BYTESWAP_INLINE uint_least64_t _GL_BYTESWAP_INLINE uint_least64_t
bswap_64 (uint_least64_t x) bswap_64 (uint_least64_t x)
{ {
# ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 return stdc_memreverse8u64 (x);
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
} }
#endif #endif

View file

@ -42,22 +42,17 @@ enum { STACK_BUF_SIZE = 1024 };
/* Act like careadlinkat (see below), with an additional argument /* Act like careadlinkat (see below), with an additional argument
STACK_BUF that can be used as temporary storage. STACK_BUF that can be used as temporary storage.
If GCC_LINT is defined, do not inline this function with GCC 10.1 In GCC 10+, do not inline this function
and later, to avoid creating a pointer to the stack that GCC to avoid creating a pointer to the stack that
-Wreturn-local-addr incorrectly complains about. See: -Wreturn-local-addr incorrectly complains about. See:
https://gcc.gnu.org/PR93644 https://gcc.gnu.org/PR93644
Although the noinline attribute can hurt performance a bit, no better way 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. 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 10 or 11, or GCC 12+ with -flto.
If the GCC bug is fixed this workaround should be limited to the
broken GCC versions. */ broken GCC versions. */
#if _GL_GNUC_PREREQ (10, 1) #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__)) __attribute__ ((__noinline__))
# elif __OPTIMIZE__ && !__NO_INLINE__
# define GCC_BOGUS_WRETURN_LOCAL_ADDR
# endif
#endif #endif
static char * static char *
readlink_stk (int fd, char const *filename, 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 common case of a symlink of small size, we get away with a
single small malloc instead of a big malloc followed by a single small malloc instead of a big malloc followed by a
shrinking realloc. */ 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]; char stack_buf[STACK_BUF_SIZE];
return readlink_stk (fd, filename, buffer, buffer_size, alloc, return readlink_stk (fd, filename, buffer, buffer_size, alloc,
preadlinkat, stack_buf); preadlinkat, stack_buf);

View file

@ -669,7 +669,8 @@
# ifdef __GNUC__ # ifdef __GNUC__
# define __restrict_arr /* Not supported in old GCC. */ # define __restrict_arr /* Not supported in old GCC. */
# else # else
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L \
&& !defined _MSC_VER)
# define __restrict_arr restrict # define __restrict_arr restrict
# else # else
/* Some other non-C99 compiler. */ /* Some other non-C99 compiler. */

View file

@ -82,10 +82,11 @@
#error "Please include config.h first." #error "Please include config.h first."
#endif #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 #ifndef OFFSET_MAX
# define 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 #endif
/* Default to no early abort. */ /* Default to no early abort. */

View file

@ -249,11 +249,11 @@ static DYNARRAY_ELEMENT *
/* The implementation is imported from glibc. */ /* The implementation is imported from glibc. */
/* Avoid possible conflicts with symbols exported by the GNU libc. */ /* Avoid possible conflicts with symbols exported by the GNU libc. */
#define __libc_dynarray_at_failure gl_dynarray_at_failure #define __libc_dynarray_at_failure _gl_dynarray_at_failure
#define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge #define __libc_dynarray_emplace_enlarge _gl_dynarray_emplace_enlarge
#define __libc_dynarray_finalize gl_dynarray_finalize #define __libc_dynarray_finalize _gl_dynarray_finalize
#define __libc_dynarray_resize_clear gl_dynarray_resize_clear #define __libc_dynarray_resize_clear _gl_dynarray_resize_clear
#define __libc_dynarray_resize gl_dynarray_resize #define __libc_dynarray_resize _gl_dynarray_resize
#if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX #if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX

View file

@ -109,7 +109,7 @@ _GL_INLINE_HEADER_BEGIN
extern "C" { extern "C" {
#endif #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 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. */ by its include guard so the functions are not yet declared. */
#ifdef _GL_BYTESWAP_INLINE #ifdef _GL_BYTESWAP_INLINE
@ -120,138 +120,174 @@ _GL_BYTESWAP_INLINE uint_least64_t bswap_64 (uint_least64_t);
/* Big endian to host. */ /* Big endian to host. */
#if !GNULIB_defined_be16toh
_GL_ENDIAN_INLINE uint16_t _GL_ENDIAN_INLINE uint16_t
be16toh (uint16_t x) 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 # if BYTE_ORDER == BIG_ENDIAN
return x; return x;
# else # else
return bswap_64 (x); return bswap_16 (x);
# endif # 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 #endif
/* Host to big endian. */ /* Host to big endian. */
#if !GNULIB_defined_htobe16
_GL_ENDIAN_INLINE uint16_t _GL_ENDIAN_INLINE uint16_t
htobe16 (uint16_t x) 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 # if BYTE_ORDER == BIG_ENDIAN
return x; return x;
# else # else
return bswap_64 (x); return bswap_16 (x);
# endif # 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 #endif
/* Little endian to host. */ /* Little endian to host. */
#if !GNULIB_defined_le16toh
_GL_ENDIAN_INLINE uint16_t _GL_ENDIAN_INLINE uint16_t
le16toh (uint16_t x) 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 # if BYTE_ORDER == BIG_ENDIAN
return bswap_64 (x); return bswap_16 (x);
# else # else
return x; return x;
# endif # 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 #endif
/* Host to little endian. */ /* Host to little endian. */
#if !GNULIB_defined_htole16
_GL_ENDIAN_INLINE uint16_t _GL_ENDIAN_INLINE uint16_t
htole16 (uint16_t x) 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 # if BYTE_ORDER == BIG_ENDIAN
return bswap_64 (x); return bswap_16 (x);
# else # else
return x; return x;
# endif # 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 #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -160,8 +160,8 @@ aclinfo_has_xattr (struct aclinfo const *ai, char const *xattr)
static void static void
get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags) get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags)
{ {
ai->buf = ai->u.__gl_acl_ch; ai->buf = ai->u._gl_acl_ch;
ssize_t acl_alloc = sizeof ai->u.__gl_acl_ch; ssize_t acl_alloc = sizeof ai->u._gl_acl_ch;
if (! (USE_ACL || flags & ACL_GET_SCONTEXT)) if (! (USE_ACL || flags & ACL_GET_SCONTEXT))
ai->size = 0; 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 /* Grow allocation to at least 'size'. Grow it by a nontrivial
amount, to defend against denial of service by an adversary amount, to defend against denial of service by an adversary
that fiddles with ACLs. */ that fiddles with ACLs. */
if (ai->buf != ai->u.__gl_acl_ch) if (ai->buf != ai->u._gl_acl_ch)
{ {
free (ai->buf); 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)) if (ckd_add (&acl_alloc, acl_alloc, acl_alloc >> 1))
acl_alloc = SSIZE_MAX; acl_alloc = SSIZE_MAX;
@ -297,7 +297,7 @@ aclinfo_scontext_free (char *scontext)
void void
aclinfo_free (struct aclinfo *ai) aclinfo_free (struct aclinfo *ai)
{ {
if (ai->buf != ai->u.__gl_acl_ch) if (ai->buf != ai->u._gl_acl_ch)
free (ai->buf); free (ai->buf);
aclinfo_scontext_free (ai->scontext); aclinfo_scontext_free (ai->scontext);
} }
@ -510,7 +510,7 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd,
#else /* !USE_LINUX_XATTR */ #else /* !USE_LINUX_XATTR */
ai->buf = ai->u.__gl_acl_ch; ai->buf = ai->u._gl_acl_ch;
ai->size = -1; ai->size = -1;
ai->u.err = ENOTSUP; ai->u.err = ENOTSUP;
ai->scontext = (char *) UNKNOWN_SECURITY_CONTEXT; ai->scontext = (char *) UNKNOWN_SECURITY_CONTEXT;

View file

@ -57,7 +57,7 @@
&& (~ (x) == (sizeof (x) < sizeof (int) \ && (~ (x) == (sizeof (x) < sizeof (int) \
? - (1 << (sizeof (x) * CHAR_BIT)) \ ? - (1 << (sizeof (x) * CHAR_BIT)) \
: 0))) \ : 0))) \
? UINTMAX_MAX : (uintmax_t) (x)) ? UINTMAX_MAX : (uintmax_t) {(x)})
/* Extract the top bit of X as an uintmax_t value. */ /* Extract the top bit of X as an uintmax_t value. */
#define EXTRACT_TOP_BIT(x) ((x) \ #define EXTRACT_TOP_BIT(x) ((x) \

View file

@ -60,10 +60,40 @@
# endif # endif
/* Disabled NLS. */ /* 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 # 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 /* The return type 'const char *' serves the purpose of producing warnings
for invalid uses of the value returned from these functions. */ for invalid uses of the value returned from these functions. */
# if __GNUC__ >= 9 # if __GNUC__ >= 9
@ -118,36 +148,80 @@ dcgettext (const char *domain, const char *msgid, int category)
# if __GNUC__ >= 9 # if __GNUC__ >= 9
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
# endif # endif
# else # elif defined __clang__
/* The casts to 'const char *' serve the purpose of producing warnings
for invalid uses of the value returned from these functions. */
# undef gettext # undef gettext
# define gettext(Msgid) ((const char *) (Msgid)) # define gettext(Msgid) ((const char *) (Msgid))
# undef dgettext # 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 # undef dcgettext
# define dcgettext(Domainname, Msgid, Category) \ # define dcgettext(Domainname, Msgid, Category) \
((void) (Category), dgettext (Domainname, Msgid)) ((void) (int) {(Category)}, dgettext (Domainname, Msgid))
# endif # endif
# undef ngettext
# define ngettext(Msgid1, Msgid2, N) \ # if (defined __GNUC__ && defined __cplusplus) || defined __clang__
((N) == 1 \ # undef ngettext
? ((void) (Msgid2), (const char *) (Msgid1)) \ # define ngettext(Msgid1, Msgid2, N) \
: ((void) (Msgid1), (const char *) (Msgid2))) ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# undef dngettext # undef dngettext
# define dngettext(Domainname, Msgid1, Msgid2, N) \ # define dngettext(Domainname, Msgid1, Msgid2, N) \
((void) (Domainname), ngettext (Msgid1, Msgid2, N)) ngettext (Msgid1, Msgid2, N)
# undef dcngettext # undef dcngettext
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) 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 # undef textdomain
# define textdomain(Domainname) ((const char *) (Domainname)) # define textdomain(Domainname) ((const char *) {(Domainname)})
# undef bindtextdomain # undef bindtextdomain
# define bindtextdomain(Domainname, Dirname) \ # define bindtextdomain(Domainname, Dirname) \
((void) (Domainname), (const char *) (Dirname)) ((void) (const char *) {(Domainname)}, (const char *) {(Dirname)})
# undef bind_textdomain_codeset # undef bind_textdomain_codeset
# define bind_textdomain_codeset(Domainname, Codeset) \ # define bind_textdomain_codeset(Domainname, Codeset) \
((void) (Domainname), (const char *) (Codeset)) ((void) (const char *) {(Domainname)}, (const char *) {(Codeset)})
#endif #endif
@ -178,6 +252,11 @@ dcgettext (const char *domain, const char *msgid, int category)
The letter 'p' stands for 'particular' or 'special'. */ The letter 'p' stands for 'particular' or 'special'. */
#include <locale.h> /* for LC_MESSAGES */ #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 #ifdef DEFAULT_TEXT_DOMAIN
# define pgettext(Msgctxt, Msgid) \ # define pgettext(Msgctxt, Msgid) \
@ -204,11 +283,9 @@ dcgettext (const char *domain, const char *msgid, int category)
#if defined __GNUC__ || defined __clang__ #if defined __GNUC__ || defined __clang__
__inline __inline
#else #elif defined __cplusplus
#ifdef __cplusplus
inline inline
#endif #endif
#endif
static const char * static const char *
pgettext_aux (const char *domain, pgettext_aux (const char *domain,
const char *msg_ctxt_id, const char *msgid, const char *msg_ctxt_id, const char *msgid,
@ -223,11 +300,9 @@ pgettext_aux (const char *domain,
#if defined __GNUC__ || defined __clang__ #if defined __GNUC__ || defined __clang__
__inline __inline
#else #elif defined __cplusplus
#ifdef __cplusplus
inline inline
#endif #endif
#endif
static const char * static const char *
npgettext_aux (const char *domain, npgettext_aux (const char *domain,
const char *msg_ctxt_id, const char *msgid, const char *msg_ctxt_id, const char *msgid,
@ -274,11 +349,9 @@ npgettext_aux (const char *domain,
#if defined __GNUC__ || defined __clang__ #if defined __GNUC__ || defined __clang__
__inline __inline
#else #elif defined __cplusplus
#ifdef __cplusplus
inline inline
#endif #endif
#endif
static const char * static const char *
dcpgettext_expr (const char *domain, dcpgettext_expr (const char *domain,
const char *msgctxt, const char *msgid, const char *msgctxt, const char *msgid,
@ -320,11 +393,9 @@ dcpgettext_expr (const char *domain,
#if defined __GNUC__ || defined __clang__ #if defined __GNUC__ || defined __clang__
__inline __inline
#else #elif defined __cplusplus
#ifdef __cplusplus
inline inline
#endif #endif
#endif
static const char * static const char *
dcnpgettext_expr (const char *domain, dcnpgettext_expr (const char *domain,
const char *msgctxt, const char *msgid, const char *msgctxt, const char *msgid,

View file

@ -35,7 +35,13 @@
# --macro-prefix=gl \ # --macro-prefix=gl \
# --no-vc-files \ # --no-vc-files \
# --avoid=access \ # --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=chmod \
# --avoid=close \ # --avoid=close \
# --avoid=crypto/af_alg \ # --avoid=crypto/af_alg \
@ -43,17 +49,13 @@
# --avoid=fchdir \ # --avoid=fchdir \
# --avoid=fstat \ # --avoid=fstat \
# --avoid=gnulib-i18n \ # --avoid=gnulib-i18n \
# --avoid=iswblank \
# --avoid=iswctype \
# --avoid=iswdigit \
# --avoid=iswxdigit \
# --avoid=langinfo-h \ # --avoid=langinfo-h \
# --avoid=libgmp-mpq \ # --avoid=libgmp-mpq \
# --avoid=localcharset \ # --avoid=localcharset \
# --avoid=locale-h \ # --avoid=localeinfo \
# --avoid=localename-unsafe-limited \ # --avoid=localename-unsafe-limited \
# --avoid=lock \ # --avoid=lock \
# --avoid=mbrtowc \ # --avoid=mbrtoc32-regular \
# --avoid=mbsinit \ # --avoid=mbsinit \
# --avoid=memchr \ # --avoid=memchr \
# --avoid=mkdir \ # --avoid=mkdir \
@ -63,14 +65,12 @@
# --avoid=openat-die \ # --avoid=openat-die \
# --avoid=opendir \ # --avoid=opendir \
# --avoid=pthread-h \ # --avoid=pthread-h \
# --avoid=raise \
# --avoid=save-cwd \ # --avoid=save-cwd \
# --avoid=select \ # --avoid=select \
# --avoid=setenv \ # --avoid=setenv \
# --avoid=sigprocmask \ # --avoid=sigprocmask \
# --avoid=stat \ # --avoid=stat \
# --avoid=std-gnu11 \ # --avoid=std-gnu11 \
# --avoid=stdarg-h \
# --avoid=strncpy \ # --avoid=strncpy \
# --avoid=threadlib \ # --avoid=threadlib \
# --avoid=tzset \ # --avoid=tzset \
@ -78,9 +78,7 @@
# --avoid=utime \ # --avoid=utime \
# --avoid=utime-h \ # --avoid=utime-h \
# --avoid=wchar-h \ # --avoid=wchar-h \
# --avoid=wcrtomb \ # --avoid=uchar-h \
# --avoid=wctype \
# --avoid=wctype-h \
# alignasof \ # alignasof \
# alloca-opt \ # alloca-opt \
# attribute \ # attribute \
@ -169,6 +167,7 @@
# stdc_count_ones \ # stdc_count_ones \
# stdc_trailing_zeros \ # stdc_trailing_zeros \
# stdckdint-h \ # stdckdint-h \
# stdcountof-h \
# stddef-h \ # stddef-h \
# stdio-h \ # stdio-h \
# stdio-windows \ # stdio-windows \
@ -254,6 +253,7 @@ CPPFLAGS = @CPPFLAGS@
CRYPTOLIB = @CRYPTOLIB@ CRYPTOLIB = @CRYPTOLIB@
CXX = @CXX@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
CXX_HAVE_STDCOUNTOF_H = @CXX_HAVE_STDCOUNTOF_H@
CYGWIN_OBJ = @CYGWIN_OBJ@ CYGWIN_OBJ = @CYGWIN_OBJ@
C_SWITCH_MACHINE = @C_SWITCH_MACHINE@ C_SWITCH_MACHINE = @C_SWITCH_MACHINE@
C_SWITCH_SYSTEM = @C_SWITCH_SYSTEM@ C_SWITCH_SYSTEM = @C_SWITCH_SYSTEM@
@ -372,6 +372,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_MINI_GMP_H_CONDITION = @GL_GENERATE_MINI_GMP_H_CONDITION@
GL_GENERATE_STDBIT_H_CONDITION = @GL_GENERATE_STDBIT_H_CONDITION@ GL_GENERATE_STDBIT_H_CONDITION = @GL_GENERATE_STDBIT_H_CONDITION@
GL_GENERATE_STDCKDINT_H_CONDITION = @GL_GENERATE_STDCKDINT_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_STDDEF_H_CONDITION = @GL_GENERATE_STDDEF_H_CONDITION@
GL_GENERATE_STDINT_H_CONDITION = @GL_GENERATE_STDINT_H_CONDITION@ GL_GENERATE_STDINT_H_CONDITION = @GL_GENERATE_STDINT_H_CONDITION@
GL_GNULIB_ABORT_DEBUG = @GL_GNULIB_ABORT_DEBUG@ GL_GNULIB_ABORT_DEBUG = @GL_GNULIB_ABORT_DEBUG@
@ -621,6 +622,28 @@ GL_GNULIB_SNZPRINTF = @GL_GNULIB_SNZPRINTF@
GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@
GL_GNULIB_STACK_TRACE = @GL_GNULIB_STACK_TRACE@ GL_GNULIB_STACK_TRACE = @GL_GNULIB_STACK_TRACE@
GL_GNULIB_STAT = @GL_GNULIB_STAT@ 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_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@
GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@
GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@
@ -681,6 +704,7 @@ GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@
GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@ GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@
GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@
GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@
GL_GNULIB_VAPRINTF = @GL_GNULIB_VAPRINTF@
GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@
GL_GNULIB_VASZPRINTF = @GL_GNULIB_VASZPRINTF@ GL_GNULIB_VASZPRINTF = @GL_GNULIB_VASZPRINTF@
GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@
@ -701,20 +725,7 @@ GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@
GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ GL_GNULIB_WRITE = @GL_GNULIB_WRITE@
GL_GNULIB_ZPRINTF = @GL_GNULIB_ZPRINTF@ GL_GNULIB_ZPRINTF = @GL_GNULIB_ZPRINTF@
GL_GNULIB__EXIT = @GL_GNULIB__EXIT@ GL_GNULIB__EXIT = @GL_GNULIB__EXIT@
GL_STDC_BIT_CEIL = @GL_STDC_BIT_CEIL@ GL_HAVE_STDBIT_H_CONDITION = @GL_HAVE_STDBIT_H_CONDITION@
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@
GMALLOC_OBJ = @GMALLOC_OBJ@ GMALLOC_OBJ = @GMALLOC_OBJ@
GMP_H = @GMP_H@ GMP_H = @GMP_H@
GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@
@ -924,7 +935,9 @@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
HAVE_SIGSET_T = @HAVE_SIGSET_T@ HAVE_SIGSET_T = @HAVE_SIGSET_T@
HAVE_SLEEP = @HAVE_SLEEP@ HAVE_SLEEP = @HAVE_SLEEP@
HAVE_SPAWN_H = @HAVE_SPAWN_H@ HAVE_SPAWN_H = @HAVE_SPAWN_H@
HAVE_STDBIT_H = @HAVE_STDBIT_H@
HAVE_STDCKDINT_H = @HAVE_STDCKDINT_H@ HAVE_STDCKDINT_H = @HAVE_STDCKDINT_H@
HAVE_STDCOUNTOF_H = @HAVE_STDCOUNTOF_H@
HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@
@ -1104,7 +1117,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_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_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_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_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_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_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@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
@ -1125,7 +1140,9 @@ NEXT_GETOPT_H = @NEXT_GETOPT_H@
NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@
NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ NEXT_SIGNAL_H = @NEXT_SIGNAL_H@
NEXT_STDBIT_H = @NEXT_STDBIT_H@
NEXT_STDCKDINT_H = @NEXT_STDCKDINT_H@ NEXT_STDCKDINT_H = @NEXT_STDCKDINT_H@
NEXT_STDCOUNTOF_H = @NEXT_STDCOUNTOF_H@
NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@ NEXT_STDIO_H = @NEXT_STDIO_H@
@ -1391,6 +1408,7 @@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@ SQLITE3_LIBS = @SQLITE3_LIBS@
STDBIT_H = @STDBIT_H@ STDBIT_H = @STDBIT_H@
STDCKDINT_H = @STDCKDINT_H@ STDCKDINT_H = @STDCKDINT_H@
STDCOUNTOF_H = @STDCOUNTOF_H@
STDDEF_H = @STDDEF_H@ STDDEF_H = @STDDEF_H@
STDDEF_NOT_IDEMPOTENT = @STDDEF_NOT_IDEMPOTENT@ STDDEF_NOT_IDEMPOTENT = @STDDEF_NOT_IDEMPOTENT@
STDINT_H = @STDINT_H@ STDINT_H = @STDINT_H@
@ -1516,6 +1534,7 @@ gl_GNULIB_ENABLED_issymlinkat_CONDITION = @gl_GNULIB_ENABLED_issymlinkat_CONDITI
gl_GNULIB_ENABLED_lchmod_CONDITION = @gl_GNULIB_ENABLED_lchmod_CONDITION@ gl_GNULIB_ENABLED_lchmod_CONDITION = @gl_GNULIB_ENABLED_lchmod_CONDITION@
gl_GNULIB_ENABLED_open_CONDITION = @gl_GNULIB_ENABLED_open_CONDITION@ gl_GNULIB_ENABLED_open_CONDITION = @gl_GNULIB_ENABLED_open_CONDITION@
gl_GNULIB_ENABLED_rawmemchr_CONDITION = @gl_GNULIB_ENABLED_rawmemchr_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_strtoll_CONDITION = @gl_GNULIB_ENABLED_strtoll_CONDITION@
gl_GNULIB_ENABLED_utimens_CONDITION = @gl_GNULIB_ENABLED_utimens_CONDITION@ gl_GNULIB_ENABLED_utimens_CONDITION = @gl_GNULIB_ENABLED_utimens_CONDITION@
gl_GNULIB_ENABLED_verify_CONDITION = @gl_GNULIB_ENABLED_verify_CONDITION@ gl_GNULIB_ENABLED_verify_CONDITION = @gl_GNULIB_ENABLED_verify_CONDITION@
@ -3199,23 +3218,36 @@ BUILT_SOURCES += $(STDBIT_H)
ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION)) ifneq (,$(GL_GENERATE_STDBIT_H_CONDITION))
stdbit.h: stdbit.in.h $(top_builddir)/config.status stdbit.h: stdbit.in.h $(top_builddir)/config.status
$(gl_V_at)$(SED_HEADER_STDOUT) \ $(gl_V_at)$(SED_HEADER_STDOUT) \
-e 's/@''GL_STDC_LEADING_ZEROS''@/$(GL_STDC_LEADING_ZEROS)/g' \ -e 's/@''HAVE_STDBIT_H''@/$(HAVE_STDBIT_H)/g' \
-e 's/@''GL_STDC_LEADING_ONES''@/$(GL_STDC_LEADING_ONES)/g' \ -e 's/@''GUARD_PREFIX''@/$(GUARD_PREFIX)/g' \
-e 's/@''GL_STDC_TRAILING_ZEROS''@/$(GL_STDC_TRAILING_ZEROS)/g' \ -e 's/@''PRAGMA_SYSTEM_HEADER''@/$(PRAGMA_SYSTEM_HEADER)/g' \
-e 's/@''GL_STDC_TRAILING_ONES''@/$(GL_STDC_TRAILING_ONES)/g' \ -e 's/@''PRAGMA_COLUMNS''@/$(PRAGMA_COLUMNS)/g' \
-e 's/@''GL_STDC_FIRST_LEADING_ZERO''@/$(GL_STDC_FIRST_LEADING_ZERO)/g' \ -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's/@''GL_STDC_FIRST_LEADING_ONE''@/$(GL_STDC_FIRST_LEADING_ONE)/g' \ -e 's/@''NEXT_STDBIT_H''@/$(NEXT_STDBIT_H)/g' \
-e 's/@''GL_STDC_FIRST_TRAILING_ZERO''@/$(GL_STDC_FIRST_TRAILING_ZERO)/g' \ -e 's/@''GNULIB_STDC_LEADING_ZEROS''@/$(GL_GNULIB_STDC_LEADING_ZEROS)/g' \
-e 's/@''GL_STDC_FIRST_TRAILING_ONE''@/$(GL_STDC_FIRST_TRAILING_ONE)/g' \ -e 's/@''GNULIB_STDC_LEADING_ONES''@/$(GL_GNULIB_STDC_LEADING_ONES)/g' \
-e 's/@''GL_STDC_COUNT_ZEROS''@/$(GL_STDC_COUNT_ZEROS)/g' \ -e 's/@''GNULIB_STDC_TRAILING_ZEROS''@/$(GL_GNULIB_STDC_TRAILING_ZEROS)/g' \
-e 's/@''GL_STDC_COUNT_ONES''@/$(GL_STDC_COUNT_ONES)/g' \ -e 's/@''GNULIB_STDC_TRAILING_ONES''@/$(GL_GNULIB_STDC_TRAILING_ONES)/g' \
-e 's/@''GL_STDC_HAS_SINGLE_BIT''@/$(GL_STDC_HAS_SINGLE_BIT)/g' \ -e 's/@''GNULIB_STDC_FIRST_LEADING_ZERO''@/$(GL_GNULIB_STDC_FIRST_LEADING_ZERO)/g' \
-e 's/@''GL_STDC_BIT_WIDTH''@/$(GL_STDC_BIT_WIDTH)/g' \ -e 's/@''GNULIB_STDC_FIRST_LEADING_ONE''@/$(GL_GNULIB_STDC_FIRST_LEADING_ONE)/g' \
-e 's/@''GL_STDC_BIT_FLOOR''@/$(GL_STDC_BIT_FLOOR)/g' \ -e 's/@''GNULIB_STDC_FIRST_TRAILING_ZERO''@/$(GL_GNULIB_STDC_FIRST_TRAILING_ZERO)/g' \
-e 's/@''GL_STDC_BIT_CEIL''@/$(GL_STDC_BIT_CEIL)/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 $(srcdir)/stdbit.in.h > $@-t
$(AM_V_at)mv $@-t $@ $(AM_V_at)mv $@-t $@
libgnu_a_SOURCES += stdbit.c
else else
stdbit.h: $(top_builddir)/config.status stdbit.h: $(top_builddir)/config.status
rm -f $@ rm -f $@
@ -3230,7 +3262,8 @@ endif
## begin gnulib module stdc_bit_width ## begin gnulib module stdc_bit_width
ifeq (,$(OMIT_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 libgnu_a_SOURCES += stdc_bit_width.c
endif endif
@ -3240,7 +3273,8 @@ endif
## begin gnulib module stdc_count_ones ## begin gnulib module stdc_count_ones
ifeq (,$(OMIT_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 libgnu_a_SOURCES += stdc_count_ones.c
endif endif
@ -3250,17 +3284,31 @@ endif
## begin gnulib module stdc_leading_zeros ## begin gnulib module stdc_leading_zeros
ifeq (,$(OMIT_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 libgnu_a_SOURCES += stdc_leading_zeros.c
endif endif
endif endif
## end gnulib module stdc_leading_zeros ## 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 ## begin gnulib module stdc_trailing_zeros
ifeq (,$(OMIT_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 libgnu_a_SOURCES += stdc_trailing_zeros.c
endif endif
@ -3299,6 +3347,36 @@ EXTRA_DIST += intprops-internal.h stdckdint.in.h
endif endif
## end gnulib module stdckdint-h ## 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 ## begin gnulib module stddef-h
ifeq (,$(OMIT_GNULIB_MODULE_stddef-h)) ifeq (,$(OMIT_GNULIB_MODULE_stddef-h))
@ -3445,6 +3523,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_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \
-e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \ -e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \
-e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/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_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \
-e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \ -e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \
-e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \
@ -3468,6 +3547,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_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \
-e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \
-e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/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 < $(srcdir)/stdio.in.h > $@-t1
$(AM_V_at)sed \ $(AM_V_at)sed \
-e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \
@ -3499,6 +3579,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_FOPEN_FOR_FOPEN_GNU''@|$(REPLACE_FOPEN_FOR_FOPEN_GNU)|g' \
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
-e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|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_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
-e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \

View file

@ -19,11 +19,17 @@
#ifndef _IDX_H #ifndef _IDX_H
#define _IDX_H #define _IDX_H
/* Get ptrdiff_t. */ #ifndef __PTRDIFF_TYPE__
#include <stddef.h> # include <stddef.h>
#endif
/* Get PTRDIFF_MAX. */ /* IDX_MAX is the maximum value of an idx_t. */
#include <stdint.h> #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. /* The type 'idx_t' holds an (array) index or an (object) size.
Its implementation promotes to a signed integer type, Its implementation promotes to a signed integer type,
@ -127,10 +133,12 @@ extern "C" {
/* Use the signed type 'ptrdiff_t'. */ /* Use the signed type 'ptrdiff_t'. */
/* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same /* 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. */ 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; typedef ptrdiff_t idx_t;
#endif
/* IDX_MAX is the maximum value of an idx_t. */
#define IDX_MAX PTRDIFF_MAX
/* So far no need has been found for an IDX_WIDTH macro. /* So far no need has been found for an IDX_WIDTH macro.
Perhaps there should be another macro IDX_VALUE_BITS that does not Perhaps there should be another macro IDX_VALUE_BITS that does not

View file

@ -25,6 +25,23 @@
# pragma GCC diagnostic ignored "-Wtype-limits" # pragma GCC diagnostic ignored "-Wtype-limits"
#endif #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. /* Return a value with the common real type of E and V and the value of V.
Do not evaluate E. */ Do not evaluate E. */
#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) #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, /* The extra casts in the following macros work around compiler bugs,
e.g., in Cray C 5.0.3.0. */ e.g., in Cray C 5.0.3.0. */
/* True if the real type T is signed. */ /* True if the standard integer or standard real type T is signed. */
#define _GL_TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) #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 /* Return 1 if the real expression E, after promotion, has a
signed or floating type. Do not evaluate E. */ signed or floating type. Do not evaluate E. */
@ -179,18 +208,6 @@
_GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
#endif #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 /* 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 the operation and OVERFLOW the overflow predicate. Return 1 if the
result overflows. Arguments should not have side effects, 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), 1) \
: (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) : (*(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, /* Return 1 if the integer expression -A would overflow.
respectively. Arguments should not have side effects, Arguments should not have side effects,
and can be any signed integer type other than char, bool, a and can be any signed integer type other than char, bool, a
bit-precise integer type, or an enumeration type. bit-precise integer type, or an enumeration type.
These macros are tuned for their last input argument being a constant. */ These macros are tuned for their last input argument being a constant. */
#if _GL_HAS_BUILTIN_OVERFLOW_P #if _GL_HAS_BUILTIN_OVERFLOW_P
# define _GL_INT_NEGATE_OVERFLOW(a) \ # 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 #else
# define _GL_INT_NEGATE_OVERFLOW(a) \ # define _GL_INT_NEGATE_OVERFLOW(a) \
_GL_INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) _GL_INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))

View file

@ -25,9 +25,21 @@
/* True if the arithmetic type T is an integer type. bool counts as /* True if the arithmetic type T is an integer type. bool counts as
an integer. */ 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) #define TYPE_SIGNED(t) _GL_TYPE_SIGNED (t)
/* Return 1 if the real expression E, after promotion, has a /* 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. */ Padding bits are not supported; this is checked at compile-time below. */
#define TYPE_WIDTH(t) _GL_TYPE_WIDTH (t) #define TYPE_WIDTH(t) _GL_TYPE_WIDTH (t)
/* The maximum and minimum values for the integer type T. */ /* The maximum and minimum values for the standard integer type T. */
#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) #if (__STDC_VERSION__ < 201112 || (defined _MSC_VER && _MSC_VER < 1944) \
#define TYPE_MAXIMUM(t) \ || _GL__GENERIC_BOGUS)
((t) (! TYPE_SIGNED (t) \ # define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
? (t) -1 \ # define TYPE_MAXIMUM(t) \
: ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) ((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 /* Bound on length of the string representing an unsigned integer
value representable in B bits. log10 (2.0) < 146/485. The 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. */ that the result (e.g., A + B) has that type. */
#if _GL_HAS_BUILTIN_OVERFLOW_P #if _GL_HAS_BUILTIN_OVERFLOW_P
# define _GL_ADD_OVERFLOW(a, b, min, max) \ # 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) \ # 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) \ # 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 #else
# define _GL_ADD_OVERFLOW(a, b, min, max) \ # define _GL_ADD_OVERFLOW(a, b, min, max) \
((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \

View file

@ -39,6 +39,10 @@
# pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" # pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc"
#endif #endif
#if _GL_GNUC_PREREQ (14, 0)
# pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
/* Pacify GCC -Wunused-variable for variables used only in 'assert' calls. */ /* Pacify GCC -Wunused-variable for variables used only in 'assert' calls. */
#if (defined NDEBUG \ #if (defined NDEBUG \
&& (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__)) && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__))

View file

@ -25,6 +25,7 @@
#if HAVE_SETMNTENT #if HAVE_SETMNTENT
# include <mntent.h> # include <mntent.h>
#endif #endif
#include <stdcountof.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -61,8 +62,6 @@
#include "minmax.h" #include "minmax.h"
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
#define NPROC_MINIMUM 1 #define NPROC_MINIMUM 1
/* Return the number of processors available to the current process, based /* Return the number of processors available to the current process, based
@ -335,9 +334,9 @@ num_processors_available (enum nproc_query query)
# endif # endif
{ CTL_HW, HW_NCPU } { 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) && len == sizeof (nprocs)
&& 0 < nprocs) && 0 < nprocs)
return nprocs; return nprocs;

View file

@ -19,19 +19,22 @@
/* Specification. */ /* Specification. */
#include <signal.h> #include <signal.h>
#include <errno.h> /* The native Windows implementation is defined in sigprocmask.c. */
#include <stddef.h> #if !(defined _WIN32 && !defined __CYGWIN__)
#if PTHREAD_SIGMASK_INEFFECTIVE # include <errno.h>
# include <string.h> # include <stddef.h>
#endif
# if PTHREAD_SIGMASK_INEFFECTIVE
# include <string.h>
# endif
int int
pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
#undef pthread_sigmask # undef pthread_sigmask
{ {
#if HAVE_PTHREAD_SIGMASK # if HAVE_PTHREAD_SIGMASK && !PTHREAD_SIGMASK_NOT_IN_LIBC
# if PTHREAD_SIGMASK_INEFFECTIVE # if PTHREAD_SIGMASK_INEFFECTIVE
sigset_t omask; sigset_t omask;
sigset_t *old_mask_ptr = &omask; sigset_t *old_mask_ptr = &omask;
sigemptyset (&omask); sigemptyset (&omask);
@ -40,13 +43,13 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
sigaddset (&omask, SIGILL); sigaddset (&omask, SIGILL);
sigset_t omask_copy; sigset_t omask_copy;
memcpy (&omask_copy, &omask, sizeof omask); memcpy (&omask_copy, &omask, sizeof omask);
# else # else
sigset_t *old_mask_ptr = old_mask; sigset_t *old_mask_ptr = old_mask;
# endif # endif
int ret = pthread_sigmask (how, new_mask, old_mask_ptr); int ret = pthread_sigmask (how, new_mask, old_mask_ptr);
# if PTHREAD_SIGMASK_INEFFECTIVE # if PTHREAD_SIGMASK_INEFFECTIVE
if (ret == 0) if (ret == 0)
{ {
/* Detect whether pthread_sigmask is currently ineffective. /* 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) if (old_mask)
memcpy (old_mask, &omask, sizeof omask); memcpy (old_mask, &omask, sizeof omask);
} }
# endif # endif
# if PTHREAD_SIGMASK_FAILS_WITH_ERRNO # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO
if (ret == -1) if (ret == -1)
return errno; return errno;
# endif # endif
return ret; return ret;
#else # else
int ret = sigprocmask (how, new_mask, old_mask); int ret = sigprocmask (how, new_mask, old_mask);
return (ret < 0 ? errno : 0); /* Test for ret != 0, not ret < 0, as a workaround against NetBSD bug
#endif <https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57213>. */
return (ret != 0 ? errno : 0);
# endif
} }
#endif

View file

@ -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 If OPTIONS & READ_UTMP_NO_BOOT_TIME is nonzero, omit the boot time
entries. 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 invokes the functions setutxent, getutxent, endutxent. These
functions are needed because they may lock FILE (so that we don't functions are needed because they may lock FILE (so that we don't
read garbage when a concurrent process writes to FILE), but their read garbage when a concurrent process writes to FILE), but their

View file

@ -21,6 +21,12 @@
# include <locale/weight.h> # include <locale/weight.h>
#endif #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, static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
size_t length, reg_syntax_t syntax); size_t length, reg_syntax_t syntax);
static void re_compile_fastmap_iter (regex_t *bufp, 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) weak_alias (__re_compile_fastmap, re_compile_fastmap)
static __always_inline void static __always_inline void
re_set_fastmap (char *fastmap, bool icase, int ch) re_set_fastmap (char *fastmap, unsigned char ch)
{ {
fastmap[ch] = 1; 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. /* 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; re_dfa_t *dfa = bufp->buffer;
Idx node_cnt; 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) for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
{ {
Idx node = init_state->nodes.elems[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) if (type == CHARACTER)
{ {
re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c); re_set_fastmap (fastmap, dfa->nodes[node].opr.c);
if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) if (bufp->syntax & RE_ICASE)
{ {
unsigned char buf[MB_LEN_MAX]; unsigned char buf[MB_LEN_MAX];
unsigned char *p; 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; *p++ = dfa->nodes[node].opr.c;
memset (&state, '\0', sizeof (state)); memset (&state, '\0', sizeof (state));
if (__mbrtowc (&wc, (const char *) buf, p - buf, if (__mbrtowc (&wc, (const char *) buf, p - buf,
&state) == p - buf &state) == p - buf)
&& (__wcrtomb ((char *) buf, __towlower (wc), &state) re_set_fastmap_icase (fastmap, wc, &state);
!= (size_t) -1))
re_set_fastmap (fastmap, false, buf[0]);
} }
} }
else if (type == SIMPLE_BRACKET) 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]; bitset_word_t w = dfa->nodes[node].opr.sbcset[i];
for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
if (w & ((bitset_word_t) 1 << j)) if (w & ((bitset_word_t) 1 << j))
re_set_fastmap (fastmap, icase, ch); re_set_fastmap (fastmap, ch);
} }
} }
else if (type == COMPLEX_BRACKET) 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); _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
for (i = 0; i < SBC_MAX; ++i) for (i = 0; i < SBC_MAX; ++i)
if (table[i] < 0) if (table[i] < 0)
re_set_fastmap (fastmap, icase, i); re_set_fastmap (fastmap, i);
} }
#endif /* _LIBC */ #endif /* _LIBC */
@ -365,7 +388,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
mbstate_t mbs; mbstate_t mbs;
memset (&mbs, 0, sizeof (mbs)); memset (&mbs, 0, sizeof (mbs));
if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2) 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); 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. */ /* ... Else catch all bytes which can start the mbchars. */
for (i = 0; i < cset->nmbchars; ++i) for (i = 0; i < cset->nmbchars; ++i)
{ {
char buf[256]; char buf[MB_LEN_MAX];
mbstate_t state; mbstate_t state;
memset (&state, '\0', sizeof (state)); memset (&state, '\0', sizeof (state));
if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1) if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
re_set_fastmap (fastmap, icase, *(unsigned char *) buf); re_set_fastmap (fastmap, buf[0]);
if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) if (bufp->syntax & RE_ICASE)
{ re_set_fastmap_icase (fastmap, cset->mbchars[i], &state);
if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state)
!= (size_t) -1)
re_set_fastmap (fastmap, false, *(unsigned char *) buf);
}
} }
} }
} }
@ -499,7 +518,7 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
{ {
const char *msg; const char *msg;
size_t msg_size; 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)) if (__glibc_unlikely (errcode < 0 || errcode >= nerrcodes))
/* Only error codes returned by the rest of the code should be passed /* Only error codes returned by the rest of the code should be passed

View file

@ -20,6 +20,7 @@
#define __STDC_WANT_IEC_60559_BFP_EXT__ #define __STDC_WANT_IEC_60559_BFP_EXT__
#ifndef _LIBC #ifndef _LIBC
# define _GL_USE_STDLIB_ALLOC 1
# include <libc-config.h> # include <libc-config.h>
# if __GNUC_PREREQ (4, 6) # if __GNUC_PREREQ (4, 6)

View file

@ -645,15 +645,15 @@ extern int re_exec (const char *);
array_name[restrict] array_name[restrict]
use glibc's __restrict_arr if available. use glibc's __restrict_arr if available.
Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode). 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_ #ifndef _Restrict_arr_
# ifdef __restrict_arr # ifdef __restrict_arr
# define _Restrict_arr_ __restrict_arr # define _Restrict_arr_ __restrict_arr
# else # else
# if ((199901L <= __STDC_VERSION__ \ # if (((199901L <= __STDC_VERSION__ && !defined _MSC_VER) \
|| 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
|| __clang_major__ >= 3) \ || __clang_major__ >= 3) \
&& !defined __cplusplus) && !defined __cplusplus)
# define _Restrict_arr_ _Restrict_ # define _Restrict_arr_ _Restrict_
# else # else
# define _Restrict_arr_ # define _Restrict_arr_

View file

@ -387,7 +387,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
{ {
size_t mbcdlen; size_t mbcdlen;
mbcdlen = __wcrtomb ((char *) buf, wcu, &prev_st); mbcdlen = __wcrtomb (buf, wcu, &prev_st);
if (__glibc_likely (mbclen == mbcdlen)) if (__glibc_likely (mbclen == mbcdlen))
memcpy (pstr->mbs + byte_idx, buf, mbclen); memcpy (pstr->mbs + byte_idx, buf, mbclen);
else if (mbcdlen != (size_t) -1) 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. /* Insert the new element ELEM to the re_node_set* SET.
SET should not already have ELEM. SET is not expected to already contain ELEM, but tolerate
Return true if successful. */ duplicates as a no-op. Return true if successful. */
static bool static bool
__attribute_warn_unused_result__ __attribute_warn_unused_result__
@ -1285,8 +1285,16 @@ re_node_set_insert (re_node_set *set, Idx elem)
else else
{ {
for (idx = set->nelem; set->elems[idx - 1] > elem; idx--) 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. */ /* Insert the new element. */

View file

@ -27,9 +27,8 @@
#include <langinfo.h> #include <langinfo.h>
#include <locale.h> #include <locale.h>
#include <wchar.h>
#include <wctype.h>
#include <stdckdint.h> #include <stdckdint.h>
#include <stdcountof.h>
#include <stdint.h> #include <stdint.h>
#ifndef _LIBC #ifndef _LIBC
@ -120,22 +119,47 @@
#define NEWLINE_CHAR '\n' #define NEWLINE_CHAR '\n'
#define WIDE_NEWLINE_CHAR L'\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 #ifndef _LIBC
# undef __wctype # undef __wctype
# undef __iswalnum # undef __iswalnum
# undef __iswctype # undef __iswctype
# undef __towlower # undef __towlower
# undef __towupper # undef __towupper
# define __wctype wctype # undef __btowc
# define __iswalnum iswalnum # undef __mbrtowc
# define __iswctype iswctype # undef __wcrtomb
# define __towlower towlower # undef __regfree
# define __towupper towupper
# define __btowc btowc
# define __mbrtowc mbrtowc
# define __wcrtomb wcrtomb
# define __regfree 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 */ #endif /* not _LIBC */
/* Types related to integers. Unless protected by #ifdef _LIBC, the /* Types related to integers. Unless protected by #ifdef _LIBC, the
@ -171,7 +195,11 @@
reindenting a lot of regex code that formerly used 'int'. */ reindenting a lot of regex code that formerly used 'int'. */
typedef regoff_t Idx; typedef regoff_t Idx;
#ifdef _REGEX_LARGE_OFFSETS #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 #else
# define IDX_MAX INT_MAX # define IDX_MAX INT_MAX
#endif #endif
@ -435,7 +463,11 @@ typedef struct re_dfa_t re_dfa_t;
# define MIN(a,b) ((a) < (b) ? (a) : (b)) # define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif #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_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
#define re_free(p) free (p) #define re_free(p) free (p)
@ -772,8 +804,8 @@ __attribute__ ((pure, unused))
re_string_wchar_at (const re_string_t *pstr, Idx idx) re_string_wchar_at (const re_string_t *pstr, Idx idx)
{ {
if (pstr->mb_cur_max == 1) if (pstr->mb_cur_max == 1)
return (wint_t) pstr->mbs[idx]; return pstr->mbs[idx];
return (wint_t) pstr->wcs[idx]; return pstr->wcs[idx];
} }
#ifdef _LIBC #ifdef _LIBC

View file

@ -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. */ /* We must check the longest matching, if nmatch > 0. */
fl_longest_match = (nmatch != 0 || dfa->nbackref); 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, err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1,
preg->translate, (preg->syntax & RE_ICASE) != 0, preg->translate, (preg->syntax & RE_ICASE) != 0,
dfa); 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) if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match)
|| dfa->nbackref) || 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); err = prune_impossible_nodes (&mctx);
if (err == REG_NOERROR) if (err == REG_NOERROR)
break; break;
if (__glibc_unlikely (err != REG_NOMATCH)) if (__glibc_unlikely (err != REG_NOMATCH))
goto free_return; goto free_return;
re_free (save_state_log);
save_state_log = NULL;
match_last = -1; match_last = -1;
} }
else else
@ -825,24 +848,79 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
{ {
Idx reg_idx; Idx reg_idx;
/* Initialize registers. */ /* When set_regs fails for a backref pattern, the structural
for (reg_idx = 1; reg_idx < nmatch; ++reg_idx) match at match_last has no valid register assignment. Try
pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1; shorter match lengths, since a valid shorter match may
exist (e.g., all groups matching empty). */
/* Set the points where matching start/end. */ for (;;)
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)
{ {
/* 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, err = set_regs (preg, &mctx, nmatch, pmatch,
dfa->has_plural_match && dfa->nbackref > 0); 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)) 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 /* At last, add the offset to each register, since we slid
the buffers so that we could assume that the matching starts 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: free_return:
re_free (save_state_log);
re_free (mctx.state_log); re_free (mctx.state_log);
if (dfa->nbackref) if (dfa->nbackref)
match_ctx_free (&mctx); match_ctx_free (&mctx);
@ -934,7 +1013,7 @@ prune_impossible_nodes (re_match_context_t *mctx)
goto free_return; goto free_return;
if (sifted_states[0] != NULL || lim_states[0] != NULL) if (sifted_states[0] != NULL || lim_states[0] != NULL)
break; break;
do for (;;)
{ {
--match_last; --match_last;
if (match_last < 0) if (match_last < 0)
@ -942,11 +1021,17 @@ prune_impossible_nodes (re_match_context_t *mctx)
ret = REG_NOMATCH; ret = REG_NOMATCH;
goto free_return; goto free_return;
} }
} while (mctx->state_log[match_last] == NULL if (mctx->state_log[match_last] != NULL
|| !mctx->state_log[match_last]->halt); && mctx->state_log[match_last]->halt)
halt_node = check_halt_state_context (mctx, {
mctx->state_log[match_last], halt_node
match_last); = 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, ret = merge_state_array (dfa, sifted_states, lim_states,
match_last + 1); 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[cur_idx] = next_state;
mctx->state_log_top = cur_idx; 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; mctx->state_log[cur_idx] = next_state;
} }

View file

@ -102,9 +102,9 @@ extern bool scratch_buffer_set_array_size (struct scratch_buffer *buffer,
/* The implementation is imported from glibc. */ /* The implementation is imported from glibc. */
/* Avoid possible conflicts with symbols exported by the GNU libc. */ /* Avoid possible conflicts with symbols exported by the GNU libc. */
#define __libc_scratch_buffer_grow gl_scratch_buffer_grow #define __libc_scratch_buffer_grow _gl_scratch_buffer_grow
#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve #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_set_array_size _gl_scratch_buffer_set_array_size
#ifndef _GL_LIKELY #ifndef _GL_LIKELY
/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */ /* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */

View file

@ -21,6 +21,8 @@
#include "acl.h" #include "acl.h"
#include <stdcountof.h>
#include "acl-internal.h" #include "acl-internal.h"
#include "minmax.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; int ret;
if (desc != -1) if (desc != -1)
ret = facl (desc, SETACL, ret = facl (desc, SETACL, countof (entries), entries);
sizeof (entries) / sizeof (aclent_t), entries);
else else
ret = acl (name, SETACL, ret = acl (name, SETACL, countof (entries), entries);
sizeof (entries) / sizeof (aclent_t), entries);
if (ret < 0) if (ret < 0)
{ {
if (errno == ENOSYS || errno == EOPNOTSUPP) if (errno == ENOSYS || errno == EOPNOTSUPP)

View file

@ -240,7 +240,7 @@ sha1_process_block (void const *restrict buffer, size_t len,
ctx->total[0] += lolen; ctx->total[0] += lolen;
ctx->total[1] += (len >> 31 >> 1) + (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] \ #define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \

View file

@ -23,6 +23,7 @@
#include <signal.h> #include <signal.h>
#include <limits.h> #include <limits.h>
#include <stdcountof.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -260,8 +261,6 @@ static struct numname { int num; char const name[8]; } numname_table[] =
{ 0, "EXIT" } { 0, "EXIT" }
}; };
#define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0])
/* ISDIGIT differs from isdigit, as follows: /* ISDIGIT differs from isdigit, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char - Its arg may be any int or unsigned int; it need not be an unsigned char
or EOF. or EOF.
@ -286,7 +285,7 @@ str2signum (char const *signame)
} }
else 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)) if (streq (numname_table[i].name, signame))
return numname_table[i].num; return numname_table[i].num;
@ -331,7 +330,7 @@ str2sig (char const *signame, int *signum)
int int
sig2str (int signum, char *signame) 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) if (numname_table[i].num == signum)
{ {
strcpy (signame, numname_table[i].name); strcpy (signame, numname_table[i].name);

View file

@ -20,6 +20,12 @@
#endif #endif
@PRAGMA_COLUMNS@ @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) #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: /* Special invocation convention:
- Inside glibc header files. - Inside glibc header files.
@ -68,12 +74,13 @@
/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, Solaris 2.6, Android, /* 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>. OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>.
But avoid namespace pollution on glibc systems.*/ But avoid namespace pollution on glibc systems. */
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
&& ((defined __APPLE__ && defined __MACH__) \ && ((defined __APPLE__ && defined __MACH__) \
|| (defined __FreeBSD__ && __FreeBSD__ < 8) \ || (defined __FreeBSD__ && __FreeBSD__ < 8) \
|| (defined __OpenBSD__ && OpenBSD < 201205) \ || (defined __OpenBSD__ && OpenBSD < 201205) \
|| defined __sun || defined __ANDROID__ \ || (defined __sun && !defined __cplusplus) \
|| defined __ANDROID__ \
|| defined __KLIBC__) \ || defined __KLIBC__) \
&& ! defined __GLIBC__ && ! defined __GLIBC__
# include <pthread.h> # include <pthread.h>

View file

@ -28,6 +28,7 @@
#include <errno.h> #include <errno.h>
#include <stdckdint.h> #include <stdckdint.h>
#include <stdcountof.h>
#include <stddef.h> #include <stddef.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <time.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), short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim),
STAT_TIMESPEC_OFFSETOF (st_mtim), STAT_TIMESPEC_OFFSETOF (st_mtim),
STAT_TIMESPEC_OFFSETOF (st_ctim) }; 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]); struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]);
long int q = ts->tv_nsec / timespec_hz; long int q = ts->tv_nsec / timespec_hz;

File diff suppressed because it is too large Load diff

View file

@ -19,5 +19,5 @@
#include <stdbit.h> #include <stdbit.h>
#if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64) #if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
signed char __gl_stdbit_popcount_support; signed char _gl_stdbit_popcount_support;
#endif #endif

19
lib/stdc_memreverse8u.c Normal file
View 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
View 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 */

View file

@ -56,7 +56,7 @@ workaround_fwrite0 (char *s, size_t n, FILE *fp)
} }
size_t 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; size_t nbytes;
if (ckd_mul (&nbytes, size, nmemb) || nbytes == 0) if (ckd_mul (&nbytes, size, nmemb) || nbytes == 0)
@ -133,7 +133,7 @@ local_vasprintf (char **resultp, const char *format, va_list args)
__mingw_*printf. */ __mingw_*printf. */
int 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_list args;
va_start (args, format); va_start (args, format);
@ -151,7 +151,7 @@ gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...)
} }
int int
gl_consolesafe_printf (const char *restrict format, ...) _gl_consolesafe_printf (const char *restrict format, ...)
{ {
va_list args; va_list args;
va_start (args, format); va_start (args, format);
@ -169,8 +169,8 @@ gl_consolesafe_printf (const char *restrict format, ...)
} }
int int
gl_consolesafe_vfprintf (FILE *restrict fp, _gl_consolesafe_vfprintf (FILE *restrict fp,
const char *restrict format, va_list args) const char *restrict format, va_list args)
{ {
char *tmpstring; char *tmpstring;
int result = vasprintf (&tmpstring, format, args); int result = vasprintf (&tmpstring, format, args);
@ -185,7 +185,7 @@ gl_consolesafe_vfprintf (FILE *restrict fp,
} }
int int
gl_consolesafe_vprintf (const char *restrict format, va_list args) _gl_consolesafe_vprintf (const char *restrict format, va_list args)
{ {
char *tmpstring; char *tmpstring;
int result = vasprintf (&tmpstring, format, args); int result = vasprintf (&tmpstring, format, args);

View file

@ -122,6 +122,20 @@
# endif # endif
#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 __attribute__ feature is available in gcc versions 2.5 and later.
The __-protected variants of the attributes 'format' and 'printf' are The __-protected variants of the attributes 'format' and 'printf' are
accepted by gcc versions 2.6.4 (effectively 2.7) and later. 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. */ /* 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. */ /* Macros for stringification. */
#define _GL_STDIO_STRINGIZE(token) #token #define _GL_STDIO_STRINGIZE(token) #token
#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
@ -273,24 +331,24 @@
#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT #if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
/* Workarounds against msvcrt bugs. */ /* 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), (const void *ptr, size_t size, size_t nmemb, FILE *fp),
_GL_ARG_NONNULL ((1, 4))); _GL_ARG_NONNULL ((1, 4)));
# if defined __MINGW32__ # if defined __MINGW32__
_GL_FUNCDECL_SYS (gl_consolesafe_fprintf, int, _GL_FUNCDECL_SYS (_gl_consolesafe_fprintf, int,
(FILE *restrict fp, const char *restrict format, ...), (FILE *restrict fp, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((1, 2))); _GL_ARG_NONNULL ((1, 2)));
_GL_FUNCDECL_SYS (gl_consolesafe_printf, int, _GL_FUNCDECL_SYS (_gl_consolesafe_printf, int,
(const char *restrict format, ...), (const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
_GL_ARG_NONNULL ((1))); _GL_ARG_NONNULL ((1)));
_GL_FUNCDECL_SYS (gl_consolesafe_vfprintf, int, _GL_FUNCDECL_SYS (_gl_consolesafe_vfprintf, int,
(FILE *restrict fp, (FILE *restrict fp,
const char *restrict format, va_list args), const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((1, 2))); _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), (const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
_GL_ARG_NONNULL ((1))); _GL_ARG_NONNULL ((1)));
@ -633,7 +691,7 @@ _GL_CXXALIASWARN (fprintf);
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO #elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fprintf # undef fprintf
# define fprintf gl_consolesafe_fprintf # define fprintf _gl_consolesafe_fprintf
# endif # endif
#endif #endif
#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
@ -985,7 +1043,7 @@ _GL_CXXALIASWARN (fwrite);
#elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT #elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fwrite # undef fwrite
# define fwrite gl_consolesafe_fwrite # define fwrite _gl_consolesafe_fwrite
# endif # endif
#endif #endif
@ -1371,7 +1429,7 @@ _GL_CXXALIASWARN (printf);
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO #elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef printf # undef printf
# define printf gl_consolesafe_printf # define printf _gl_consolesafe_printf
# endif # endif
#endif #endif
#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
@ -1808,6 +1866,26 @@ _GL_CXXALIAS_SYS (vasprintf, int,
_GL_CXXALIASWARN (vasprintf); _GL_CXXALIASWARN (vasprintf);
#endif #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@ #if @GNULIB_VDZPRINTF@
/* Prints formatted output to file descriptor FD. /* Prints formatted output to file descriptor FD.
Returns the number of bytes written to the file descriptor. Upon 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 #elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef vfprintf # undef vfprintf
# define vfprintf gl_consolesafe_vfprintf # define vfprintf _gl_consolesafe_vfprintf
# endif # endif
#endif #endif
#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
@ -2001,7 +2079,7 @@ _GL_CXXALIASWARN (vprintf);
#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO #elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef vprintf # undef vprintf
# define vprintf gl_consolesafe_vprintf # define vprintf _gl_consolesafe_vprintf
# endif # endif
#endif #endif
#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK

View file

@ -757,7 +757,7 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
#if @REPLACE_MB_CUR_MAX@ #if @REPLACE_MB_CUR_MAX@
# if !GNULIB_defined_MB_CUR_MAX # if !GNULIB_defined_MB_CUR_MAX
_GL_STDLIB_INLINE size_t _GL_STDLIB_INLINE size_t
gl_MB_CUR_MAX (void) _gl_MB_CUR_MAX (void)
{ {
# if 0 < @REPLACE_MB_CUR_MAX@ # if 0 < @REPLACE_MB_CUR_MAX@
return @REPLACE_MB_CUR_MAX@; return @REPLACE_MB_CUR_MAX@;
@ -768,7 +768,7 @@ gl_MB_CUR_MAX (void)
# endif # endif
} }
# undef MB_CUR_MAX # 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 # define GNULIB_defined_MB_CUR_MAX 1
# endif # endif
#endif #endif
@ -1458,7 +1458,7 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
#if @GNULIB_REALLOC_POSIX@ #if @GNULIB_REALLOC_POSIX@
# if @REPLACE_REALLOC_FOR_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 # define _GL_INLINE_RPL_REALLOC 1
# ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -109,6 +109,7 @@
#include <limits.h> #include <limits.h>
#include <locale.h> #include <locale.h>
#include <stdckdint.h> #include <stdckdint.h>
#include <stdcountof.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -1882,7 +1883,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
#endif #endif
} }
bufp = buf + sizeof (buf) / sizeof (buf[0]); bufp = buf + countof (buf);
if (negative_number) if (negative_number)
u_number_value = - u_number_value; 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_('-') CHAR_T sign_char = (negative_number ? L_('-')
: always_output_a_sign ? L_('+') : always_output_a_sign ? L_('+')
: 0); : 0);
int number_bytes = buf + sizeof buf / sizeof buf[0] - bufp; int number_bytes = buf + countof (buf) - bufp;
int number_digits = number_bytes; int number_digits = number_bytes;
#if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME #if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME
if (digits_base >= 0x100) 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; /* Generate string value for T using time_t arithmetic;
this works even if sizeof (long) < sizeof (time_t). */ this works even if sizeof (long) < sizeof (time_t). */
bufp = buf + sizeof (buf) / sizeof (buf[0]); bufp = buf + countof (buf);
negative_number = t < 0; negative_number = t < 0;
do do

View file

@ -420,16 +420,19 @@ _GL_WARN_ON_USE_CXX (memchr,
/* Are S1 and S2, of size N, bytewise equal? */ /* Are S1 and S2, of size N, bytewise equal? */
#if @GNULIB_MEMEQ@ && !@HAVE_DECL_MEMEQ@ #if @GNULIB_MEMEQ@ && !@HAVE_DECL_MEMEQ@
# ifdef __cplusplus # if !GNULIB_defined_memeq
# ifdef __cplusplus
extern "C" { extern "C" {
# endif # endif
_GL_MEMEQ_INLINE bool _GL_MEMEQ_INLINE bool
memeq (void const *__s1, void const *__s2, size_t __n) memeq (void const *__s1, void const *__s2, size_t __n)
{ {
return !memcmp (__s1, __s2, __n); return !memcmp (__s1, __s2, __n);
} }
# ifdef __cplusplus # ifdef __cplusplus
} }
# endif
# define GNULIB_defined_memeq 1
# endif # endif
#endif #endif
@ -805,16 +808,19 @@ _GL_CXXALIASWARN (strdup);
/* Are strings S1 and S2 equal? */ /* Are strings S1 and S2 equal? */
#if @GNULIB_STREQ@ && !@HAVE_DECL_STREQ@ #if @GNULIB_STREQ@ && !@HAVE_DECL_STREQ@
# ifdef __cplusplus # if !GNULIB_defined_streq
# ifdef __cplusplus
extern "C" { extern "C" {
# endif # endif
_GL_STREQ_INLINE bool _GL_STREQ_INLINE bool
streq (char const *__s1, char const *__s2) streq (char const *__s1, char const *__s2)
{ {
return !strcmp (__s1, __s2); return !strcmp (__s1, __s2);
} }
# ifdef __cplusplus # ifdef __cplusplus
} }
# endif
# define GNULIB_defined_streq 1
# endif # endif
#endif #endif
@ -1041,7 +1047,7 @@ _GL_WARN_ON_USE_CXX (strrchr,
If *STRINGP was already NULL, nothing happens. If *STRINGP was already NULL, nothing happens.
Return the old value of *STRINGP. 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. empty fields.
Caveat: It modifies the original string. 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 x = strtok_r(NULL, "=", &sp); // x = NULL
// s = "abc\0-def\0" // 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: For the POSIX documentation for this function, see:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html 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) string + strlen (string)
or to or to
strchr (string, '\0'). */ strchr (string, '\0'). */
# ifdef __cplusplus # if !GNULIB_defined_strnul
# ifdef __cplusplus
extern "C" { extern "C" {
# endif # endif
_GL_STRNUL_INLINE const char *gl_strnul (const char *string) _GL_STRNUL_INLINE const char *_gl_strnul (const char *string)
_GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)); _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 /* In gcc >= 7 or clang >= 4, we could use the expression
strchr (string, '\0') strchr (string, '\0')
@ -1261,22 +1268,24 @@ _GL_STRNUL_INLINE const char *gl_strnul (const char *string)
option '-fno-builtin' is in use. */ option '-fno-builtin' is in use. */
return string + strlen (string); return string + strlen (string);
} }
# ifdef __cplusplus # ifdef __cplusplus
} }
# endif # endif
# ifdef __cplusplus # ifdef __cplusplus
extern "C++" { /* needed for AIX and Solaris 10 */
_GL_BEGIN_NAMESPACE _GL_BEGIN_NAMESPACE
template <typename T> T strnul (T); template <typename T> T strnul (T);
template <> inline const char *strnul<const char *> (const char *s) 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) template <> inline char *strnul< char *> ( char *s)
{ return const_cast<char *>(gl_strnul (s)); } { return const_cast<char *>(_gl_strnul (s)); }
_GL_END_NAMESPACE _GL_END_NAMESPACE
# else }
# if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __cplusplus) \ # else
|| (defined __clang__ && __clang_major__ >= 3) \ # if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __cplusplus) \
|| (defined __SUNPRO_C && __SUNPRO_C >= 0x5150) \ || (defined __clang__ && __clang_major__ >= 3) \
|| (__STDC_VERSION__ >= 201112L && !defined __GNUC__) || (defined __SUNPRO_C && __SUNPRO_C >= 0x5150) \
|| (__STDC_VERSION__ >= 201112L && !defined __GNUC__)
/* The compiler supports _Generic from ISO C11. */ /* The compiler supports _Generic from ISO C11. */
/* Since in C (but not in C++!), any function that accepts a '[const] char *' /* 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- also accepts a '[const] void *' as argument, we make sure that the function-
@ -1284,14 +1293,16 @@ _GL_END_NAMESPACE
char *, void * -> void * char *, void * -> void *
const char *, const void * -> const void * const char *, const void * -> const void *
This mapping is done through the conditional expression. */ This mapping is done through the conditional expression. */
# define strnul(s) \ # define strnul(s) \
_Generic (1 ? (s) : (void *) 99, \ _Generic (1 ? (s) : (void *) 99, \
void * : (char *) gl_strnul (s), \ void * : (char *) _gl_strnul (s), \
const void * : gl_strnul (s)) const void * : _gl_strnul (s))
# else # else
# define strnul(s) \ # define strnul(s) \
((char *) gl_strnul (s)) ((char *) _gl_strnul (s))
# endif
# endif # endif
# define GNULIB_defined_strnul 1
# endif # endif
#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 /* Don't silently convert a 'const char *' to a 'char *'. Programmers want
compiler warnings for 'const' related mistakes. */ compiler warnings for 'const' related mistakes. */
# ifdef __cplusplus # ifdef __cplusplus
extern "C++" { /* needed for AIX */ extern "C++" { /* needed for AIX and Solaris 10 */
template <typename T> template <typename T>
T * mbsstr_template (T* haystack, const char *needle); T * mbsstr_template (T* haystack, const char *needle);
template <> 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 /* Don't silently convert a 'const char *' to a 'char *'. Programmers want
compiler warnings for 'const' related mistakes. */ compiler warnings for 'const' related mistakes. */
# ifdef __cplusplus # ifdef __cplusplus
extern "C++" { /* needed for AIX */ extern "C++" { /* needed for AIX and Solaris 10 */
template <typename T> template <typename T>
T * mbspcasecmp_template (T* string, const char *prefix); T * mbspcasecmp_template (T* string, const char *prefix);
template <> 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 /* Don't silently convert a 'const char *' to a 'char *'. Programmers want
compiler warnings for 'const' related mistakes. */ compiler warnings for 'const' related mistakes. */
# ifdef __cplusplus # ifdef __cplusplus
extern "C++" { /* needed for AIX */ extern "C++" { /* needed for AIX and Solaris 10 */
template <typename T> template <typename T>
T * mbscasestr_template (T* haystack, const char *needle); T * mbscasestr_template (T* haystack, const char *needle);
template <> template <>
@ -1655,7 +1666,7 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
"use gnulib module strerror to guarantee non-NULL result"); "use gnulib module strerror to guarantee non-NULL result");
#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.
Uses the POSIX declaration, not the glibc declaration. */ Uses the POSIX declaration, not the glibc declaration. */
#if @GNULIB_STRERROR_R@ #if @GNULIB_STRERROR_R@
# if @REPLACE_STRERROR_R@ # if @REPLACE_STRERROR_R@
@ -1711,7 +1722,7 @@ _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
# endif # endif
#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. with locale_t argument.
Not portable! Only provided by gnulib. */ Not portable! Only provided by gnulib. */
#if @GNULIB_STRERROR_L@ #if @GNULIB_STRERROR_L@

View file

@ -1,4 +1,4 @@
/* gl_strnul function. /* _gl_strnul function.
Copyright (C) 2025-2026 Free Software Foundation, Inc. Copyright (C) 2025-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify

View file

@ -111,9 +111,11 @@ random_bits (random_value *r, random_value s)
__clock_gettime64 (CLOCK_REALTIME, &tv); __clock_gettime64 (CLOCK_REALTIME, &tv);
v = mix_random_values (v, tv.tv_sec); v = mix_random_values (v, tv.tv_sec);
v = mix_random_values (v, tv.tv_nsec); v = mix_random_values (v, tv.tv_nsec);
#else
v = mix_random_values (v, clock ());
#endif #endif
*r = mix_random_values (v, clock ()); *r = v;
return false; return false;
} }

View file

@ -22,7 +22,7 @@
#include <time.h> #include <time.h>
/* The replacement functions in this file are only used on native Windows. /* 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 on native Windows both in the ucrt and in the older MSVCRT return a
pointer to a 'struct tm' in thread-local memory. */ pointer to a 'struct tm' in thread-local memory. */

View file

@ -18,7 +18,7 @@
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */
/* Although this module is not thread-safe, any races should be fairly /* 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 library with a working timezone_t type, so that this module is not
needed. */ needed. */
@ -118,7 +118,8 @@ save_abbr (timezone_t tz, struct tm *tm)
{ {
# if HAVE_STRUCT_TM_TM_ZONE # if HAVE_STRUCT_TM_TM_ZONE
char const *zone = 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. */ /* No need to replace null zones, or zones within the struct tm. */
if (!zone || ((char *) tm <= zone && zone < (char *) (tm + 1))) if (!zone || ((char *) tm <= zone && zone < (char *) (tm + 1)))

View file

@ -46,10 +46,10 @@ extern "C" {
/* Native implementations are trivial. See below for comments on what /* Native implementations are trivial. See below for comments on what
these operations do. */ these operations do. */
typedef uint64_t u64; typedef uint64_t u64;
# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo))) # define u64hilo(hi, lo) ((u64) {((u64) {(hi)} << 32) + (lo)})
# define u64init(hi, lo) u64hilo (hi, lo) # define u64init(hi, lo) (((u64) (hi) << 32) + (lo))
# define u64lo(x) ((u64) (x)) # define u64lo(x) ((u64) {(x)})
# define u64getlo(x) ((uint32_t) ((x) & UINT32_MAX)) # define u64getlo(x) ((uint32_t) {(x) & UINT32_MAX})
# define u64size(x) u64lo (x) # define u64size(x) u64lo (x)
# define u64not(x) (~(x)) # define u64not(x) (~(x))
# define u64lt(x, y) ((x) < (y)) # define u64lt(x, y) ((x) < (y))

View file

@ -361,13 +361,18 @@ soon as a function returns non-nil.")
(defun auth-source-backend-parse (entry) (defun auth-source-backend-parse (entry)
"Create an `auth-source-backend' from an ENTRY in `auth-sources'." "Create an `auth-source-backend' from an ENTRY in `auth-sources'."
(let ((backend (let* ((backend
(run-hook-with-args-until-success 'auth-source-backend-parser-functions (run-hook-wrapped
entry))) 'auth-source-backend-parser-functions
(lambda (fun entry)
(when-let* ((result (funcall fun entry))
(_ (not (eq (slot-value result 'type) 'ignore))))
result))
entry)))
(unless backend (unless backend
;; none of the parsers worked ;; none of the parsers worked
(auth-source-do-warn (auth-source-do-debug
"auth-source-backend-parse: invalid backend spec: %S" entry) "auth-source-backend-parse: invalid backend spec: %S" entry)
(setq backend (make-instance 'auth-source-backend (setq backend (make-instance 'auth-source-backend
:source "" :source ""
@ -378,12 +383,12 @@ soon as a function returns non-nil.")
"List of usable backends from `auth-sources'. "List of usable backends from `auth-sources'.
Filter out backends with type `ignore'. Filter out backends with type `ignore'.
A fallback backend is added to ensure, that at least `read-passwd' is called." A fallback backend is added to ensure, that at least `read-passwd' is called."
`(or (seq-keep `(or (seq-uniq (seq-keep
(lambda (entry) (lambda (entry)
(and-let* ((backend (auth-source-backend-parse entry)) (and-let* ((backend (auth-source-backend-parse entry))
((not (eq (slot-value backend 'type) 'ignore))) ((not (eq (slot-value backend 'type) 'ignore)))
backend))) backend)))
auth-sources) auth-sources))
;; Fallback. ;; Fallback.
(list (auth-source-backend (list (auth-source-backend
:source "" :source ""

View file

@ -103,7 +103,8 @@
;; 3 Bottom of current formula (marker). ;; 3 Bottom of current formula (marker).
;; 4 Top of current formula's delimiters (marker). ;; 4 Top of current formula's delimiters (marker).
;; 5 Bottom of current formula's delimiters (marker). ;; 5 Bottom of current formula's delimiters (marker).
;; 6 String representation of current formula. ;; 6 String representation of current formula (actually, the
;; buffer-substring between positions given by 2 and 3 above.
;; 7 Non-nil if formula is embedded within a single line. ;; 7 Non-nil if formula is embedded within a single line.
;; 8 Internal representation of current formula. ;; 8 Internal representation of current formula.
;; 9 Variable assigned by this formula, or nil. ;; 9 Variable assigned by this formula, or nil.
@ -1140,7 +1141,8 @@ The command \\[yank] can retrieve it from there."
(insert str) (insert str)
(set-marker (aref info 3) (+ (point) adjbot)) (set-marker (aref info 3) (+ (point) adjbot))
(set-marker (aref info 5) (+ (point) delta)) (set-marker (aref info 5) (+ (point) delta))
(aset info 6 str)))))) (aset info 6 (buffer-substring (aref info 2)
(aref info 3))))))))
(if (eq (car-safe val) 'calcFunc-evalto) (if (eq (car-safe val) 'calcFunc-evalto)
(progn (progn
(setq evalled (nth 2 val) (setq evalled (nth 2 val)

Some files were not shown because too many files have changed in this diff Show more