diff options
author | Eric Blake <ebb9@byu.net> | 2010-01-04 15:14:55 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2010-01-07 21:39:26 -0700 |
commit | 3117f7ea6a22ea5b32877180b460beffba5ca83f (patch) | |
tree | d9e70aa0a1efbf031a26714290f329c7a5bb7f41 | |
parent | f224a4967f21b643b79bf79b61d4ca6853203f28 (diff) | |
download | m4-3117f7ea6a22ea5b32877180b460beffba5ca83f.tar.gz |
Address 'make sc_cast_of_argument_to_free' failures.
* m4/m4private.h (DELETE): Adjust comment and fix parentheses.
* m4/m4.c (m4_delete): Use it to avoid warning.
* m4/module.c (install_builtin_table, module_remove): Likewise.
* m4/symtab.c (m4_symbol_value_delete, m4_symbol_value_copy):
Likewise.
* .x-sc_cast_of_argument_to_free: New file.
* Makefile.am (syntax_check_exceptions): Distribute exceptions.
Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r-- | .x-sc_cast_of_argument_to_free | 1 | ||||
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | m4/m4.c | 2 | ||||
-rw-r--r-- | m4/m4private.h | 5 | ||||
-rw-r--r-- | m4/module.c | 4 | ||||
-rw-r--r-- | m4/symtab.c | 8 |
7 files changed, 21 insertions, 9 deletions
diff --git a/.x-sc_cast_of_argument_to_free b/.x-sc_cast_of_argument_to_free new file mode 100644 index 00000000..ad761aea --- /dev/null +++ b/.x-sc_cast_of_argument_to_free @@ -0,0 +1 @@ +m4/m4private.h @@ -1,5 +1,14 @@ 2010-01-07 Eric Blake <ebb9@byu.net> + Address 'make sc_cast_of_argument_to_free' failures. + * m4/m4private.h (DELETE): Adjust comment and fix parentheses. + * m4/m4.c (m4_delete): Use it to avoid warning. + * m4/module.c (install_builtin_table, module_remove): Likewise. + * m4/symtab.c (m4_symbol_value_delete, m4_symbol_value_copy): + Likewise. + * .x-sc_cast_of_argument_to_free: New file. + * Makefile.am (syntax_check_exceptions): Distribute exceptions. + More whitespace cleanup. * HACKING: Nuke trailing whitespace. * examples/WWW/Makefile: Likewise. diff --git a/Makefile.am b/Makefile.am index 89eb7f03..ddffcff8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,6 +53,7 @@ include ltdl/Makefile.inc # Additional configuration. Version management comes from suggestions # given in build-aux/git-version-gen. syntax_check_exceptions = \ + .x-sc_cast_of_argument_to_free \ .x-sc_prohibit_tab_based_indentation \ .x-sc_require_config_h \ .x-sc_require_config_h_first \ @@ -74,7 +74,7 @@ m4_delete (m4 *context) m4__search_path *stale = path; path = path->next; - free ((void*) stale->dir); + DELETE (stale->dir); /* Cast away const. */ free (stale); } free (context->search_path); diff --git a/m4/m4private.h b/m4/m4private.h index ab5c299b..0ee10e24 100644 --- a/m4/m4private.h +++ b/m4/m4private.h @@ -615,8 +615,9 @@ extern void m4__include_init (m4 *); -/* Convenience macro to zero a variable after freeing it. */ -#define DELETE(Expr) ((Expr) = (free ((void *) Expr), (void *) 0)) +/* Convenience macro to zero a variable after freeing it, as well as + casting away any const. */ +#define DELETE(Expr) ((Expr) = (free ((void *) (Expr)), (void *) 0)) #if DEBUG diff --git a/m4/module.c b/m4/module.c index 0b92cdeb..b8ce8d2f 100644 --- a/m4/module.c +++ b/m4/module.c @@ -152,7 +152,7 @@ install_builtin_table (m4 *context, m4_module *module) m4_symbol_pushdef (M4SYMTAB, name, strlen (name), value); if (m4_get_prefix_builtins_opt (context)) - free ((char *) name); + DELETE (name); } if (i) m4_debug_message (context, M4_DEBUG_TRACE_MODULE, @@ -649,7 +649,7 @@ module_remove (m4 *context, m4_module *module, m4_obstack *obs) { size_t i; for (i = 0; i < module->builtins_len; i++) - free ((char *) module->builtins[i].builtin.name); + DELETE (module->builtins[i].builtin.name); free (module->builtins); free (module); } diff --git a/m4/symtab.c b/m4/symtab.c index 710d1b39..3ab0353f 100644 --- a/m4/symtab.c +++ b/m4/symtab.c @@ -378,10 +378,10 @@ m4_symbol_value_delete (m4_symbol_value *value) switch (value->type) { case M4_SYMBOL_TEXT: - free ((char *) m4_get_symbol_value_text (value)); + DELETE (value->u.u_t.text); break; case M4_SYMBOL_PLACEHOLDER: - free ((char *) m4_get_symbol_value_placeholder (value)); + DELETE (value->u.u_t.text); break; case M4_SYMBOL_VOID: case M4_SYMBOL_FUNC: @@ -469,10 +469,10 @@ m4_symbol_value_copy (m4 *context, m4_symbol_value *dest, m4_symbol_value *src) switch (dest->type) { case M4_SYMBOL_TEXT: - free ((char *) m4_get_symbol_value_text (dest)); + DELETE (dest->u.u_t.text); break; case M4_SYMBOL_PLACEHOLDER: - free ((char *) m4_get_symbol_value_placeholder (dest)); + DELETE (dest->u.u_t.text); break; case M4_SYMBOL_VOID: case M4_SYMBOL_FUNC: |