Skip to content

Commit f976711

Browse files
committed
Fix various warnings
1 parent 549b686 commit f976711

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+384
-425
lines changed

cmake/compilers/msvc.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ add_compile_options("$<$<COMPILE_LANGUAGE:C>:/W4>")
2929
# There are way too many of these to realistically deal with them
3030
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4267>")
3131

32+
# C4206: nonstandard extension used: translation unit is empty
33+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4206>")
34+
35+
# C4324: 'struct': structure was padded due to alignment specifier
36+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4324>")
37+
38+
# C4200: nonstandard extension used: zero-sized array in struct/union
39+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/wd4200>")
40+
3241
# MSVC doesn't understand __inline__, which libjpeg uses
3342
add_compile_definitions(__inline__=inline)
3443

cmake/tools/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,18 @@ set(LBURG_SOURCES
6565
)
6666

6767
add_executable(q3asm ${Q3ASM_SOURCES})
68-
target_compile_options(q3asm PRIVATE -fno-strict-aliasing)
6968
set_output_dirs(q3asm)
7069
add_executable(q3lcc ${Q3LCC_SOURCES})
71-
target_compile_options(q3asm PRIVATE -fno-strict-aliasing)
7270
set_output_dirs(q3lcc)
7371
add_dependencies(q3lcc q3rcc q3cpp)
7472

