From: "Jan Beulich" <JBeulich@novell.com>
To: <twall@alum.mit.edu>,<nickc@redhat.com>
Cc: <binutils@sources.redhat.com>
Subject: Re: gas/config/tc-tic54x.c's use of macro_struct and formal_struct
Date: Thu, 10 Mar 2005 08:01:00 -0000 [thread overview]
Message-ID: <s22ffeb2.084@emea1-mh.id2.novell.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3232 bytes --]
>>> 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 *));
[-- Attachment #2: binutils-mainline-tic54x-macro-structs.patch --]
[-- Type: text/plain, Size: 2222 bytes --]
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 reply other threads:[~2005-03-10 8:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-10 8:01 Jan Beulich [this message]
2005-03-10 8:47 ` Alan Modra
-- strict thread matches above, loose matches on Subject: below --
2005-03-09 10:12 Jan Beulich
2005-03-09 12:44 ` Nick Clifton
2005-03-09 14:04 ` Timothy Wall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s22ffeb2.084@emea1-mh.id2.novell.com \
--to=jbeulich@novell.com \
--cc=binutils@sources.redhat.com \
--cc=nickc@redhat.com \
--cc=twall@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).