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) ...@@ -542,7 +542,7 @@ weak_alias (__regcomp, regcomp)
from either regcomp or regexec. We don't use PREG here. */ from either regcomp or regexec. We don't use PREG here. */
size_t 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) char *__restrict errbuf, size_t errbuf_size)
{ {
const char *msg; const char *msg;
...@@ -1358,7 +1358,7 @@ calc_first (void *extra, bin_tree_t *node) ...@@ -1358,7 +1358,7 @@ calc_first (void *extra, bin_tree_t *node)
/* Pass 2: compute NEXT on the tree. Preorder visit. */ /* Pass 2: compute NEXT on the tree. Preorder visit. */
static reg_errcode_t 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) switch (node->token.type)
{ {
...@@ -3309,7 +3309,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, ...@@ -3309,7 +3309,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
static reg_errcode_t static reg_errcode_t
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, 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) reg_syntax_t syntax, int accept_hyphen)
{ {
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
...@@ -3804,7 +3804,7 @@ free_token (re_token_t *node) ...@@ -3804,7 +3804,7 @@ free_token (re_token_t *node)
and its children. */ and its children. */
static reg_errcode_t 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); free_token (&node->token);
return REG_NOERROR; return REG_NOERROR;
......
...@@ -27,6 +27,14 @@ ...@@ -27,6 +27,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.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 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
# include <langinfo.h> # include <langinfo.h>
#endif #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