m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: silence some compiler warnings


From: Eric Blake
Subject: Re: silence some compiler warnings
Date: Thu, 01 May 2008 21:16:46 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 4/17/2008 7:06 AM:
| I tried playing with the (extra-strict) warnings present in coreutils'
| maint.mk, and it caught several shadowing problems.  gnulib has more
| problems, so this doesn't silence everything, but it still seemed worth
| doing.  It's annoying that 'index' is a function in <string.h>, as it is
| an otherwise useful variable name.

Now ported to the master branch:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgah50ACgkQ84KuGfSFAYAibACfWyU2NKLrDdM6W/gSq5fdWIDE
71YAoK27hw/0GFRX1rplOU/h7ZygGbUP
=Gv8z
-----END PGP SIGNATURE-----
>From 6abccf89a8f468530209cf5b2f6178ab343af2a4 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 1 May 2008 08:53:18 -0600
Subject: [PATCH] Improve debugmode testing, based on recent branch-1.6 
regressions.

* doc/m4.texinfo (Debugmode): Enhance tests.
* tests/generate.awk: Run tests from stdin, not input.m4.  Support
stderr munging when using -I examples.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog          |    5 +++++
 doc/m4.texinfo     |   40 ++++++++++++++++++++++++++++++++++++----
 tests/generate.awk |   22 +++++++++++++++-------
 3 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 79da06b..684a3a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-05-01  Eric Blake  <address@hidden>
 
