QRegion: upgrade Q_ASSUME to Q_ASSERT
This is to fix the warning qregion.cpp:3582:12: error: ‘ET.EdgeTable::ymax’ may be used uninitialized [-Werror=maybe-uninitialized] Because the previous code in PolygonRegion() was: Q_ASSUME(Count > 1); But Q_ASSUME is becoming a no-op with GCC 12, so when this disappears, compiler rightly considered Count < 2 as a valid input. Therefore, when CreateETandAET() was called and had if (count < 2) return; The compiler again rightly concluded that it was a valid condition (after all, you're checking it!), leading to ET.ymax being used uninitialized. Since that Q_ASSUME really meant the condition of Count < 2 was not permitted, we may as well upgrade to Q_ASSERT in both places. Change-Id: I7f354474adce419ca6c2fffd1748119ef0092fa4 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
52c7f699ac
commit
8dbceaa398
@ -3191,8 +3191,7 @@ static void CreateETandAET(int count, const QPoint *pts,
|
||||
int iSLLBlock = 0;
|
||||
int dy;
|
||||
|
||||
if (count < 2)
|
||||
return;
|
||||
Q_ASSERT(count > 1);
|
||||
|
||||
/*
|
||||
* initialize the Active Edge Table
|
||||
@ -3538,7 +3537,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
|
||||
POINTBLOCK *tmpPtBlock;
|
||||
int numFullPtBlocks = 0;
|
||||
|
||||
Q_ASSUME(Count > 1);
|
||||
Q_ASSERT(Count > 1);
|
||||
|
||||
region = new QRegionPrivate;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user