Commit 976d9e13 by Sebastian Bauer

regex: Fixed warnings about unused parameter values.

There are different solutions to the problem. In this change, we
define an UNUSED macro that maps to __attribute__((unused)) when
compiling with gcc. Otherwise it is a NOOP. We apply this macro
in all function headers for each parameter value that is not used
within the function body.

The change is local to regex.
parent d2f14df8
......@@ -542,7 +542,7 @@ weak_alias (__regcomp, regcomp)
from either regcomp or regexec. We don't use PREG here. */
size_t
regerror(int errcode, const regex_t *__restrict preg,
regerror(int errcode, UNUSED const regex_t *__restrict preg,
char *__restrict errbuf, size_t errbuf_size)
{
const char *msg;
......@@ -1358,7 +1358,7 @@ calc_first (void *extra, bin_tree_t *node)
/* Pass 2: compute NEXT on the tree. Preorder visit. */
static reg_errcode_t
calc_next (void *extra, bin_tree_t *node)
calc_next (UNUSED void *extra, bin_tree_t *node)
{
switch (node->token.type)
{
......@@ -3309,7 +3309,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
static reg_errcode_t
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
re_token_t *token, int token_len, re_dfa_t *dfa,
re_token_t *token, int token_len, UNUSED re_dfa_t *dfa,
reg_syntax_t syntax, int accept_hyphen)
{
#ifdef RE_ENABLE_I18N
......@@ -3804,7 +3804,7 @@ free_token (re_token_t *node)
and its children. */
static reg_errcode_t
free_tree (void *extra, bin_tree_t *node)
free_tree (UNUSED void *extra, bin_tree_t *node)
{
free_token (&node->token);
return REG_NOERROR;
......
......@@ -27,6 +27,14 @@
#include <stdlib.h>
#include <string.h>
#ifndef UNUSED
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#endif
#else
#define UNUSED
#endif
#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
# include <langinfo.h>
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment