engine: fix -Wincompatible-pointer-types, add it to Werror list

This commit is contained in:
Alibek Omarov 2019-11-28 19:18:50 +03:00
parent 08e7bb1bf4
commit c07109e69c
7 changed files with 10 additions and 9 deletions

View File

@ -612,7 +612,7 @@ void R_CollectRendererNames( void )
pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME ); pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME );
if( !pfn ) // just in case if( !pfn ) // just in case
{ {
Con_Reportf( "R_CollectRendererNames: can't find GetHumanReadableName export in %s\n", temp, COM_GetLibraryError() ); Con_Reportf( "R_CollectRendererNames: can't find GetHumanReadableName export in %s\n", temp );
Q_strncpy( ref.readableNames[i], renderers[i], sizeof( ref.readableNames[i] )); Q_strncpy( ref.readableNames[i], renderers[i], sizeof( ref.readableNames[i] ));
} }
else else

View File

@ -595,7 +595,7 @@ void Cvar_Set( const char *var_name, const char *value )
if( !var_name ) if( !var_name )
{ {
// there is an error in C code if this happens // there is an error in C code if this happens
Con_Printf( "Cvar_Set: passed NULL variable name\n", var_name ); Con_Printf( "Cvar_Set: passed NULL variable name\n" );
return; return;
} }
@ -649,7 +649,7 @@ float Cvar_VariableValue( const char *var_name )
if( !var_name ) if( !var_name )
{ {
// there is an error in C code if this happens // there is an error in C code if this happens
Con_Printf( "Cvar_VariableValue: passed NULL variable name\n", var_name ); Con_Printf( "Cvar_VariableValue: passed NULL variable name\n" );
return 0.0f; return 0.0f;
} }
@ -686,7 +686,7 @@ const char *Cvar_VariableString( const char *var_name )
if( !var_name ) if( !var_name )
{ {
// there is an error in C code if this happens // there is an error in C code if this happens
Con_Printf( "Cvar_VariableString: passed NULL variable name\n", var_name ); Con_Printf( "Cvar_VariableString: passed NULL variable name\n" );
return ""; return "";
} }

View File

@ -116,7 +116,7 @@ static void COM_GenerateServerLibraryPath( char *out, size_t size )
#else #else
string dllpath; string dllpath;
char *ext; const char *ext;
#if XASH_WIN32 #if XASH_WIN32
Q_strncpy( dllpath, GI->game_dll, sizeof( dllpath ) ); Q_strncpy( dllpath, GI->game_dll, sizeof( dllpath ) );

View File

@ -65,14 +65,14 @@ typedef struct
dleaf_t *leafs; dleaf_t *leafs;
dleaf32_t *leafs32; dleaf32_t *leafs32;
}; };
int numleafs; size_t numleafs;
union union
{ {
dclipnode_t *clipnodes; dclipnode_t *clipnodes;
dclipnode32_t *clipnodes32; dclipnode32_t *clipnodes32;
}; };
int numclipnodes; size_t numclipnodes;
dtexinfo_t *texinfo; dtexinfo_t *texinfo;
size_t numtexinfo; size_t numtexinfo;

View File

@ -97,7 +97,7 @@ static int ioctl_stub( int d, unsigned long r, ... )
#define closesocket close #define closesocket close
#define SOCKET int #define SOCKET int
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
typedef size_t WSAsize_t; typedef socklen_t WSAsize_t;
#else // WIN32 #else // WIN32
typedef int WSAsize_t; // for some reason, MS has signed size. We won't exceed 2^32, probably, so just typedef it typedef int WSAsize_t; // for some reason, MS has signed size. We won't exceed 2^32, probably, so just typedef it
#endif #endif

View File

@ -87,7 +87,7 @@ static const dframetype_t *R_SpriteLoadFrame( model_t *mod, const void *pin, msp
pspriteframe->gl_texturenum = gl_texturenum; pspriteframe->gl_texturenum = gl_texturenum;
*ppframe = pspriteframe; *ppframe = pspriteframe;
return ( const dspriteframe_t* )(( const byte* )pin + sizeof( dspriteframe_t ) + pinframe.width * pinframe.height * bytes ); return ( const dframetype_t* )(( const byte* )pin + sizeof( dspriteframe_t ) + pinframe.width * pinframe.height * bytes );
} }
/* /*

View File

@ -235,6 +235,7 @@ def configure(conf):
'-Werror=duplicated-branches', # BEWARE: buggy '-Werror=duplicated-branches', # BEWARE: buggy
'-Werror=bool-compare', '-Werror=bool-compare',
'-Werror=bool-operation', '-Werror=bool-operation',
'-Werror=incompatible-pointer-types',
# '-Wdouble-promotion', # disable warning flood # '-Wdouble-promotion', # disable warning flood
'-Wstrict-aliasing', '-Wstrict-aliasing',
] ]