Skip to content

Commit

Permalink
Update Gnulib and lib/patch-Makefile.am.diff.
Browse files Browse the repository at this point in the history
Remove m4/.gitignore.

Override lib/.gitignore and don't ignore:
- lib/malloc.c
- lib/pthread.in.h
- lib/sched.in.h
- lib/stdlib.c
- lib/time.in.h

Override lib/glthread/.gitignore and don't ignore:
- lib/glthread/once.c
- lib/glthread/once.h

TODO: Integrate Gnulib top/bootstrap.
  • Loading branch information
slewsys committed Jan 20, 2025
1 parent 15411e8 commit 7bd6ead
Show file tree
Hide file tree
Showing 225 changed files with 21,008 additions and 5,853 deletions.
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ update-gnulib:
if test -f lib/regex.h; then \
rm -f lib/regex.h; \
fi; \
if test -f lib/dynarray.h; then \
rm -f lib/dynarray.h; \
fi; \
if test -f lib/malloc/dynarray.h; then \
rm -f lib/malloc/dynarray.h; \
fi; \
"$(gnulib_srcdir)/gnulib-tool" --import \
--dir=$($top_srcdir) \
--lib=libgnu \
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ else
[Options with which "${top_srcdir}/configure" was invoked.])
fi

AS_MKDIR_P([doc])
AS_MKDIR_P([lib])
AS_MKDIR_P([po])
AS_MKDIR_P([src])
AS_MKDIR_P([testsuite])

# Generate autotest helpers.
AC_CONFIG_TESTDIR([testsuite])
AC_CONFIG_FILES([testsuite/ed], [chmod 755 testsuite/ed])
Expand Down
8 changes: 7 additions & 1 deletion lib/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/Makefile.am
/_Noreturn.h
/arg-nonnull.h
#/assert.in.h
Expand Down Expand Up @@ -77,9 +76,16 @@
/iswdigit.c
/iswpunct.c
/iswxdigit.c
#/malloc.c
/mbszero.c
/setlocale_null-unlocked.c
/stddef.h
/stdckdint.in.h
/wctype-impl.h
/wctype.c
/pthread-once.c
#/pthread.in.h
#/sched.in.h
#/stdlib.c
#/time.in.h
/Makefile.am
366 changes: 332 additions & 34 deletions lib/Makefile.am

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/_Noreturn.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* A C macro for declaring that a function does not return.
Copyright (C) 2011-2024 Free Software Foundation, Inc.
Copyright (C) 2011-2025 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
Expand Down Expand Up @@ -34,7 +34,7 @@
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| (!defined __STRICT_ANSI__ \
&& (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
&& (4 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __clang__ \
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))))
Expand Down
2 changes: 1 addition & 1 deletion lib/arg-nonnull.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* A C macro for declaring that specific arguments must not be NULL.
Copyright (C) 2009-2024 Free Software Foundation, Inc.
Copyright (C) 2009-2025 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
Expand Down
2 changes: 1 addition & 1 deletion lib/assert.in.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <assert.h>
Copyright (C) 2011-2024 Free Software Foundation, Inc.
Copyright (C) 2011-2025 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
Expand Down
123 changes: 102 additions & 21 deletions lib/attribute.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
Copyright 2020-2024 Free Software Foundation, Inc.
Copyright 2020-2025 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
Expand All @@ -20,12 +20,49 @@
/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_*
macros used within Gnulib. */

/* These attributes can be placed in two ways:
- At the start of a declaration (i.e. even before storage-class
specifiers!); then they apply to all entities that are declared
by the declaration.
- Immediately after the name of an entity being declared by the
declaration; then they apply to that entity only. */
/* The placement of these attributes depends on the kind of declaration
and, in some cases, also on the programming language (C vs. C++).
In function declarations and function definitions:
* ATTRIBUTE_NOTHROW must come after the parameter list.
* The macros
ATTRIBUTE_CONST
ATTRIBUTE_PURE
DEPRECATED
MAYBE_UNUSED
NODISCARD
REPRODUCIBLE
UNSEQUENCED
must come before the return type, and more precisely:
- In a function declaration/definition without a storage-class
specifier: at the beginning of the declaration/definition.
- In a function declaration/definition with a storage-class
specifier:
- In C: before the storage-class specifier.
- In C++: between the storage-class specifier and the return type.
* The other macros can be placed
- Either
- In a function declaration/definition without a storage-class
specifier: at the beginning of the declaration/definition.
- In a function declaration/definition with a storage-class
specifier: between the storage-class specifier and the return
type.
- Or after the parameter list,
∙ but after ATTRIBUTE_NOTHROW if present.
In other declarations, such as variable declarations:
* Either
- In C: before the storage-class specifier.
- In C++: between the storage-class specifier and the return type.
Then they apply to all entities that are declared by the declaration.
* Or immediately after the name of an entity being declared by the
declaration. Then they apply to that entity only.
*/

