Eric Blake wrote: > On 01/27/2011 08:16 AM, Jim Meyering wrote: >>>>> @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \ >>> >>> Is there a way to tighten it, by passing the grep output through a sed >>> script that combines multiple lines (easily determined by the difference >>> between file: and file- for matching vs. context lines and the -- >>> separator between hunks), then limit the detection of the capital letter >>> to one occurring after error( but before ';'? >> >> That sounds like it'd be an improvement. With that, we could >> search a couple more lines of following context, too. >> While I haven't been willing to spend any more time on it, >> you're welcome to do so. >> >> One tiny fly in the ointment: ';' inside a string or in a comment >> between concatenated strings would cause trouble. > > Yes, it means possible false negatives, but that's probably not a > practical concern. Really, who writes code this awful, with a ; in a > comment prior to the error message? > > error (0, errno, /* ; */ _("Oops"));
It doesn't have to be awful: error (0, errno, /* a few words; more words. */ _("Oops")); but, as I said, it's a tiny fly. > Whereas a ';' inside a string is not too likely to cause issues; this > (mis-)usage would still be caught: > > error (0, errno, "%s", _("Oops; you did something wrong")); > > because we are looking for any instance of "[A-Z] after the open ( but > before the first ;, and a ; within the string is after the point we care > about. Good point.