[PATCH] rs6000/sysv4.h: Add missing ASM_NAME_TO_STRING macro

Jeffrey A Law law@upchuck.cygnus.com
Tue May 25 12:18:00 GMT 1999


  In message < 4.2.0.54.19990525191950.04696090@mail.lauterbach.com >you write:
  > At 19:00 25.05.99 , Jeffrey A Law wrote:
  > >I think the way to go is:
  > >
  > >   1. Define a default STRIP_NAME_ENCODING that merely strips out '*'.
  > >      Backends are allowed to override this definition.  You might want to
  > >      put the default definition in output.h.
  > >
  > >   2. Now that we can depend on STRIP_NAME_ENCODING always being defined,
  > >      update ASM_NAME_TO_STRING in dwarf2out.c to use it.
  > >
  > >This avoids useless code duplication, will work for all our targets that
  > >do name encoding (and there are several) and in general reduces the
  > >maintenance burden for this code.
  > 
  > That was my first thought too, but it won't work with the 
  > ASM_NAME_TO_STRING macro. That would need an additional 
  > CHAR_IS_NAME_ENCODING macro or maybe ASM_NAME_TO_STRING can strcmp the 
  > original name and the stripped name for decision? Would such a patch 
  > accepted for the release?
I don't completely follow the need to copy the string or a special macro
to determine if the string had an encoding.

STRIP_NAME_ENCODING accepts two arguments.  target & source, both are
char *s.  So I would think ASM_NAME_TO_STRING could then be implemented
with something like this:

{
  char *realname;

  STRIP_NAME_ENCODING (realname, NAME);
  if ((NAME[0] == '*'))
    dyn_string_append (STR, realname)
  else
    {
      dyn_string_append (STR, user_label_prefix)
      dyn_string_append (STR, realname);
    }
}




More information about the Gcc-patches mailing list