[Spice-devel] [PATCH] miLineArc(): initialize edge1, edge2
Jonathon Jongsma
jjongsma at redhat.com
Wed May 9 21:24:51 UTC 2018
When compiling spice-common with meson/ninja under "release" mode, I get
the following compiler warnings:
../subprojects/spice-common/common/lines.c: In function ‘miLineArc’:
../subprojects/spice-common/common/lines.c:2167:17: error: ‘edge2.dx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->e += edge->dx; \
^~
../subprojects/spice-common/common/lines.c:2426:24: note: ‘edge2.dx’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2167:17: error: ‘edge2.e’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->e += edge->dx; \
^~
../subprojects/spice-common/common/lines.c:2426:24: note: ‘edge2.e’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2170:21: error: ‘edge2.signdx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->x += edge->signdx; \
^~
../subprojects/spice-common/common/lines.c:2426:24: note: ‘edge2.signdx’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2166:17: error: ‘edge2.stepx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->x += edge->stepx; \
^~
../subprojects/spice-common/common/lines.c:2426:24: note: ‘edge2.stepx’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2167:17: error: ‘edge1.dx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->e += edge->dx; \
^~
../subprojects/spice-common/common/lines.c:2426:17: note: ‘edge1.dx’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2167:17: error: ‘edge1.e’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->e += edge->dx; \
^~
../subprojects/spice-common/common/lines.c:2426:17: note: ‘edge1.e’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2170:21: error: ‘edge1.signdx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->x += edge->signdx; \
^~
../subprojects/spice-common/common/lines.c:2426:17: note: ‘edge1.signdx’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
../subprojects/spice-common/common/lines.c:2166:17: error: ‘edge1.stepx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
edge->x += edge->stepx; \
^~
../subprojects/spice-common/common/lines.c:2426:17: note: ‘edge1.stepx’ was declared here
PolyEdgeRec edge1, edge2;
^~~~~
cc1: all warnings being treated as errors
Initializing these structures to zero silences the warnings.
---
common/lines.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/lines.c b/common/lines.c
index e5097c4..7d30a03 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -2423,7 +2423,7 @@ miLineArc (GCPtr pGC,
int xorgi = 0, yorgi = 0;
Spans spanRec;
int n;
- PolyEdgeRec edge1, edge2;
+ PolyEdgeRec edge1 = {0}, edge2 = {0};
int edgey1, edgey2;
Boolean edgeleft1, edgeleft2;
--
2.14.3
More information about the Spice-devel
mailing list