gas/config/tc-tic54x.c's use of macro_struct and formal_struct
Jan Beulich
JBeulich@novell.com
Thu Mar 10 08:01:00 GMT 2005
>>> Timothy Wall <twall@alum.mit.edu> 09.03.05 15:04:36 >>>
>Since it looks like I moved those structs into macro.h in the first
>place to make them publicly accessible, I'm guessing the duplicated
>code in the tic54x file pre-dates moving the structs into macro.h, and
>was never properly cleaned up.
>
>Please contribute a patch.
>
>T.
>
>On Mar 9, 2005, at 7:56 AM, Nick Clifton wrote:
>
>> Hi Jan,
>>
>>> As I'm intending to add one or two elements to macro_struct (to
allow
>>> .purgem to free the memory allocated by .macro) I'd like to
understand
>>> what, if any, reasons there are for this file, in function
>>> tic54x_macro_info, to redeclare these two structures instead of
using
>>> them (or even better their typedef equivalents) from the already
>>> included macro.h.
>>
>> As far as I can tell this was an ill-advised piece of coding. The
>> typedefs from macro.h should have been used as you suggested.
Please
>> feel free to contribute a patch to do just this.
>>
>> Cheers
>> Nick
Built and tested cross for tic54x-coff on i686-pc-linux-gnu.
Jan
gas/
2005-03-10 Jan Beulich <jbeulich@novell.com>
* config/tc-tic54x.h (tic54x_macro_info): Change parameter
type.
* config/tc-tic54x.c (tic54x_macro_info): Likewise. Replace
hand-
crafted structure declaractions with the types from macro.h.
---
/home/jbeulich/src/binutils/mainline/2005-03-08/gas/config/tc-tic54x.c 2005-03-04
15:51:46.000000000 +0100
+++ 2005-03-08/gas/config/tc-tic54x.c 2005-03-10 08:44:11.847979016
+0100
@@ -2700,29 +2700,10 @@ tic54x_macro_start ()
}
void
-tic54x_macro_info (info)
- void *info;
+tic54x_macro_info (macro)
+ const macro_entry *macro;
{
- struct formal_struct
- {
- struct formal_struct *next; /* Next formal in list */
- sb name; /* Name of the formal */
- sb def; /* The default value */
- sb actual; /* The actual argument (changed
on
- each expansion) */
- int index; /* The index of the formal
- 0 .. formal_count - 1 */
- } *entry;
- struct macro_struct
- {
- sb sub; /* Substitution text. */
- int formal_count; /* Number of formal args. */
- struct formal_struct *formals; /* Pointer to list of
- formal_structs. */
- struct hash_control *formal_hash; /* Hash table of formals. */
- } *macro;
-
- macro = (struct macro_struct *) info;
+ const formal_entry *entry;
/* Put the formal args into the substitution symbol table. */
for (entry = macro->formals; entry; entry = entry->next)
---
/home/jbeulich/src/binutils/mainline/2005-03-08/gas/config/tc-tic54x.h 2001-11-13
15:22:41.000000000 +0100
+++ 2005-03-08/gas/config/tc-tic54x.h 2005-03-10 08:43:54.707584752
+0100
@@ -97,7 +97,8 @@ extern void tic54x_macro_start (void);
#define md_macro_end() tic54x_macro_end()
extern void tic54x_macro_end (void);
#define md_macro_info(args) tic54x_macro_info(args)
-extern void tic54x_macro_info PARAMS((void *macro));
+struct macro_struct;
+extern void tic54x_macro_info PARAMS((const struct macro_struct *));
#define tc_frob_label(sym) tic54x_define_label (sym)
extern void tic54x_define_label PARAMS((symbolS *));
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-mainline-tic54x-macro-structs.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050310/3f03d1f0/attachment.ksh>
More information about the Binutils
mailing list