summaryrefslogtreecommitdiff
path: root/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp')
-rw-r--r--Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp182
1 files changed, 98 insertions, 84 deletions
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
index 3e22e1f1c..fcb24e4e8 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "DiagnosticsBase.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
-#include <cassert>
+#include "common/debug.h"
namespace pp
{
@@ -16,8 +16,8 @@ Diagnostics::~Diagnostics()
}
void Diagnostics::report(ID id,
- const SourceLocation& loc,
- const std::string& text)
+ const SourceLocation &loc,
+ const std::string &text)
{
// TODO(alokp): Keep a count of errors and warnings.
print(id, loc, text);
@@ -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;
+ UNREACHABLE();
+ return PP_ERROR;
}
std::string Diagnostics::message(ID id)
@@ -40,86 +40,100 @@ std::string Diagnostics::message(ID id)
switch (id)
{
// Errors begin.
- case INTERNAL_ERROR:
- return "internal error";
- case OUT_OF_MEMORY:
- return "out of memory";
- case INVALID_CHARACTER:
- return "invalid character";
- case INVALID_NUMBER:
- return "invalid number";
- case INTEGER_OVERFLOW:
- return "integer overflow";
- case FLOAT_OVERFLOW:
- return "float overflow";
- case TOKEN_TOO_LONG:
- return "token too long";
- case INVALID_EXPRESSION:
- return "invalid expression";
- case DIVISION_BY_ZERO:
- return "division by zero";
- case EOF_IN_COMMENT:
- return "unexpected end of file found in comment";
- case UNEXPECTED_TOKEN:
- return "unexpected token";
- case DIRECTIVE_INVALID_NAME:
- return "invalid directive name";
- case MACRO_NAME_RESERVED:
- return "macro name is reserved";
- case MACRO_REDEFINED:
- return "macro redefined";
- case MACRO_PREDEFINED_REDEFINED:
- return "predefined macro redefined";
- case MACRO_PREDEFINED_UNDEFINED:
- return "predefined macro undefined";
- case MACRO_UNTERMINATED_INVOCATION:
- return "unterminated macro invocation";
- case MACRO_TOO_FEW_ARGS:
- return "Not enough arguments for macro";
- case MACRO_TOO_MANY_ARGS:
- return "Too many arguments for macro";
- case CONDITIONAL_ENDIF_WITHOUT_IF:
- return "unexpected #endif found without a matching #if";
- case CONDITIONAL_ELSE_WITHOUT_IF:
- return "unexpected #else found without a matching #if";
- case CONDITIONAL_ELSE_AFTER_ELSE:
- return "unexpected #else found after another #else";
- case CONDITIONAL_ELIF_WITHOUT_IF:
- return "unexpected #elif found without a matching #if";
- case CONDITIONAL_ELIF_AFTER_ELSE:
- return "unexpected #elif found after #else";
- case CONDITIONAL_UNTERMINATED:
- return "unexpected end of file found in conditional block";
- case INVALID_EXTENSION_NAME:
- return "invalid extension name";
- case INVALID_EXTENSION_BEHAVIOR:
- return "invalid extension behavior";
- case INVALID_EXTENSION_DIRECTIVE:
- return "invalid extension directive";
- case INVALID_VERSION_NUMBER:
- return "invalid version number";
- case INVALID_VERSION_DIRECTIVE:
- return "invalid version directive";
- case VERSION_NOT_FIRST_STATEMENT:
+ case PP_INTERNAL_ERROR:
+ return "internal error";
+ case PP_OUT_OF_MEMORY:
+ return "out of memory";
+ case PP_INVALID_CHARACTER:
+ return "invalid character";
+ case PP_INVALID_NUMBER:
+ return "invalid number";
+ case PP_INTEGER_OVERFLOW:
+ return "integer overflow";
+ case PP_FLOAT_OVERFLOW:
+ return "float overflow";
+ case PP_TOKEN_TOO_LONG:
+ return "token too long";
+ case PP_INVALID_EXPRESSION:
+ return "invalid expression";
+ case PP_DIVISION_BY_ZERO:
+ return "division by zero";
+ case PP_EOF_IN_COMMENT:
+ return "unexpected end of file found in comment";
+ case PP_UNEXPECTED_TOKEN:
+ return "unexpected token";
+ case PP_DIRECTIVE_INVALID_NAME:
+ return "invalid directive name";
+ case PP_MACRO_NAME_RESERVED:
+ return "macro name is reserved";
+ case PP_MACRO_REDEFINED:
+ return "macro redefined";
+ case PP_MACRO_PREDEFINED_REDEFINED:
+ return "predefined macro redefined";
+ case PP_MACRO_PREDEFINED_UNDEFINED:
+ return "predefined macro undefined";
+ case PP_MACRO_UNTERMINATED_INVOCATION:
+ return "unterminated macro invocation";
+ case PP_MACRO_UNDEFINED_WHILE_INVOKED:
+ return "macro undefined while being invoked";
+ case PP_MACRO_TOO_FEW_ARGS:
+ return "Not enough arguments for macro";
+ case PP_MACRO_TOO_MANY_ARGS:
+ return "Too many arguments for macro";
+ case PP_MACRO_DUPLICATE_PARAMETER_NAMES:
+ return "duplicate macro parameter name";
+ case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
+ return "unexpected #endif found without a matching #if";
+ case PP_CONDITIONAL_ELSE_WITHOUT_IF:
+ return "unexpected #else found without a matching #if";
+ case PP_CONDITIONAL_ELSE_AFTER_ELSE:
+ return "unexpected #else found after another #else";
+ case PP_CONDITIONAL_ELIF_WITHOUT_IF:
+ return "unexpected #elif found without a matching #if";
+ case PP_CONDITIONAL_ELIF_AFTER_ELSE:
+ return "unexpected #elif found after #else";
+ case PP_CONDITIONAL_UNTERMINATED:
+ return "unexpected end of file found in conditional block";
+ case PP_INVALID_EXTENSION_NAME:
+ return "invalid extension name";
+ case PP_INVALID_EXTENSION_BEHAVIOR:
+ return "invalid extension behavior";
+ case PP_INVALID_EXTENSION_DIRECTIVE:
+ return "invalid extension directive";
+ case PP_INVALID_VERSION_NUMBER:
+ return "invalid version number";
+ case PP_INVALID_VERSION_DIRECTIVE:
+ return "invalid version directive";
+ case PP_VERSION_NOT_FIRST_STATEMENT:
return "#version directive must occur before anything else, "
"except for comments and white space";
- case INVALID_LINE_NUMBER:
- return "invalid line number";
- case INVALID_FILE_NUMBER:
- return "invalid file number";
- case INVALID_LINE_DIRECTIVE:
- return "invalid line directive";
+ case PP_VERSION_NOT_FIRST_LINE_ESSL3:
+ return "#version directive must occur on the first line of the shader";
+ case PP_INVALID_LINE_NUMBER:
+ return "invalid line number";
+ case PP_INVALID_FILE_NUMBER:
+ return "invalid file number";
+ case PP_INVALID_LINE_DIRECTIVE:
+ return "invalid line directive";
+ case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
+ return "extension directive must occur before any non-preprocessor tokens in ESSL3";
+ case PP_UNDEFINED_SHIFT:
+ return "shift exponent is negative or undefined";
// Errors end.
// Warnings begin.
- case EOF_IN_DIRECTIVE:
- return "unexpected end of file found in directive";
- case CONDITIONAL_UNEXPECTED_TOKEN:
- return "unexpected token after conditional expression";
- case UNRECOGNIZED_PRAGMA:
- return "unrecognized pragma";
+ case PP_EOF_IN_DIRECTIVE:
+ return "unexpected end of file found in directive";
+ case PP_CONDITIONAL_UNEXPECTED_TOKEN:
+ return "unexpected token after conditional expression";
+ case PP_UNRECOGNIZED_PRAGMA:
+ return "unrecognized pragma";
+ case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1:
+ return "extension directive should occur before any non-preprocessor tokens";
+ case PP_WARNING_MACRO_NAME_RESERVED:
+ return "macro name with a double underscore is reserved - unintented behavior is possible";
// Warnings end.
default:
- assert(false);
+ UNREACHABLE();
return "";
}
}