Skip to content

Commit c9c6abf

Browse files
committed
Update from Gnulib by running admin/merge-gnulib
The following changes were made by hand, so that admin/merge-gnulib could succeed instead of failing because the diff didn’t match. * admin/gnulib-patches/lib/getloadavg.c.diff: Remove, as it is no longer needed now that recent Gnulib has been merged. * admin/merge-gnulib (GNULIB_TOOL_FLAGS): Remove the --local-dir="$src"admin/gnulib-patches option, as it is no longer needed either.
1 parent 322ed63 commit c9c6abf

14 files changed

+141
-52
lines changed

admin/gnulib-patches/lib/getloadavg.c.diff

-14
This file was deleted.

admin/merge-gnulib

-4
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ case $src in
8080
*) src=$src/ ;;
8181
esac
8282

83-
GNULIB_TOOL_FLAGS="$GNULIB_TOOL_FLAGS
84-
--local-dir="$src"admin/gnulib-patches
85-
"
86-
8783
# Gnulib's source directory.
8884
gnulib_srcdir=${1-$src../gnulib}
8985

lib/attribute.h

+10-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF,
8686
_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
8787
_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
88-
_GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED,
89-
_GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_REPRODUCIBLE,
90-
_GL_ATTRIBUTE_RETURNS_NONNULL, _GL_ATTRIBUTE_SENTINEL,
91-
_GL_ATTRIBUTE_UNSEQUENCED. */
88+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO, _GL_ATTRIBUTE_NONSTRING,
89+
_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE,
90+
_GL_ATTRIBUTE_REPRODUCIBLE, _GL_ATTRIBUTE_RETURNS_NONNULL,
91+
_GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNSEQUENCED. */
9292
#if !_GL_CONFIG_H_INCLUDED
9393
#error "Please include config.h first."
9494
#endif
@@ -170,6 +170,12 @@
170170
/* Applies to: functions. */
171171
#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args)
172172

173+
/* ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) - Argument NP (a pointer)
174+
must not be NULL if the argument NI (an integer) is != 0. */
175+
/* Applies to: functions. */
176+
#define ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (np, ni)
177+
178+
173179
/* The function's return value is a non-NULL pointer. */
174180
/* Applies to: functions. */
175181
#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL

