[quake3-commits] r2188 - in trunk: . code/cgame code/client code/qcommon code/renderer code/sys
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Oct 27 17:32:28 EDT 2011
Author: tma
Date: 2011-10-27 17:32:28 -0400 (Thu, 27 Oct 2011)
New Revision: 2188
Modified:
trunk/Makefile
trunk/code/cgame/cg_view.c
trunk/code/client/libmumblelink.c
trunk/code/qcommon/common.c
trunk/code/qcommon/q_shared.c
trunk/code/qcommon/q_shared.h
trunk/code/renderer/tr_bsp.c
trunk/code/sys/con_tty.c
Log:
* Fix various warnings with GCC and clang
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/Makefile 2011-10-27 21:32:28 UTC (rev 2188)
@@ -276,7 +276,7 @@
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
- -Wno-self-assign -pipe -DUSE_ICON
+ -pipe -DUSE_ICON
CLIENT_CFLAGS += $(SDL_CFLAGS)
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
@@ -902,6 +902,10 @@
RENDERER_LIBS += -ljpeg
endif
+ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
+ BASE_CFLAGS += -Qunused-arguments
+endif
+
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
endif
Modified: trunk/code/cgame/cg_view.c
===================================================================
--- trunk/code/cgame/cg_view.c 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/cgame/cg_view.c 2011-10-27 21:32:28 UTC (rev 2188)
@@ -506,9 +506,7 @@
}
} else {
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
- if ( f > 1.0 ) {
- fov_x = fov_x;
- } else {
+ if ( f <= 1.0 ) {
fov_x = zoomFov + f * ( fov_x - zoomFov );
}
}
Modified: trunk/code/client/libmumblelink.c
===================================================================
--- trunk/code/client/libmumblelink.c 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/client/libmumblelink.c 2011-10-27 21:32:28 UTC (rev 2188)
@@ -115,7 +115,7 @@
close(shmfd);
#endif
memset(lm, 0, sizeof(LinkedMem));
- mbstowcs(lm->name, name, sizeof(lm->name));
+ mbstowcs(lm->name, name, sizeof(lm->name) / sizeof(wchar_t));
return 0;
}
Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/qcommon/common.c 2011-10-27 21:32:28 UTC (rev 2188)
@@ -2329,10 +2329,7 @@
=================
*/
static void Com_Crash_f( void ) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wnull-dereference"
- * ( int * ) 0 = 0x12345678;
-#pragma clang diagnostic pop
+ * ( volatile int * ) 0 = 0x12345678;
}
/*
Modified: trunk/code/qcommon/q_shared.c
===================================================================
--- trunk/code/qcommon/q_shared.c 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/qcommon/q_shared.c 2011-10-27 21:32:28 UTC (rev 2188)
@@ -706,11 +706,12 @@
qboolean Q_isanumber( const char *s )
{
char *p;
+ double UNUSED_VAR d;
if( *s == '\0' )
return qfalse;
- strtod( s, &p );
+ d = strtod( s, &p );
return *p == '\0';
}
Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/qcommon/q_shared.h 2011-10-27 21:32:28 UTC (rev 2188)
@@ -97,6 +97,12 @@
#endif
#endif
+#ifdef __GNUC__
+#define UNUSED_VAR __attribute__((unused))
+#else
+#define UNUSED_VAR
+#endif
+
#if (defined _MSC_VER)
#define Q_EXPORT __declspec(dllexport)
#elif (defined __SUNPRO_C)
Modified: trunk/code/renderer/tr_bsp.c
===================================================================
--- trunk/code/renderer/tr_bsp.c 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/renderer/tr_bsp.c 2011-10-27 21:32:28 UTC (rev 2188)
@@ -272,11 +272,11 @@
shader_t *shader;
dshader_t *dsh;
- shaderNum = LittleLong( shaderNum );
- if ( shaderNum < 0 || shaderNum >= s_worldData.numShaders ) {
- ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", shaderNum );
+ int _shaderNum = LittleLong( shaderNum );
+ if ( _shaderNum < 0 || _shaderNum >= s_worldData.numShaders ) {
+ 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 ) {
lightmapNum = LIGHTMAP_BY_VERTEX;
Modified: trunk/code/sys/con_tty.c
===================================================================
--- trunk/code/sys/con_tty.c 2011-10-21 22:48:53 UTC (rev 2187)
+++ trunk/code/sys/con_tty.c 2011-10-27 21:32:28 UTC (rev 2188)
@@ -88,13 +88,14 @@
static void CON_Back( void )
{
char key;
+ size_t UNUSED_VAR size;
key = '\b';
- write(STDOUT_FILENO, &key, 1);
+ size = write(STDOUT_FILENO, &key, 1);
key = ' ';
- write(STDOUT_FILENO, &key, 1);
+ size = write(STDOUT_FILENO, &key, 1);
key = '\b';
- write(STDOUT_FILENO, &key, 1);
+ size = write(STDOUT_FILENO, &key, 1);
}
/*
@@ -145,12 +146,13 @@
ttycon_hide--;
if (ttycon_hide == 0)
{
- write(STDOUT_FILENO, "]", 1);
+ size_t UNUSED_VAR size;
+ size = write(STDOUT_FILENO, "]", 1);
if (TTY_con.cursor)
{
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 @@
int avail;
char key;
field_t *history;
+ size_t UNUSED_VAR size;
if(ttycon_on)
{
@@ -356,8 +359,8 @@
Q_strncpyz(text, TTY_con.buffer, sizeof(text));
Field_Clear(&TTY_con);
key = '\n';
- write(STDOUT_FILENO, &key, 1);
- write(STDOUT_FILENO, "]", 1);
+ size = write(STDOUT_FILENO, &key, 1);
+ size = write(STDOUT_FILENO, "]", 1);
return text;
}
if (key == '\t')
@@ -421,7 +424,7 @@
TTY_con.buffer[TTY_con.cursor] = key;
TTY_con.cursor++;
// print the current line (this is differential)
- write(STDOUT_FILENO, &key, 1);
+ size = write(STDOUT_FILENO, &key, 1);
}
return NULL;
More information about the quake3-commits
mailing list