Fix for stupid con programmers making stupid con errors and a couple of other extremely minor changes

git-svn-id: https://svn.eduke32.com/eduke32@1435 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-06-18 05:57:10 +00:00
parent dea9f18232
commit cc58eafd29
5 changed files with 52 additions and 26 deletions

View file

@ -25,6 +25,16 @@
# include "msvc/inttypes.h" // from http://code.google.com/p/msinttypes/
#endif
#ifndef _MSC_VER
#if defined(__GNUC__) && defined(__i386__)
#ifndef __fastcall
#define __fastcall __attribute__((fastcall))
#endif
#else
#define __fastcall
#endif
#endif
#define REPLACE_SYSTEM_ALLOCATOR
#define THREADCACHEMAX 65536
#include "nedmalloc.h"

View file

@ -4568,16 +4568,6 @@ int32_t lastcullcheck = 0;
char cullmodel[MAXSPRITES];
int32_t cullcheckcnt = 0;
#ifndef _MSC_VER
#if defined (__GNUC__) && defined(__i386__)
#ifndef __fastcall
#define __fastcall __attribute__((fastcall))
#endif
#else
#define __fastcall
#endif
#endif
int32_t __fastcall polymost_checkcoordinates(int32_t x, int32_t y, spritetype *tspr)
{
int16_t datempsectnum = tspr->sectnum;

View file

@ -25,16 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __funct_h__
#define __funct_h__
#ifndef _MSC_VER
#if defined(__GNUC__) && defined(__i386__)
#ifndef __fastcall
#define __fastcall __attribute__((fastcall))
#endif
#else
#define __fastcall
#endif
#endif
extern void sendscore(const char *s);
extern void S_SoundStartup(void);
extern void S_SoundShutdown(void);

View file

@ -1896,6 +1896,25 @@ static int32_t C_GetNextValue(int32_t type)
return 0; // literal value
}
static int32_t C_CheckMalformedBranch(intptr_t lastScriptPtr)
{
switch (C_GetKeyword())
{
case CON_RIGHTBRACE:
case CON_ENDA:
case CON_ENDEVENT:
case CON_ENDS:
g_scriptPtr = lastScriptPtr + &script[0];
g_ifElseAborted = 1;
C_ReportError(-1);
g_numCompilerWarnings++;
initprintf("%s:%d: warning: malformed `%s' branch\n",g_szScriptFileName,g_lineNumber,
keyw[*(g_scriptPtr) & 0xFFF]);
return 1;
}
return 0;
}
static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr)
{
// ifrnd and ifhitweapon actually do something when the condition is executed
@ -1916,8 +1935,7 @@ static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr)
g_scriptPtr = lastScriptPtr + &script[0];
initprintf("%s:%d: warning: empty `%s' branch\n",g_szScriptFileName,g_lineNumber,
keyw[*(g_scriptPtr) & 0xFFF]);
if (g_ifElseAborted)
*(g_scriptPtr) = (CON_NULLOP + (IFELSE_MAGIC<<12));
*(g_scriptPtr) = (CON_NULLOP + (IFELSE_MAGIC<<12));
return 1;
}
return 0;
@ -3037,8 +3055,13 @@ static int32_t C_ParseCommand(void)
{
intptr_t offset;
intptr_t lastScriptPtr = g_scriptPtr - &script[0] - 1;
g_ifElseAborted = 0;
g_checkingIfElse--;
if (C_CheckMalformedBranch(lastScriptPtr))
return 0;
tempscrptr = g_scriptPtr;
offset = (unsigned)(tempscrptr-script);
g_scriptPtr++; //Leave a spot for the fail location
@ -4183,6 +4206,10 @@ static int32_t C_ParseCommand(void)
g_ifElseAborted = 0;
C_GetManyVars(2);
if (C_CheckMalformedBranch(lastScriptPtr))
return 0;
tempscrptr = g_scriptPtr;
offset = (unsigned)(g_scriptPtr-script);
g_scriptPtr++; // Leave a spot for the fail location
@ -4238,6 +4265,9 @@ static int32_t C_ParseCommand(void)
C_GetNextVar();
C_GetNextValue(LABEL_DEFINE); // the number to check against...
if (C_CheckMalformedBranch(lastScriptPtr))
return 0;
tempscrptr = g_scriptPtr;
offset = (unsigned)(tempscrptr-script);
g_scriptPtr++; //Leave a spot for the fail location
@ -4781,6 +4811,9 @@ repeatcase:
break;
}
if (C_CheckMalformedBranch(lastScriptPtr))
return 0;
tempscrptr = g_scriptPtr;
offset = (unsigned)(tempscrptr-script);
@ -4828,6 +4861,9 @@ repeatcase:
g_ifElseAborted = 0;
if (C_CheckMalformedBranch(lastScriptPtr))
return 0;
tempscrptr = g_scriptPtr;
offset = (unsigned)(tempscrptr-script);

View file

@ -4057,7 +4057,7 @@ static inline void X_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabe
}
}
#else
static int32_t X_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2)
static int32_t __fastcall X_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2)
{
if ((ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) && g_scriptSanityChecks)
{
@ -4124,7 +4124,7 @@ static int32_t X_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2)
}
}
static int32_t X_AccessSectorX(int32_t iSector, int32_t lLabelID)
static int32_t __fastcall X_AccessSectorX(int32_t iSector, int32_t lLabelID)
{
switch (lLabelID)
{
@ -4155,7 +4155,7 @@ static int32_t X_AccessSectorX(int32_t iSector, int32_t lLabelID)
}
}
static int32_t X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2)
static int32_t __fastcall X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2)
{
if ((PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) && g_scriptSanityChecks)
{
@ -4458,7 +4458,7 @@ static int32_t X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2
}
}
static int32_t X_AccessWallX(int32_t iWall, int32_t lLabelID)
static int32_t __fastcall X_AccessWallX(int32_t iWall, int32_t lLabelID)
{
switch (lLabelID)
{