Thread (13 messages) 13 messages, 4 authors, 2022-12-07

Re: [PATCH] git-compat-util.h: introduce CALLOC(x)

From: Taylor Blau <hidden>
Date: 2022-12-05 22:36:36

On Mon, Dec 05, 2022 at 10:01:11PM +0100, René Scharfe wrote:
This rule would turn this code:

	struct foo *bar = xcalloc(1, sizeof(*bar));
	int i;

... into:

	struct foo *bar;
	CALLOC(bar);
	int i;

... which violates the coding guideline to not mix declarations and
statements (-Wdeclaration-after-statement).
Yeah, I was wondering about this myself when I wrote this part of the
Coccinelle patch.

Is there an intelligent way to tell it to put the first statement after
all declarations? I couldn't find anything after a quick scan of the
documentation nor our own patches.

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