PATCH: removes expand_constant language hook

Mark Mitchell mark@codesourcery.com
Fri Mar 16 00:56:00 GMT 2007


Ollie Wild wrote:

> :ADDPATCH c++:
> 
> 2007-03-14  Ollie Wild  <aaw@google.com>
> 
>       * varasm.c (compare_constant): Removed call to
>       lang_hooks.expand_constant.
>       (copy_constants): Removed call to lang_hooks.expand_constant.
>       (compute_reloc_for_constant): Removed call to
>       lang_hooks.expand_constant.
>       (output_addressed_constants): Removed call to
>       lang_hooks.expand_constant.
>       (constructor_static_from_elts_p): Removed call to
>       lang_hooks.expand_constant.
>       (output_constant): Removed calls to lang_hooks.expand_constant.
>       * langhooks.h (struct lang_hooks): Removed field expand_constant.
>       * langhooks-def.h (lhd_return_tree): Removed.
>       (LANG_HOOKS_EXPAND_CONSTANT): Removed.
>       (LANG_HOOKS_INITIALIZER): Removed LANG_HOOKS_EXPAND_CONSTANT.
>       * langhooks.c (lhd_return_tree): Removed.
> 
> 2007-03-14  Ollie Wild  <aaw@google.com>
> 
>       * typeck2.c (store_init_value): Call cplus_expand_constant after
>       digest_init.
>       * cp-objcp-common.h (LANG_HOOKS_EXPAND_CONSTANT): Removed.
>       * expr.c (cplus_expand_constant): Updated function description.

I like this idea, but I'm not sure if it works -- does it handle
recursion in the initializer?  Like:

  struct S {
    void foo();
    void bar();
  };
  typedef void (S::*PM)();
  PM a[] = { &S::foo, &S::bar };
  struct T {
    PM pm1;
    PM pm2;
  };
  T t = { &S::foo, &S::bar };

?

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list