build: avoid some warnings
authorEric Blake <ebb9@byu.net>
Sat, 31 Oct 2009 00:58:58 +0000 (18:58 -0600)
committerEric Blake <ebb9@byu.net>
Mon, 2 Nov 2009 13:34:24 +0000 (06:34 -0700)
* gl/lib/mbsalign.c (mbsalign): Mark unused parameter.
* bootstrap.conf (gnulib_modules): Remove obsolete
rename-dest-slash.
* gnulib-tests/Makefile.am (AM_CFLAGS): Reduce set of warnings for
gnulib tests.
* gl/modules/rename-tests.diff (Makefile.am): New file, to add
LIBINTL to LDADD, since we avoid canonicalize-lgpl module.
* gl/lib/regcomp.c.diff (regerror, calc_next)
(build_collating_symbol, parse_bracket_element, build_equiv_class)
(free_tree): Mark unused parameters.
* gl/lib/regex_internal.h.diff (re_string_elem_size_at): New file,
to mark unused parameters.
* gl/lib/printf-args.c.diff (PRINTF_FETCHARGS): New file, to avoid
type mismatch.
* gl/lib/vasnprintf.c (VASNPRINTF): New file, to avoid shadowing
local variable name.
* .gitignore: Ignore temporary build artifacts.

.gitignore
bootstrap.conf
gl/lib/mbsalign.c
gl/lib/printf-args.c.diff [new file with mode: 0644]
gl/lib/regcomp.c.diff
gl/lib/regex_internal.h.diff [new file with mode: 0644]
gl/lib/vasnprintf.c.diff [new file with mode: 0644]
gl/modules/rename-tests.diff [new file with mode: 0644]
gnulib-tests/Makefile.am

index a28415479176517da0eb1b94b6a44f70f4240822..8d1370ff89165485c5a829614dd87fb74cb22ee1 100644 (file)
@@ -3,6 +3,7 @@
 *.o
 */.deps
 *~
+._bootmp
 .gdb-history
 .kludge-stamp
 .tarball-version
index 4c0f4c7b062a7c66f7ac59de2217aa764e2186e7..79605460efeb40ad3f9841770a717cf9283e8f41 100644 (file)
@@ -181,7 +181,6 @@ gnulib_modules="
   realloc
   regex
   rename
-  rename-dest-slash
   rmdir
   root-dev-ino
   rpmatch
