summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-08-08 02:58:39 +0200
committerBruno Haible <bruno@clisp.org>2021-08-08 02:58:39 +0200
commit683b84444bc3228a429022bc80b03e62c402161d (patch)
tree3553c214faf694c939d83b8b45dde22a7e0ebfb8
parent15e4365267e316f15222b8bf9f0a7cd0db231e9c (diff)
downloadlibunistring-683b84444bc3228a429022bc80b03e62c402161d.tar.gz
Update after gnulib changed.
* gnulib-local/lib/uninorm.in.h.diff: Add an include of <unistring/cdefs.h>. * lib/unistring/cdefs.h (_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEALLOC_FREE): New macros. (_UC_ATTR_malloc, _UC_ATTRIBUTE_DEALLOC, _UC_ATTRIBUTE_DEALLOC_FREE, _UC_ATTRIBUTE_MALLOC): New auxiliary macros, from gnulib/m4/gnulib-common.m4. (_UC_HAS_C_ATTRIBUTE): Renamed from _GL_HAS_C_ATTRIBUTE.
-rw-r--r--gnulib-local/lib/uninorm.in.h.diff9
-rw-r--r--lib/unistring/cdefs.h37
2 files changed, 40 insertions, 6 deletions
diff --git a/gnulib-local/lib/uninorm.in.h.diff b/gnulib-local/lib/uninorm.in.h.diff
index 47f644e..f7e4ebb 100644
--- a/gnulib-local/lib/uninorm.in.h.diff
+++ b/gnulib-local/lib/uninorm.in.h.diff
@@ -1,11 +1,14 @@
-*** uninorm.in.h.orig 2009-04-05 12:38:24.000000000 +0200
---- uninorm.in.h 2009-04-12 04:31:52.000000000 +0200
+*** uninorm.in.h.orig 2021-08-07 14:40:34.920237057 +0200
+--- uninorm.in.h 2021-08-08 02:17:17.145608518 +0200
***************
*** 18,23 ****
---- 18,26 ----
+--- 18,29 ----
#ifndef _UNINORM_H
#define _UNINORM_H
++ /* Get common macros for C. */
++ #include <unistring/cdefs.h>
++
+ /* Get LIBUNISTRING_DLL_VARIABLE. */
+ #include <unistring/woe32dll.h>
+
diff --git a/lib/unistring/cdefs.h b/lib/unistring/cdefs.h
index 066ea66..91e3292 100644
--- a/lib/unistring/cdefs.h
+++ b/lib/unistring/cdefs.h
@@ -31,6 +31,23 @@
# define _GL_UNUSED_PARAMETER _UC_ATTRIBUTE_MAYBE_UNUSED
#endif
+#ifndef _GL_ATTRIBUTE_MALLOC
+# define _GL_ATTRIBUTE_MALLOC _UC_ATTRIBUTE_MALLOC
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers
+ that can be freed by passing them as the Ith argument to the
+ function F. _UC_ATTRIBUTE_DEALLOC_FREE is for functions that
+ return pointers that can be freed via 'free'; it can be used
+ only after including stdlib.h. These macros cannot be used on
+ inline functions. */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# define _GL_ATTRIBUTE_DEALLOC _UC_ATTRIBUTE_DEALLOC
+#endif
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# define _GL_ATTRIBUTE_DEALLOC_FREE _UC_ATTRIBUTE_DEALLOC_FREE
+#endif
+
/* The definitions below are taken from gnulib/m4/gnulib-common.m4,
with prefix _UC instead of prefix _GL. */
@@ -48,16 +65,30 @@
# define _UC_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
#else
# define _UC_HAS_ATTRIBUTE(attr) _UC_ATTR_##attr
+# define _UC_ATTR_malloc _UC_GNUC_PREREQ (3, 0)
# define _UC_ATTR_unused _UC_GNUC_PREREQ (2, 7)
#endif
#ifdef __has_c_attribute
-# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__)
+# define _UC_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__)
+#else
+# define _UC_HAS_C_ATTRIBUTE(attr) 0
+#endif
+
+#if _UC_GNUC_PREREQ (11, 0)
+# define _UC_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+#else
+# define _UC_ATTRIBUTE_DEALLOC(f, i)
+#endif
+#define _UC_ATTRIBUTE_DEALLOC_FREE _UC_ATTRIBUTE_DEALLOC (free, 1)
+
+#if _UC_HAS_ATTRIBUTE (malloc)
+# define _UC_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
#else
-# define _GL_HAS_C_ATTRIBUTE(attr) 0
+# define _UC_ATTRIBUTE_MALLOC
#endif
-#if _GL_HAS_C_ATTRIBUTE (maybe_unused)
+#if _UC_HAS_C_ATTRIBUTE (maybe_unused)
# define _UC_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
#else
# define _UC_ATTRIBUTE_MAYBE_UNUSED _UC_ATTRIBUTE_UNUSED