]> git.proxmox.com Git - libgit2.git/commitdiff
regex: Fixed warnings about unused parameter values.
authorSebastian Bauer <mail@sebastianbauer.info>
Fri, 11 Jan 2013 09:47:44 +0000 (10:47 +0100)
committerSebastian Bauer <mail@sebastianbauer.info>
Fri, 11 Jan 2013 10:03:48 +0000 (11:03 +0100)
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.

deps/regex/regcomp.c
deps/regex/regex_internal.h

index b18ca8f3ef300c3c935637d458f02a766d346847..43bffbc21f5cdf5901bb10bcf75337227c308250 100644 (file)
@@ -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;
index f7601113175b763b381ad6b1885e2f4d8159c138..aa3820740cd33e2aba4e603882023c0704151f9a 100644 (file)
 #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