[PATCH] Mark Host_Error and Host_Endgame with noreturn attribute

Host_Error and Host_Endgame never return, so mark them as such and cleanup a
few unnecessary statements previously used to quiet compiler warnings.

Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
Tyrann 2008-04-26 18:38:34 +09:30
parent 440d9d3d17
commit 7b6a5da600
5 changed files with 11 additions and 14 deletions

View File

@ -45,8 +45,10 @@ void Host_ServerFrame(void);
void Host_InitCommands(void);
void Host_Init(quakeparms_t *parms);
void Host_Shutdown(void);
void Host_Error(const char *error, ...) __attribute__((format(printf,1,2)));
void Host_EndGame(const char *message, ...) __attribute__((format(printf,1,2)));
void Host_Error(const char *error, ...)
__attribute__((noreturn, format(printf,1,2)));
void Host_EndGame(const char *message, ...)
__attribute__((noreturn, format(printf,1,2)));
void Host_Frame(float time);
void Host_Quit_f(void);
void Host_ClientCommands(const char *fmt, ...)

View File

@ -237,10 +237,8 @@ FlushEntityPacket(void)
// read it all, but ignore it
while (1) {
word = (unsigned short)MSG_ReadShort();
if (msg_badread) { // something didn't parse right...
if (msg_badread)
Host_EndGame("msg_badread in packetentities");
return;
}
if (!word)
break; // done
@ -302,10 +300,8 @@ CL_ParsePacketEntities(qboolean delta)
while (1) {
word = (unsigned short)MSG_ReadShort();
if (msg_badread) { // something didn't parse right...
if (msg_badread)
Host_EndGame("msg_badread in packetentities");
return;
}
if (!word) {
while (oldindex < oldp->num_entities) { // copy all the rest of the entities from the old packet

View File

@ -934,7 +934,6 @@ CL_ConnectionlessPacket(void)
Con_Printf("disconnect\n");
Host_EndGame("Server disconnected");
return;
}
#endif

View File

@ -1143,10 +1143,8 @@ CL_ParseServerMessage(void)
// parse the message
//
while (1) {
if (msg_badread) {
if (msg_badread)
Host_EndGame("%s: Bad server message", __func__);
break;
}
cmd = MSG_ReadByte();

View File

@ -85,8 +85,10 @@ void Host_ServerFrame(void);
void Host_InitCommands(void);
void Host_Init(quakeparms_t *parms);
void Host_Shutdown(void);
void Host_Error(const char *error, ...) __attribute__((format(printf,1,2)));
void Host_EndGame(const char *message, ...) __attribute__((format(printf,1,2)));
void Host_Error(const char *error, ...)
__attribute__((noreturn, format(printf,1,2)));
void Host_EndGame(const char *message, ...)
__attribute__((noreturn, format(printf,1,2)));
qboolean Host_SimulationTime(float time);
void Host_Frame(float time);
void Host_Quit_f(void);