+       Improve debugmode testing, based on recent branch-1.6 regressions.
+       * doc/m4.texinfo (Debugmode): Enhance tests.
+       * tests/generate.awk: Run tests from stdin, not input.m4.  Support
+       stderr munging when using -I examples.
+
        Fix regression in define from 2008-02-22.
        * m4/m4module.h (m4_symbol_value_copy): Add parameter.
        * m4/symtab.c (m4_symbol_value_copy): Support copying $@
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 69ec5dc..c593a8d 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -4040,7 +4040,15 @@ debugmode()
 foo
 @error{}m4trace: -1- foo -> `FOO'
 @result{}FOO
+debugmode(`V')
address@hidden
+foo(`BAR')
address@hidden:stdin:6: -1- id 6: foo ... = `FOO$1'
address@hidden:stdin:6: -1- id 6: foo(`BAR') -> `FOOBAR'
address@hidden
 debugmode
address@hidden:stdin:7: -1- id 7: debugmode ... = <debugmode>@address@hidden
address@hidden:stdin:7: -1- id 7: debugmode ->@w{ }
 @result{}
 foo
 @error{}m4trace: -1- foo
@@ -4048,15 +4056,39 @@ foo
 debugmode(`+clmx')
 @result{}
 foo(divnum)
address@hidden:8: -1- id 8: foo ... = FOO$1
address@hidden:8: -2- id 9: divnum ... = <divnum>@address@hidden
address@hidden:8: -2- id 9: divnum
address@hidden:8: -1- id 8: foo
address@hidden:10: -1- id 10: foo ... = FOO$1
address@hidden:10: -2- id 11: divnum ... = <divnum>@address@hidden
address@hidden:10: -2- id 11: divnum
address@hidden:10: -1- id 10: foo
 @result{}FOO0
 debugmode(`-m')
 @result{}
 @end example
 
+This example shows the effects of the debug flags that are not related
+to macro tracing.
+
address@hidden examples
address@hidden options: -dip
address@hidden
+$ @kbd{m4 -dip -I examples}
address@hidden: input read from stdin
+define(`foo', `m4wrap(`wrapped text
+')dnl')
address@hidden
+include(`incl.m4')dnl
address@hidden: path search for `incl.m4' found `examples/incl.m4'
address@hidden: input read from examples/incl.m4
address@hidden file start
address@hidden file end
address@hidden: input reverted to stdin, line 3
+^D
address@hidden: input exhausted
address@hidden: input from m4wrap recursion level 1
address@hidden text
address@hidden: input from m4wrap exhausted
address@hidden example
+
 @node Debuglen
 @section Limiting debug output
 
diff --git a/tests/generate.awk b/tests/generate.awk
index 979995b..692e21b 100755
--- a/tests/generate.awk
+++ b/tests/generate.awk
@@ -1,6 +1,7 @@
 # Extract all examples from the manual source.            -*- AWK -*-
 
-# Copyright (C) 1992, 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1992, 2000, 2001, 2006, 2007, 2008 Free Software
+# Foundation, Inc.
 #
 # This file is part of GNU M4.
 #
@@ -141,7 +142,6 @@ function normalize(contents,    i, lines, n, line, res) {
       gsub ("@tabchar{}", "\t", line);
       gsub ("@w{ }", " @\\&t@", line);
       gsub ("m4_", "address@hidden&address@hidden", line);
-      gsub ("stdin", "input.m4", line);
 
       # Some of the examples have improperly balanced square brackets.
       gsub ("[[]", "@<:@", line);
@@ -181,23 +181,31 @@ function new_test(input, status, output, error, options, 
xfail, examples) {
       printf ("AT_DATA([expout1],\n[[%s]])\n", output);
       printf ("sed -e \"s|examples|$abs_top_srcdir/examples|g\" \\\n");
       printf ("  < expout1 > expout\n\n");
+      if (error)
+       {
+         printf ("AT_DATA([experr1],\n[[%s]])\n", error);
+         printf ("sed \"s|examples|$abs_top_srcdir/examples|g\" \\\n");
+         printf ("  < experr1 > experr\n\n");
+       }
       options = options " -I\"$abs_top_srcdir/examples\"";
     }
 
   printf ("AT_DATA([[input.m4]],\n[[%s]])\n\n", input);
   # Some of these tests `include' files from tests/.
-  printf ("AT_CHECK_M4([[%s input.m4]], %s,", options, status);
+  printf ("AT_CHECK_M4([[%s]], %s,", options, status);
   if (examples == 1)
     printf ("\n[expout]");
   else if (output)
     printf ("\n[[%s]]", output);
   else
     printf (" []");
-  if (error)
-    printf (",\n[[%s]])", error);
+  if (examples == 1 && error)
+    printf (",\n[experr]");
+  else if (error)
+    printf (",\n[[%s]]", error);
   else
-    printf (")");
-  printf ("\n\n");
+    printf (", []");
+  printf (", [[input.m4]])\n\n");
 }
 
 function fatal(msg) {
-- 
1.5.5.1


>From 1dd98ea10e065300cfa110b7305362c1f12ed00f Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 1 May 2008 12:05:03 -0600
Subject: [PATCH] Avoid -Wshadow compiler warnings.

* m4/output.c (threshold_diversion_CB): s/div/diversion/.
* m4/macro.c (make_argv_ref, arg_symbol, m4_arg_symbol)
(m4_is_arg_text, m4_is_arg_func, m4_arg_text, m4_arg_empty)
(m4_arg_len, m4_arg_func, m4__arg_print, m4_make_argv_ref)
(m4_push_arg, m4__push_arg_quote): s/index/arg/.
* modules/format.c (format): Likewise.
* modules/m4.c (ifelse): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog        |    9 ++++
 m4/macro.c       |  132 +++++++++++++++++++++++++++---------------------------
 m4/output.c      |    4 +-
 modules/format.c |   20 ++++----
 modules/m4.c     |   12 +++---
 5 files changed, 93 insertions(+), 84 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 684a3a4..44df370 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-05-01  Eric Blake  <address@hidden>
 
+       Avoid -Wshadow compiler warnings.
+       * m4/output.c (threshold_diversion_CB): s/div/diversion/.
+       * m4/macro.c (make_argv_ref, arg_symbol, m4_arg_symbol)
+       (m4_is_arg_text, m4_is_arg_func, m4_arg_text, m4_arg_empty)
+       (m4_arg_len, m4_arg_func, m4__arg_print, m4_make_argv_ref)
+       (m4_push_arg, m4__push_arg_quote): s/index/arg/.
+       * modules/format.c (format): Likewise.
+       * modules/m4.c (ifelse): Likewise.
+
        Improve debugmode testing, based on recent branch-1.6 regressions.
        * doc/m4.texinfo (Debugmode): Enhance tests.
        * tests/generate.awk: Run tests from stdin, not input.m4.  Support
diff --git a/m4/macro.c b/m4/macro.c
index bd0f88b..e58e657 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -1067,19 +1067,19 @@ arg_mark (m4_macro_args *argv)
 }
 
 /* Populate the newly-allocated VALUE as a wrapper around ARGV,
-   starting with argument INDEX.  Allocate any data on OBS, owned by a
+   starting with argument ARG.  Allocate any data on OBS, owned by a
    given expansion LEVEL.  FLATTEN determines whether to allow
    builtins, and QUOTES determines whether all arguments are quoted.
    Return TOKEN when successful, NULL when wrapping ARGV is trivially
    empty.  */
 static m4_symbol_value *
 make_argv_ref (m4 *context, m4_symbol_value *value, m4_obstack *obs,
-              size_t level, m4_macro_args *argv, size_t index, bool flatten,
+              size_t level, m4_macro_args *argv, size_t arg, bool flatten,
               const m4_string_pair *quotes)
 {
   m4__symbol_chain *chain;
 
-  if (argv->argc <= index)
+  if (argv->argc <= arg)
     return NULL;
   value->type = M4_SYMBOL_COMP;
   value->u.u_c.chain = value->u.u_c.end = NULL;
@@ -1096,14 +1096,14 @@ make_argv_ref (m4 *context, m4_symbol_value *value, 
m4_obstack *obs,
               && argv->array[i]->u.u_c.wrapper)
              || level < SIZE_MAX)
            break;
-         if (index == 1)
+         if (arg == 1)
            {
              m4__push_arg_quote (context, obs, argv, i + 1, quotes);
              /* TODO support M4_SYNTAX_COMMA.  */
              obstack_1grow (obs, ',');
            }
          else
-           index--;
+           arg--;
        }
       assert (i < argv->arraylen);
       if (i + 1 == argv->arraylen)
@@ -1114,11 +1114,11 @@ make_argv_ref (m4 *context, m4_symbol_value *value, 
m4_obstack *obs,
          assert (!chain->next && chain->type == M4__CHAIN_ARGV
                  && !chain->u.u_a.skip_last);
          argv = chain->u.u_a.argv;
-         index += chain->u.u_a.index - 1;
+         arg += chain->u.u_a.index - 1;
        }
       else
        {
-         index += i;
+         arg += i;
          break;
        }
     }
@@ -1136,7 +1136,7 @@ make_argv_ref (m4 *context, m4_symbol_value *value, 
m4_obstack *obs,
   chain->type = M4__CHAIN_ARGV;
   chain->quote_age = argv->quote_age;
   chain->u.u_a.argv = argv;
-  chain->u.u_a.index = index;
+  chain->u.u_a.index = arg;
   chain->u.u_a.flatten = flatten;
   chain->u.u_a.has_func = argv->has_func;
   chain->u.u_a.comma = false;
@@ -1146,31 +1146,31 @@ make_argv_ref (m4 *context, m4_symbol_value *value, 
m4_obstack *obs,
   return value;
 }
 
-/* Given ARGV, return the symbol value at the specified INDEX, which
+/* Given ARGV, return the symbol value at the specified ARG, which
    must be non-zero.  *LEVEL is set to the obstack level that contains
    the symbol (which is not necessarily the level of ARGV).  If
    FLATTEN, avoid returning a builtin token.  */
 static m4_symbol_value *
-arg_symbol (m4_macro_args *argv, size_t index, size_t *level, bool flatten)
+arg_symbol (m4_macro_args *argv, size_t arg, size_t *level, bool flatten)
 {
   size_t i;
   m4_symbol_value *value;
 
-  assert (index);
+  assert (arg);
   if (level)
     *level = argv->level;
   flatten |= argv->flatten;
-  if (argv->argc <= index)
+  if (argv->argc <= arg)
     return &empty_symbol;
   if (!argv->wrapper)
     {
-      value = argv->array[index - 1];
+      value = argv->array[arg - 1];
       if (flatten && m4_is_symbol_value_func (value))
        value = &empty_symbol;
       return value;
     }
 
-  /* Must cycle through all array slots until we find index, since
+  /* Must cycle through all array slots until we find arg, since
      wrappers can contain multiple arguments.  */
   for (i = 0; i < argv->arraylen; i++)
     {
@@ -1179,40 +1179,40 @@ arg_symbol (m4_macro_args *argv, size_t index, size_t 
*level, bool flatten)
        {
          m4__symbol_chain *chain = value->u.u_c.chain;
          assert (!chain->next && chain->type == M4__CHAIN_ARGV);
-         if (index <= (chain->u.u_a.argv->argc - chain->u.u_a.index
+         if (arg <= (chain->u.u_a.argv->argc - chain->u.u_a.index
                        - chain->u.u_a.skip_last))
            {
              value = arg_symbol (chain->u.u_a.argv,
-                                 chain->u.u_a.index - 1 + index, level,
+                                 chain->u.u_a.index - 1 + arg, level,
                                  flatten || chain->u.u_a.flatten);
              break;
            }
-         index -= (chain->u.u_a.argv->argc - chain->u.u_a.index
+         arg -= (chain->u.u_a.argv->argc - chain->u.u_a.index
                    - chain->u.u_a.skip_last);
        }
-      else if (--index == 0)
+      else if (--arg == 0)
        break;
     }
   return value;
 }
 
-/* Given ARGV, return the symbol value at the specified INDEX, which
+/* Given ARGV, return the symbol value at the specified ARG, which
    must be non-zero.  */
 m4_symbol_value *
-m4_arg_symbol (m4_macro_args *argv, size_t index)
+m4_arg_symbol (m4_macro_args *argv, size_t arg)
 {
-  return arg_symbol (argv, index, NULL, false);
+  return arg_symbol (argv, arg, NULL, false);
 }
 
-/* Given ARGV, return true if argument INDEX is text.  Index 0 is
-   always text, as are indices beyond argc.  */
+/* Given ARGV, return true if argument ARG is text.  Arg 0 is always
+   text, as are indices beyond argc.  */
 bool
-m4_is_arg_text (m4_macro_args *argv, size_t index)
+m4_is_arg_text (m4_macro_args *argv, size_t arg)
 {
   m4_symbol_value *value;
-  if (index == 0 || argv->argc <= index || argv->flatten || !argv->has_func)
+  if (arg == 0 || argv->argc <= arg || argv->flatten || !argv->has_func)
     return true;
-  value = m4_arg_symbol (argv, index);
+  value = m4_arg_symbol (argv, arg);
   if (m4_is_symbol_value_text (value)
       || (value->type == M4_SYMBOL_COMP && !value->u.u_c.has_func))
     return true;
@@ -1220,33 +1220,33 @@ m4_is_arg_text (m4_macro_args *argv, size_t index)
 }
 
 /* TODO - add m4_is_arg_comp to distinguish concatenation of builtins.  */
-/* Given ARGV, return true if argument INDEX is a single builtin
+/* Given ARGV, return true if argument ARG is a single builtin
    function.  Only non-zero indices less than argc can return
    true.  */
 bool
-m4_is_arg_func (m4_macro_args *argv, size_t index)
+m4_is_arg_func (m4_macro_args *argv, size_t arg)
 {
-  if (index == 0 || argv->argc <= index || argv->flatten || !argv->has_func)
+  if (arg == 0 || argv->argc <= arg || argv->flatten || !argv->has_func)
     return false;
-  return m4_is_symbol_value_func (m4_arg_symbol (argv, index));
+  return m4_is_symbol_value_func (m4_arg_symbol (argv, arg));
 }
 
-/* Given ARGV, return the text at argument INDEX.  Abort if the
-   argument is not text.  Index 0 is always text, and indices beyond
-   argc return the empty string.  The result is always NUL-terminated,
-   even if it includes embedded NUL characters.  */
+/* Given ARGV, return the text at argument ARG.  Abort if the argument
+   is not text.  Arg 0 is always text, and indices beyond argc return
+   the empty string.  The result is always NUL-terminated, even if it
+   includes embedded NUL characters.  */
 const char *
-m4_arg_text (m4 *context, m4_macro_args *argv, size_t index)
+m4_arg_text (m4 *context, m4_macro_args *argv, size_t arg)
 {
   m4_symbol_value *value;
   m4__symbol_chain *chain;
   m4_obstack *obs;
 
-  if (index == 0)
+  if (arg == 0)
     return argv->argv0;
-  if (argv->argc <= index)
+  if (argv->argc <= arg)
     return "";
-  value = m4_arg_symbol (argv, index);
+  value = m4_arg_symbol (argv, arg);
   if (m4_is_symbol_value_text (value))
     return m4_get_symbol_value_text (value);
   assert (value->type == M4_SYMBOL_COMP);
@@ -1423,30 +1423,30 @@ m4_arg_equal (m4 *context, m4_macro_args *argv, size_t 
indexa, size_t indexb)
   return ca == cb;
 }
 
-/* Given ARGV, return true if argument INDEX is the empty string.
-   This gives the same result as comparing m4_arg_len against 0, but
-   is often faster.  */
+/* Given ARGV, return true if argument ARG is the empty string.  This
+   gives the same result as comparing m4_arg_len against 0, but is
+   often faster.  */
 bool
-m4_arg_empty (m4_macro_args *argv, size_t index)
+m4_arg_empty (m4_macro_args *argv, size_t arg)
 {
-  return (index ? m4_arg_symbol (argv, index) == &empty_symbol
+  return (arg ? m4_arg_symbol (argv, arg) == &empty_symbol
          : !argv->argv0_len);
 }
 
-/* Given ARGV, return the length of argument INDEX.  Abort if the
+/* Given ARGV, return the length of argument ARG.  Abort if the
    argument is not text.  Indices beyond argc return 0.  */
 size_t
-m4_arg_len (m4 *context, m4_macro_args *argv, size_t index)
+m4_arg_len (m4 *context, m4_macro_args *argv, size_t arg)
 {
   m4_symbol_value *value;
   m4__symbol_chain *chain;
   size_t len;
 
-  if (index == 0)
+  if (arg == 0)
     return argv->argv0_len;
-  if (argv->argc <= index)
+  if (argv->argc <= arg)
     return 0;
-  value = m4_arg_symbol (argv, index);
+  value = m4_arg_symbol (argv, arg);
   if (m4_is_symbol_value_text (value))
     return m4_get_symbol_value_len (value);
   assert (value->type == M4_SYMBOL_COMP);
@@ -1492,16 +1492,16 @@ m4_arg_len (m4 *context, m4_macro_args *argv, size_t 
index)
   return len;
 }
 
-/* Given ARGV, return the builtin function referenced by argument
-   INDEX.  Abort if it is not a single builtin.  */
+/* Given ARGV, return the builtin function referenced by argument ARG.
+   Abort if it is not a single builtin.  */
 m4_builtin_func *
-m4_arg_func (m4_macro_args *argv, size_t index)
+m4_arg_func (m4_macro_args *argv, size_t arg)
 {
-  return m4_get_symbol_value_func (m4_arg_symbol (argv, index));
+  return m4_get_symbol_value_func (m4_arg_symbol (argv, arg));
 }
 
 /* Dump a representation of ARGV to the obstack OBS, starting with
-   argument INDEX.  If QUOTES is non-NULL, each argument is displayed
+   argument ARG.  If QUOTES is non-NULL, each argument is displayed
    with those quotes.  If FLATTEN, builtins are converted to empty
    quotes; if CHAINP, *CHAINP is updated with macro tokens; otherwise,
    builtins are represented by their name.  Separate arguments with
@@ -1515,7 +1515,7 @@ m4_arg_func (m4_macro_args *argv, size_t index)
    originating modules; modules do not count against truncation
    length.  MAX_LEN and CHAINP may not both be specified.  */
 bool
-m4__arg_print (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t index,
+m4__arg_print (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg,
               const m4_string_pair *quotes, bool flatten,
               m4__symbol_chain **chainp, const char *sep, size_t *max_len,
               bool quote_each, bool module)
@@ -1531,7 +1531,7 @@ m4__arg_print (m4 *context, m4_obstack *obs, 
m4_macro_args *argv, size_t index,
   if (!sep)
     sep = ",";
   sep_len = strlen (sep);
-  for (i = index; i < argv->argc; i++)
+  for (i = arg; i < argv->argc; i++)
     {
       if (quote_each && max_len)
        len = *max_len;
@@ -1572,12 +1572,12 @@ m4_make_argv_ref (m4 *context, m4_macro_args *argv, 
const char *argv0,
   m4_macro_args *new_argv;
   m4_symbol_value *value;
   m4_symbol_value *new_value;
-  size_t index = skip ? 2 : 1;
+  size_t arg = skip ? 2 : 1;
   m4_obstack *obs = m4_arg_scratch (context);
 
   new_value = (m4_symbol_value *) obstack_alloc (obs, sizeof *value);
   value = make_argv_ref (context, new_value, obs, context->expansion_level - 1,
-                        argv, index, flatten, NULL);
+                        argv, arg, flatten, NULL);
   if (!value)
     {
       obstack_free (obs, new_value);
@@ -1601,7 +1601,7 @@ m4_make_argv_ref (m4 *context, m4_macro_args *argv, const 
char *argv0,
       new_argv->flatten = flatten;
       new_argv->has_func = argv->has_func;
     }
-  new_argv->argc = argv->argc - (index - 1);
+  new_argv->argc = argv->argc - (arg - 1);
   new_argv->inuse = false;
   new_argv->argv0 = argv0;
   new_argv->argv0_len = argv0_len;
@@ -1610,14 +1610,14 @@ m4_make_argv_ref (m4 *context, m4_macro_args *argv, 
const char *argv0,
   return new_argv;
 }
 
-/* Push argument INDEX from ARGV, which must be a text token, onto the
+/* Push argument ARG from ARGV, which must be a text token, onto the
    expansion stack OBS for rescanning.  */
 void
-m4_push_arg (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t index)
+m4_push_arg (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg)
 {
   m4_symbol_value value;
 
-  if (index == 0)
+  if (arg == 0)
     {
       m4_set_symbol_value_text (&value, argv->argv0, argv->argv0_len, 0);
       if (m4__push_symbol (context, &value, context->expansion_level - 1,
@@ -1625,18 +1625,18 @@ m4_push_arg (m4 *context, m4_obstack *obs, 
m4_macro_args *argv, size_t index)
        arg_mark (argv);
     }
   else
-    m4__push_arg_quote (context, obs, argv, index, NULL);
+    m4__push_arg_quote (context, obs, argv, arg, NULL);
 }
 
-/* Push argument INDEX from ARGV onto the expansion stack OBS for
-   rescanning.  INDEX must be non-zero.  QUOTES determines any quote
+/* Push argument ARG from ARGV onto the expansion stack OBS for
+   rescanning.  ARG must be non-zero.  QUOTES determines any quote
    delimiters that were in effect when the reference was created.  */
 void
 m4__push_arg_quote (m4 *context, m4_obstack *obs, m4_macro_args *argv,
-                   size_t index, const m4_string_pair *quotes)
+                   size_t arg, const m4_string_pair *quotes)
 {
   size_t level;
-  m4_symbol_value *value = arg_symbol (argv, index, &level, false);
+  m4_symbol_value *value = arg_symbol (argv, arg, &level, false);
 
   if (quotes)
     obstack_grow (obs, quotes->str1, quotes->len1);
diff --git a/m4/output.c b/m4/output.c
index 6f1be1c..c903d99 100644
--- a/m4/output.c
+++ b/m4/output.c
@@ -119,10 +119,10 @@ cmp_diversion_CB (const void *elt1, const void *elt2)
 static bool
 threshold_diversion_CB (const void *elt, const void *threshold)
 {
-  const m4_diversion *div = (const m4_diversion *) elt;
+  const m4_diversion *diversion = (const m4_diversion *) elt;
   /* No need to worry about overflow, since we don't create diversions
      with negative divnum.  */
-  return div->divnum >= *(const int *) threshold;
+  return diversion->divnum >= *(const int *) threshold;
 }
 
 /* Initialize the output engine.  */
diff --git a/modules/format.c b/modules/format.c
index fd086c8..4ff72b9 100644
--- a/modules/format.c
+++ b/modules/format.c
@@ -127,7 +127,7 @@ format (m4 *context, m4_obstack *obs, int argc, 
m4_macro_args *argv)
   char fstart[] = "%'+- 0#*.*hhd";     /* Current format spec.  */
   char *p;                             /* Position within fstart.  */
   unsigned char c;                     /* A simple character.  */
-  int index = 0;                       /* Index within argc used so far.  */
+  int i = 0;                           /* Index within argc used so far.  */
   bool valid_format = true;            /* True if entire format string ok.  */
 
   /* Flags.  */
@@ -158,7 +158,7 @@ format (m4 *context, m4_obstack *obs, int argc, 
m4_macro_args *argv)
   char *str;                   /* Malloc'd buffer of formatted text.  */
   enum {CHAR, INT, LONG, DOUBLE, STR} datatype;
 
-  f = fmt = ARG_STR (index, argc, argv);
+  f = fmt = ARG_STR (i, argc, argv);
   memset (ok, 0, sizeof ok);
   while (true)
     {
@@ -167,7 +167,7 @@ format (m4 *context, m4_obstack *obs, int argc, 
m4_macro_args *argv)
          if (c == '\0')
            {
              if (valid_format)
-               m4_bad_argc (context, argc, me, index, index, true);
+               m4_bad_argc (context, argc, me, i, i, true);
              return;
            }
          obstack_1grow (obs, c);
@@ -247,7 +247,7 @@ format (m4 *context, m4_obstack *obs, int argc, 
m4_macro_args *argv)
       *p++ = '*';
       if (*fmt == '*')
        {
-         width = ARG_INT (index, argc, argv);
+         width = ARG_INT (i, argc, argv);
          fmt++;
        }
       else
@@ -267,7 +267,7 @@ format (m4 *context, m4_obstack *obs, int argc, 
m4_macro_args *argv)
          ok['c'] = 0;
          if (*(++fmt) == '*')
            {
-             prec = ARG_INT (index, argc, argv);
+             prec = ARG_INT (i, argc, argv);
              ++fmt;
            }
          else
@@ -356,27 +356,27 @@ format (m4 *context, m4_obstack *obs, int argc, 
m4_macro_args *argv)
        {
        case CHAR:
          str = asnprintf (base, &len, fstart, width,
-                          ARG_INT (index, argc, argv));
+                          ARG_INT (i, argc, argv));
          break;
 
        case INT:
          str = asnprintf (base, &len, fstart, width, prec,
-                          ARG_INT (index, argc, argv));
+                          ARG_INT (i, argc, argv));
          break;
 
        case LONG:
          str = asnprintf (base, &len, fstart, width, prec,
-                          ARG_LONG (index, argc, argv));
+                          ARG_LONG (i, argc, argv));
          break;
 
        case DOUBLE:
          str = asnprintf (base, &len, fstart, width, prec,
-                          ARG_DOUBLE (index, argc, argv));
+                          ARG_DOUBLE (i, argc, argv));
          break;
 
        case STR:
          str = asnprintf (base, &len, fstart, width, prec,
-                          ARG_STR (index, argc, argv));
+                          ARG_STR (i, argc, argv));
          break;
 
        default:
diff --git a/modules/m4.c b/modules/m4.c
index b8562ec..0b714ef 100644
--- a/modules/m4.c
+++ b/modules/m4.c
@@ -210,7 +210,7 @@ M4BUILTIN_HANDLER (ifdef)
 M4BUILTIN_HANDLER (ifelse)
 {
   const char *me = M4ARG (0);
-  size_t index;
+  size_t i;
 
   /* The valid ranges of argc for ifelse is discontinuous, we cannot
      rely on the regular mechanisms.  */
@@ -220,14 +220,14 @@ M4BUILTIN_HANDLER (ifelse)
     /* Diagnose excess arguments if 5, 8, 11, etc., actual arguments.  */
     m4_bad_argc (context, argc, me, 0, argc - 2, false);
 
-  index = 1;
+  i = 1;
   argc--;
 
   while (true)
     {
-      if (m4_arg_equal (context, argv, index, index + 1))
+      if (m4_arg_equal (context, argv, i, i + 1))
        {
-         m4_push_arg (context, obs, argv, index + 2);
+         m4_push_arg (context, obs, argv, i + 2);
          return;
        }
       switch (argc)
@@ -237,12 +237,12 @@ M4BUILTIN_HANDLER (ifelse)
 
        case 4:
        case 5:
-         m4_push_arg (context, obs, argv, index + 3);
+         m4_push_arg (context, obs, argv, i + 3);
          return;
 
        default:
          argc -= 3;
-         index += 3;
+         i += 3;
        }
     }
 }
-- 
1.5.5.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]