+2009-12-24 Bruno Haible <bruno@clisp.org>
+
+ New module 'unused-parameter'.
+ * build-aux/unused-parameter.h: New file, extracted from earlier
+ gnulib-common.m4.
+ * modules/unused-parameter: New file.
+ * lib/unistr.h: Include unused-parameter.h.
+ (u32_mbtouc_unsafe, u32_mbtouc): Use _GL_UNUSED_PARAMETER instead of
+ _GL_UNUSED.
+ * modules/unistr/base (Depends-on): Add unused-parameter.
+
2009-12-24 Bruno Haible <bruno@clisp.org>
Add missing dependencies to 'extensions' module.
--- /dev/null
+/* A C macro for declaring that specific function parameters are not used.
+ Copyright (C) 2008-2009 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
+ by the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* _GL_UNUSED_PARAMETER is a marker that can be appended 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
+ or more generally
+ param_decl _GL_UNUSED_PARAMETER
+ 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)
+ */
+#ifndef _GL_UNUSED_PARAMETER
+# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
+# else
+# define _GL_UNUSED_PARAMETER
+# endif
+#endif
#include "unitypes.h"
+/* Get common macros for C. */
+#include "unused-parameter.h"
+
/* Get bool. */
#include <stdbool.h>
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
-u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED)
+u32_mbtouc_unsafe (ucs4_t *puc,
+ const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
-u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED)
+u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
Depends-on:
unitypes
+unused-parameter
stdbool
inline
--- /dev/null
+Description:
+A C macro for declaring that specific function parameters are not used.
+
+Applicability:
+all
+
+Files:
+build-aux/unused-parameter.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += unused-parameter.h
+# The unused-parameter.h that gets inserted into generated .h files is the same
+# as build-aux/unused-parameter.h, except that it has the copyright header cut
+# off.
+unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \
+ < $(top_srcdir)/build-aux/unused-parameter.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t
+
+UNUSED_PARAMETER_H=unused-parameter.h
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible