[Spice-devel] [PATCH v2] miLineArc(): initialize edge1, edge2
Jonathon Jongsma
jjongsma at redhat.com
Thu May 10 14:21:29 UTC 2018
When compiling spice-common with meson/ninja under "release" mode, I get
several compiler warnings about possibly-uninitialized members. For
example:
../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;
^~~~~
Initializing these structures to zero silences the warnings.
---
Changes in v2:
- only keep one compiler warning in log
- change spacing to match upstream changes to this file
common/lines.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/lines.c b/common/lines.c
index e5097c4..dadaf86 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