Re: [ANNOUNCE] Git v2.19.0-rc0
flat view
From: Jeff King <hidden>
Date: 2018-08-23 23:40:53
On Thu, Aug 23, 2018 at 04:30:10PM -0700, Jacob Keller wrote:
On Thu, Aug 23, 2018 at 9:30 AM Jeff King [off-list ref] wrote:quoted
I think that audit isn't actually too bad (but definitely not something we should do for v2.19). The cocci patch I showed earlier hits most of them. It misses the negated ones (e.g., "if (oidcmp(...))"). I'm not sure if there's a way to ask coccinelle only for oidcmp() used in a boolean context.You can look for explicitly "if (oidcmp(...))" though. I don't know if you can catch *any* use which degrades to boolean outside of an if statement, but I wouldn't expect there to be too many of those?
Yeah, that was my thought, too. And I've been trying this all afternoon without success. Why doesn't this work: @@ expression a, b; @@ - if (oidcmp(a, b)) + if (!oideq(a, b)) I get: Fatal error: exception Failure("minus: parse error: \n = File \"contrib/coccinelle/oideq.cocci\", line 21, column 0, charpos = 221\n around = '', whole content = \n") If I do: - if (oidcmp(a, b)) { ... } that seems to please the parser for the minus line. But I cannot include the "..." on the plus line. Clearly the "..." part should be context, but I can't seem to find the right syntax. FWIW, I do have patches adding hasheq() and converting all of the !oidcmp() cases. I may resort to hand-investigating each of the negated ones, but I really feel like I should be able to do better with coccinelle. -Peff