73+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang$")
74+
add_compile_options(-fno-strict-aliasing -Wno-unused-result
75+
-Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
76+
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
77+
add_compile_options(/wd4311 /wd4312)
78+
endif()
79+
7580
add_executable(lburg ${LBURG_SOURCES})
7681
set_output_dirs(lburg)
7782
set(DAGCHECK_C ${CMAKE_BINARY_DIR}/dagcheck.c)

code/botlib/be_ai_char.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ bot_character_t *BotLoadCharacterFromFile(char *charfile, int skill)
247247
return NULL;
248248
} //end if
249249
//if it's the correct skill
250-
if (skill < 0 || token.intvalue == skill)
250+
if (skill < 0 || (int)token.intvalue == skill)
251251
{
252252
foundcharacter = qtrue;
253253
ch->skill = token.intvalue;

code/botlib/l_script.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ int PS_ReadWhiteSpace(script_t *script)
356356
//============================================================================
357357
int PS_ReadEscapeCharacter(script_t *script, char *ch)
358358
{
359-
int c, val, i;
359+
int c, val;
360360

361361
//step over the leading '\\'
362362
script->script_p++;
@@ -377,7 +377,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch)
377377
case 'x':
378378
{
379379
script->script_p++;
380-
for (i = 0, val = 0; ; i++, script->script_p++)
380+
for (val = 0; ; script->script_p++)
381381
{
382382
c = *script->script_p;
383383
if (c >= '0' && c <= '9') c = c - '0';
@@ -398,7 +398,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch)
398398
default: //NOTE: decimal ASCII code, NOT octal
399399
{
400400
if (*script->script_p < '0' || *script->script_p > '9') ScriptError(script, "unknown escape char");
401-
for (i = 0, val = 0; ; i++, script->script_p++)
401+
for (val = 0; ; script->script_p++)
402402
{
403403
c = *script->script_p;
404404
if (c >= '0' && c <= '9') c = c - '0';

code/cgame/cg_newdraw.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ void CG_CheckOrderPending(void) {
9999
}
100100

101101
if (cg_currentSelectedPlayer.integer == numSortedTeamPlayers) {
102-
// to everyone
103-
trap_SendConsoleCommand(va("cmd vsay_team %s\n", p2));
102+
if (p2) {
103+
// to everyone
104+
trap_SendConsoleCommand(va("cmd vsay_team %s\n", p2));
105+
}
104106
} else {
105107
// for the player self
106108
if (sortedTeamPlayers[cg_currentSelectedPlayer.integer] == cg.snap->ps.clientNum && p1) {

code/cgame/cg_particles.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,12 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha)
574574
{
575575
vec3_t rr, ru;
576576
vec3_t rotate_ang;
577-
float alpha;
577+
float pAlpha;
578578

579-
alpha = p->alpha;
579+
pAlpha = p->alpha;
580580

581581
if ( cgs.glconfig.hardwareType == GLHW_RAGEPRO )
582-
alpha = 1;
582+
pAlpha = 1;
583583

584584
if (p->roll)
585585
{
@@ -601,7 +601,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha)
601601
verts[0].modulate[0] = 111;
602602
verts[0].modulate[1] = 19;
603603
verts[0].modulate[2] = 9;
604-
verts[0].modulate[3] = 255 * alpha;
604+
verts[0].modulate[3] = 255 * pAlpha;
605605

606606
VectorMA (org, -p->height, ru, point);
607607
VectorMA (point, p->width, rr, point);
@@ -611,7 +611,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha)
611611
verts[1].modulate[0] = 111;
612612
verts[1].modulate[1] = 19;
613613
verts[1].modulate[2] = 9;
614-
verts[1].modulate[3] = 255 * alpha;
614+
verts[1].modulate[3] = 255 * pAlpha;
615615

616616
VectorMA (org, p->height, ru, point);
617617
VectorMA (point, p->width, rr, point);
@@ -621,7 +621,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha)
621621
verts[2].modulate[0] = 111;
622622
verts[2].modulate[1] = 19;
623623
verts[2].modulate[2] = 9;
624-
verts[2].modulate[3] = 255 * alpha;
624+
verts[2].modulate[3] = 255 * pAlpha;
625625

626626
VectorMA (org, p->height, ru, point);
627627
VectorMA (point, -p->width, rr, point);
@@ -631,7 +631,7 @@ void CG_AddParticleToScene (cparticle_t *p, vec3_t org, float alpha)
631631
verts[3].modulate[0] = 111;
632632
verts[3].modulate[1] = 19;
633633
verts[3].modulate[2] = 9;
634-
verts[3].modulate[3] = 255 * alpha;
634+
verts[3].modulate[3] = 255 * pAlpha;
635635

636636
}
637637
else if (p->type == P_FLAT_SCALEUP)

code/client/cl_avi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ static int bufIndex;
7979
SafeFS_Write
8080
===============
8181
*/
82-
static ID_INLINE void SafeFS_Write( const void *buffer, int len, fileHandle_t f )
82+
static ID_INLINE void SafeFS_Write( const void *buf, int len, fileHandle_t f )
8383
{
84-
if( FS_Write( buffer, len, f ) < len )
84+
if( FS_Write( buf, len, f ) < len )
8585
Com_Error( ERR_DROP, "Failed to write avi file" );
8686
}
8787

code/client/cl_cin.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,9 @@ static void setupQuad( long xOff, long yOff )
934934
long numQuadCels, i,x,y;
935935
byte *temp;
936936

937-
if (xOff == cin.oldXOff && yOff == cin.oldYOff && cinTable[currentHandle].ysize == cin.oldysize && cinTable[currentHandle].xsize == cin.oldxsize) {
937+
if (xOff == cin.oldXOff && yOff == cin.oldYOff &&
938+
(long)cinTable[currentHandle].ysize == cin.oldysize &&
939+
(long)cinTable[currentHandle].xsize == cin.oldxsize) {
938940
return;
939941
}
940942

code/client/cl_http_curl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static void *GPA(char *str)
103103
CL_HTTP_Init
104104
=================
105105
*/
106-
qboolean CL_HTTP_Init()
106+
qboolean CL_HTTP_Init(void)
107107
{
108108
if(cURLLib)
109109
return qtrue;
@@ -158,7 +158,7 @@ qboolean CL_HTTP_Init()
158158
CL_HTTP_Available
159159
=================
160160
*/
161-
qboolean CL_HTTP_Available()
161+
qboolean CL_HTTP_Available(void)
162162
{
163163
return cURLLib != NULL;
164164
}

code/client/cl_http_windows.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void CL_HTTP_BeginDownload(const char *remoteURL)
104104
BOOL success;
105105

106106
hUrl = InternetOpenUrlA(hInternet, remoteURL,
107-
va("Referer: ioQ3://%s\r\n", NET_AdrToString(clc.serverAddress)), -1,
107+
va("Referer: ioQ3://%s\r\n", NET_AdrToString(clc.serverAddress)), (DWORD)-1,
108108
INTERNET_FLAG_HYPERLINK |
109109
INTERNET_FLAG_NO_CACHE_WRITE |
110110
INTERNET_FLAG_NO_COOKIES |
@@ -149,7 +149,7 @@ qboolean CL_HTTP_PerformDownload(void)
149149
clc.downloadCount += bytesRead;
150150
Cvar_SetValue("cl_downloadCount", clc.downloadCount);
151151

152-
int bytesWritten = FS_Write(readBuffer, bytesRead, clc.download);
152+
DWORD bytesWritten = (DWORD)FS_Write(readBuffer, bytesRead, clc.download);
153153
DropIf(bytesWritten != bytesRead, "bytesWritten != bytesRead");
154154

155155
return qfalse;

0 commit comments

Comments
 (0)