diff --git a/idlib/Str.h b/idlib/Str.h index 35d037c..3ac1cd6 100644 --- a/idlib/Str.h +++ b/idlib/Str.h @@ -503,6 +503,10 @@ ID_INLINE idStr::operator const char *( void ) const { return c_str(); } +#pragma GCC diagnostic push +// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that +// (X - c) > X is always false [-Wstrict-overflow]" +#pragma GCC diagnostic ignored "-Wstrict-overflow" ID_INLINE char idStr::operator[]( int index ) const { assert( ( index >= 0 ) && ( index <= len ) ); return data[ index ]; @@ -512,6 +516,7 @@ ID_INLINE char &idStr::operator[]( int index ) { assert( ( index >= 0 ) && ( index <= len ) ); return data[ index ]; } +#pragma GCC diagnostic pop ID_INLINE void idStr::operator=( const idStr &text ) { int l; @@ -912,12 +917,17 @@ ID_INLINE idStr idStr::Left( int len ) const { return Mid( 0, len ); } +#pragma GCC diagnostic push +// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that +// (X - c) > X is always false [-Wstrict-overflow]" +#pragma GCC diagnostic ignored "-Wstrict-overflow" ID_INLINE idStr idStr::Right( int len ) const { if ( len >= Length() ) { return *this; } return Mid( Length() - len, len ); } +#pragma GCC diagnostic pop ID_INLINE void idStr::Strip( const char c ) { StripLeading( c ); diff --git a/idlib/containers/List.h b/idlib/containers/List.h index 7389267..ddb214f 100644 --- a/idlib/containers/List.h +++ b/idlib/containers/List.h @@ -356,6 +356,10 @@ Allocates memory for the amount of elements requested while keeping the contents Contents are copied using their = operator so that data is correnctly instantiated. ================ */ +#pragma GCC diagnostic push +// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that +// (X - c) > X is always false [-Wstrict-overflow]" +#pragma GCC diagnostic ignored "-Wstrict-overflow" template< class type > ID_INLINE void idList::Resize( int newsize ) { type *temp; @@ -376,6 +380,7 @@ ID_INLINE void idList::Resize( int newsize ) { temp = list; size = newsize; + if ( size < num ) { num = size; } @@ -391,6 +396,7 @@ ID_INLINE void idList::Resize( int newsize ) { delete[] temp; } } +#pragma GCC diagnostic pop /* ================ @@ -549,6 +555,10 @@ ID_INLINE idList &idList::operator=( const idList &other ) { return *this; } +#pragma GCC diagnostic push +// shut up GCC's stupid "warning: assuming signed overflow does not occur when assuming that +// (X - c) > X is always false [-Wstrict-overflow]" +#pragma GCC diagnostic ignored "-Wstrict-overflow" /* ================ idList::operator[] const @@ -580,6 +590,7 @@ ID_INLINE type &idList::operator[]( int index ) { return list[ index ]; } +#pragma GCC diagnostic pop /* ================