diff options
author | Bruno Haible <bruno@clisp.org> | 2021-08-01 17:27:42 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2021-08-01 17:27:42 +0200 |
commit | a192acd84d07c25256eea34a18293133d2435689 (patch) | |
tree | ea0de4f264ee880c4a07dd12830f98290beea359 | |
parent | 01888dcca8255a86603c7d5e42bf67dd827138ff (diff) | |
download | libunistring-a192acd84d07c25256eea34a18293133d2435689.tar.gz |
Update after gnulib changed.
* gnulib-local/lib/unistr.in.h.diff: Update.
* lib/unistring/cdefs.h (_GL_UNUSED_PARAMETER): Use the new definition from
gnulib-common.m4.
(_UC_GNUC_PREREQ, _UC_HAS_ATTRIBUTE, _UC_ATTR_unused, _GL_HAS_C_ATTRIBUTE,
_UC_ATTRIBUTE_MAYBE_UNUSED, _UC_ATTRIBUTE_UNUSED): New auxiliary macros, based
on gnulib-common.m4.
-rw-r--r-- | gnulib-local/lib/unistr.in.h.diff | 29 | ||||
-rw-r--r-- | lib/unistring/cdefs.h | 59 |
2 files changed, 59 insertions, 29 deletions
diff --git a/gnulib-local/lib/unistr.in.h.diff b/gnulib-local/lib/unistr.in.h.diff index 0b31c86..7bd18e7 100644 --- a/gnulib-local/lib/unistr.in.h.diff +++ b/gnulib-local/lib/unistr.in.h.diff @@ -1,28 +1,27 @@ -*** unistr.in.h.orig 2009-12-24 23:21:27.000000000 +0100 ---- unistr.in.h 2009-12-25 02:04:40.000000000 +0100 +*** lib/unistr.in.h.orig 2021-08-01 16:43:54.915090697 +0200 +--- lib/unistr.in.h 2021-08-01 15:52:07.388856862 +0200 *************** -*** 20,29 **** - #include "unitypes.h" +*** 19,26 **** - /* Get common macros for C. */ -! #include "unused-parameter.h" + #include "unitypes.h" /* Get bool. */ ! #include <stdbool.h> - /* Get size_t. */ + /* Get size_t, ptrdiff_t. */ #include <stddef.h> ---- 20,32 ---- - #include "unitypes.h" +--- 19,32 ---- - /* Get common macros for C. */ -! #include <unistring/cdefs.h> -! -! /* Get inline if available. */ -! #include <unistring/inline.h> + #include "unitypes.h" ++ /* Get common macros for C. */ ++ #include <unistring/cdefs.h> ++ ++ /* Get inline if available. */ ++ #include <unistring/inline.h> ++ /* Get bool. */ ! #include <unistring/stdbool.h> - /* Get size_t. */ + /* Get size_t, ptrdiff_t. */ #include <stddef.h> diff --git a/lib/unistring/cdefs.h b/lib/unistring/cdefs.h index e186b3a..066ea66 100644 --- a/lib/unistring/cdefs.h +++ b/lib/unistring/cdefs.h @@ -1,5 +1,5 @@ /* Common macro definitions for C include files. - Copyright (C) 2008-2020 Free Software Foundation, Inc. + Copyright (C) 2008-2021 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 @@ -17,25 +17,56 @@ #ifndef _UNISTRING_CDEFS_H #define _UNISTRING_CDEFS_H -/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter +/* _GL_UNUSED_PARAMETER is a marker that can be prepended to function parameter declarations for parameters that are not used. This helps to reduce warnings, such as from GCC -Wunused-parameter. The syntax is as follows: - type param _GL_UNUSED_PARAMETER + _GL_UNUSED_PARAMETER type param or more generally - param_decl _GL_UNUSED_PARAMETER + _GL_UNUSED_PARAMETER param_decl For example: - int param _GL_UNUSED_PARAMETER - int *(*param)(void) _GL_UNUSED_PARAMETER - Other possible, but obscure and discouraged syntaxes: - int _GL_UNUSED_PARAMETER *(*param)(void) - _GL_UNUSED_PARAMETER int *(*param)(void) + _GL_UNUSED_PARAMETER int param + _GL_UNUSED_PARAMETER int *(*param) (void) */ #ifndef _GL_UNUSED_PARAMETER -# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__)) -# else -# define _GL_UNUSED_PARAMETER -# endif +# define _GL_UNUSED_PARAMETER _UC_ATTRIBUTE_MAYBE_UNUSED +#endif + +/* The definitions below are taken from gnulib/m4/gnulib-common.m4, + with prefix _UC instead of prefix _GL. */ + +/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define _UC_GNUC_PREREQ(major, minor) \ + ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#else +# define _UC_GNUC_PREREQ(major, minor) 0 +#endif + +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || 3 < __clang_major__ + (5 <= __clang_minor__))) +# define _UC_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) +#else +# define _UC_HAS_ATTRIBUTE(attr) _UC_ATTR_##attr +# define _UC_ATTR_unused _UC_GNUC_PREREQ (2, 7) +#endif + +#ifdef __has_c_attribute +# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) +#else +# define _GL_HAS_C_ATTRIBUTE(attr) 0 +#endif + +#if _GL_HAS_C_ATTRIBUTE (maybe_unused) +# define _UC_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +#else +# define _UC_ATTRIBUTE_MAYBE_UNUSED _UC_ATTRIBUTE_UNUSED +#endif + +#if _UC_HAS_ATTRIBUTE (unused) +# define _UC_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#else +# define _UC_ATTRIBUTE_UNUSED #endif #endif /* _UNISTRING_CDEFS_H */ |