From: Matthew Fernandez Date: Thu, 8 Sep 2022 00:27:49 +0000 (-0700) Subject: neatogen makeObstacle: squash -Wmaybe-uninitialized warnings X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b7c4bcc2828fc77f2577db3115acacbb3961890;p=graphviz neatogen makeObstacle: squash -Wmaybe-uninitialized warnings This seems to be a false positive, but to figure this out requires non-trivial reasoning about the control flow in this function. We may as well remove the need to think about this. This squashes these warnings: neatosplines.c: In function ‘makeObstacle’: neatosplines.c:360:37: warning: ‘margin.y’ may be used uninitialized in this function [-Wmaybe-uninitialized] 360 | ymargin = -margin.y; | ~~~~~~~~^~~~~~~~~~~ neatosplines.c:351:37: warning: ‘margin.x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 351 | xmargin = -margin.x; | ~~~~~~~~^~~~~~~~~~~ --- diff --git a/lib/neatogen/neatosplines.c b/lib/neatogen/neatosplines.c index f03da45be..1d3531706 100644 --- a/lib/neatogen/neatosplines.c +++ b/lib/neatogen/neatosplines.c @@ -288,7 +288,7 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin, bool isOrtho) pointf* verts = NULL; pointf vs[4]; pointf p; - pointf margin; + pointf margin = {0}; switch (shapeOf(n)) { case SH_POLY: @@ -299,7 +299,6 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin, bool isOrtho) isPoly = true; sides = 4; verts = vs; - margin.x = margin.y = 0; /* For fixedshape, we can't use the width and height, as this includes * the label. We only want to use the actual node shape. */