Commit 0685fbde by Ehsan Akhgari

Rename the Diagnostics enum values to have a PP_ prefix

This will make it possible to build angle in unified mode for Mozilla. Change-Id: Iba4b971392b8abae8b5ff8f96e9172582f43de90
parent 0dd3b3ff
......@@ -30,11 +30,11 @@ void TDiagnostics::writeInfo(Severity severity,
TPrefixType prefix = EPrefixNone;
switch (severity)
{
case ERROR:
case PP_ERROR:
++mNumErrors;
prefix = EPrefixError;
break;
case WARNING:
case PP_WARNING:
++mNumWarnings;
prefix = EPrefixWarning;
break;
......
......@@ -39,7 +39,7 @@ TDirectiveHandler::~TDirectiveHandler()
void TDirectiveHandler::handleError(const pp::SourceLocation& loc,
const std::string& msg)
{
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc, msg, "", "");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "", "");
}
void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
......@@ -73,12 +73,12 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
}
else
{
mDiagnostics.report(pp::Diagnostics::UNRECOGNIZED_PRAGMA, loc, name);
mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
return;
}
if (invalidValue)
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"invalid pragma value", value,
"'on' or 'off' expected");
}
......@@ -92,7 +92,7 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
TBehavior behaviorVal = getBehavior(behavior);
if (behaviorVal == EBhUndefined)
{
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"behavior", name, "invalid");
return;
}
......@@ -101,13 +101,13 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
{
if (behaviorVal == EBhRequire)
{
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension", name,
"cannot have 'require' behavior");
}
else if (behaviorVal == EBhEnable)
{
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension", name,
"cannot have 'enable' behavior");
}
......@@ -127,15 +127,15 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
return;
}
pp::Diagnostics::Severity severity = pp::Diagnostics::ERROR;
pp::Diagnostics::Severity severity = pp::Diagnostics::PP_ERROR;
switch (behaviorVal) {
case EBhRequire:
severity = pp::Diagnostics::ERROR;
severity = pp::Diagnostics::PP_ERROR;
break;
case EBhEnable:
case EBhWarn:
case EBhDisable:
severity = pp::Diagnostics::WARNING;
severity = pp::Diagnostics::PP_WARNING;
break;
default:
UNREACHABLE();
......@@ -155,7 +155,7 @@ void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
std::stringstream stream;
stream << version;
std::string str = stream.str();
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"version number", str, "not supported");
}
}
......@@ -182,7 +182,7 @@ void TParseContext::error(const TSourceLoc& loc,
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
diagnostics.writeInfo(pp::Diagnostics::ERROR,
diagnostics.writeInfo(pp::Diagnostics::PP_ERROR,
srcLoc, reason, token, extraInfo);
}
......@@ -193,7 +193,7 @@ void TParseContext::warning(const TSourceLoc& loc,
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
diagnostics.writeInfo(pp::Diagnostics::WARNING,
diagnostics.writeInfo(pp::Diagnostics::PP_WARNING,
srcLoc, reason, token, extraInfo);
}
......
......@@ -25,14 +25,14 @@ void Diagnostics::report(ID id,
Diagnostics::Severity Diagnostics::severity(ID id)
{
if ((id > ERROR_BEGIN) && (id < ERROR_END))
return ERROR;
if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
return PP_ERROR;
if ((id > WARNING_BEGIN) && (id < WARNING_END))
return WARNING;
if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
return PP_WARNING;
assert(false);
return ERROR;
return PP_ERROR;
}
std::string Diagnostics::message(ID id)
......@@ -40,82 +40,82 @@ std::string Diagnostics::message(ID id)
switch (id)
{
// Errors begin.
case INTERNAL_ERROR:
case PP_INTERNAL_ERROR:
return "internal error";
case OUT_OF_MEMORY:
case PP_OUT_OF_MEMORY:
return "out of memory";
case INVALID_CHARACTER:
case PP_INVALID_CHARACTER:
return "invalid character";
case INVALID_NUMBER:
case PP_INVALID_NUMBER:
return "invalid number";
case INTEGER_OVERFLOW:
case PP_INTEGER_OVERFLOW:
return "integer overflow";
case FLOAT_OVERFLOW:
case PP_FLOAT_OVERFLOW:
return "float overflow";
case TOKEN_TOO_LONG:
case PP_TOKEN_TOO_LONG:
return "token too long";
case INVALID_EXPRESSION:
case PP_INVALID_EXPRESSION:
return "invalid expression";
case DIVISION_BY_ZERO:
case PP_DIVISION_BY_ZERO:
return "division by zero";
case EOF_IN_COMMENT:
case PP_EOF_IN_COMMENT:
return "unexpected end of file found in comment";
case UNEXPECTED_TOKEN:
case PP_UNEXPECTED_TOKEN:
return "unexpected token";
case DIRECTIVE_INVALID_NAME:
case PP_DIRECTIVE_INVALID_NAME:
return "invalid directive name";
case MACRO_NAME_RESERVED:
case PP_MACRO_NAME_RESERVED:
return "macro name is reserved";
case MACRO_REDEFINED:
case PP_MACRO_REDEFINED:
return "macro redefined";
case MACRO_PREDEFINED_REDEFINED:
case PP_MACRO_PREDEFINED_REDEFINED:
return "predefined macro redefined";
case MACRO_PREDEFINED_UNDEFINED:
case PP_MACRO_PREDEFINED_UNDEFINED:
return "predefined macro undefined";
case MACRO_UNTERMINATED_INVOCATION:
case PP_MACRO_UNTERMINATED_INVOCATION:
return "unterminated macro invocation";
case MACRO_TOO_FEW_ARGS:
case PP_MACRO_TOO_FEW_ARGS:
return "Not enough arguments for macro";
case MACRO_TOO_MANY_ARGS:
case PP_MACRO_TOO_MANY_ARGS:
return "Too many arguments for macro";
case CONDITIONAL_ENDIF_WITHOUT_IF:
case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
return "unexpected #endif found without a matching #if";
case CONDITIONAL_ELSE_WITHOUT_IF:
case PP_CONDITIONAL_ELSE_WITHOUT_IF:
return "unexpected #else found without a matching #if";
case CONDITIONAL_ELSE_AFTER_ELSE:
case PP_CONDITIONAL_ELSE_AFTER_ELSE:
return "unexpected #else found after another #else";
case CONDITIONAL_ELIF_WITHOUT_IF:
case PP_CONDITIONAL_ELIF_WITHOUT_IF:
return "unexpected #elif found without a matching #if";
case CONDITIONAL_ELIF_AFTER_ELSE:
case PP_CONDITIONAL_ELIF_AFTER_ELSE:
return "unexpected #elif found after #else";
case CONDITIONAL_UNTERMINATED:
case PP_CONDITIONAL_UNTERMINATED:
return "unexpected end of file found in conditional block";
case INVALID_EXTENSION_NAME:
case PP_INVALID_EXTENSION_NAME:
return "invalid extension name";
case INVALID_EXTENSION_BEHAVIOR:
case PP_INVALID_EXTENSION_BEHAVIOR:
return "invalid extension behavior";
case INVALID_EXTENSION_DIRECTIVE:
case PP_INVALID_EXTENSION_DIRECTIVE:
return "invalid extension directive";
case INVALID_VERSION_NUMBER:
case PP_INVALID_VERSION_NUMBER:
return "invalid version number";
case INVALID_VERSION_DIRECTIVE:
case PP_INVALID_VERSION_DIRECTIVE:
return "invalid version directive";
case VERSION_NOT_FIRST_STATEMENT:
case PP_VERSION_NOT_FIRST_STATEMENT:
return "#version directive must occur before anything else, "
"except for comments and white space";
case INVALID_LINE_NUMBER:
case PP_INVALID_LINE_NUMBER:
return "invalid line number";
case INVALID_FILE_NUMBER:
case PP_INVALID_FILE_NUMBER:
return "invalid file number";
case INVALID_LINE_DIRECTIVE:
case PP_INVALID_LINE_DIRECTIVE:
return "invalid line directive";
// Errors end.
// Warnings begin.
case EOF_IN_DIRECTIVE:
case PP_EOF_IN_DIRECTIVE:
return "unexpected end of file found in directive";
case CONDITIONAL_UNEXPECTED_TOKEN:
case PP_CONDITIONAL_UNEXPECTED_TOKEN:
return "unexpected token after conditional expression";
case UNRECOGNIZED_PRAGMA:
case PP_UNRECOGNIZED_PRAGMA:
return "unrecognized pragma";
// Warnings end.
default:
......
......@@ -21,53 +21,53 @@ class Diagnostics
public:
enum Severity
{
ERROR,
WARNING
PP_ERROR,
PP_WARNING
};
enum ID
{
ERROR_BEGIN,
INTERNAL_ERROR,
OUT_OF_MEMORY,
INVALID_CHARACTER,
INVALID_NUMBER,
INTEGER_OVERFLOW,
FLOAT_OVERFLOW,
TOKEN_TOO_LONG,
INVALID_EXPRESSION,
DIVISION_BY_ZERO,
EOF_IN_COMMENT,
UNEXPECTED_TOKEN,
DIRECTIVE_INVALID_NAME,
MACRO_NAME_RESERVED,
MACRO_REDEFINED,
MACRO_PREDEFINED_REDEFINED,
MACRO_PREDEFINED_UNDEFINED,
MACRO_UNTERMINATED_INVOCATION,
MACRO_TOO_FEW_ARGS,
MACRO_TOO_MANY_ARGS,
CONDITIONAL_ENDIF_WITHOUT_IF,
CONDITIONAL_ELSE_WITHOUT_IF,
CONDITIONAL_ELSE_AFTER_ELSE,
CONDITIONAL_ELIF_WITHOUT_IF,
CONDITIONAL_ELIF_AFTER_ELSE,
CONDITIONAL_UNTERMINATED,
INVALID_EXTENSION_NAME,
INVALID_EXTENSION_BEHAVIOR,
INVALID_EXTENSION_DIRECTIVE,
INVALID_VERSION_NUMBER,
INVALID_VERSION_DIRECTIVE,
VERSION_NOT_FIRST_STATEMENT,
INVALID_LINE_NUMBER,
INVALID_FILE_NUMBER,
INVALID_LINE_DIRECTIVE,
ERROR_END,
PP_ERROR_BEGIN,
PP_INTERNAL_ERROR,
PP_OUT_OF_MEMORY,
PP_INVALID_CHARACTER,
PP_INVALID_NUMBER,
PP_INTEGER_OVERFLOW,
PP_FLOAT_OVERFLOW,
PP_TOKEN_TOO_LONG,
PP_INVALID_EXPRESSION,
PP_DIVISION_BY_ZERO,
PP_EOF_IN_COMMENT,
PP_UNEXPECTED_TOKEN,
PP_DIRECTIVE_INVALID_NAME,
PP_MACRO_NAME_RESERVED,
PP_MACRO_REDEFINED,
PP_MACRO_PREDEFINED_REDEFINED,
PP_MACRO_PREDEFINED_UNDEFINED,
PP_MACRO_UNTERMINATED_INVOCATION,
PP_MACRO_TOO_FEW_ARGS,
PP_MACRO_TOO_MANY_ARGS,
PP_CONDITIONAL_ENDIF_WITHOUT_IF,
PP_CONDITIONAL_ELSE_WITHOUT_IF,
PP_CONDITIONAL_ELSE_AFTER_ELSE,
PP_CONDITIONAL_ELIF_WITHOUT_IF,
PP_CONDITIONAL_ELIF_AFTER_ELSE,
PP_CONDITIONAL_UNTERMINATED,
PP_INVALID_EXTENSION_NAME,
PP_INVALID_EXTENSION_BEHAVIOR,
PP_INVALID_EXTENSION_DIRECTIVE,
PP_INVALID_VERSION_NUMBER,
PP_INVALID_VERSION_DIRECTIVE,
PP_VERSION_NOT_FIRST_STATEMENT,
PP_INVALID_LINE_NUMBER,
PP_INVALID_FILE_NUMBER,
PP_INVALID_LINE_DIRECTIVE,
PP_ERROR_END,
WARNING_BEGIN,
EOF_IN_DIRECTIVE,
CONDITIONAL_UNEXPECTED_TOKEN,
UNRECOGNIZED_PRAGMA,
WARNING_END
PP_WARNING_BEGIN,
PP_EOF_IN_DIRECTIVE,
PP_CONDITIONAL_UNEXPECTED_TOKEN,
PP_UNRECOGNIZED_PRAGMA,
PP_WARNING_END
};
virtual ~Diagnostics();
......
......@@ -172,7 +172,7 @@ class DefinedParser : public Lexer
if (token->type != Token::IDENTIFIER)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mLexer, token);
return;
......@@ -185,7 +185,7 @@ class DefinedParser : public Lexer
mLexer->lex(token);
if (token->type != ')')
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mLexer, token);
return;
......@@ -233,7 +233,7 @@ void DirectiveParser::lex(Token* token)
if (!mConditionalStack.empty())
{
const ConditionalBlock& block = mConditionalStack.back();
mDiagnostics->report(Diagnostics::CONDITIONAL_UNTERMINATED,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
block.location, block.type);
}
break;
......@@ -268,7 +268,7 @@ void DirectiveParser::parseDirective(Token* token)
switch(directive)
{
case DIRECTIVE_NONE:
mDiagnostics->report(Diagnostics::DIRECTIVE_INVALID_NAME,
mDiagnostics->report(Diagnostics::PP_DIRECTIVE_INVALID_NAME,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
break;
......@@ -319,7 +319,7 @@ void DirectiveParser::parseDirective(Token* token)
skipUntilEOD(mTokenizer, token);
if (token->type == Token::LAST)
{
mDiagnostics->report(Diagnostics::EOF_IN_DIRECTIVE,
mDiagnostics->report(Diagnostics::PP_EOF_IN_DIRECTIVE,
token->location, token->text);
}
}
......@@ -331,19 +331,19 @@ void DirectiveParser::parseDefine(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
return;
}
if (isMacroPredefined(token->text, *mMacroSet))
{
mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_REDEFINED,
mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_REDEFINED,
token->location, token->text);
return;
}
if (isMacroNameReserved(token->text))
{
mDiagnostics->report(Diagnostics::MACRO_NAME_RESERVED,
mDiagnostics->report(Diagnostics::PP_MACRO_NAME_RESERVED,
token->location, token->text);
return;
}
......@@ -368,7 +368,7 @@ void DirectiveParser::parseDefine(Token* token)
if (token->type != ')')
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location,
token->text);
return;
......@@ -396,7 +396,7 @@ void DirectiveParser::parseDefine(Token* token)
MacroSet::const_iterator iter = mMacroSet->find(macro.name);
if (iter != mMacroSet->end() && !macro.equals(iter->second))
{
mDiagnostics->report(Diagnostics::MACRO_REDEFINED,
mDiagnostics->report(Diagnostics::PP_MACRO_REDEFINED,
token->location,
macro.name);
return;
......@@ -411,7 +411,7 @@ void DirectiveParser::parseUndef(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
return;
}
......@@ -421,7 +421,7 @@ void DirectiveParser::parseUndef(Token* token)
{
if (iter->second.predefined)
{
mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_UNDEFINED,
mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED,
token->location, token->text);
}
else
......@@ -457,7 +457,7 @@ void DirectiveParser::parseElse(Token* token)
if (mConditionalStack.empty())
{
mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_WITHOUT_IF,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
......@@ -472,7 +472,7 @@ void DirectiveParser::parseElse(Token* token)
}
if (block.foundElseGroup)
{
mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_AFTER_ELSE,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
......@@ -486,7 +486,7 @@ void DirectiveParser::parseElse(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
......@@ -498,7 +498,7 @@ void DirectiveParser::parseElif(Token* token)
if (mConditionalStack.empty())
{
mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_WITHOUT_IF,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
......@@ -513,7 +513,7 @@ void DirectiveParser::parseElif(Token* token)
}
if (block.foundElseGroup)
{
mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_AFTER_ELSE,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
......@@ -538,7 +538,7 @@ void DirectiveParser::parseEndif(Token* token)
if (mConditionalStack.empty())
{
mDiagnostics->report(Diagnostics::CONDITIONAL_ENDIF_WITHOUT_IF,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
......@@ -550,7 +550,7 @@ void DirectiveParser::parseEndif(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
......@@ -618,7 +618,7 @@ void DirectiveParser::parsePragma(Token* token)
(state == RIGHT_PAREN + 1)); // With value.
if (!valid)
{
mDiagnostics->report(Diagnostics::UNRECOGNIZED_PRAGMA,
mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
token->location, name);
}
else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
......@@ -650,7 +650,7 @@ void DirectiveParser::parseExtension(Token* token)
case EXT_NAME:
if (valid && (token->type != Token::IDENTIFIER))
{
mDiagnostics->report(Diagnostics::INVALID_EXTENSION_NAME,
mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_NAME,
token->location, token->text);
valid = false;
}
......@@ -659,7 +659,7 @@ void DirectiveParser::parseExtension(Token* token)
case COLON:
if (valid && (token->type != ':'))
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
......@@ -667,7 +667,7 @@ void DirectiveParser::parseExtension(Token* token)
case EXT_BEHAVIOR:
if (valid && (token->type != Token::IDENTIFIER))
{
mDiagnostics->report(Diagnostics::INVALID_EXTENSION_BEHAVIOR,
mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR,
token->location, token->text);
valid = false;
}
......@@ -676,7 +676,7 @@ void DirectiveParser::parseExtension(Token* token)
default:
if (valid)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
......@@ -686,7 +686,7 @@ void DirectiveParser::parseExtension(Token* token)
}
if (valid && (state != EXT_BEHAVIOR + 1))
{
mDiagnostics->report(Diagnostics::INVALID_EXTENSION_DIRECTIVE,
mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
......@@ -700,7 +700,7 @@ void DirectiveParser::parseVersion(Token* token)
if (mPastFirstStatement)
{
mDiagnostics->report(Diagnostics::VERSION_NOT_FIRST_STATEMENT,
mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return;
......@@ -723,13 +723,13 @@ void DirectiveParser::parseVersion(Token* token)
case VERSION_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
mDiagnostics->report(Diagnostics::INVALID_VERSION_NUMBER,
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&version))
{
mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
......@@ -737,7 +737,7 @@ void DirectiveParser::parseVersion(Token* token)
default:
if (valid)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
......@@ -747,7 +747,7 @@ void DirectiveParser::parseVersion(Token* token)
}
if (valid && (state != VERSION_NUMBER + 1))
{
mDiagnostics->report(Diagnostics::INVALID_VERSION_DIRECTIVE,
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
......@@ -778,13 +778,13 @@ void DirectiveParser::parseLine(Token* token)
case LINE_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
mDiagnostics->report(Diagnostics::INVALID_LINE_NUMBER,
mDiagnostics->report(Diagnostics::PP_INVALID_LINE_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&line))
{
mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
......@@ -792,13 +792,13 @@ void DirectiveParser::parseLine(Token* token)
case FILE_NUMBER:
if (valid && (token->type != Token::CONST_INT))
{
mDiagnostics->report(Diagnostics::INVALID_FILE_NUMBER,
mDiagnostics->report(Diagnostics::PP_INVALID_FILE_NUMBER,
token->location, token->text);
valid = false;
}
if (valid && !token->iValue(&file))
{
mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
valid = false;
}
......@@ -806,7 +806,7 @@ void DirectiveParser::parseLine(Token* token)
default:
if (valid)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
valid = false;
}
......@@ -817,7 +817,7 @@ void DirectiveParser::parseLine(Token* token)
if (valid && (state != FILE_NUMBER) && (state != FILE_NUMBER + 1))
{
mDiagnostics->report(Diagnostics::INVALID_LINE_DIRECTIVE,
mDiagnostics->report(Diagnostics::PP_INVALID_LINE_DIRECTIVE,
token->location, token->text);
valid = false;
}
......@@ -893,7 +893,7 @@ int DirectiveParser::parseExpressionIf(Token* token)
// Warn if there are tokens after #if expression.
if (!isEOD(token))
{
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
......@@ -909,7 +909,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
{
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
return 0;
......@@ -922,7 +922,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
mTokenizer->lex(token);
if (!isEOD(token))
{
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
token->location, token->text);
skipUntilEOD(mTokenizer, token);
}
......
......@@ -1587,7 +1587,7 @@ yyreduce:
std::ostringstream stream;
stream << (yyvsp[(1) - (3)]) << " % " << (yyvsp[(3) - (3)]);
std::string text = stream.str();
context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
......@@ -1604,7 +1604,7 @@ yyreduce:
std::ostringstream stream;
stream << (yyvsp[(1) - (3)]) << " / " << (yyvsp[(3) - (3)]);
std::string text = stream.str();
context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
......@@ -1903,7 +1903,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
unsigned int val = 0;
if (!token->uValue(&val))
{
context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
}
*lvalp = static_cast<YYSTYPE>(val);
......@@ -1944,7 +1944,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
void yyerror(Context* context, const char* reason)
{
context->diagnostics->report(pp::Diagnostics::INVALID_EXPRESSION,
context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
context->token->location,
reason);
}
......@@ -1972,12 +1972,12 @@ bool ExpressionParser::parse(Token* token, int* result)
break;
case 2:
mDiagnostics->report(Diagnostics::OUT_OF_MEMORY, token->location, "");
mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
break;
default:
assert(false);
mDiagnostics->report(Diagnostics::INTERNAL_ERROR, token->location, "");
mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
break;
}
......
......@@ -254,7 +254,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
if (token.type == Token::LAST)
{
mDiagnostics->report(Diagnostics::MACRO_UNTERMINATED_INVOCATION,
mDiagnostics->report(Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION,
identifier.location, identifier.text);
// Do not lose EOF token.
ungetToken(token);
......@@ -302,8 +302,8 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
if (args->size() != params.size())
{
Diagnostics::ID id = args->size() < macro.parameters.size() ?
Diagnostics::MACRO_TOO_FEW_ARGS :
Diagnostics::MACRO_TOO_MANY_ARGS;
Diagnostics::PP_MACRO_TOO_FEW_ARGS :
Diagnostics::PP_MACRO_TOO_MANY_ARGS;
mDiagnostics->report(id, identifier.location, identifier.text);
return false;
}
......
......@@ -101,11 +101,11 @@ void Preprocessor::lex(Token* token)
assert(false);
break;
case Token::PP_NUMBER:
mImpl->diagnostics->report(Diagnostics::INVALID_NUMBER,
mImpl->diagnostics->report(Diagnostics::PP_INVALID_NUMBER,
token->location, token->text);
break;
case Token::PP_OTHER:
mImpl->diagnostics->report(Diagnostics::INVALID_CHARACTER,
mImpl->diagnostics->report(Diagnostics::PP_INVALID_CHARACTER,
token->location, token->text);
break;
default:
......
......@@ -1143,7 +1143,7 @@ case YY_STATE_EOF(COMMENT):
if (YY_START == COMMENT)
{
yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
pp::SourceLocation(yyfileno, yylineno),
"");
}
......@@ -2327,7 +2327,7 @@ void Tokenizer::lex(Token* token)
token->type = pplex(&token->text,&token->location,mHandle);
if (token->text.size() > mMaxTokenLength)
{
mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
token->text.erase(mMaxTokenLength);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment