Unity-Technologies / qstat

New official qstat repository
Artistic License 2.0
121 stars 33 forks source link

having a warningless build #19

Closed illwieckz closed 7 years ago

illwieckz commented 9 years ago

Currently:

qstat.c:911:18: warning: variable ‘fd’ set but not used [-Wunused-but-set-variable]
qstat.c:7638:26: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
qstat.c:7638:18: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
ts2.c:51:12: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
ts3.c:209:12: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
bfbc2.c:57:6: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
ventrilo.c:326:26: warning: ‘rawpkt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
terraria.c:37:12: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
illwieckz commented 9 years ago

Perhaps this line is a gcc bug:

ventrilo.c: In function ‘deal_with_ventrilo_packet’:
ventrilo.c:326:26: warning: ‘rawpkt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    server->max_players = atoi( line + 12 );
                          ^

gcc complains about rawpkt on a line where it is not evolved, and the line variable was initialized like that:

line = strtok_ret( rawpkt, "\n", &last_line );

and rawpkt is a function argument, so if the function is called, it is always initialized:

query_status_t deal_with_ventrilo_packet( struct qserver *server, char *rawpkt, int pktlen )

clang does not complain.

stevenh commented 7 years ago

All builds here are warning less