From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24435 invoked by alias); 10 Mar 2005 08:01:58 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 23840 invoked from network); 10 Mar 2005 08:00:51 -0000 Received: from unknown (HELO emea1-mh.id2.novell.com) (195.33.99.129) by sourceware.org with SMTP; 10 Mar 2005 08:00:51 -0000 Received: from EMEA1-MTA by emea1-mh.id2.novell.com with Novell_GroupWise; Thu, 10 Mar 2005 08:00:50 +0100 Message-Id: Date: Thu, 10 Mar 2005 08:01:00 -0000 From: "Jan Beulich" To: , Cc: Subject: Re: gas/config/tc-tic54x.c's use of macro_struct and formal_struct Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part577437AC.2__=" X-SW-Source: 2005-03/txt/msg00292.txt.bz2 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part577437AC.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 3232 >>> Timothy Wall 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 * 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 *)); --=__Part577437AC.2__= Content-Type: text/plain; name="binutils-mainline-tic54x-macro-structs.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="binutils-mainline-tic54x-macro-structs.patch" Content-length: 2222 Built and tested cross for tic54x-coff on i686-pc-linux-gnu. Jan gas/ 2005-03-10 Jan Beulich * 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 *)); --=__Part577437AC.2__=--