1
0
forked from 0ad/0ad

Fix CPreprocessor uninitialised data causing error messages on "#endif" followed by EOF with no newline. Warn about unrecognised "#elif".

This was SVN commit r11418.
This commit is contained in:
Ykkrosh 2012-04-02 16:12:46 +00:00
parent 25762f1f0d
commit 3792b02963
2 changed files with 8 additions and 2 deletions

View File

@ -1131,8 +1131,14 @@ Done:
rc = HandleElse (t, iLine);
else if (IS_DIRECTIVE ("endif"))
rc = HandleEndIf (t, iLine);
else
{
// elif is tricky to support because the EnableOutput stack doesn't
// contain enough data to tell whether any previous branch matched
if (IS_DIRECTIVE ("elif"))
Error (iLine, "Unsupported preprocessor directive #elif");
//Error (iLine, "Unknown preprocessor directive", &iToken);
//return Token (Token::TK_ERROR);

View File

@ -108,10 +108,10 @@ class CPreprocessor
/// Token length in bytes
size_t Length;
Token () : Allocated (0), String (NULL)
Token () : Type (TK_ERROR), Allocated (0), String (NULL), Length (0)
{ }
Token (Kind iType) : Type (iType), Allocated (0), String (NULL)
Token (Kind iType) : Type (iType), Allocated (0), String (NULL), Length (0)
{ }
Token (Kind iType, const char *iString, size_t iLength) :