Re: [PATCH v2] pretty: add %(decorate[:<options>]) format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 23 Jul 2023 at 17:26, Phillip Wood  wrote:
>
> On 19/07/2023 19:16, Glen Choo wrote:
> >>      case 'D':
> >> -            format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
> >> +            format_decorations(sb, commit, c->auto_color,
> >> +                               &(struct decoration_options){"", ""});
> >
> > I don't remember if C99 lets you name .prefix and .suffix here, but if
> > so, it would be good to name them. Otherwise it's easy to get the order
> > wrong, e.g. if someone reorders the fields in struct decoration_options.
>
> That's a good suggestion. I think this would be the first use of a
> compound literal in the code base so it would be helpful to mention that
> in the commit message.

I've taken the suggestion, but then forgot to mention it in the commit
message. Will do in the next round.

> We've been depending on C99 for a while now so I'd support adding this
> compound literal as a test balloon for compiler support. Ævar reported a
> while back that they are supported by IBM xlc, Oracle SunCC and HP/UX's
> aCC[1] and back then I looked at NonStop which seemed to offer support
> with the right compiler flag.

There are a number of uses of designated initializers already, so
hopefully compound literals aren't too much of an extra challenge.

Thanks,
Andy




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux