mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-01-31 04:50:42 +00:00
* Fix various warnings with GCC and clang
This commit is contained in:
parent
675e7a641a
commit
fd986dae06
8 changed files with 31 additions and 22 deletions
6
Makefile
6
Makefile
|
@ -276,7 +276,7 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
|
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
|
||||||
-Wno-self-assign -pipe -DUSE_ICON
|
-pipe -DUSE_ICON
|
||||||
CLIENT_CFLAGS += $(SDL_CFLAGS)
|
CLIENT_CFLAGS += $(SDL_CFLAGS)
|
||||||
|
|
||||||
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
|
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
|
||||||
|
@ -902,6 +902,10 @@ else
|
||||||
RENDERER_LIBS += -ljpeg
|
RENDERER_LIBS += -ljpeg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
|
||||||
|
BASE_CFLAGS += -Qunused-arguments
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef DEFAULT_BASEDIR
|
ifdef DEFAULT_BASEDIR
|
||||||
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
|
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -506,9 +506,7 @@ static int CG_CalcFov( void ) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
|
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
|
||||||
if ( f > 1.0 ) {
|
if ( f <= 1.0 ) {
|
||||||
fov_x = fov_x;
|
|
||||||
} else {
|
|
||||||
fov_x = zoomFov + f * ( fov_x - zoomFov );
|
fov_x = zoomFov + f * ( fov_x - zoomFov );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ int mumble_link(const char* name)
|
||||||
close(shmfd);
|
close(shmfd);
|
||||||
#endif
|
#endif
|
||||||
memset(lm, 0, sizeof(LinkedMem));
|
memset(lm, 0, sizeof(LinkedMem));
|
||||||
mbstowcs(lm->name, name, sizeof(lm->name));
|
mbstowcs(lm->name, name, sizeof(lm->name) / sizeof(wchar_t));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2329,10 +2329,7 @@ A way to force a bus error for development reasons
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Com_Crash_f( void ) {
|
static void Com_Crash_f( void ) {
|
||||||
#pragma clang diagnostic push
|
* ( volatile int * ) 0 = 0x12345678;
|
||||||
#pragma clang diagnostic ignored "-Wnull-dereference"
|
|
||||||
* ( int * ) 0 = 0x12345678;
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -706,11 +706,12 @@ int Q_isalpha( int c )
|
||||||
qboolean Q_isanumber( const char *s )
|
qboolean Q_isanumber( const char *s )
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
double UNUSED_VAR d;
|
||||||
|
|
||||||
if( *s == '\0' )
|
if( *s == '\0' )
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
|
||||||
strtod( s, &p );
|
d = strtod( s, &p );
|
||||||
|
|
||||||
return *p == '\0';
|
return *p == '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define UNUSED_VAR __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define UNUSED_VAR
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (defined _MSC_VER)
|
#if (defined _MSC_VER)
|
||||||
#define Q_EXPORT __declspec(dllexport)
|
#define Q_EXPORT __declspec(dllexport)
|
||||||
#elif (defined __SUNPRO_C)
|
#elif (defined __SUNPRO_C)
|
||||||
|
|
|
@ -272,11 +272,11 @@ static shader_t *ShaderForShaderNum( int shaderNum, int lightmapNum ) {
|
||||||
shader_t *shader;
|
shader_t *shader;
|
||||||
dshader_t *dsh;
|
dshader_t *dsh;
|
||||||
|
|
||||||
shaderNum = LittleLong( shaderNum );
|
int _shaderNum = LittleLong( shaderNum );
|
||||||
if ( shaderNum < 0 || shaderNum >= s_worldData.numShaders ) {
|
if ( _shaderNum < 0 || _shaderNum >= s_worldData.numShaders ) {
|
||||||
ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", shaderNum );
|
ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", _shaderNum );
|
||||||
}
|
}
|
||||||
dsh = &s_worldData.shaders[ shaderNum ];
|
dsh = &s_worldData.shaders[ _shaderNum ];
|
||||||
|
|
||||||
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
|
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
|
||||||
lightmapNum = LIGHTMAP_BY_VERTEX;
|
lightmapNum = LIGHTMAP_BY_VERTEX;
|
||||||
|
|
|
@ -88,13 +88,14 @@ send "\b \b"
|
||||||
static void CON_Back( void )
|
static void CON_Back( void )
|
||||||
{
|
{
|
||||||
char key;
|
char key;
|
||||||
|
size_t UNUSED_VAR size;
|
||||||
|
|
||||||
key = '\b';
|
key = '\b';
|
||||||
write(STDOUT_FILENO, &key, 1);
|
size = write(STDOUT_FILENO, &key, 1);
|
||||||
key = ' ';
|
key = ' ';
|
||||||
write(STDOUT_FILENO, &key, 1);
|
size = write(STDOUT_FILENO, &key, 1);
|
||||||
key = '\b';
|
key = '\b';
|
||||||
write(STDOUT_FILENO, &key, 1);
|
size = write(STDOUT_FILENO, &key, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -145,12 +146,13 @@ static void CON_Show( void )
|
||||||
ttycon_hide--;
|
ttycon_hide--;
|
||||||
if (ttycon_hide == 0)
|
if (ttycon_hide == 0)
|
||||||
{
|
{
|
||||||
write(STDOUT_FILENO, "]", 1);
|
size_t UNUSED_VAR size;
|
||||||
|
size = write(STDOUT_FILENO, "]", 1);
|
||||||
if (TTY_con.cursor)
|
if (TTY_con.cursor)
|
||||||
{
|
{
|
||||||
for (i=0; i<TTY_con.cursor; i++)
|
for (i=0; i<TTY_con.cursor; i++)
|
||||||
{
|
{
|
||||||
write(STDOUT_FILENO, TTY_con.buffer+i, 1);
|
size = write(STDOUT_FILENO, TTY_con.buffer+i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,6 +329,7 @@ char *CON_Input( void )
|
||||||
int avail;
|
int avail;
|
||||||
char key;
|
char key;
|
||||||
field_t *history;
|
field_t *history;
|
||||||
|
size_t UNUSED_VAR size;
|
||||||
|
|
||||||
if(ttycon_on)
|
if(ttycon_on)
|
||||||
{
|
{
|
||||||
|
@ -356,8 +359,8 @@ char *CON_Input( void )
|
||||||
Q_strncpyz(text, TTY_con.buffer, sizeof(text));
|
Q_strncpyz(text, TTY_con.buffer, sizeof(text));
|
||||||
Field_Clear(&TTY_con);
|
Field_Clear(&TTY_con);
|
||||||
key = '\n';
|
key = '\n';
|
||||||
write(STDOUT_FILENO, &key, 1);
|
size = write(STDOUT_FILENO, &key, 1);
|
||||||
write(STDOUT_FILENO, "]", 1);
|
size = write(STDOUT_FILENO, "]", 1);
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
if (key == '\t')
|
if (key == '\t')
|
||||||
|
@ -421,7 +424,7 @@ char *CON_Input( void )
|
||||||
TTY_con.buffer[TTY_con.cursor] = key;
|
TTY_con.buffer[TTY_con.cursor] = key;
|
||||||
TTY_con.cursor++;
|
TTY_con.cursor++;
|
||||||
// print the current line (this is differential)
|
// print the current line (this is differential)
|
||||||
write(STDOUT_FILENO, &key, 1);
|
size = write(STDOUT_FILENO, &key, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue