- added 'strictdecorate' CVAR. If this is set to 'true', any DECORATE error that had to be demoted to a warning for backwards compatibility will be treated as an actual error.

This commit is contained in:
Christoph Oelckers 2016-06-08 10:56:11 +02:00
parent cf21bb1524
commit ef86b3975a
5 changed files with 17 additions and 8 deletions

View file

@ -60,6 +60,7 @@
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
EXTERN_CVAR(Bool, strictdecorate);
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -3067,7 +3068,8 @@ void PClass::InsertIntoHash ()
if (found != NULL) if (found != NULL)
{ // This type has already been inserted { // This type has already been inserted
// ... but there is no need whatsoever to make it a fatal error! // ... but there is no need whatsoever to make it a fatal error!
Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars()); if (!strictdecorate) Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars());
else I_Error("Tried to register class '%s' more than once.\n", TypeName.GetChars());
TypeTable.ReplaceType(this, found, bucket); TypeTable.ReplaceType(this, found, bucket);
} }
else else

View file

@ -1038,11 +1038,17 @@ FScriptPosition &FScriptPosition::operator=(const FScriptPosition &other)
// //
//========================================================================== //==========================================================================
CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
void FScriptPosition::Message (int severity, const char *message, ...) const void FScriptPosition::Message (int severity, const char *message, ...) const
{ {
FString composed; FString composed;
if ((severity == MSG_DEBUG || severity == MSG_DEBUGLOG) && !developer) return; if ((severity == MSG_DEBUG || severity == MSG_DEBUGLOG) && !developer) return;
if (severity == MSG_OPTERROR)
{
severity = strictdecorate ? MSG_ERROR : MSG_WARNING;
}
if (message == NULL) if (message == NULL)
{ {

View file

@ -124,6 +124,7 @@ enum
MSG_WARNING, MSG_WARNING,
MSG_FATAL, MSG_FATAL,
MSG_ERROR, MSG_ERROR,
MSG_OPTERROR,
MSG_DEBUG, MSG_DEBUG,
MSG_LOG, MSG_LOG,
MSG_DEBUGLOG, MSG_DEBUGLOG,

View file

@ -368,8 +368,8 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
else else
{ {
// Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :( // Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :(
if (!basex->isConstant()) ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got a name"); if (!basex->isConstant()) ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got a name");
else ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars()); else ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
FxExpression * x = new FxConstant(0, ScriptPosition); FxExpression * x = new FxConstant(0, ScriptPosition);
delete this; delete this;
return x; return x;
@ -466,8 +466,8 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx)
else else
{ {
// Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :( // Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :(
if (!basex->isConstant()) ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got a name"); if (!basex->isConstant()) ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got a name");
else ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars()); else ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
FxExpression *x = new FxConstant(0.0, ScriptPosition); FxExpression *x = new FxConstant(0.0, ScriptPosition);
delete this; delete this;
return x; return x;
@ -3924,7 +3924,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
{ {
/* lax */ /* lax */
// Since this happens in released WADs it must pass without a terminal error... :( // Since this happens in released WADs it must pass without a terminal error... :(
ScriptPosition.Message(MSG_WARNING, ScriptPosition.Message(MSG_OPTERROR,
"Unknown class name '%s'", "Unknown class name '%s'",
clsname.GetChars(), desttype->TypeName.GetChars()); clsname.GetChars(), desttype->TypeName.GetChars());
} }
@ -4095,7 +4095,7 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
destination = scope->FindState(names.Size()-1, &names[1], false); destination = scope->FindState(names.Size()-1, &names[1], false);
if (destination == NULL) if (destination == NULL)
{ {
ScriptPosition.Message(MSG_WARNING, "Unknown state jump destination"); ScriptPosition.Message(MSG_OPTERROR, "Unknown state jump destination");
/* lax */ /* lax */
return this; return this;
} }

View file

@ -457,7 +457,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
} }
if (bag.StateSet) if (bag.StateSet)
{ {
bag.ScriptPosition.Message(MSG_WARNING, bag.ScriptPosition.Message(MSG_OPTERROR,
"'skip_super' must appear before any state definitions."); "'skip_super' must appear before any state definitions.");
return; return;
} }