Re: [PATCH] git-compat-util: Avoid strcasecmp() being inlined

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] git-compat-util: Avoid strcasecmp() being inlined

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:51

Jeff King [off-list ref] writes:
On Thu, Sep 19, 2013 at 11:47:51AM +0200, Piotr Krukowiecki wrote:
quoted
quoted
quoted
quoted
it still ends up as a single function call). The downside is that it has
to be remembered at each site that uses strcasecmp, but we do not use
pointers to standard library functions very often.
Is it possible to add a test which fails if wrapper is not used?
No test needed for this, as compilation or linkage will fail, I think.
But only when someone compiles on MinGW, no?
Yeah. I think a more clear way to phrase the question would be: is there
some trick we can use to booby-trap strcasecmp as a function pointer so
that it fails to compile even on systems where it would otherwise work?
That line of thought nudges us toward the place Linus explicitly
said he didn't want to see us going, no?  We do not particularly
want to care the exact nature of the breakage on MinGW.  Do we
really want to set a booby-trap that intimately knows about how
their strcasecmp is broken, and possibly cover breakages of the same
kind but with other functions?

It isn't like "we are deliberately relying on this non-standard
behaviour we see on the system _we_ commonly use, and somebody on
a new strictly POSIX platform may be bitten by it", in which case it
would make sense to have a test that intimately knows about the
non-standard behaviour we rely on.  This case is a total opposite.

Re: [PATCH] git-compat-util: Avoid strcasecmp() being inlined

From: Jeff King <hidden>
Date: 2016-06-15 22:58:51

On Thu, Sep 19, 2013 at 03:03:46PM -0700, Junio C Hamano wrote:
quoted
quoted
But only when someone compiles on MinGW, no?
Yeah. I think a more clear way to phrase the question would be: is there
some trick we can use to booby-trap strcasecmp as a function pointer so
that it fails to compile even on systems where it would otherwise work?
That line of thought nudges us toward the place Linus explicitly
said he didn't want to see us going, no?  We do not particularly
want to care the exact nature of the breakage on MinGW.  Do we
really want to set a booby-trap that intimately knows about how
their strcasecmp is broken, and possibly cover breakages of the same
kind but with other functions?
Exactly. You snipped my second paragraph, but the gist of it was "...and
no, we do not want to go there". Calling it a booby-trap was meant to be
derogatory. :)

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help