Suppress strange -Wunsafe-loop-optimizations in wxString code
The error message wx/string.h:558:47: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations] for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ ) ~~^~~~~~~~~~~ doesn't seem to really make much sense, as it shouldn't overflow here.
This commit is contained in:
@@ -554,6 +554,12 @@ private:
|
||||
if ( cacheBegin == NULL )
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
// gcc 7 warns about not being able to optimize this loop because of
|
||||
// possible loop variable overflow, really not sure what to do about
|
||||
// this, so just disable this warnings for now
|
||||
wxGCC_ONLY_WARNING_SUPPRESS(unsafe-loop-optimizations)
|
||||
|
||||
Cache::Element * const cacheEnd = GetCacheEnd();
|
||||
for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ )
|
||||
{
|
||||
@@ -561,6 +567,8 @@ private:
|
||||
return c;
|
||||
}
|
||||
|
||||
wxGCC_ONLY_WARNING_RESTORE(unsafe-loop-optimizations)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user