lib/cdefs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@
482482
run in pedantic mode if the uses are carefully marked using the
483483
`__extension__' keyword. But this is not generally available before
484484
version 2.8. */
485-
#if !(__GNUC_PREREQ (2,8) || defined __clang__)
485+
#if ! (__GNUC_PREREQ (2,8) || defined __clang__ || 0x5150 <= __SUNPRO_C)
486486
# define __extension__ /* Ignore */
487487
#endif
488488

lib/diffseq.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
#include "minmax.h"
7878
*/
7979

80+
/* This file uses _GL_GNUC_PREREQ. */
81+
#if !_GL_CONFIG_H_INCLUDED
82+
#error "Please include config.h first."
83+
#endif
84+
8085
/* Maximum value of type OFFSET. */
8186
#ifndef OFFSET_MAX
8287
# define OFFSET_MAX \
@@ -93,7 +98,7 @@
9398
#endif
9499

95100
/* Suppress gcc's "...may be used before initialized" warnings,
96-
generated by GCC versions up to at least GCC 14.2.
101+
generated by GCC versions up to at least GCC 15.1.
97102
Likewise for gcc -fanalyzer's "use of uninitialized value" warnings. */
98103
#if _GL_GNUC_PREREQ (4, 7)
99104
# pragma GCC diagnostic push

lib/getloadavg.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
# define SUNOS_5
141141
# endif
142142

143-
# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
143+
# if defined (__osf__) && defined (__alpha)
144144
# define OSF_ALPHA
145145
# include <sys/mbuf.h>
146146
# include <sys/socket.h>
@@ -499,9 +499,9 @@ getloadavg (double loadavg[], int nelem)
499499
}
500500
# endif
501501

502-
# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__) \
503-
&& (!defined __ANDROID__ || __ANDROID_API__ >= 13)
504-
/* Linux without glibc, Android, Cygwin */
502+
# if (!defined LDAV_DONE \
503+
&& (defined __ANDROID__ ? 13 <= __ANDROID_API__ : defined __linux__))
504+
/* non-Android Linux without glibc, Android 3.2+, Cygwin */
505505
# define LDAV_DONE
506506
# undef LOAD_AVE_TYPE
507507

@@ -514,7 +514,7 @@ getloadavg (double loadavg[], int nelem)
514514
loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT);
515515
elem = 3;
516516
}
517-
# endif /* __linux__ || __ANDROID__ */
517+
# endif /* __ANDROID__ ? 13 <= __ANDROID_API__ : __linux__ */
518518

519519
# if !defined (LDAV_DONE) && defined __CYGWIN__
520520
/* Cygwin */

lib/gnulib.mk.in

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
# Generated by gnulib-tool.
2323
# Reproduce by:
2424
# gnulib-tool --import \
25-
# --local-dir=./admin/gnulib-patches \
2625
# --lib=libgnu \
2726
# --source-base=lib \
2827
# --m4-base=m4 \

lib/stddef.in.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
|| defined __need_ptrdiff_t || defined __need_NULL \
3232
|| defined __need_wint_t) \
3333
/* Avoid warning triggered by "gcc -std=gnu23 -Wsystem-headers" \
34-
in Fedora 40 with gcc 14.0.1. \
34+
in GCC 13.3 and 14.2 \
3535
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870>. */ \
3636
&& !@STDDEF_NOT_IDEMPOTENT@
3737
/* Special invocation convention inside gcc header files. In

lib/stdlib.in.h

+28-2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ _GL_INLINE_HEADER_BEGIN
168168
# endif
169169
#endif
170170

171+
/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
172+
(a pointer) must not be NULL if the argument NI (an integer) is != 0. */
173+
/* Applies to: functions. */
174+
#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
175+
# if __GNUC__ >= 15 && !defined __clang__
176+
# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
177+
__attribute__ ((__nonnull_if_nonzero__ (np, ni)))
178+
# else
179+
# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
180+
# endif
181+
#endif
182+
171183
/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
172184
*/
173185
#ifndef _GL_ATTRIBUTE_NOTHROW
@@ -223,6 +235,18 @@ _GL_INLINE_HEADER_BEGIN
223235
#endif
224236

225237

238+
/* Declarations for ISO C N3322. */
239+
#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
240+
_GL_EXTERN_C void *bsearch (const void *__key,
241+
const void *__base, size_t __nmemb, size_t __size,
242+
int (*__compare) (const void *, const void *))
243+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5));
244+
_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size,
245+
int (*__compare) (const void *, const void *))
246+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4));
247+
#endif
248+
249+
226250
#if @GNULIB__EXIT@
227251
/* Terminate the current process with the given return code, without running
228252
the 'atexit' handlers. */
@@ -1182,7 +1206,8 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
11821206
_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
11831207
_gl_qsort_r_compar_fn compare,
11841208
void *arg),
1185-
_GL_ARG_NONNULL ((1, 4)));
1209+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1210+
_GL_ARG_NONNULL ((4)));
11861211
_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
11871212
_gl_qsort_r_compar_fn compare,
11881213
void *arg));
@@ -1191,7 +1216,8 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
11911216
_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
11921217
_gl_qsort_r_compar_fn compare,
11931218
void *arg),
1194-
_GL_ARG_NONNULL ((1, 4)));
1219+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1220+
_GL_ARG_NONNULL ((4)));
11951221
# endif
11961222
_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
11971223
_gl_qsort_r_compar_fn compare,

lib/string.in.h

+65-10
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@
116116
# endif
117117
#endif
118118

119+
/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
120+
(a pointer) must not be NULL if the argument NI (an integer) is != 0. */
121+
/* Applies to: functions. */
122+
#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
123+
# if __GNUC__ >= 15 && !defined __clang__
124+
# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
125+
__attribute__ ((__nonnull_if_nonzero__ (np, ni)))
126+
# else
127+
# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
128+
# endif
129+
#endif
130+
119131
/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
120132
*/
121133
#ifndef _GL_ATTRIBUTE_NOTHROW
@@ -154,6 +166,7 @@
154166

155167
/* The definition of _GL_WARN_ON_USE is copied here. */
156168

169+
157170
/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
158171
been included yet. */
159172
#if @GNULIB_FREE_POSIX@
@@ -198,6 +211,44 @@ _GL_EXTERN_C void free (void *);
198211
# endif
199212
#endif
200213

214+
215+
/* Declarations for ISO C N3322. */
216+
#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
217+
_GL_EXTERN_C void *memcpy (void *__dest, const void *__src, size_t __n)
218+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
219+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
220+
_GL_EXTERN_C void *memccpy (void *__dest, const void *__src, int __c, size_t __n)
221+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 4)
222+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 4);
223+
_GL_EXTERN_C void *memmove (void *__dest, const void *__src, size_t __n)
224+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
225+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
226+
_GL_EXTERN_C char *strncpy (char *__dest, const char *__src, size_t __n)
227+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
228+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
229+
_GL_EXTERN_C char *strndup (const char *__s, size_t __n)
230+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2);
231+
_GL_EXTERN_C char *strncat (char *__dest, const char *__src, size_t __n)
232+
_GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
233+
_GL_EXTERN_C int memcmp (const void *__s1, const void *__s2, size_t __n)
234+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
235+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
236+
_GL_EXTERN_C int strncmp (const char *__s1, const char *__s2, size_t __n)
237+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
238+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
239+
# ifndef __cplusplus
240+
_GL_EXTERN_C void *memchr (const void *__s, int __c, size_t __n)
241+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
242+
_GL_EXTERN_C void *memrchr (const void *__s, int __c, size_t __n)
243+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
244+
# endif
245+
_GL_EXTERN_C void *memset (void *__s, int __c, size_t __n)
246+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
247+
_GL_EXTERN_C void *memset_explicit (void *__s, int __c, size_t __n)
248+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
249+
#endif
250+
251+
201252
/* Clear a block of memory. The compiler will not delete a call to
202253
this function, even if the block is dead after the call. */
203254
#if @GNULIB_EXPLICIT_BZERO@
@@ -215,6 +266,7 @@ _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
215266
# endif
216267
#endif
217268

269+
218270
/* Find the index of the least-significant set bit. */
219271
#if @GNULIB_FFSL@
220272
# if !@HAVE_FFSL@
@@ -281,7 +333,7 @@ _GL_CXXALIASWARN (memccpy);
281333
# endif
282334
_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n),
283335
_GL_ATTRIBUTE_PURE
284-
_GL_ARG_NONNULL ((1)));
336+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
285337
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
286338
# else
287339
/* On some systems, this function is defined as an overloaded function:
@@ -388,7 +440,7 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
388440
# if ! @HAVE_DECL_MEMRCHR@
389441
_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t),
390442
_GL_ATTRIBUTE_PURE
391-
_GL_ARG_NONNULL ((1)));
443+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
392444
# endif
393445
/* On some systems, this function is defined as an overloaded function:
394446
extern "C++" { const void * std::memrchr (const void *, int, size_t); }
@@ -425,12 +477,14 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
425477
# define memset_explicit rpl_memset_explicit
426478
# endif
427479
_GL_FUNCDECL_RPL (memset_explicit, void *,
428-
(void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
480+
(void *__dest, int __c, size_t __n),
481+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
429482
_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
430483
# else
431484
# if !@HAVE_MEMSET_EXPLICIT@
432485
_GL_FUNCDECL_SYS (memset_explicit, void *,
433-
(void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
486+
(void *__dest, int __c, size_t __n),
487+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
434488
# endif
435489
_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
436490
# endif
@@ -697,7 +751,8 @@ _GL_CXXALIASWARN (strdup);
697751
# endif
698752
_GL_FUNCDECL_RPL (strncat, char *,
699753
(char *restrict dest, const char *restrict src, size_t n),
700-
_GL_ARG_NONNULL ((1, 2)));
754+
_GL_ARG_NONNULL ((1))
755+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
701756
_GL_CXXALIAS_RPL (strncat, char *,
702757
(char *restrict dest, const char *restrict src, size_t n));
703758
# else
@@ -724,7 +779,7 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
724779
# endif
725780
_GL_FUNCDECL_RPL (strndup, char *,
726781
(char const *__s, size_t __n),
727-
_GL_ARG_NONNULL ((1))
782+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
728783
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
729784
_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
730785
# else
@@ -733,13 +788,13 @@ _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
733788
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
734789
_GL_FUNCDECL_SYS (strndup, char *,
735790
(char const *__s, size_t __n),
736-
_GL_ARG_NONNULL ((1))
791+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
737792
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
738793
_GL_ATTRIBUTE_NOTHROW;
739794
# else
740795
_GL_FUNCDECL_SYS (strndup, char *,
741796
(char const *__s, size_t __n),
742-
_GL_ARG_NONNULL ((1))
797+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
743798
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
744799
# endif
745800
# endif
@@ -752,13 +807,13 @@ _GL_CXXALIASWARN (strndup);
752807
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
753808
_GL_FUNCDECL_SYS (strndup, char *,
754809
(char const *__s, size_t __n),
755-
_GL_ARG_NONNULL ((1))
810+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
756811
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
757812
_GL_ATTRIBUTE_NOTHROW;
758813
# else
759814
_GL_FUNCDECL_SYS (strndup, char *,
760815
(char const *__s, size_t __n),
761-
_GL_ARG_NONNULL ((1))
816+
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
762817
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
763818
# endif
764819
# endif

lib/utimensat.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
118118
ts[1] = times[1];
119119
times = ts;
120120
}
121-
# if defined __hppa__ || defined __NetBSD__
121+
# if defined __hppa || defined __NetBSD__
122122
/* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec
123123
values.
124124

0 commit comments

Comments
 (0)