Commit 4de340ac by Olli Etuaho Committed by Commit Bot

Remove extraInfo parameter from compiler diagnostic functions

This makes error messages more consistent. It was not clear what was supposed to go to the extraInfo parameter, and previously it was mostly being misused, resulting in poorly formatted error messages. Sometimes the order of parameters to the diagnostic functions like error() and warning() was wrong altogether. The diagnostics API is simpler when there's only the "reason" and "token" parameters that have clear meaning and that are separated by consistent punctuation in the output. Fixes error messages like "redifinition interface block member" to be grammatically reasonable like the rest of the error messages. For other error messages, punctuation is added to make them clearer. Example: "invalid layout qualifier location requires an argument" is changed to "invalid layout qualifier: location requires an argument". Extra spaces are also removed from the beginning of error messages. BUG=angleproject:1670 BUG=angleproject:911 TEST=angle_unittests Change-Id: Id5fb1a1f2892fad2b796aaef47ffb07e9d79759c Reviewed-on: https://chromium-review.googlesource.com/420789Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 08a617ad
......@@ -21,11 +21,11 @@ float CheckedSum(float lhs, float rhs, TDiagnostics *diag, const TSourceLoc &lin
float result = lhs + rhs;
if (gl::isNaN(result) && !gl::isNaN(lhs) && !gl::isNaN(rhs))
{
diag->warning(line, "Constant folded undefined addition generated NaN", "+", "");
diag->warning(line, "Constant folded undefined addition generated NaN", "+");
}
else if (gl::isInf(result) && !gl::isInf(lhs) && !gl::isInf(rhs))
{
diag->warning(line, "Constant folded addition overflowed to infinity", "+", "");
diag->warning(line, "Constant folded addition overflowed to infinity", "+");
}
return result;
}
......@@ -35,11 +35,11 @@ float CheckedDiff(float lhs, float rhs, TDiagnostics *diag, const TSourceLoc &li
float result = lhs - rhs;
if (gl::isNaN(result) && !gl::isNaN(lhs) && !gl::isNaN(rhs))
{
diag->warning(line, "Constant folded undefined subtraction generated NaN", "-", "");
diag->warning(line, "Constant folded undefined subtraction generated NaN", "-");
}
else if (gl::isInf(result) && !gl::isInf(lhs) && !gl::isInf(rhs))
{
diag->warning(line, "Constant folded subtraction overflowed to infinity", "-", "");
diag->warning(line, "Constant folded subtraction overflowed to infinity", "-");
}
return result;
}
......@@ -49,11 +49,11 @@ float CheckedMul(float lhs, float rhs, TDiagnostics *diag, const TSourceLoc &lin
float result = lhs * rhs;
if (gl::isNaN(result) && !gl::isNaN(lhs) && !gl::isNaN(rhs))
{
diag->warning(line, "Constant folded undefined multiplication generated NaN", "*", "");
diag->warning(line, "Constant folded undefined multiplication generated NaN", "*");
}
else if (gl::isInf(result) && !gl::isInf(lhs) && !gl::isInf(rhs))
{
diag->warning(line, "Constant folded multiplication overflowed to infinity", "*", "");
diag->warning(line, "Constant folded multiplication overflowed to infinity", "*");
}
return result;
}
......@@ -380,7 +380,7 @@ TConstantUnion TConstantUnion::rshift(const TConstantUnion &lhs,
if ((rhs.type == EbtInt && (rhs.iConst < 0 || rhs.iConst > 31)) ||
(rhs.type == EbtUInt && rhs.uConst > 31u))
{
diag->error(line, "Undefined shift (operand out of range)", ">>", "");
diag->error(line, "Undefined shift (operand out of range)", ">>");
switch (lhs.type)
{
case EbtInt:
......@@ -487,7 +487,7 @@ TConstantUnion TConstantUnion::lshift(const TConstantUnion &lhs,
if ((rhs.type == EbtInt && (rhs.iConst < 0 || rhs.iConst > 31)) ||
(rhs.type == EbtUInt && rhs.uConst > 31u))
{
diag->error(line, "Undefined shift (operand out of range)", "<<", "");
diag->error(line, "Undefined shift (operand out of range)", "<<");
switch (lhs.type)
{
case EbtInt:
......
......@@ -26,8 +26,7 @@ TDiagnostics::~TDiagnostics()
void TDiagnostics::writeInfo(Severity severity,
const pp::SourceLocation &loc,
const std::string &reason,
const std::string &token,
const std::string &extra)
const std::string &token)
{
TPrefixType prefix = EPrefixNone;
switch (severity)
......@@ -49,39 +48,28 @@ void TDiagnostics::writeInfo(Severity severity,
/* VC++ format: file(linenum) : error #: 'token' : extrainfo */
sink.prefix(prefix);
sink.location(loc.file, loc.line);
sink << "'" << token << "' : " << reason << " " << extra << "\n";
sink << "'" << token << "' : " << reason << "\n";
}
void TDiagnostics::error(const TSourceLoc &loc,
const char *reason,
const char *token,
const char *extraInfo)
void TDiagnostics::error(const TSourceLoc &loc, const char *reason, const char *token)
{
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
writeInfo(pp::Diagnostics::PP_ERROR, srcLoc, reason, token, extraInfo);
}
void TDiagnostics::error(const TSourceLoc &loc, const char *reason, const char *token)
{
error(loc, reason, token, "");
writeInfo(pp::Diagnostics::PP_ERROR, srcLoc, reason, token);
}
void TDiagnostics::warning(const TSourceLoc &loc,
const char *reason,
const char *token,
const char *extraInfo)
void TDiagnostics::warning(const TSourceLoc &loc, const char *reason, const char *token)
{
pp::SourceLocation srcLoc;
srcLoc.file = loc.first_file;
srcLoc.line = loc.first_line;
writeInfo(pp::Diagnostics::PP_WARNING, srcLoc, reason, token, extraInfo);
writeInfo(pp::Diagnostics::PP_WARNING, srcLoc, reason, token);
}
void TDiagnostics::print(ID id, const pp::SourceLocation &loc, const std::string &text)
{
writeInfo(severity(id), loc, message(id), text, "");
writeInfo(severity(id), loc, message(id), text);
}
} // namespace sh
......@@ -30,15 +30,10 @@ class TDiagnostics : public pp::Diagnostics, angle::NonCopyable
void writeInfo(Severity severity,
const pp::SourceLocation &loc,
const std::string &reason,
const std::string &token,
const std::string &extra);
const std::string &token);
void error(const TSourceLoc &loc, const char *reason, const char *token, const char *extraInfo);
void error(const TSourceLoc &loc, const char *reason, const char *token);
void warning(const TSourceLoc &loc,
const char *reason,
const char *token,
const char *extraInfo);
void warning(const TSourceLoc &loc, const char *reason, const char *token);
protected:
void print(ID id, const pp::SourceLocation &loc, const std::string &text) override;
......
......@@ -52,7 +52,7 @@ TDirectiveHandler::~TDirectiveHandler()
void TDirectiveHandler::handleError(const pp::SourceLocation &loc, const std::string &msg)
{
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "", "");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "");
}
void TDirectiveHandler::handlePragma(const pp::SourceLocation &loc,
......@@ -72,7 +72,7 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation &loc,
// ESSL 3.00.4 section 4.6.1
mDiagnostics.writeInfo(
pp::Diagnostics::PP_ERROR, loc,
"#pragma STDGL invariant(all) can not be used in fragment shader", name, value);
"#pragma STDGL invariant(all) can not be used in fragment shader", name);
}
mPragma.stdgl.invariantAll = true;
}
......@@ -125,8 +125,8 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation &loc,
if (invalidValue)
{
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "invalid pragma value", value,
"'on' or 'off' expected");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"invalid pragma value - 'on' or 'off' expected", value);
}
}
}
......@@ -140,7 +140,7 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation &loc,
TBehavior behaviorVal = getBehavior(behavior);
if (behaviorVal == EBhUndefined)
{
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "behavior", name, "invalid");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "behavior invalid", name);
return;
}
......@@ -148,13 +148,13 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation &loc,
{
if (behaviorVal == EBhRequire)
{
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "extension", name,
"cannot have 'require' behavior");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension cannot have 'require' behavior", name);
}
else if (behaviorVal == EBhEnable)
{
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "extension", name,
"cannot have 'enable' behavior");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"extension cannot have 'enable' behavior", name);
}
else
{
......@@ -187,7 +187,7 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation &loc,
UNREACHABLE();
break;
}
mDiagnostics.writeInfo(severity, loc, "extension", name, "is not supported");
mDiagnostics.writeInfo(severity, loc, "extension is not supported", name);
}
void TDirectiveHandler::handleVersion(const pp::SourceLocation &loc, int version)
......@@ -201,8 +201,7 @@ void TDirectiveHandler::handleVersion(const pp::SourceLocation &loc, int version
std::stringstream stream;
stream << version;
std::string str = stream.str();
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "version number", str,
"not supported");
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, "version number not supported", str);
}
}
......
......@@ -54,7 +54,7 @@ void UndefinedConstantFoldingError(const TSourceLoc &loc,
TConstantUnion *result)
{
diagnostics->warning(loc, "operation result is undefined for the values passed in",
GetOperatorString(op), "");
GetOperatorString(op));
switch (basicType)
{
......@@ -1342,13 +1342,13 @@ TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
diagnostics->warning(
getLine(),
"Zero divided by zero during constant folding generated NaN",
"/", "");
"/");
resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
}
else
{
diagnostics->warning(
getLine(), "Divide by zero during constant folding", "/", "");
diagnostics->warning(getLine(),
"Divide by zero during constant folding", "/");
bool negativeResult =
std::signbit(dividend) != std::signbit(divisor);
resultArray[i].setFConst(
......@@ -1361,7 +1361,7 @@ TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
diagnostics->warning(getLine(),
"Infinity divided by infinity during constant "
"folding generated NaN",
"/", "");
"/");
resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
}
else
......@@ -1371,7 +1371,7 @@ TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
{
diagnostics->warning(
getLine(), "Constant folded division overflowed to infinity",
"/", "");
"/");
}
resultArray[i].setFConst(result);
}
......@@ -1381,7 +1381,7 @@ TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
if (rightArray[i] == 0)
{
diagnostics->warning(
getLine(), "Divide by zero error during constant folding", "/", "");
getLine(), "Divide by zero error during constant folding", "/");
resultArray[i].setIConst(INT_MAX);
}
else
......@@ -1418,7 +1418,7 @@ TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
diagnostics->warning(getLine(),
"Negative modulus operator operand "
"encountered during constant folding",
"%", "");
"%");
resultArray[i].setIConst(0);
}
else
......@@ -1433,7 +1433,7 @@ TConstantUnion *TIntermConstantUnion::foldBinary(TOperator op,
if (rightArray[i] == 0)
{
diagnostics->warning(
getLine(), "Divide by zero error during constant folding", "/", "");
getLine(), "Divide by zero error during constant folding", "/");
resultArray[i].setUConst(UINT_MAX);
}
else
......
......@@ -50,21 +50,14 @@ class TParseContext : angle::NonCopyable
ShShaderSpec getShaderSpec() const { return mShaderSpec; }
int numErrors() const { return mDiagnostics.numErrors(); }
TInfoSink &infoSink() { return mDiagnostics.infoSink(); }
void error(const TSourceLoc &loc,
const char *reason,
const char *token,
const char *extraInfo = "");
void warning(const TSourceLoc &loc,
const char *reason,
const char *token,
const char *extraInfo = "");
void error(const TSourceLoc &loc, const char *reason, const char *token);
void warning(const TSourceLoc &loc, const char *reason, const char *token);
// If isError is false, a warning will be reported instead.
void outOfRangeError(bool isError,
const TSourceLoc &loc,
const char *reason,
const char *token,
const char *extraInfo = "");
const char *token);
TIntermBlock *getTreeRoot() const { return mTreeRoot; }
void setTreeRoot(TIntermBlock *treeRoot) { mTreeRoot = treeRoot; }
......@@ -273,6 +266,9 @@ class TParseContext : angle::NonCopyable
const TString &fieldString,
const TSourceLoc &fieldLocation);
TFieldList *combineStructFieldLists(TFieldList *processedFields,
const TFieldList *newlyAddedFields,
const TSourceLoc &location);
TFieldList *addStructDeclaratorListWithQualifiers(
const TTypeQualifierBuilder &typeQualifierBuilder,
TPublicType *typeSpecifier,
......@@ -362,13 +358,12 @@ class TParseContext : angle::NonCopyable
TSymbolTable &symbolTable; // symbol table that goes with the language currently being parsed
private:
// Returns a clamped index.
// Returns a clamped index. If it prints out an error message, the token is "[]".
int checkIndexOutOfRange(bool outOfRangeIndexIsError,
const TSourceLoc &location,
int index,
int arraySize,
const char *reason,
const char *token);
const char *reason);
bool declareVariable(const TSourceLoc &line,
const TString &identifier,
......
......@@ -476,7 +476,7 @@ TTypeQualifier GetVariableTypeQualifierFromSortedSequence(
{
const TString &qualifierString = qualifier->getQualifierString();
diagnostics->error(qualifier->getLine(), "invalid qualifier combination",
qualifierString.c_str(), "");
qualifierString.c_str());
break;
}
}
......@@ -521,7 +521,7 @@ TTypeQualifier GetParameterTypeQualifierFromSortedSequence(
{
const TString &qualifierString = qualifier->getQualifierString();
diagnostics->error(qualifier->getLine(), "invalid parameter qualifier",
qualifierString.c_str(), "");
qualifierString.c_str());
break;
}
}
......@@ -542,7 +542,7 @@ TTypeQualifier GetParameterTypeQualifierFromSortedSequence(
break;
default:
diagnostics->error(sortedSequence[0]->getLine(), "Invalid parameter qualifier ",
getQualifierString(typeQualifier.qualifier), "");
getQualifierString(typeQualifier.qualifier));
}
return typeQualifier;
}
......@@ -578,7 +578,7 @@ TLayoutQualifier JoinLayoutQualifiers(TLayoutQualifier leftQualifier,
{
diagnostics->error(rightQualifierLocation,
"Cannot have multiple different work group size specifiers",
getWorkGroupSizeString(i), "");
getWorkGroupSizeString(i));
}
joinedQualifier.localSize[i] = rightQualifier.localSize[i];
}
......@@ -661,15 +661,13 @@ bool TTypeQualifierBuilder::checkSequenceIsValid(TDiagnostics *diagnostics) cons
std::string errorMessage;
if (HasRepeatingQualifiers(mQualifiers, areQualifierChecksRelaxed, &errorMessage))
{
diagnostics->error(mQualifiers[0]->getLine(), "qualifier sequence", errorMessage.c_str(),
"");
diagnostics->error(mQualifiers[0]->getLine(), errorMessage.c_str(), "qualifier sequence");
return false;
}
if (!areQualifierChecksRelaxed && !AreQualifiersInOrder(mQualifiers, &errorMessage))
{
diagnostics->error(mQualifiers[0]->getLine(), "qualifier sequence", errorMessage.c_str(),
"");
diagnostics->error(mQualifiers[0]->getLine(), errorMessage.c_str(), "qualifier sequence");
return false;
}
......
......@@ -401,7 +401,7 @@ O [0-7]
}
<FIELDS>[ \t\v\f\r] {}
<FIELDS>. {
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, "");
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext);
return 0;
}
......@@ -445,7 +445,7 @@ int check_type(yyscan_t yyscanner) {
int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->error(*yylloc, "Illegal use of reserved word", yytext);
return 0;
}
......@@ -539,12 +539,12 @@ int uint_constant(TParseContext *context)
if (context->getShaderVersion() < 300)
{
context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext);
return 0;
}
if (!atoi_clamp(yytext, &(yylval->lex.u)))
yyextra->error(*yylloc, "Integer overflow", yytext, "");
yyextra->error(*yylloc, "Integer overflow", yytext);
return UINTCONSTANT;
}
......@@ -562,7 +562,7 @@ int floatsuffix_check(TParseContext* context)
std::string text = yytext;
text.resize(text.size() - 1);
if (!strtof_clamp(text, &(yylval->lex.f)))
yyextra->warning(*yylloc, "Float overflow", yytext, "");
yyextra->warning(*yylloc, "Float overflow", yytext);
return(FLOATCONSTANT);
}
......@@ -578,9 +578,9 @@ int int_constant(TParseContext *context) {
if (!atoi_clamp(yytext, &u))
{
if (context->getShaderVersion() >= 300)
yyextra->error(*yylloc, "Integer overflow", yytext, "");
yyextra->error(*yylloc, "Integer overflow", yytext);
else
yyextra->warning(*yylloc, "Integer overflow", yytext, "");
yyextra->warning(*yylloc, "Integer overflow", yytext);
}
yylval->lex.i = static_cast<int>(u);
return INTCONSTANT;
......@@ -590,7 +590,7 @@ int float_constant(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
if (!strtof_clamp(yytext, &(yylval->lex.f)))
yyextra->warning(*yylloc, "Float overflow", yytext, "");
yyextra->warning(*yylloc, "Float overflow", yytext);
return FLOATCONSTANT;
}
......
......@@ -932,7 +932,7 @@ storage_qualifier
| INOUT_QUAL {
if (!context->declaringFunction())
{
context->error(@1, "invalid inout qualifier", "'inout' can be only used with function parameters");
context->error(@1, "invalid qualifier: can be only used with function parameters", "inout");
}
$$ = new TStorageQualifierWrapper(EvqInOut, @1);
}
......@@ -1257,16 +1257,7 @@ struct_declaration_list
$$ = $1;
}
| struct_declaration_list struct_declaration {
$$ = $1;
for (size_t i = 0; i < $2->size(); ++i) {
TField* field = (*$2)[i];
for (size_t j = 0; j < $$->size(); ++j) {
if ((*$$)[j]->name() == field->name()) {
context->error(@2, "duplicate field name in structure:", "struct", field->name().c_str());
}
}
$$->push_back(field);
}
$$ = context->combineStructFieldLists($1, $2, @2);
}
;
......
#line 17 "./glslang.l"
//
// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
......@@ -221,7 +222,7 @@ typedef size_t yy_size_t;
#define YY_LESS_LINENO(n) \
do { \
yy_size_t yyl;\
for ( yyl = n; yyl < static_cast<yy_site_t>(yyleng); ++yyl )\
for ( yyl = n; yyl < yyleng; ++yyl )\
if ( yytext[yyl] == '\n' )\
--yylineno;\
}while(0)
......@@ -396,7 +397,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
yyleng = (size_t) (yy_cp - yy_bp); \
yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
......@@ -1380,7 +1381,7 @@ yy_find_action:
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
{
yy_size_t yyl;
for ( yyl = 0; yyl < static_cast<yy_size_t>(yyleng); ++yyl )
for ( yyl = 0; yyl < yyleng; ++yyl )
if ( yytext[yyl] == '\n' )
do{ yylineno++;
......@@ -2141,7 +2142,7 @@ YY_RULE_SETUP
case 238:
YY_RULE_SETUP
{
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, "");
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext);
return 0;
}
YY_BREAK
......@@ -2384,7 +2385,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
static_cast<int>(number_to_move) - 1;
number_to_move - 1;
}
......@@ -2392,10 +2393,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
size_t result = 0;
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
result, num_to_read );
yyg->yy_n_chars = static_cast<int>(result);
yyg->yy_n_chars, num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
}
......@@ -2836,7 +2835,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner)
/* Increase the buffer to prepare for a possible push. */
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = static_cast<int>(yyg->yy_buffer_stack_max + grow_size);
num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
(yyg->yy_buffer_stack,
num_to_alloc * sizeof(struct yy_buffer_state*)
......@@ -2870,7 +2869,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = static_cast<int>(size) - 2; /* "- 2" to take care of EOB's */
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
......@@ -2919,7 +2918,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < static_cast<yy_size_t>(_yybytes_len); ++i )
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
......@@ -3342,7 +3341,7 @@ int check_type(yyscan_t yyscanner) {
int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->error(*yylloc, "Illegal use of reserved word", yytext);
return 0;
}
......@@ -3436,12 +3435,12 @@ int uint_constant(TParseContext *context)
if (context->getShaderVersion() < 300)
{
context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext);
return 0;
}
if (!atoi_clamp(yytext, &(yylval->lex.u)))
yyextra->error(*yylloc, "Integer overflow", yytext, "");
yyextra->error(*yylloc, "Integer overflow", yytext);
return UINTCONSTANT;
}
......@@ -3459,7 +3458,7 @@ int floatsuffix_check(TParseContext* context)
std::string text = yytext;
text.resize(text.size() - 1);
if (!strtof_clamp(text, &(yylval->lex.f)))
yyextra->warning(*yylloc, "Float overflow", yytext, "");
yyextra->warning(*yylloc, "Float overflow", yytext);
return(FLOATCONSTANT);
}
......@@ -3475,9 +3474,9 @@ int int_constant(TParseContext *context) {
if (!atoi_clamp(yytext, &u))
{
if (context->getShaderVersion() >= 300)
yyextra->error(*yylloc, "Integer overflow", yytext, "");
yyextra->error(*yylloc, "Integer overflow", yytext);
else
yyextra->warning(*yylloc, "Integer overflow", yytext, "");
yyextra->warning(*yylloc, "Integer overflow", yytext);
}
yylval->lex.i = static_cast<int>(u);
return INTCONSTANT;
......@@ -3487,7 +3486,7 @@ int float_constant(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
if (!strtof_clamp(yytext, &(yylval->lex.f)))
yyextra->warning(*yylloc, "Float overflow", yytext, "");
yyextra->warning(*yylloc, "Float overflow", yytext);
return FLOATCONSTANT;
}
......
......@@ -755,13 +755,13 @@ static const yytype_uint16 yyrline[] =
1147, 1150, 1153, 1156, 1159, 1162, 1165, 1168, 1171, 1174,
1177, 1180, 1183, 1190, 1196, 1199, 1202, 1205, 1208, 1211,
1214, 1217, 1220, 1223, 1226, 1229, 1232, 1235, 1247, 1247,
1250, 1250, 1256, 1259, 1274, 1277, 1284, 1288, 1294, 1300,
1312, 1316, 1320, 1321, 1327, 1328, 1329, 1330, 1331, 1332,
1333, 1337, 1338, 1338, 1338, 1347, 1348, 1352, 1352, 1353,
1353, 1358, 1361, 1370, 1375, 1382, 1383, 1387, 1394, 1398,
1405, 1405, 1412, 1415, 1422, 1426, 1439, 1439, 1444, 1444,
1450, 1450, 1458, 1461, 1467, 1470, 1476, 1480, 1487, 1490,
1493, 1496, 1499, 1508, 1514, 1520, 1523, 1529, 1529
1250, 1250, 1256, 1259, 1265, 1268, 1275, 1279, 1285, 1291,
1303, 1307, 1311, 1312, 1318, 1319, 1320, 1321, 1322, 1323,
1324, 1328, 1329, 1329, 1329, 1338, 1339, 1343, 1343, 1344,
1344, 1349, 1352, 1361, 1366, 1373, 1374, 1378, 1385, 1389,
1396, 1396, 1403, 1406, 1413, 1417, 1430, 1430, 1435, 1435,
1441, 1441, 1449, 1452, 1458, 1461, 1467, 1471, 1478, 1481,
1484, 1487, 1490, 1499, 1505, 1511, 1514, 1520, 1520
};
#endif
......@@ -3677,7 +3677,7 @@ yyreduce:
{
if (!context->declaringFunction())
{
context->error((yylsp[0]), "invalid inout qualifier", "'inout' can be only used with function parameters");
context->error((yylsp[0]), "invalid qualifier: can be only used with function parameters", "inout");
}
(yyval.interm.qualifierWrapper) = new TStorageQualifierWrapper(EvqInOut, (yylsp[0]));
}
......@@ -4402,16 +4402,7 @@ yyreduce:
case 223:
{
(yyval.interm.fieldList) = (yyvsp[-1].interm.fieldList);
for (size_t i = 0; i < (yyvsp[0].interm.fieldList)->size(); ++i) {
TField* field = (*(yyvsp[0].interm.fieldList))[i];
for (size_t j = 0; j < (yyval.interm.fieldList)->size(); ++j) {
if ((*(yyval.interm.fieldList))[j]->name() == field->name()) {
context->error((yylsp[0]), "duplicate field name in structure:", "struct", field->name().c_str());
}
}
(yyval.interm.fieldList)->push_back(field);
}
(yyval.interm.fieldList) = context->combineStructFieldLists((yyvsp[-1].interm.fieldList), (yyvsp[0].interm.fieldList), (yylsp[0]));
}
break;
......
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