#ifndef _GL_ATTRIBUTE_H
#define _GL_ATTRIBUTE_H
Expand All @@ -49,8 +86,9 @@
_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
_GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED,
_GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL,
_GL_ATTRIBUTE_SENTINEL. */
_GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_REPRODUCIBLE,
_GL_ATTRIBUTE_RETURNS_NONNULL, _GL_ATTRIBUTE_SENTINEL,
_GL_ATTRIBUTE_UNSEQUENCED. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
Expand Down Expand Up @@ -88,7 +126,7 @@
is the size of the returned memory block.
ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments
to determine the size of the returned memory block. */
/* Applies to: function, pointer to function, function types. */
/* Applies to: functions, pointer to functions, function types. */
#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)

/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
Expand Down Expand Up @@ -170,7 +208,7 @@
/* Attributes regarding debugging information emitted by the compiler. */

/* Omit the function from stack traces when debugging. */
/* Applies to: function. */
/* Applies to: functions. */
#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL

/* Make the entity visible to debuggers etc., even with '-fwhole-program'. */
Expand All @@ -192,25 +230,68 @@

/* Always inline the function, and report an error if the compiler
cannot inline. */
/* Applies to: function. */
/* Applies to: functions. */
#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE

/* It is OK for a compiler to omit duplicate calls with the same arguments.
/* It is OK for a compiler to move calls to the function and to omit
calls to the function if another call has the same arguments or the
result is not used.
This attribute is safe for a function that neither depends on
nor affects observable state, and always returns exactly once -
e.g., does not loop forever, and does not call longjmp.
(This attribute is stricter than ATTRIBUTE_PURE.) */
nor affects state, and always returns exactly once -
e.g., does not raise an exception, call longjmp, or loop forever.
(This attribute is stricter than ATTRIBUTE_PURE because the
function cannot observe state. It is stricter than UNSEQUENCED
because the function must return exactly once and cannot depend on
state addressed by its arguments.) */
/* Applies to: functions. */
#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST

/* It is OK for a compiler to omit duplicate calls with the same
arguments if observable state is not changed between calls.
This attribute is safe for a function that does not affect
observable state, and always returns exactly once.
(This attribute is looser than ATTRIBUTE_CONST.) */
/* It is OK for a compiler to move calls to the function and to omit duplicate
calls to the function with the same arguments, so long as the state
addressed by its arguments is the same.
This attribute is safe for a function that is effectless, idempotent,
stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
these terms.
(This attribute is stricter than REPRODUCIBLE because the function
must be stateless and independent. It is looser than ATTRIBUTE_CONST
because the function need not return exactly once and can depend
on state addressed by its arguments.)
See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
<https://stackoverflow.com/questions/76847905/>.
ATTENTION! Efforts are underway to change the meaning of this attribute.
See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
/* Applies to: functions, pointer to functions, function type. */
#define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED

/* It is OK for a compiler to move calls to the function and to omit
calls to the function if another call has the same arguments or the
result is not used, and if observable state is the same.
This attribute is safe for a function that does not affect observable state
and always returns exactly once.
(This attribute is looser than ATTRIBUTE_CONST because the function
can depend on observable state. It is stricter than REPRODUCIBLE
because the function must return exactly once and cannot affect
state addressed by its arguments.) */
/* Applies to: functions. */
#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE

