mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2025-02-17 17:41:48 +00:00
Get rid of some compiler warnings
GCC had shitloads of superfluous warnings wherever List.h and Str.h were included.. get rid of them by using #pragma GCC diagnostic at some places in List.h and Str.h. Also add some casts, initialize some variables for other warnings
This commit is contained in:
parent
a1f72df989
commit
01545faf94
2 changed files with 21 additions and 0 deletions
10
idlib/Str.h
10
idlib/Str.h
|
@ -503,6 +503,10 @@ ID_INLINE idStr::operator const char *( void ) const {
|
||||||
return c_str();
|
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 {
|
ID_INLINE char idStr::operator[]( int index ) const {
|
||||||
assert( ( index >= 0 ) && ( index <= len ) );
|
assert( ( index >= 0 ) && ( index <= len ) );
|
||||||
return data[ index ];
|
return data[ index ];
|
||||||
|
@ -512,6 +516,7 @@ ID_INLINE char &idStr::operator[]( int index ) {
|
||||||
assert( ( index >= 0 ) && ( index <= len ) );
|
assert( ( index >= 0 ) && ( index <= len ) );
|
||||||
return data[ index ];
|
return data[ index ];
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
ID_INLINE void idStr::operator=( const idStr &text ) {
|
ID_INLINE void idStr::operator=( const idStr &text ) {
|
||||||
int l;
|
int l;
|
||||||
|
@ -912,12 +917,17 @@ ID_INLINE idStr idStr::Left( int len ) const {
|
||||||
return Mid( 0, len );
|
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 {
|
ID_INLINE idStr idStr::Right( int len ) const {
|
||||||
if ( len >= Length() ) {
|
if ( len >= Length() ) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
return Mid( Length() - len, len );
|
return Mid( Length() - len, len );
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
ID_INLINE void idStr::Strip( const char c ) {
|
ID_INLINE void idStr::Strip( const char c ) {
|
||||||
StripLeading( c );
|
StripLeading( c );
|
||||||
|
|
|
@ -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.
|
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 >
|
template< class type >
|
||||||
ID_INLINE void idList<type>::Resize( int newsize ) {
|
ID_INLINE void idList<type>::Resize( int newsize ) {
|
||||||
type *temp;
|
type *temp;
|
||||||
|
@ -376,6 +380,7 @@ ID_INLINE void idList<type>::Resize( int newsize ) {
|
||||||
|
|
||||||
temp = list;
|
temp = list;
|
||||||
size = newsize;
|
size = newsize;
|
||||||
|
|
||||||
if ( size < num ) {
|
if ( size < num ) {
|
||||||
num = size;
|
num = size;
|
||||||
}
|
}
|
||||||
|
@ -391,6 +396,7 @@ ID_INLINE void idList<type>::Resize( int newsize ) {
|
||||||
delete[] temp;
|
delete[] temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
|
@ -549,6 +555,10 @@ ID_INLINE idList<type> &idList<type>::operator=( const idList<type> &other ) {
|
||||||
return *this;
|
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<type>::operator[] const
|
idList<type>::operator[] const
|
||||||
|
@ -580,6 +590,7 @@ ID_INLINE type &idList<type>::operator[]( int index ) {
|
||||||
|
|
||||||
return list[ index ];
|
return list[ index ];
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
|
|
Loading…
Reference in a new issue