[PATCH] macro hooks

Timothy Wall twall@domesolutions.com
Wed Feb 23 16:14:00 GMT 2000

What I want to do is replace "ABC" in the input stream with "DEF".  The input
stream consists entirely of data within sbs.   In order to do a replacement, it
makes sense to either 1) replace one sb with another or 2) change the contents of
an sb.

Ideally, this would be done at the preprocessor level; however, the substitutions
to be done are based on the results of assembler directives.


Ian Lance Taylor wrote:

>    Date: Wed, 23 Feb 2000 13:45:12 -0500
>    From: Timothy Wall <twall@alum.mit.edu>
>      The sb handling expects an entire conditional clause (or macro definition)
>    to be contained within a single sb; if the the line above is in its own sb,
>    the conditional checking reaches the end of the line's sb and complains b/c
>    it hasn't seen the endif before the end of sb.  Perhaps there is a different
>    way of modifying the sb contents to avoid this issue.
> You do not have to modify the sb contents at all.  I don't understand
> why you think you do.  Sure, the current sb handling expects an entire
> macro definition to be inside an sb.  But that has nothing whatsoever
> to do with the sb itself.  That only has to do with how it is being
> used.  You want to store an additional flag inside the sb, but there
> is no reason to do that.  The sb just holds data.
>      The push and pop don't cleanly map b/c the original line is being replaced
>    rather than a new line of different input inserted.
> Your patch already does a push and a pop, so it already maps cleanly.
> The push is done in input_scrub_include_sb and the pop is done
> input_scrub_next_buffer after reading the whole sb.  This has nothing
> to do with whether a line is being replaced or inserted.  A macro
> definition replaces a line too; it replaces the macro call.
> Ian

More information about the Binutils mailing list