This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] macro hooks (revised)


   Date: Wed, 08 Mar 2000 14:55:37 -0500
   From: Timothy Wall <twall@domesolutions.com>

   + 	* sb.h:  Add argument to prototype for input_scrib_include_sb.

Typo for input_scrub.

   !   if (do_check)
   !     {
   !       if (macro_nest > max_macro_nest)
   !         as_fatal (_("macros nested too deeply"));
   !       ++macro_nest;
   ! #ifdef md_macro_start
   !       md_macro_start ();
   ! #endif
   !     }

I think you should do the macro_nest checks unconditionally.  I see no
benefit to omitting them.  On the other hand, if you do them, you will
catch an infinite recursion.

It's not clear to me why md_macro_start should only be called

conditionally.  If this is correct, it needs to be documented somehow.
   !           if (check_from_sb)
   !             {
   !               cond_finish_check (macro_nest);
   !               /* allow the target to clean up per-macro expansion data */
   ! #ifdef md_macro_end
   !               md_macro_end ();
   ! #endif
   !               --macro_nest;
   !             }

Here again macro_nest should be unconditional, and I suspect that
md_macro_end should be unconditional.

   + /* Insert a (usually automatically generated) file into the input stream;
   +    the path must resolve to an actual file; no include path searching or
   +    dependency registering is performed.  */

The file is not usually automatically generated.  This function is
used to process the standard .include directive.  I don't know why you
say that in the comment, and I think it should be omitted.

   + @item md_macro_start
   + @cindex md_macro_start
   + GAS will call this function when it starts to include a macro expansion.
   + 'macro_nest' indicates the current macro nesting level, which includes the one
   + being expanded. 

Say something like ``if this macro is defined.''  Say something like
``the global variable macro_nest''.  Do not invent your own quoting
for macro_nest; use standard texinfo constructs.  It should be
@code{macro_nest}.

   + @item md_macro_info
   + @cindex md_macro_info
   + GAS will call this function after the macro expansion has been included and
   + after parsing the macro arguments.  The single argument is a pointer to the
   + macro processing's internal representation of the macro, which includes
   + expansion of the formal arguments.

Again, gas will only call this if the macro is defined.  It is a
macro, not a function.  Indicate the type of the parameter
(macro_entry *); if you do that, you don't need to further describe
it.

   + @item md_macro_end
   + @cindex md_macro_end
   + Complement to md_macro_start, called when finished processing an inserted macro
   + expansion, just before decrementing macro_nest.

Again, this is only called if it is defined.


If you fix these, this is OK.

Ian

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]