index a0757471d71ed22c9dbd8ddef4317183f8a15ceb..b9d7e525594122fb9164dc66da4198f1c6403d66 100644 (file)
@@ -129,7 +129,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
 
 size_t
 mbsalign (const char *src, char *dest, size_t dest_size,
-          size_t *width, mbs_align_t align, int flags)
+          size_t *width, mbs_align_t align, int flags _UNUSED_PARAMETER_)
 {
   size_t ret = -1;
   size_t src_size = strlen (src) + 1;
diff --git a/gl/lib/printf-args.c.diff b/gl/lib/printf-args.c.diff
new file mode 100644 (file)
index 0000000..952d741
--- /dev/null
@@ -0,0 +1,21 @@
+diff --git a/lib/printf-args.c b/lib/printf-args.c
+index 4978914..e994239 100644
+--- a/lib/printf-args.c
++++ b/lib/printf-args.c
+@@ -1,5 +1,6 @@
+ /* Decomposed printf argument list.
+-   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
++   Copyright (C) 1999, 2002-2003, 2005-2007, 2009 Free Software
++   Foundation, Inc.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+@@ -89,7 +90,7 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
+          where wint_t is 'unsigned short'.  */
+       ap->a.a_wide_char =
+         (sizeof (wint_t) < sizeof (int)
+-         ? va_arg (args, int)
++         ? (wint_t) va_arg (args, int)
+          : va_arg (args, wint_t));
+       break;
+ #endif
index 88097a445308a7b6a7388ac79415ee6742e796b4..a31c39f60ef7937aa6cf47ff56336fa98e2a562f 100644 (file)
@@ -1,7 +1,7 @@
-diff --git a/lib/regcomp.c b/lib/regcomp.c
-index 6472ff6..fadf36d 100644
---- a/lib/regcomp.c
-+++ b/lib/regcomp.c
+diff --git c/lib/regcomp.c i/lib/regcomp.c
+index 6472ff6..665b2ab 100644
+--- c/lib/regcomp.c
++++ i/lib/regcomp.c
 @@ -18,6 +18,8 @@
     with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
@@ -11,6 +11,24 @@ index 6472ff6..fadf36d 100644
  static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
                                          size_t length, reg_syntax_t syntax);
  static void re_compile_fastmap_iter (regex_t *bufp,
+@@ -541,7 +543,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
+     size_t errbuf_size;
+ #else /* size_t might promote */
+ size_t
+-regerror (int errcode, const regex_t *_Restrict_ preg,
++regerror (int errcode, const regex_t *_Restrict_ preg _UNUSED_PARAMETER_,
+         char *_Restrict_ errbuf, size_t errbuf_size)
+ #endif
+ {
+@@ -1375,7 +1377,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 (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
+ {
+   switch (node->token.type)
+     {
 @@ -2571,7 +2573,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
    /* This loop is actually executed only when end != REG_MISSING,
       to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?...  We have
@@ -21,3 +39,44 @@ index 6472ff6..fadf36d 100644
      for (i = start + 2; i <= end; ++i)
        {
        elem = duplicate_tree (elem, dfa);
+@@ -2731,7 +2734,8 @@ static reg_errcode_t
+ internal_function
+ build_collating_symbol (bitset_t sbcset,
+ # ifdef RE_ENABLE_I18N
+-                      re_charset_t *mbcset, Idx *coll_sym_alloc,
++                      re_charset_t *mbcset _UNUSED_PARAMETER_,
++                      Idx *coll_sym_alloc _UNUSED_PARAMETER_,
+ # endif
+                       const unsigned char *name)
+ {
+@@ -3309,7 +3313,8 @@ 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,
++                     re_dfa_t *dfa _UNUSED_PARAMETER_,
+                      reg_syntax_t syntax, bool accept_hyphen)
+ {
+ #ifdef RE_ENABLE_I18N
+@@ -3396,8 +3401,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
+
+ static reg_errcode_t
+ #ifdef RE_ENABLE_I18N
+-build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
+-                 Idx *equiv_class_alloc, const unsigned char *name)
++build_equiv_class (bitset_t sbcset, re_charset_t *mbcset _UNUSED_PARAMETER_,
++                 Idx *equiv_class_alloc _UNUSED_PARAMETER_,
++                 const unsigned char *name)
+ #else /* not RE_ENABLE_I18N */
+ build_equiv_class (bitset_t sbcset, const unsigned char *name)
+ #endif /* not RE_ENABLE_I18N */
+@@ -3798,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 (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
+ {
+   free_token (&node->token);
+   return REG_NOERROR;
diff --git a/gl/lib/regex_internal.h.diff b/gl/lib/regex_internal.h.diff
new file mode 100644 (file)
index 0000000..d1506a6
--- /dev/null
@@ -0,0 +1,14 @@
+diff --git i/lib/regex_internal.h w/lib/regex_internal.h
+index 859832f..3c7fe06 100644
+--- i/lib/regex_internal.h
++++ w/lib/regex_internal.h
+@@ -826,7 +826,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
+
+ static int
+ internal_function __attribute ((pure))
+-re_string_elem_size_at (const re_string_t *pstr, Idx idx)
++re_string_elem_size_at (const re_string_t *pstr _UNUSED_PARAMETER_,
++                      Idx idx _UNUSED_PARAMETER_)
+ {
+ # ifdef _LIBC
+   const unsigned char *p, *extra;
diff --git a/gl/lib/vasnprintf.c.diff b/gl/lib/vasnprintf.c.diff
new file mode 100644 (file)
index 0000000..eb48ab0
--- /dev/null
@@ -0,0 +1,120 @@
+diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
+index 661445c..ab66288 100644
+--- a/lib/vasnprintf.c
++++ b/lib/vasnprintf.c
+@@ -2375,16 +2375,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+                     characters = 0;
+                     while (precision > 0)
+                       {
+-                        char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
++                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         int count;
+
+                         if (*arg_end == 0)
+                           /* Found the terminating null wide character.  */
+                           break;
+ #  if HAVE_WCRTOMB
+-                        count = wcrtomb (buf, *arg_end, &state);
++                        count = wcrtomb (cbuf, *arg_end, &state);
+ #  else
+-                        count = wctomb (buf, *arg_end);
++                        count = wctomb (cbuf, *arg_end);
+ #  endif
+                         if (count < 0)
+                           {
+@@ -2420,16 +2420,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+                     characters = 0;
+                     for (;;)
+                       {
+-                        char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
++                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         int count;
+
+                         if (*arg_end == 0)
+                           /* Found the terminating null wide character.  */
+                           break;
+ #  if HAVE_WCRTOMB
+-                        count = wcrtomb (buf, *arg_end, &state);
++                        count = wcrtomb (cbuf, *arg_end, &state);
+ #  else
+-                        count = wctomb (buf, *arg_end);
++                        count = wctomb (cbuf, *arg_end);
+ #  endif
+                         if (count < 0)
+                           {
+@@ -2470,20 +2470,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+ #   endif
+                   for (remaining = characters; remaining > 0; )
+                     {
+-                      char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
++                      char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                       int count;
+
+                       if (*arg == 0)
+                         abort ();
+ #   if HAVE_WCRTOMB
+-                      count = wcrtomb (buf, *arg, &state);
++                      count = wcrtomb (cbuf, *arg, &state);
+ #   else
+-                      count = wctomb (buf, *arg);
++                      count = wctomb (cbuf, *arg);
+ #   endif
+                       if (count <= 0)
+                         /* Inconsistency.  */
+                         abort ();
+-                      memcpy (tmpptr, buf, count);
++                      memcpy (tmpptr, cbuf, count);
+                       tmpptr += count;
+                       arg++;
+                       remaining -= count;
+@@ -2552,20 +2552,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+                     ENSURE_ALLOCATION (xsum (length, characters));
+                     for (remaining = characters; remaining > 0; )
+                       {
+-                        char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
++                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         int count;
+
+                         if (*arg == 0)
+                           abort ();
+ #   if HAVE_WCRTOMB
+-                        count = wcrtomb (buf, *arg, &state);
++                        count = wcrtomb (cbuf, *arg, &state);
+ #   else
+-                        count = wctomb (buf, *arg);
++                        count = wctomb (cbuf, *arg);
+ #   endif
+                         if (count <= 0)
+                           /* Inconsistency.  */
+                           abort ();
+-                        memcpy (result + length, buf, count);
++                        memcpy (result + length, cbuf, count);
+                         length += count;
+                         arg++;
+                         remaining -= count;
+@@ -2581,21 +2581,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+ #   endif
+                     while (arg < arg_end)
+                       {
+-                        char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
++                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         int count;
+
+                         if (*arg == 0)
+                           abort ();
+ #   if HAVE_WCRTOMB
+-                        count = wcrtomb (buf, *arg, &state);
++                        count = wcrtomb (cbuf, *arg, &state);
+ #   else
+-                        count = wctomb (buf, *arg);
++                        count = wctomb (cbuf, *arg);
+ #   endif
+                         if (count <= 0)
+                           /* Inconsistency.  */
+                           abort ();
+                         ENSURE_ALLOCATION (xsum (length, count));
+-                        memcpy (result + length, buf, count);
++                        memcpy (result + length, cbuf, count);
+                         length += count;
+                         arg++;
+                       }
diff --git a/gl/modules/rename-tests.diff b/gl/modules/rename-tests.diff
new file mode 100644 (file)
index 0000000..7f1ff61
--- /dev/null
@@ -0,0 +1,9 @@
+diff --git a/modules/rename-tests b/modules/rename-tests
+index be1b423..fea330a 100644
+--- a/modules/rename-tests
++++ b/modules/rename-tests
+@@ -14,3 +14,4 @@ configure.ac:
+ Makefile.am:
+ TESTS += test-rename
+ check_PROGRAMS += test-rename
++test_rename_LDADD = $(LDADD) @LIBINTL@
index 494786faf0aa62f2dbf75975ce175d4aa3e85983..c3a48e841ffa6dd0dca72e0a3d322c1abbbb8ae4 100644 (file)
@@ -1,3 +1,3 @@
 include gnulib.mk
 
-AM_CFLAGS = $(WARN_CFLAGS) # $(WERROR_CFLAGS)
+AM_CFLAGS = $(GNULIB_WARN_CFLAGS) # $(WERROR_CFLAGS)