summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-05-05 15:36:33 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2022-05-05 15:37:40 -0700
commit9007e10a0fc94190404c6a988f7d52d162901940 (patch)
treebec4b170622a185f9feacde07e864f32c7ca71b2 /lib
parent7e9d364b663613fd907f92de31e996463ef7d03c (diff)
downloademacs-9007e10a0fc94190404c6a988f7d52d162901940.tar.gz
Gnulib update via admin/merge-gnulib
Diffstat (limited to 'lib')
-rw-r--r--lib/cdefs.h12
-rw-r--r--lib/libc-config.h11
-rw-r--r--lib/md5.h3
-rw-r--r--lib/regcomp.c16
-rw-r--r--lib/sha1.h3
-rw-r--r--lib/sha256.h3
-rw-r--r--lib/sha512.h3
-rw-r--r--lib/stdlib.in.h4
-rw-r--r--lib/string.in.h4
9 files changed, 48 insertions, 11 deletions
diff --git a/lib/cdefs.h b/lib/cdefs.h
index cb2514504f1..7b8ed5b344b 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -164,13 +164,13 @@
|| (__builtin_constant_p (__l) && (__l) > 0))
/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ
- condition can be folded to a constant and if it is true. The -1 check is
- redundant because since it implies that __glibc_safe_len_cond is true. */
+ condition can be folded to a constant and if it is true, or unknown (-1) */
#define __glibc_safe_or_unknown_len(__l, __s, __osz) \
- (__glibc_unsigned_or_positive (__l) \
- && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
- __s, __osz)) \
- && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
+ ((__osz) == (__SIZE_TYPE__) -1 \
+ || (__glibc_unsigned_or_positive (__l) \
+ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
+ (__s), (__osz))) \
+ && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz))))
/* Conversely, we know at compile time that the length is unsafe if the
__L * __S <= __OBJSZ condition can be folded to a constant and if it is
diff --git a/lib/libc-config.h b/lib/libc-config.h
index 8fec4893787..a56665b1ce3 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -121,6 +121,7 @@
# undef __attr_dealloc
# undef __attr_dealloc_free
# undef __attribute__
+# undef __attribute_alloc_align__
# undef __attribute_alloc_size__
# undef __attribute_artificial__
# undef __attribute_const__
@@ -129,6 +130,7 @@
# undef __attribute_format_arg__
# undef __attribute_format_strfmon__
# undef __attribute_malloc__
+# undef __attribute_maybe_unused__
# undef __attribute_noinline__
# undef __attribute_nonstring__
# undef __attribute_pure__
@@ -142,16 +144,24 @@
# undef __extern_always_inline
# undef __extern_inline
# undef __flexarr
+# undef __fortified_attr_access
# undef __fortify_function
# undef __glibc_c99_flexarr_available
+# undef __glibc_fortify
+# undef __glibc_fortify_n
# undef __glibc_has_attribute
# undef __glibc_has_builtin
# undef __glibc_has_extension
+# undef __glibc_likely
# undef __glibc_macro_warning
# undef __glibc_macro_warning1
# undef __glibc_objsize
# undef __glibc_objsize0
+# undef __glibc_safe_len_cond
+# undef __glibc_safe_or_unknown_len
# undef __glibc_unlikely
+# undef __glibc_unsafe_len
+# undef __glibc_unsigned_or_positive
# undef __inline
# undef __ptr_t
# undef __restrict
@@ -159,6 +169,7 @@
# undef __va_arg_pack
# undef __va_arg_pack_len
# undef __warnattr
+# undef __wur
/* Include our copy of glibc <sys/cdefs.h>. */
# include <cdefs.h>
diff --git a/lib/md5.h b/lib/md5.h
index 5b92eac5ec8..611c230b817 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -24,6 +24,9 @@
#include <stdint.h>
# if HAVE_OPENSSL_MD5
+# ifndef OPENSSL_API_COMPAT
+# define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */
+# endif
# include <openssl/md5.h>
# endif
diff --git a/lib/regcomp.c b/lib/regcomp.c
index b607c85320f..122c3de58c3 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -2038,15 +2038,25 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
}
switch (c)
{
- case '-':
- token->type = OP_CHARSET_RANGE;
- break;
case ']':
token->type = OP_CLOSE_BRACKET;
break;
case '^':
token->type = OP_NON_MATCH_LIST;
break;
+ case '-':
+ /* In V7 Unix grep and Unix awk and mawk, [...---...]
+ (3 adjacent minus signs) stands for a single minus sign.
+ Support that without breaking anything else. */
+ if (! (re_string_cur_idx (input) + 2 < re_string_length (input)
+ && re_string_peek_byte (input, 1) == '-'
+ && re_string_peek_byte (input, 2) == '-'))
+ {
+ token->type = OP_CHARSET_RANGE;
+ break;
+ }
+ re_string_skip_bytes (input, 2);
+ FALLTHROUGH;
default:
token->type = CHARACTER;
}
diff --git a/lib/sha1.h b/lib/sha1.h
index 098678d8da6..bc3470a508d 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -23,6 +23,9 @@
# include <stdint.h>
# if HAVE_OPENSSL_SHA1
+# ifndef OPENSSL_API_COMPAT
+# define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */
+# endif
# include <openssl/sha.h>
# endif
diff --git a/lib/sha256.h b/lib/sha256.h
index dc9d87e615f..533173a59e8 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -22,6 +22,9 @@
# include <stdint.h>
# if HAVE_OPENSSL_SHA256
+# ifndef OPENSSL_API_COMPAT
+# define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */
+# endif
# include <openssl/sha.h>
# endif
diff --git a/lib/sha512.h b/lib/sha512.h
index f38819faf0f..1eb18702278 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -22,6 +22,9 @@
# include "u64.h"
# if HAVE_OPENSSL_SHA512
+# ifndef OPENSSL_API_COMPAT
+# define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */
+# endif
# include <openssl/sha.h>
# endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index d52c2f79638..a86643c3ca3 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -184,7 +184,11 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
# undef free
# define free rpl_free
# endif
+# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_FUNCDECL_RPL (free, void, (void *ptr) throw ());
+# else
_GL_FUNCDECL_RPL (free, void, (void *ptr));
+# endif
_GL_CXXALIAS_RPL (free, void, (void *ptr));
# else
_GL_CXXALIAS_SYS (free, void, (void *ptr));
diff --git a/lib/string.in.h b/lib/string.in.h
index b6840fa9121..33160b25254 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -583,7 +583,7 @@ _GL_FUNCDECL_RPL (strndup, char *,
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
# else
-# if !@HAVE_DECL_STRNDUP@ || __GNUC__ >= 11
+# if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup)
_GL_FUNCDECL_SYS (strndup, char *,
(char const *__s, size_t __n)
_GL_ARG_NONNULL ((1))
@@ -593,7 +593,7 @@ _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
# endif
_GL_CXXALIASWARN (strndup);
#else
-# if __GNUC__ >= 11
+# if __GNUC__ >= 11 && !defined strndup
/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
_GL_FUNCDECL_SYS (strndup, char *,
(char const *__s, size_t __n)