/* It is OK for a compiler to move calls to the function and to omit duplicate
calls to the function with the same arguments, so long as the state
addressed by its arguments is the same and is updated in time for
the rest of the program.
This attribute is safe for a function that is effectless and idempotent; see
ISO C 23 § 6.7.12.7 for a definition of these terms.
(This attribute is looser than UNSEQUENCED because the function need
not be stateless and idempotent. It is looser than ATTRIBUTE_PURE
because the function need not return exactly once and can affect
state addressed by its arguments.)
See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
<https://stackoverflow.com/questions/76847905/>.
ATTENTION! Efforts are underway to change the meaning of this attribute.
See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
/* Applies to: functions, pointer to functions, function type. */
#define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE

/* The function is rarely executed. */
/* Applies to: functions. */
#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
Expand Down
2 changes: 1 addition & 1 deletion lib/btowc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Convert unibyte character to wide character.
Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc.
Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This file is free software: you can redistribute it and/or modify
Expand Down
50 changes: 35 additions & 15 deletions lib/c++defs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* C++ compatible function declaration macros.
Copyright (C) 2010-2024 Free Software Foundation, Inc.
Copyright (C) 2010-2025 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
Expand Down Expand Up @@ -93,11 +93,27 @@
# define _GL_EXTERN_C extern
#endif

/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
/* _GL_EXTERN_C_FUNC declaration;
performs the declaration of a function with C linkage. */
#if defined __cplusplus
# define _GL_EXTERN_C_FUNC extern "C"
#else
/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
are not allowed between 'extern' and the return type (see gnulib-common.m4).
*/
# define _GL_EXTERN_C_FUNC
#endif

/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]);
declares a replacement function, named rpl_func, with the given prototype,
consisting of return type, parameters, and attributes.
Example:
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
Although attributes are optional, the comma before them is required
for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
at the end of the declaration.
Examples:
_GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
_GL_ARG_NONNULL ((1)));
Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
Expand All @@ -106,20 +122,24 @@
[[...]] extern "C" <declaration>;
is invalid syntax in C++.)
*/
#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
_GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
_GL_EXTERN_C rettype rpl_func parameters_and_attributes
#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
_GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
_GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters

/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
declares the system function, named func, with the given prototype,
consisting of return type, parameters, and attributes.
Example:
_GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
_GL_ARG_NONNULL ((1)));
Although attributes are optional, the comma before them is required
for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
at the end of the declaration.
Examples:
_GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
*/
#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
_GL_EXTERN_C rettype func parameters_and_attributes
#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
_GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters

/* _GL_CXXALIAS_RPL (func, rettype, parameters);
declares a C++ alias called GNULIB_NAMESPACE::func
Expand Down Expand Up @@ -297,7 +317,7 @@
_GL_WARN_ON_USE (func, \
"The symbol ::" #func " refers to the system function. " \
"Use " #namespace "::" #func " instead.")
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
# define _GL_CXXALIASWARN_2(func,namespace) \
extern __typeof__ (func) func
# else
Expand Down
4 changes: 2 additions & 2 deletions lib/cdefs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
/* Copyright (C) 1992-2025 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -83,7 +83,7 @@
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
# else
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# if __cplusplus >= 201103L
# define __THROW noexcept (true)
# else
Expand Down
2 changes: 1 addition & 1 deletion lib/dynarray.h.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Type-safe arrays which grow dynamically.
Copyright 2021-2024 Free Software Foundation, Inc.
Copyright 2021-2025 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
Expand Down
12 changes: 8 additions & 4 deletions lib/getopt-cdefs.in.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* getopt-on-non-glibc compatibility macros.
Copyright (C) 1989-2024 Free Software Foundation, Inc.
Copyright (C) 1989-2025 Free Software Foundation, Inc.
This file is part of gnulib.
Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library.
Expand Down Expand Up @@ -46,10 +46,14 @@
# endif
#endif

#if defined __clang__
/* clang really only groks GNU C 4.2, regardless of its value of __GNUC__. */
# undef __GNUC_PREREQ
# define __GNUC_PREREQ(maj, min) ((maj) < 4 + ((min) <= 2))
#endif
#ifndef __GNUC_PREREQ
# if defined __GNUC__ && defined __GNUC_VERSION__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
# else
# define __GNUC_PREREQ(maj, min) 0
# endif
Expand Down
2 changes: 1 addition & 1 deletion lib/getopt-core.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Declarations for getopt (basic, portable features only).
Copyright (C) 1989-2024 Free Software Foundation, Inc.
Copyright (C) 1989-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
Expand Down
Loading

0 comments on commit 7bd6ead

Please sign in to comment.