Re: New ARI warning Sat Mar 12 01:53:29 UTC 2011

Mark Kettenis
2011-03-19T17:32:25Z

> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Date: Mon, 14 Mar 2011 15:20:48 +0100
>
> > > I'm fine with your suggestion, and in fact it's my preference
> > > as well. However, there _are_ cases where you just can't do that,
> > > because the return type + function name + parameter end up being
> > > too long for a single line.
> >
> > What's wrong with leaving a single long line in such cases? They are
> > supposed to be very rare (if typedefs are used for complex function
> > arguments).
>
> Take for instance a look at hppa-tdep.h:
> my patch changes
> <<<hppa-tdep.h>>>>
> extern struct hppa_objfile_private *
> hppa_init_objfile_priv_data (struct objfile *objfile);
> <<<hppa-tdep.h>>>>
> into:
>
> <<<hppa-tdep.h>>>>
> extern struct hppa_objfile_private *
> hppa_init_objfile_priv_data (struct objfile *objfile);
> <<<hppa-tdep.h>>>>
>
> Your suggestion would lead to:
> <<<hppa-tdep.h>>>>
> extern struct hppa_objfile_private * hppa_init_objfile_priv_data (struct
> objfile *objfile);
> <<<hppa-tdep.h>>>>
>
> on a single line (might have been corrupted by my mailer...)
> 91 column wide...
>
> but if you look at the rest of the hppa-tdep.h file, you will find:
>
> <<<hppa-tdep.h>>>>
> extern struct value *
> hppa_frame_prev_register_helper (struct frame_info *this_frame,
> struct trad_frame_saved_reg *saved_regs,
> int regnum);
>
> extern CORE_ADDR hppa_read_pc (struct regcache *regcache);
> extern void hppa_write_pc (struct regcache *regcache, CORE_ADDR pc);
> extern CORE_ADDR hppa_unwind_pc (struct gdbarch *gdbarch,
> struct frame_info *next_frame);
>
> extern struct minimal_symbol *
> hppa_lookup_stub_minimal_symbol (const char *name,
> enum unwind_stub_types stub_type);
>
> extern struct hppa_objfile_private * hppa_init_objfile_priv_data (struct
> objfile
> *objfile);
>
> extern int hppa_in_solib_call_trampoline (struct gdbarch *gdbarch,
> CORE_ADDR pc, char *name);
> extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR
> pc);
> <<<hppa-tdep.h>>>>
>
> So you can see that the ugly formatting, I proposed is already
> used twice.
> I found 37 occurrences listed below,
> should we considered those as badly formatted?

Indenting the function name with two spaces is what we traditionally
did for long prototypes. I think it is a perfectly fine solution for
the "problem" at hand.