index e6c4189d3577bb6e20c6910f6e7c4fbced6b2eba..843c638695df1fc8fce827d652727c940307c45a 100644 (file)
+2007年04月02日 Eric Blake <ebb9@byu.net>
+
+ Fix warnings from last commit.
+ * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import
+ fprintf-posix sprintf-posix'.
+ * m4/macro.c (expand_macro, trace_format): Use correct specifier
+ for size_t.
+ (process_macro): Avoid negative array index.
+ * src/freeze.c (produce_resyntax_dump, produce_module_dump)
+ (dump_symbol_CB, produce_frozen_state): Use correct specifier for
+ size_t.
+
2007年04月02日 Gary V. Vaughan <gary@gnu.org>
Get rid of the last 'differs in signedness' compiler warnings:
-
+
* m4/macro.c (process_macro): m4_get_symbol_value_text() returns
a regular 'char *', so variables to store the return address,
and iterate through it should be regular 'char *' too.
index b47578baf7cfe0a6d0b258ba02549671044a4917..5bf13c94ff91a963e4b30a90ff46424621fa539a 100644 (file)
/* GNU m4 -- A simple macro processor
- Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2001, 2006
+ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2001, 2006, 2007
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -275,7 +275,7 @@ expand_macro (m4 *context, const char *name, m4_symbol *symbol)
if (m4_get_nesting_limit_opt (context) > 0
&& expansion_level > m4_get_nesting_limit_opt (context))
m4_error (context, EXIT_FAILURE, 0, _("\
-recursion limit of %d exceeded, use -L<N> to change it"),
+recursion limit of %zu exceeded, use -L<N> to change it"),
m4_get_nesting_limit_opt (context));
macro_call_id++;
@@ -422,7 +422,7 @@ process_macro (m4 *context, m4_symbol_value *value, m4_obstack *obs,
{
char ch;
- if (!m4_has_syntax (M4SYNTAX, *text, M4_SYNTAX_DOLLAR))
+ if (!m4_has_syntax (M4SYNTAX, to_uchar (*text), M4_SYNTAX_DOLLAR))
{
obstack_1grow (obs, *text);
text++;
@@ -475,7 +475,7 @@ process_macro (m4 *context, m4_symbol_value *value, m4_obstack *obs,
const char *key;
for (endp = ++text;
- *endp && m4_has_syntax (M4SYNTAX, *endp,
+ *endp && m4_has_syntax (M4SYNTAX, to_uchar (*endp),
(M4_SYNTAX_OTHER | M4_SYNTAX_ALPHA
| M4_SYNTAX_NUM));
++endp)
@@ -565,21 +565,13 @@ trace_format (m4 *context, const char *fmt, ...)
break;
case 'z':
- /* GNU assumption: Although POSIX allows size_t to be just
- 16 bits, independently of int, GNU assumes is at least as
- big as int. Likewise, although POSIX allows size_t to be
- bigger than unsigned long in some compilation
- environments, GNU assumes that size_t always fits in
- unsigned long. Unfortunately, GNU does not assume that
- %zu is portable, yet. */
ch = *fmt++;
assert (ch == 'u');
- assert (sizeof (size_t) >= sizeof (int));
{
size_t z = va_arg (args, size_t);
char nbuf[INT_BUFSIZE_BOUND (size_t)];
- sprintf (nbuf, "%lu", (unsigned long int) z);
+ sprintf (nbuf, "%zu", z);
s = nbuf;
}
break;
index ddc1647158700ae7004b0481d0721676723354d6..70355ebc6e46782e27572f00dc91cc1e5170aa4c 100644 (file)
@@ -94,7 +94,7 @@ produce_resyntax_dump (m4 *context, FILE *file)
/* No need to use produce_mem_dump, since we know all resyntax
names are already ASCII-encoded. */
- fprintf (file, "R%d\n%s\n", strlen (resyntax), resyntax);
+ fprintf (file, "R%zu\n%s\n", strlen (resyntax), resyntax);
}
}
@@ -138,13 +138,7 @@ produce_module_dump (FILE *file, lt_dlhandle handle)
if (handle)
produce_module_dump (file, handle);
- /* GNU assumption: Although POSIX allows size_t to be just 16 bits,
- independently of int, GNU assumes is at least as big as int.
- Likewise, although POSIX allows size_t to be bigger than unsigned
- long in some compilation environments, GNU assumes that size_t
- always fits in unsigned long. Unfortunately, GNU does not assume
- that %zu is portable, yet. */
- fprintf (file, "M%lu\n", (unsigned long int) len);
+ fprintf (file, "M%zu\n", len);
produce_mem_dump (file, name, len);
fputc ('\n', file);
}
@@ -173,10 +167,9 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *symbol_name,
{
const char *text = m4_get_symbol_text (symbol);
size_t text_len = strlen (text);
- fprintf (file, "T%lu,%lu", (unsigned long int) symbol_len,
- (unsigned long int) text_len);
+ fprintf (file, "T%zu,%zu", symbol_len, text_len);
if (handle)
- fprintf (file, ",%lu", (unsigned long int) module_len);
+ fprintf (file, ",%zu", module_len);
fputc ('\n', file);
produce_mem_dump (file, symbol_name, symbol_len);
@@ -193,10 +186,9 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *symbol_name,
assert (!"INTERNAL ERROR: builtin not found in builtin table!");
bp_len = strlen (bp->name);
- fprintf (file, "F%lu,%lu", (unsigned long int) symbol_len,
- (unsigned long int) bp_len);
+ fprintf (file, "F%zu,%zu", symbol_len, bp_len);
if (handle)
- fprintf (file, ",%lu", (unsigned long int) module_len);
+ fprintf (file, ",%zu", module_len);
fputc ('\n', file);
produce_mem_dump (file, symbol_name, symbol_len);
@@ -237,9 +229,8 @@ produce_frozen_state (m4 *context, const char *name)
if (strcmp (m4_get_syntax_lquote (M4SYNTAX), DEF_LQUOTE)
|| strcmp (m4_get_syntax_rquote (M4SYNTAX), DEF_RQUOTE))
{
- fprintf (file, "Q%lu,%lu\n",
- (unsigned long int) M4SYNTAX->lquote.length,
- (unsigned long int) M4SYNTAX->rquote.length);
+ fprintf (file, "Q%zu,%zu\n", M4SYNTAX->lquote.length,
+ M4SYNTAX->rquote.length);
produce_mem_dump (file, M4SYNTAX->lquote.string,
M4SYNTAX->lquote.length);
produce_mem_dump (file, M4SYNTAX->rquote.string,
@@ -252,9 +243,8 @@ produce_frozen_state (m4 *context, const char *name)
if (strcmp (m4_get_syntax_bcomm (M4SYNTAX), DEF_BCOMM)
|| strcmp (m4_get_syntax_ecomm (M4SYNTAX), DEF_ECOMM))
{
- fprintf (file, "C%lu,%lu\n",
- (unsigned long int) M4SYNTAX->bcomm.length,
- (unsigned long int) M4SYNTAX->ecomm.length);
+ fprintf (file, "C%zu,%zu\n", M4SYNTAX->bcomm.length,
+ M4SYNTAX->ecomm.length);
produce_mem_dump (file, M4SYNTAX->bcomm.string, M4SYNTAX->bcomm.length);
produce_mem_dump (file, M4SYNTAX->ecomm.string, M4SYNTAX->ecomm.length);
fputc ('\n', file);