[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: argv_ref patch 24: allow NUL in macro names
From: |
Eric Blake |
Subject: |
Re: argv_ref patch 24: allow NUL in macro names |
Date: |
Tue, 3 Jun 2008 20:38:16 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
>
> Eric Blake <ebb9 <at> byu.net> writes:
>
> > hardware.] On the master branch, I split it into three patches -
> > reworking m4_error to take a call_info * instead of a char * (so that the
> > length can be passed in alongside the name), changing the symbol table to
> > support NUL, and changing all macro name output (warnings, dumpdef, trace)
> > to handle or quote difficult characters while avoiding extra munging of
> > the global location variables.
>
> And I'm not sure how I let the master branch testsuite failure in - I thought
I
> properly ran 'make check' before committing.
This also introduced some potential failures on 64-bit platforms, due to
carelessness in using size_t instead of int for the call_id in contrast to the
branch, but without updating the printf specifiers accordingly. I think newer
gcc detects that automatically, but gcc 3.4 on a 32-bit platform did not
trigger any -Wall warnings; it took a build on a x86_64 machine to see this.
Fixed as follows:
>From ec19d062daf1e3402fefa1f81f59a9460a878e9d Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 3 Jun 2008 09:17:42 -0600
Subject: [PATCH] Fix printf type mismatches.
* m4/m4module.h (m4_bad_argc): Alter parameter type.
* m4/m4private.h (struct m4_call_info): Alter call_id type.
* m4/macro.c (expand_macro, m4__adjust_refcount): Use correct
specifiers.
* m4/utility.c (m4_bad_argc): Likewise.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 7 +++++++
m4/m4module.h | 2 +-
m4/m4private.h | 2 +-
m4/macro.c | 6 +++---
m4/utility.c | 6 +++---
5 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6abc3b4..b94b250 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-06-03 Eric Blake <address@hidden>
+ Fix printf type mismatches.
+ * m4/m4module.h (m4_bad_argc): Alter parameter type.
+ * m4/m4private.h (struct m4_call_info): Alter call_id type.
+ * m4/macro.c (expand_macro, m4__adjust_refcount): Use correct
+ specifiers.
+ * m4/utility.c (m4_bad_argc): Likewise.
+
Borrow bootstrap ideas from gnulib.
* bootstrap (options, DOWNLOAD_PO): Remove --download-po; the
advertized subset of languages didn't work. Use --skip-po
diff --git a/m4/m4module.h b/m4/m4module.h
index 346463d..29495f3 100644
--- a/m4/m4module.h
+++ b/m4/m4module.h
@@ -167,7 +167,7 @@ struct m4_string_pair
`m4_macro_args *argv' are in scope. */
#define M4ARGLEN(i) m4_arg_len (context, argv, i)
-extern bool m4_bad_argc (m4 *, int, const m4_call_info *, size_t,
+extern bool m4_bad_argc (m4 *, size_t, const m4_call_info *, size_t,
size_t, bool);
extern bool m4_numeric_arg (m4 *, const m4_call_info *, const char *,
int *);
diff --git a/m4/m4private.h b/m4/m4private.h
index e1c8163..9734a16 100644
--- a/m4/m4private.h
+++ b/m4/m4private.h
@@ -341,7 +341,7 @@ struct m4_call_info
{
const char *file; /* The file containing the macro invocation. */
int line; /* The line the macro was called on. */
- int call_id; /* The unique sequence call id of the macro. */
+ size_t call_id; /* The unique sequence call id of the macro. */
int trace : 1; /* True to trace this macro. */
int debug_level : 31; /* The debug level for tracing the macro call.
*/
const char *name; /* The macro name. */
diff --git a/m4/macro.c b/m4/macro.c
index 1436ea9..b1f9f44 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -526,7 +526,7 @@ recursion limit of %zu exceeded, use -L<N> to change it"),
{
obstack_free (stack->args, args_scratch);
if (debug_macro_level & PRINT_ARGCOUNT_CHANGES)
- xfprintf (stderr, "m4debug: -%d- `%s' in use, level=%d, "
+ xfprintf (stderr, "m4debug: -%zu- `%s' in use, level=%zu, "
"refcount=%zu, argcount=%zu\n", info.call_id,
argv->info->name, level, stack->refcount,
stack->argcount);
@@ -980,13 +980,13 @@ m4__adjust_refcount (m4 *context, size_t level, bool
increase)
obstack_free (stack->args, stack->args_base);
obstack_free (stack->argv, stack->argv_base);
if ((debug_macro_level & PRINT_ARGCOUNT_CHANGES) && 1 < stack->argcount)
- xfprintf (stderr, "m4debug: -%d- freeing %zu args, level=%d\n",
+ xfprintf (stderr, "m4debug: -%zu- freeing %zu args, level=%zu\n",
macro_call_id, stack->argcount, level);
stack->argcount = 0;
}
if (debug_macro_level
& (increase ? PRINT_REFCOUNT_INCREASE : PRINT_REFCOUNT_DECREASE))
- xfprintf (stderr, "m4debug: level %d refcount=%d\n", level,
+ xfprintf (stderr, "m4debug: level %zu refcount=%zu\n", level,
stack->refcount);
return stack->refcount;
}
diff --git a/m4/utility.c b/m4/utility.c
index c104779..596c621 100644
--- a/m4/utility.c
+++ b/m4/utility.c
@@ -41,19 +41,19 @@ static const char *skip_space (m4 *, const char *);
Return true if the macro is guaranteed to expand to the empty
string, false otherwise. */
bool
-m4_bad_argc (m4 *context, int argc, const m4_call_info *caller, size_t min,
+m4_bad_argc (m4 *context, size_t argc, const m4_call_info *caller, size_t min,
size_t max, bool side_effect)
{
if (argc - 1 < min)
{
- m4_warn (context, 0, caller, _("too few arguments: %d < %d"),
+ m4_warn (context, 0, caller, _("too few arguments: %zu < %zu"),
argc - 1, min);
return !side_effect;
}
if (argc - 1 > max)
{
- m4_warn (context, 0, caller, _("extra arguments ignored: %d > %d"),
+ m4_warn (context, 0, caller, _("extra arguments ignored: %zu > %zu"),
argc - 1, max);
}
--
1.5.5.1