- Fixed some warnings flagged by GCC 4.1.1, which brings up an interesting

observation. The following code works with VC++ 2005. It aborts with GCC:
    FString str = "This is a string.";
    Printf ("%s\n", str);

SVN r408 (trunk)
This commit is contained in:
Randy Heit 2006-12-09 00:16:10 +00:00
parent 6f3a28e355
commit 41de448add
12 changed files with 130 additions and 101 deletions

View File

@ -749,7 +749,7 @@ public:
bool UpdateWaterLevel (fixed_t oldz);
FState *FindState (FName label) const;
FState *FindState (int numnames, int first, ...) const;
FState *FindState (int numnames, ...) const;
FState *FindState (int numnames, va_list arglist) const;
bool HasSpecialDeathStates () const;

View File

@ -380,4 +380,4 @@ PSymbol *PSymbolTable::AddSymbol (PSymbol *sym)
// Good. The symbol is not in the table yet.
Symbols.Insert (MAX(min, max), sym);
return sym;
}
}

View File

@ -509,8 +509,7 @@ bool AActor::HasSpecialDeathStates () const
//
//===========================================================================
FState *AActor::FindState (int numnames, int first, ...) const // The 'first' parameter is only here to
// disambiguate from the single parameter version
FState *AActor::FindState (int numnames, ...) const
{
va_list arglist;
va_start (arglist, numnames);

View File

@ -574,6 +574,12 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc
initpass = true;
pass = interlace ? 0 : 7;
// Silence GCC warnings. Due to initpass being true, these will be set
// before they're used, but it doesn't know that.
curr = prev = 0;
passwidth = passpitch = bytesPerRowIn = 0;
passbuff = 0;
while (err != Z_STREAM_END && pass < 8 - interlace)
{
if (initpass)

View File

@ -4753,7 +4753,7 @@ void AActor::Crash()
if (DamageType != NAME_None)
{
crashstate = GetClass()->ActorInfo->FindStateExact(2, NAME_Crash, DamageType);
crashstate = GetClass()->ActorInfo->FindStateExact(2, NAME_Crash, int(DamageType));
}
if (crashstate == NULL)
{

View File

@ -376,6 +376,27 @@ static void ParseOuter ()
}
}
//==========================================================================
//
// SetSplashDefaults
//
//==========================================================================
static void SetSplashDefaults (FSplashDef *splashdef)
{
splashdef->SmallSplashSound =
splashdef->NormalSplashSound = 0;
splashdef->SmallSplash =
splashdef->SplashBase =
splashdef->SplashChunk = NULL;
splashdef->ChunkXVelShift =
splashdef->ChunkYVelShift =
splashdef->ChunkZVelShift = 8;
splashdef->ChunkBaseZVel = FRACUNIT;
splashdef->SmallSplashClip = 12*FRACUNIT;
splashdef->NoAlert = false;
}
//==========================================================================
//
// ParseSplash
@ -395,6 +416,7 @@ void ParseSplash ()
if (splashnum < 0)
{
FSplashDef def;
SetSplashDefaults (&def);
def.Name = name;
splashnum = (int)Splashes.Push (def);
isnew = true;
@ -402,19 +424,16 @@ void ParseSplash ()
splashdef = &Splashes[splashnum];
SC_MustGetString ();
if (!SC_Compare ("modify") || (SC_MustGetString(), isnew))
if (!SC_Compare ("modify"))
{ // Set defaults
splashdef->SmallSplashSound =
splashdef->NormalSplashSound = 0;
splashdef->SmallSplash =
splashdef->SplashBase =
splashdef->SplashChunk = NULL;
splashdef->ChunkXVelShift =
splashdef->ChunkYVelShift =
splashdef->ChunkZVelShift = 8;
splashdef->ChunkBaseZVel = FRACUNIT;
splashdef->SmallSplashClip = 12*FRACUNIT;
splashdef->NoAlert = false;
if (!isnew)
{ // New ones already have their defaults set before they're pushed.
SetSplashDefaults (splashdef);
}
}
else
{
SC_MustGetString();
}
if (!SC_Compare ("{"))
{

View File

@ -1197,7 +1197,7 @@ void RP_AddLine (seg_t *line)
}
else
{ // The seg is only part of the wall.
if (line->linedef->sidenum[0] != line->sidedef - sides)
if (line->linedef->sidenum[0] != DWORD(line->sidedef - sides))
{
swap (v1, v2);
}

View File

@ -440,8 +440,9 @@ void SC_MustGetToken (int token)
SC_MustGetAnyToken ();
if (sc_TokenType != token)
{
SC_ScriptError ("Expected %s but got %s instead.",
SC_TokenName(token), SC_TokenName(sc_TokenType, sc_String));
FString tok1 = SC_TokenName(token);
FString tok2 = SC_TokenName(sc_TokenType, sc_String);
SC_ScriptError ("Expected %s but got %s instead.", tok1.GetChars(), tok2.GetChars());
}
}

View File

@ -1649,7 +1649,7 @@ do_stop:
stype = PClass::FindClass (scopename);
if (stype == NULL)
{
SC_ScriptError ("%s is an unknown class.", scopename);
SC_ScriptError ("%s is an unknown class.", scopename.GetChars());
}
if (!stype->IsDescendantOf (RUNTIME_CLASS(AActor)))
{
@ -4327,7 +4327,8 @@ void ParseClass()
}
else
{
SC_ScriptError ("Expected 'action' or 'const' but got %s", SC_TokenName(sc_TokenType, sc_String));
FString tokname = SC_TokenName(sc_TokenType, sc_String);
SC_ScriptError ("Expected 'action' or 'const' but got %s", tokname.GetChars());
}
SC_MustGetAnyToken();
}

View File

@ -404,7 +404,7 @@ static void DoJump(AActor * self, FState * CallingState, int offset)
if (classname != NAME_None) Printf("%s::", ((FName)(ENamedName)classname).GetChars());
for (int i=0;i<JumpParameters[offset+1];i++)
{
Printf("%s%s", dot, ((FName)(ENamedName)JumpParameters[offset+2+i]));
Printf("%s%s", dot, ((FName)(ENamedName)JumpParameters[offset+2+i]).GetChars());
}
Printf("not found in %s\n", self->GetClass()->TypeName.GetChars());
return;

View File

@ -885,7 +885,8 @@ static ExpData *ParseExpressionA (const PClass *cls)
}
else
{
SC_ScriptError ("Unexpected token %s", SC_TokenName(sc_TokenType, sc_String));
FString tokname = SC_TokenName(sc_TokenType, sc_String);
SC_ScriptError ("Unexpected token %s", tokname.GetChars());
return NULL;
}
}
@ -946,6 +947,8 @@ static ExpVal EvalExpression (ExpData *data, AActor *self, const PClass *cls)
{
ExpVal val;
val.Type = VAL_Int; // Placate GCC
switch (data->Type)
{
case EX_NOP:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="updaterevision"
ProjectGUID="{6077B7D6-349F-4077-B552-3BC302EF5859}"
RootNamespace="updaterevision"
@ -95,6 +95,82 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
@ -172,82 +248,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"