On Thu, 18 Nov 2010, Joern Rennecke wrote:
> Maybe you should talk more with your colleagues. I had protested when the
> CUMULATIVE_ARGS taking vectors were added to targetm, and I was told they'd
> be changed to taking void *, thus eliminating the problem.
> Now people don't want void * because it lacks type safety. So these hooks
> are really in the wrong place now. The target vector is a farce because
You can perfectly well do type safety without using void *.
struct cumulative_args;
type hook(struct cumulative_args *arg);
static inline struct x86_cumulative_args *
x86_get_cumulative_args (struct cumulative_args *arg)
{
return (struct x86_cumulative_args *) arg;
}
and then use x86_get_cumulative_args in the hook implementations to
convert the target-independent type to the target-dependent one, keeping
the cast in one place per target only. Or many other variations that
involve an opaque type, not void *, in the target-independent code.
> you can only use it if you include a header file that includes tm.h,
> so target macro use can creep in undetected.
Yes, that should indeed be fixed. You don't need to split up the target
vector to do so.
> And target vectors of different targets are not type compatible, thus
> a front end has to be compiled for a particular target for standards
> compliance.
Yes, that should indeed be fixed. You don't need to split up the target
vector to do so, just give the hooks suitable types (and I think they
should be given target-independent types whether or not you split it up).
> Are you willing to do a review of:
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01813.html ?
That does not appear to be a patch in areas that I maintain.
--
Joseph S. Myers
[email protected]