diff options
author | Android Chromium Automerger <chromium-automerger@android> | 2013-11-26 00:35:59 +0000 |
---|---|---|
committer | Android Chromium Automerger <chromium-automerger@android> | 2013-11-26 00:35:59 +0000 |
commit | a9fb4a91fa55e7808f65ca1a448c7847652d5199 (patch) | |
tree | d29d5417654aff6bb920f179beaa86e2159ffc80 | |
parent | ab53caecc8bef9e989a85ff841100df1e9b44708 (diff) | |
parent | 3bc1f246ff86182ceb05dc2d7c55f7c2ab44fd46 (diff) | |
download | angle_dx11-a9fb4a91fa55e7808f65ca1a448c7847652d5199.tar.gz |
Merge third_party/angle_dx11 from https://chromium.googlesource.com/external/angle.git at 3bc1f246ff86182ceb05dc2d7c55f7c2ab44fd46
This commit was generated by merge_from_chromium.py.
Change-Id: I78ff13fbdf53ff3ecb0ab1a9acb29fc042e8562e
33 files changed, 345 insertions, 296 deletions
diff --git a/.gclient b/.gclient new file mode 100644 index 00000000..77bf7d28 --- /dev/null +++ b/.gclient @@ -0,0 +1,7 @@ +solutions = [ { + u'managed': False, + u'name': u'.', + u'url': u'https://chromium.googlesource.com/angle/angle', + u'custom_deps': { }, + u'deps_file': u'DEPS' +} ]
\ No newline at end of file @@ -1,18 +1,18 @@ deps = { - "trunk/third_party/gyp": - "http://gyp.googlecode.com/svn/trunk@1564", + "third_party/gyp": + "http://gyp.googlecode.com/svn/trunk@1767", - "trunk/third_party/googletest": - "http://googletest.googlecode.com/svn/trunk@573", #release 1.6.0 + "third_party/googletest": + "http://googletest.googlecode.com/svn/trunk@629", - "trunk/third_party/googlemock": - "http://googlemock.googlecode.com/svn/trunk@387", #release 1.6.0 + "third_party/googlemock": + "http://googlemock.googlecode.com/svn/trunk@410", } hooks = [ { # A change to a .gyp, .gypi, or to GYP itself should run the generator. "pattern": ".", - "action": ["python", "trunk/build/gyp_angle"], + "action": ["python", "build/gyp_angle"], }, ] diff --git a/build/common.gypi b/build/common.gypi index 49156640..1c48170e 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -9,6 +9,8 @@ # angle_code is set to 0 for test code, sample code, and third party code. # When angle_code is 1, we build with additional warning flags on Mac and Linux. 'angle_code%': 0, + 'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0', + 'winsdk_arch%': 'x86', 'gcc_or_clang_warnings': [ '-Wall', '-Wchar-subscripts', @@ -81,7 +83,7 @@ # and utilities with console output. 'SubSystem': '1', # /SUBSYSTEM:CONSOLE 'AdditionalLibraryDirectories': [ - '$(ProgramFiles)/Windows Kits/8.0/Lib/win8/um/x86', + '<(windows_sdk_path)/Lib/win8/um/<(winsdk_arch)', ], 'AdditionalDependencies': [ 'kernel32.lib', @@ -101,7 +103,7 @@ }, 'VCLibrarianTool': { 'AdditionalLibraryDirectories': [ - '$(ProgramFiles)/Windows Kits/8.0/Lib/win8/um/x86', + '<(windows_sdk_path)/Lib/win8/um/<(winsdk_arch)', ], }, 'VCResourceCompilerTool': { @@ -109,8 +111,8 @@ }, }, 'msvs_system_include_dirs': [ - '$(ProgramFiles)/Windows Kits/8.0/Include/shared', - '$(ProgramFiles)/Windows Kits/8.0/Include/um', + '<(windows_sdk_path)/Include/shared', + '<(windows_sdk_path)/Include/um', ], }, # Common 'Debug': { diff --git a/build/gyp_angle b/build/gyp_angle index 2aa38a52..6533d367 100644 --- a/build/gyp_angle +++ b/build/gyp_angle @@ -25,7 +25,7 @@ if __name__ == '__main__': # Set the depth to get the top-level Makefile generated into the # correct directory. This only has an effect on Linux. args.append('--depth'); - args.append('./trunk'); + args.append('.'); # Add common.gypi to the include path. args.append('-I' + os.path.join(script_dir, 'common.gypi')) # Add all.gyp as the main gyp file to be generated. diff --git a/src/build_angle.gypi b/src/build_angle.gypi index 13c42f9e..d87ff4e6 100644 --- a/src/build_angle.gypi +++ b/src/build_angle.gypi @@ -369,6 +369,14 @@ ], } }, + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(windows_sdk_path)/Redist/D3D/<(winsdk_arch)/d3dcompiler_46.dll', + ], + }, + ], }, { 'target_name': 'libEGL', diff --git a/src/common/angleutils.h b/src/common/angleutils.h index 9761567f..7723f0fb 100644 --- a/src/common/angleutils.h +++ b/src/common/angleutils.h @@ -42,6 +42,20 @@ void SafeRelease(T& resource) } } +template <typename T> +void SafeDelete(T*& resource) +{ + delete resource; + resource = NULL; +} + +template <typename T> +void SafeDeleteArray(T*& resource) +{ + delete[] resource; + resource = NULL; +} + #if defined(_MSC_VER) #define snprintf _snprintf #endif diff --git a/src/common/version.h b/src/common/version.h index 9f221f3a..eb028574 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -1,7 +1,7 @@ #define MAJOR_VERSION 1 #define MINOR_VERSION 2 #define BUILD_VERSION 0 -#define BUILD_REVISION 2450 +#define BUILD_REVISION 2451 #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) diff --git a/src/compiler/Diagnostics.cpp b/src/compiler/Diagnostics.cpp index 8a38c41a..1c1b9b5e 100644 --- a/src/compiler/Diagnostics.cpp +++ b/src/compiler/Diagnostics.cpp @@ -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; diff --git a/src/compiler/DirectiveHandler.cpp b/src/compiler/DirectiveHandler.cpp index d1f6ab3a..6d3d831a 100644 --- a/src/compiler/DirectiveHandler.cpp +++ b/src/compiler/DirectiveHandler.cpp @@ -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"); } } diff --git a/src/compiler/ForLoopUnroll.h b/src/compiler/ForLoopUnroll.h index e800e25b..738b7692 100644 --- a/src/compiler/ForLoopUnroll.h +++ b/src/compiler/ForLoopUnroll.h @@ -4,6 +4,9 @@ // found in the LICENSE file. // +#ifndef COMPILER_FORLOOPUNROLL_H_ +#define COMPILER_FORLOOPUNROLL_H_ + #include "compiler/intermediate.h" struct TLoopIndexInfo { @@ -46,3 +49,4 @@ private: TVector<TLoopIndexInfo> mLoopIndexStack; }; +#endif diff --git a/src/compiler/ParseContext.cpp b/src/compiler/ParseContext.cpp index 9a279523..4db9c034 100644 --- a/src/compiler/ParseContext.cpp +++ b/src/compiler/ParseContext.cpp @@ -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); } diff --git a/src/compiler/intermediate.h b/src/compiler/intermediate.h index 14e39fd5..3f2ea145 100644 --- a/src/compiler/intermediate.h +++ b/src/compiler/intermediate.h @@ -384,9 +384,9 @@ public: ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; } - int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; } - float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; } - bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; } + int getIConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; } + float getFConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; } + bool getBConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; } virtual TIntermConstantUnion* getAsConstantUnion() { return this; } virtual void traverse(TIntermTraverser*); diff --git a/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/compiler/preprocessor/DiagnosticsBase.cpp index 3e22e1f1..a7ce862b 100644 --- a/src/compiler/preprocessor/DiagnosticsBase.cpp +++ b/src/compiler/preprocessor/DiagnosticsBase.cpp @@ -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: diff --git a/src/compiler/preprocessor/DiagnosticsBase.h b/src/compiler/preprocessor/DiagnosticsBase.h index 07bc4118..2c8c5391 100644 --- a/src/compiler/preprocessor/DiagnosticsBase.h +++ b/src/compiler/preprocessor/DiagnosticsBase.h @@ -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(); diff --git a/src/compiler/preprocessor/DirectiveParser.cpp b/src/compiler/preprocessor/DirectiveParser.cpp index 94dfdf51..ebec7980 100644 --- a/src/compiler/preprocessor/DirectiveParser.cpp +++ b/src/compiler/preprocessor/DirectiveParser.cpp @@ -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); } diff --git a/src/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp index 06c94382..2d374961 100644 --- a/src/compiler/preprocessor/ExpressionParser.cpp +++ b/src/compiler/preprocessor/ExpressionParser.cpp @@ -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; } diff --git a/src/compiler/preprocessor/MacroExpander.cpp b/src/compiler/preprocessor/MacroExpander.cpp index 1116c516..b789260a 100644 --- a/src/compiler/preprocessor/MacroExpander.cpp +++ b/src/compiler/preprocessor/MacroExpander.cpp @@ -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; } diff --git a/src/compiler/preprocessor/Preprocessor.cpp b/src/compiler/preprocessor/Preprocessor.cpp index b615c85d..580ffba4 100644 --- a/src/compiler/preprocessor/Preprocessor.cpp +++ b/src/compiler/preprocessor/Preprocessor.cpp @@ -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: diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp index 3b0fd101..21f11041 100644 --- a/src/compiler/preprocessor/Tokenizer.cpp +++ b/src/compiler/preprocessor/Tokenizer.cpp @@ -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); } diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp index e89f8bdd..59ae6c52 100644 --- a/src/libGLESv2/renderer/Renderer9.cpp +++ b/src/libGLESv2/renderer/Renderer9.cpp @@ -121,8 +121,6 @@ Renderer9::Renderer9(egl::Display *display, HDC hDc, bool softwareDevice) : Rend Renderer9::~Renderer9() { - releaseDeviceResources(); - if (mDevice) { // If the device is lost, reset it first to prevent leaving the driver in an unstable state @@ -130,22 +128,19 @@ Renderer9::~Renderer9() { resetDevice(); } - - mDevice->Release(); - mDevice = NULL; } - if (mDeviceEx) - { - mDeviceEx->Release(); - mDeviceEx = NULL; - } + deinitialize(); +} - if (mD3d9) - { - mD3d9->Release(); - mD3d9 = NULL; - } +void Renderer9::deinitialize() +{ + releaseDeviceResources(); + + SafeRelease(mDevice); + SafeRelease(mDeviceEx); + SafeRelease(mD3d9); + SafeRelease(mD3d9Ex); if (mDeviceWindow) { @@ -153,12 +148,6 @@ Renderer9::~Renderer9() mDeviceWindow = NULL; } - if (mD3d9Ex) - { - mD3d9Ex->Release(); - mD3d9Ex = NULL; - } - if (mD3d9Module) { mD3d9Module = NULL; @@ -2045,31 +2034,19 @@ void Renderer9::releaseDeviceResources() mEventQueryPool.pop_back(); } - if (mMaskedClearSavedState) - { - mMaskedClearSavedState->Release(); - mMaskedClearSavedState = NULL; - } + SafeRelease(mMaskedClearSavedState); mVertexShaderCache.clear(); mPixelShaderCache.clear(); - delete mBlit; - mBlit = NULL; - - delete mVertexDataManager; - mVertexDataManager = NULL; - - delete mIndexDataManager; - mIndexDataManager = NULL; - - delete mLineLoopIB; - mLineLoopIB = NULL; + SafeDelete(mBlit); + SafeDelete(mVertexDataManager); + SafeDelete(mIndexDataManager); + SafeDelete(mLineLoopIB); for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++) { - delete mNullColorbufferCache[i].buffer; - mNullColorbufferCache[i].buffer = NULL; + SafeDelete(mNullColorbufferCache[i].buffer); } } @@ -2089,22 +2066,8 @@ bool Renderer9::isDeviceLost() // set notify to true to broadcast a message to all contexts of the device loss bool Renderer9::testDeviceLost(bool notify) { - HRESULT status = S_OK; - - if (mDeviceEx) - { - status = mDeviceEx->CheckDeviceState(NULL); - } - else if (mDevice) - { - status = mDevice->TestCooperativeLevel(); - } - else - { - // No device yet, so no reset required - } - - bool isLost = FAILED(status) || d3d9::isDeviceLostError(status); + HRESULT status = getDeviceStatusCode(); + bool isLost = (FAILED(status) || d3d9::isDeviceLostError(status)); if (isLost) { @@ -2123,7 +2086,7 @@ bool Renderer9::testDeviceLost(bool notify) return isLost; } -bool Renderer9::testDeviceResettable() +HRESULT Renderer9::getDeviceStatusCode() { HRESULT status = D3D_OK; @@ -2136,9 +2099,14 @@ bool Renderer9::testDeviceResettable() status = mDevice->TestCooperativeLevel(); } + return status; +} + +bool Renderer9::testDeviceResettable() +{ // On D3D9Ex, DEVICELOST represents a hung device that needs to be restarted // DEVICEREMOVED indicates the device has been stopped and must be recreated - switch (status) + switch (getDeviceStatusCode()) { case D3DERR_DEVICENOTRESET: case D3DERR_DEVICEHUNG: @@ -2146,8 +2114,8 @@ bool Renderer9::testDeviceResettable() case D3DERR_DEVICELOST: return (mDeviceEx != NULL); case D3DERR_DEVICEREMOVED: - UNIMPLEMENTED(); - return false; + ASSERT(mDeviceEx != NULL); + return true; default: return false; } @@ -2162,13 +2130,22 @@ bool Renderer9::resetDevice() HRESULT result = D3D_OK; bool lost = testDeviceLost(false); int attempts = 3; + bool removedDevice = (getDeviceStatusCode() == D3DERR_DEVICEREMOVED); while (lost && attempts > 0) { if (mDeviceEx) { Sleep(500); // Give the graphics driver some CPU time - result = mDeviceEx->ResetEx(&presentParameters, NULL); + + if (removedDevice) + { + result = resetRemovedDevice(); + } + else + { + result = mDeviceEx->ResetEx(&presentParameters, NULL); + } } else { @@ -2195,13 +2172,29 @@ bool Renderer9::resetDevice() return false; } - // reset device defaults - initializeDevice(); + // If the device was removed, we already finished re-initialization in resetRemovedDevice + if (!removedDevice) + { + // reset device defaults + initializeDevice(); + } + mDeviceLost = false; return true; } +HRESULT Renderer9::resetRemovedDevice() +{ + // From http://msdn.microsoft.com/en-us/library/windows/desktop/bb172554(v=vs.85).aspx: + // The hardware adapter has been removed. Application must destroy the device, do enumeration of + // adapters and create another Direct3D device. If application continues rendering without + // calling Reset, the rendering calls will succeed. Applies to Direct3D 9Ex only. + ASSERT(mDeviceEx != NULL); + deinitialize(); + return (initialize() == EGL_SUCCESS ? S_OK : S_FALSE); +} + DWORD Renderer9::getAdapterVendor() const { return mAdapterIdentifier.VendorId; diff --git a/src/libGLESv2/renderer/Renderer9.h b/src/libGLESv2/renderer/Renderer9.h index afc2dc1d..65e8d73d 100644 --- a/src/libGLESv2/renderer/Renderer9.h +++ b/src/libGLESv2/renderer/Renderer9.h @@ -198,6 +198,8 @@ class Renderer9 : public Renderer private: DISALLOW_COPY_AND_ASSIGN(Renderer9); + void deinitialize(); + void applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v); void applyUniformniv(gl::Uniform *targetUniform, const GLint *v); void applyUniformnbv(gl::Uniform *targetUniform, const GLint *v); @@ -218,6 +220,9 @@ class Renderer9 : public Renderer D3DPRESENT_PARAMETERS getDefaultPresentParameters(); void releaseDeviceResources(); + HRESULT getDeviceStatusCode(); + HRESULT resetRemovedDevice(); + UINT mAdapter; D3DDEVTYPE mDeviceType; bool mSoftwareDevice; // FIXME: Deprecate diff --git a/tests/build_tests.gyp b/tests/build_tests.gyp index aa930f17..d485c834 100644 --- a/tests/build_tests.gyp +++ b/tests/build_tests.gyp @@ -14,6 +14,14 @@ 'sources': [ '../third_party/googletest/src/gtest-all.cc', ], + 'defines': [ + '_VARIADIC_MAX=10', + ], + 'direct_dependent_settings': { + 'defines': [ + '_VARIADIC_MAX=10', + ], + }, }, { 'target_name': 'gmock', @@ -26,6 +34,14 @@ 'sources': [ '../third_party/googlemock/src/gmock-all.cc', ], + 'defines': [ + '_VARIADIC_MAX=10', + ], + 'direct_dependent_settings': { + 'defines': [ + '_VARIADIC_MAX=10', + ], + }, }, { 'target_name': 'preprocessor_tests', diff --git a/tests/compiler_tests/ExpressionLimit_test.cpp b/tests/compiler_tests/ExpressionLimit_test.cpp index f671bad1..bb83a4e9 100644 --- a/tests/compiler_tests/ExpressionLimit_test.cpp +++ b/tests/compiler_tests/ExpressionLimit_test.cpp @@ -145,7 +145,7 @@ protected: const char* source, int compileOptions, const char* expected_error) { - bool success = ShCompile(compiler, &source, 1, compileOptions); + bool success = ShCompile(compiler, &source, 1, compileOptions) != 0; if (success) { success = !expected_error; } else { diff --git a/tests/preprocessor_tests/char_test.cpp b/tests/preprocessor_tests/char_test.cpp index e6576a0b..6ea5d808 100644 --- a/tests/preprocessor_tests/char_test.cpp +++ b/tests/preprocessor_tests/char_test.cpp @@ -82,7 +82,7 @@ TEST_P(CharTest, Identified) // Everything else is invalid. using testing::_; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INVALID_CHARACTER, _, str)); + print(pp::Diagnostics::PP_INVALID_CHARACTER, _, str)); } pp::Token token; diff --git a/tests/preprocessor_tests/comment_test.cpp b/tests/preprocessor_tests/comment_test.cpp index 27f78cf1..f0a2814f 100644 --- a/tests/preprocessor_tests/comment_test.cpp +++ b/tests/preprocessor_tests/comment_test.cpp @@ -62,7 +62,7 @@ TEST_F(BlockCommentTest, UnterminatedComment) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); using testing::_; - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::EOF_IN_COMMENT, _, _)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_EOF_IN_COMMENT, _, _)); pp::Token token; mPreprocessor.lex(&token); diff --git a/tests/preprocessor_tests/define_test.cpp b/tests/preprocessor_tests/define_test.cpp index bb72016b..fd3ae415 100644 --- a/tests/preprocessor_tests/define_test.cpp +++ b/tests/preprocessor_tests/define_test.cpp @@ -19,7 +19,7 @@ TEST_F(DefineTest, NonIdentifier) "2\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::UNEXPECTED_TOKEN, + print(pp::Diagnostics::PP_UNEXPECTED_TOKEN, pp::SourceLocation(0, 1), "2")); @@ -46,19 +46,19 @@ TEST_F(DefineTest, RedefinePredefined) "1\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_REDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_REDEFINED, pp::SourceLocation(0, 1), "__LINE__")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_REDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_REDEFINED, pp::SourceLocation(0, 3), "__FILE__")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_REDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_REDEFINED, pp::SourceLocation(0, 5), "__VERSION__")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_REDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_REDEFINED, pp::SourceLocation(0, 7), "GL_ES")); @@ -73,7 +73,7 @@ TEST_F(DefineTest, ReservedUnderScore1) "__foo\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_NAME_RESERVED, + print(pp::Diagnostics::PP_MACRO_NAME_RESERVED, pp::SourceLocation(0, 1), "__foo")); @@ -88,7 +88,7 @@ TEST_F(DefineTest, ReservedUnderScore2) "foo__bar\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_NAME_RESERVED, + print(pp::Diagnostics::PP_MACRO_NAME_RESERVED, pp::SourceLocation(0, 1), "foo__bar")); @@ -103,7 +103,7 @@ TEST_F(DefineTest, ReservedGL) "GL_foo\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_NAME_RESERVED, + print(pp::Diagnostics::PP_MACRO_NAME_RESERVED, pp::SourceLocation(0, 1), "GL_foo")); @@ -135,7 +135,7 @@ TEST_F(DefineTest, ObjRedefineInvalid) "(0)\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_REDEFINED, + print(pp::Diagnostics::PP_MACRO_REDEFINED, pp::SourceLocation(0, 2), "foo")); @@ -167,7 +167,7 @@ TEST_F(DefineTest, FuncRedefineInvalid) "( a )\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_REDEFINED, + print(pp::Diagnostics::PP_MACRO_REDEFINED, pp::SourceLocation(0, 2), "foo")); @@ -684,7 +684,7 @@ TEST_F(DefineTest, FuncMissingRightParen) "\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_UNTERMINATED_INVOCATION, + print(pp::Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION, pp::SourceLocation(0, 2), "foo")); @@ -703,15 +703,15 @@ TEST_F(DefineTest, FuncIncorrectArgCount) "\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_TOO_FEW_ARGS, + print(pp::Diagnostics::PP_MACRO_TOO_FEW_ARGS, pp::SourceLocation(0, 2), "foo")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_TOO_FEW_ARGS, + print(pp::Diagnostics::PP_MACRO_TOO_FEW_ARGS, pp::SourceLocation(0, 3), "foo")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_TOO_MANY_ARGS, + print(pp::Diagnostics::PP_MACRO_TOO_MANY_ARGS, pp::SourceLocation(0, 4), "foo")); @@ -752,19 +752,19 @@ TEST_F(DefineTest, UndefPredefined) "1\n"; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_UNDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED, pp::SourceLocation(0, 1), "__LINE__")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_UNDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED, pp::SourceLocation(0, 3), "__FILE__")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_UNDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED, pp::SourceLocation(0, 5), "__VERSION__")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::MACRO_PREDEFINED_UNDEFINED, + print(pp::Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED, pp::SourceLocation(0, 7), "GL_ES")); diff --git a/tests/preprocessor_tests/error_test.cpp b/tests/preprocessor_tests/error_test.cpp index c9e0c40f..ac7cdba3 100644 --- a/tests/preprocessor_tests/error_test.cpp +++ b/tests/preprocessor_tests/error_test.cpp @@ -86,7 +86,7 @@ TEST_F(ErrorTest, MissingNewline) EXPECT_CALL(mDirectiveHandler, handleError(pp::SourceLocation(0, 1), " foo")); // Error reported about EOF. - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::EOF_IN_DIRECTIVE, _, _)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_EOF_IN_DIRECTIVE, _, _)); preprocess(str, expected); } diff --git a/tests/preprocessor_tests/extension_test.cpp b/tests/preprocessor_tests/extension_test.cpp index 94b7eb70..0b8cf88b 100644 --- a/tests/preprocessor_tests/extension_test.cpp +++ b/tests/preprocessor_tests/extension_test.cpp @@ -61,7 +61,7 @@ TEST_F(ExtensionTest, MissingNewline) EXPECT_CALL(mDirectiveHandler, handleExtension(pp::SourceLocation(0, 1), "foo", "bar")); // Error reported about EOF. - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::EOF_IN_DIRECTIVE, _, _)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_EOF_IN_DIRECTIVE, _, _)); preprocess(str, expected); } @@ -93,11 +93,11 @@ TEST_P(InvalidExtensionTest, Identified) } static const ExtensionTestParam kParams[] = { - {"#extension\n", pp::Diagnostics::INVALID_EXTENSION_DIRECTIVE}, - {"#extension 1\n", pp::Diagnostics::INVALID_EXTENSION_NAME}, - {"#extension foo bar\n", pp::Diagnostics::UNEXPECTED_TOKEN}, - {"#extension foo : \n", pp::Diagnostics::INVALID_EXTENSION_DIRECTIVE}, - {"#extension foo : 1\n", pp::Diagnostics::INVALID_EXTENSION_BEHAVIOR}, - {"#extension foo : bar baz\n", pp::Diagnostics::UNEXPECTED_TOKEN} + {"#extension\n", pp::Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE}, + {"#extension 1\n", pp::Diagnostics::PP_INVALID_EXTENSION_NAME}, + {"#extension foo bar\n", pp::Diagnostics::PP_UNEXPECTED_TOKEN}, + {"#extension foo : \n", pp::Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE}, + {"#extension foo : 1\n", pp::Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR}, + {"#extension foo : bar baz\n", pp::Diagnostics::PP_UNEXPECTED_TOKEN} }; INSTANTIATE_TEST_CASE_P(All, InvalidExtensionTest, testing::ValuesIn(kParams)); diff --git a/tests/preprocessor_tests/if_test.cpp b/tests/preprocessor_tests/if_test.cpp index 7a7548ff..2849887e 100644 --- a/tests/preprocessor_tests/if_test.cpp +++ b/tests/preprocessor_tests/if_test.cpp @@ -612,7 +612,7 @@ TEST_F(IfTest, MissingExpression) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INVALID_EXPRESSION, + print(pp::Diagnostics::PP_INVALID_EXPRESSION, pp::SourceLocation(0, 1), "syntax error")); @@ -627,7 +627,7 @@ TEST_F(IfTest, DivisionByZero) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::DIVISION_BY_ZERO, + print(pp::Diagnostics::PP_DIVISION_BY_ZERO, pp::SourceLocation(0, 1), "1 / 0")); pp::Token token; @@ -641,7 +641,7 @@ TEST_F(IfTest, ModuloByZero) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::DIVISION_BY_ZERO, + print(pp::Diagnostics::PP_DIVISION_BY_ZERO, pp::SourceLocation(0, 1), "1 % 0")); pp::Token token; @@ -655,7 +655,7 @@ TEST_F(IfTest, DecIntegerOverflow) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INTEGER_OVERFLOW, + print(pp::Diagnostics::PP_INTEGER_OVERFLOW, pp::SourceLocation(0, 1), "4294967296")); pp::Token token; @@ -669,7 +669,7 @@ TEST_F(IfTest, OctIntegerOverflow) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INTEGER_OVERFLOW, + print(pp::Diagnostics::PP_INTEGER_OVERFLOW, pp::SourceLocation(0, 1), "077777777777")); pp::Token token; @@ -683,7 +683,7 @@ TEST_F(IfTest, HexIntegerOverflow) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INTEGER_OVERFLOW, + print(pp::Diagnostics::PP_INTEGER_OVERFLOW, pp::SourceLocation(0, 1), "0xfffffffff")); pp::Token token; @@ -697,11 +697,11 @@ TEST_F(IfTest, UndefinedMacro) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INVALID_EXPRESSION, + print(pp::Diagnostics::PP_INVALID_EXPRESSION, pp::SourceLocation(0, 1), "syntax error")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN, + print(pp::Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN, pp::SourceLocation(0, 1), "UNDEFINED")); @@ -735,7 +735,7 @@ TEST_F(IfTest, ElseWithoutIf) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_ELSE_WITHOUT_IF, + print(pp::Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF, pp::SourceLocation(0, 1), "else")); @@ -749,7 +749,7 @@ TEST_F(IfTest, ElifWithoutIf) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_ELIF_WITHOUT_IF, + print(pp::Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF, pp::SourceLocation(0, 1), "elif")); @@ -763,7 +763,7 @@ TEST_F(IfTest, EndifWithoutIf) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_ENDIF_WITHOUT_IF, + print(pp::Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF, pp::SourceLocation(0, 1), "endif")); @@ -780,7 +780,7 @@ TEST_F(IfTest, ElseAfterElse) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_ELSE_AFTER_ELSE, + print(pp::Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE, pp::SourceLocation(0, 3), "else")); @@ -797,7 +797,7 @@ TEST_F(IfTest, ElifAfterElse) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_ELIF_AFTER_ELSE, + print(pp::Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE, pp::SourceLocation(0, 3), "elif")); @@ -811,7 +811,7 @@ TEST_F(IfTest, UnterminatedIf) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_UNTERMINATED, + print(pp::Diagnostics::PP_CONDITIONAL_UNTERMINATED, pp::SourceLocation(0, 1), "if")); @@ -825,7 +825,7 @@ TEST_F(IfTest, UnterminatedIfdef) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::CONDITIONAL_UNTERMINATED, + print(pp::Diagnostics::PP_CONDITIONAL_UNTERMINATED, pp::SourceLocation(0, 1), "ifdef")); diff --git a/tests/preprocessor_tests/location_test.cpp b/tests/preprocessor_tests/location_test.cpp index b615f99c..eb81555b 100644 --- a/tests/preprocessor_tests/location_test.cpp +++ b/tests/preprocessor_tests/location_test.cpp @@ -77,7 +77,7 @@ TEST_F(LocationTest, ErrorLocationAfterComment) const char* str = "/*\n\n*/@"; ASSERT_TRUE(mPreprocessor.init(1, &str, NULL)); - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::INVALID_CHARACTER, + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_INVALID_CHARACTER, pp::SourceLocation(0, 3), "@")); @@ -261,7 +261,7 @@ TEST_F(LocationTest, LineDirectiveMissingNewline) using testing::_; // Error reported about EOF. - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::EOF_IN_DIRECTIVE, _, _)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_EOF_IN_DIRECTIVE, _, _)); pp::Token token; mPreprocessor.lex(&token); @@ -292,12 +292,12 @@ TEST_P(InvalidLineTest, Identified) } static const LineTestParam kParams[] = { - {"#line\n", pp::Diagnostics::INVALID_LINE_DIRECTIVE}, - {"#line foo\n", pp::Diagnostics::INVALID_LINE_NUMBER}, - {"#line 10 foo\n", pp::Diagnostics::INVALID_FILE_NUMBER}, - {"#line 10 20 foo\n", pp::Diagnostics::UNEXPECTED_TOKEN}, - {"#line 0xffffffff\n", pp::Diagnostics::INTEGER_OVERFLOW}, - {"#line 10 0xffffffff\n", pp::Diagnostics::INTEGER_OVERFLOW} + {"#line\n", pp::Diagnostics::PP_INVALID_LINE_DIRECTIVE}, + {"#line foo\n", pp::Diagnostics::PP_INVALID_LINE_NUMBER}, + {"#line 10 foo\n", pp::Diagnostics::PP_INVALID_FILE_NUMBER}, + {"#line 10 20 foo\n", pp::Diagnostics::PP_UNEXPECTED_TOKEN}, + {"#line 0xffffffff\n", pp::Diagnostics::PP_INTEGER_OVERFLOW}, + {"#line 10 0xffffffff\n", pp::Diagnostics::PP_INTEGER_OVERFLOW} }; INSTANTIATE_TEST_CASE_P(All, InvalidLineTest, testing::ValuesIn(kParams)); diff --git a/tests/preprocessor_tests/number_test.cpp b/tests/preprocessor_tests/number_test.cpp index 13673212..9b2518b7 100644 --- a/tests/preprocessor_tests/number_test.cpp +++ b/tests/preprocessor_tests/number_test.cpp @@ -20,7 +20,7 @@ TEST_P(InvalidNumberTest, InvalidNumberIdentified) ASSERT_TRUE(mPreprocessor.init(1, &str, 0)); using testing::_; - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::INVALID_NUMBER, _, str)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_INVALID_NUMBER, _, str)); pp::Token token; mPreprocessor.lex(&token); diff --git a/tests/preprocessor_tests/pragma_test.cpp b/tests/preprocessor_tests/pragma_test.cpp index a76fadae..de0fa98c 100644 --- a/tests/preprocessor_tests/pragma_test.cpp +++ b/tests/preprocessor_tests/pragma_test.cpp @@ -91,7 +91,7 @@ TEST_F(PragmaTest, MissingNewline) EXPECT_CALL(mDirectiveHandler, handlePragma(pp::SourceLocation(0, 1), "foo", "bar")); // Error reported about EOF. - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::EOF_IN_DIRECTIVE, _, _)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_EOF_IN_DIRECTIVE, _, _)); preprocess(str, expected); } @@ -111,7 +111,7 @@ TEST_P(InvalidPragmaTest, Identified) EXPECT_CALL(mDirectiveHandler, handlePragma(_, _, _)).Times(0); // Unrecognized pragma warning. EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::UNRECOGNIZED_PRAGMA, + print(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, pp::SourceLocation(0, 1), _)); preprocess(str, expected); diff --git a/tests/preprocessor_tests/version_test.cpp b/tests/preprocessor_tests/version_test.cpp index 0db2fad1..1c490e50 100644 --- a/tests/preprocessor_tests/version_test.cpp +++ b/tests/preprocessor_tests/version_test.cpp @@ -57,7 +57,7 @@ TEST_F(VersionTest, MissingNewline) EXPECT_CALL(mDirectiveHandler, handleVersion(pp::SourceLocation(0, 1), 200)); // Error reported about EOF. - EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::EOF_IN_DIRECTIVE, _, _)); + EXPECT_CALL(mDiagnostics, print(pp::Diagnostics::PP_EOF_IN_DIRECTIVE, _, _)); preprocess(str, expected); } @@ -104,7 +104,7 @@ TEST_F(VersionTest, AfterValidToken) using testing::_; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::VERSION_NOT_FIRST_STATEMENT, + print(pp::Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, pp::SourceLocation(0, 2), _)); pp::Token token; @@ -122,10 +122,10 @@ TEST_F(VersionTest, AfterInvalidToken) using testing::_; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::INVALID_CHARACTER, + print(pp::Diagnostics::PP_INVALID_CHARACTER, pp::SourceLocation(0, 1), "$")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::VERSION_NOT_FIRST_STATEMENT, + print(pp::Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, pp::SourceLocation(0, 2), _)); pp::Token token; @@ -143,7 +143,7 @@ TEST_F(VersionTest, AfterValidDirective) using testing::_; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::VERSION_NOT_FIRST_STATEMENT, + print(pp::Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, pp::SourceLocation(0, 2), _)); pp::Token token; @@ -161,10 +161,10 @@ TEST_F(VersionTest, AfterInvalidDirective) using testing::_; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::DIRECTIVE_INVALID_NAME, + print(pp::Diagnostics::PP_DIRECTIVE_INVALID_NAME, pp::SourceLocation(0, 1), "foo")); EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::VERSION_NOT_FIRST_STATEMENT, + print(pp::Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, pp::SourceLocation(0, 2), _)); pp::Token token; @@ -184,7 +184,7 @@ TEST_F(VersionTest, AfterExcludedBlock) using testing::_; EXPECT_CALL(mDiagnostics, - print(pp::Diagnostics::VERSION_NOT_FIRST_STATEMENT, + print(pp::Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, pp::SourceLocation(0, 4), _)); pp::Token token; @@ -220,10 +220,10 @@ TEST_P(InvalidVersionTest, Identified) } static const VersionTestParam kParams[] = { - {"#version\n", pp::Diagnostics::INVALID_VERSION_DIRECTIVE}, - {"#version foo\n", pp::Diagnostics::INVALID_VERSION_NUMBER}, - {"#version 100 foo\n", pp::Diagnostics::UNEXPECTED_TOKEN}, - {"#version 0xffffffff\n", pp::Diagnostics::INTEGER_OVERFLOW} + {"#version\n", pp::Diagnostics::PP_INVALID_VERSION_DIRECTIVE}, + {"#version foo\n", pp::Diagnostics::PP_INVALID_VERSION_NUMBER}, + {"#version 100 foo\n", pp::Diagnostics::PP_UNEXPECTED_TOKEN}, + {"#version 0xffffffff\n", pp::Diagnostics::PP_INTEGER_OVERFLOW} }; INSTANTIATE_TEST_CASE_P(All, InvalidVersionTest, testing::ValuesIn(kParams)); |