forked from qt-creator/qt-creator
GLSL: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: Ib959a9aa39d8f87b0f0b5e297547913c1daa9c14 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
abc8567198
commit
5f10acd5c9
@@ -580,7 +580,7 @@ AST *Parser::parse(int startToken)
|
|||||||
QString message = QLatin1String("Syntax error");
|
QString message = QLatin1String("Syntax error");
|
||||||
if (yytoken != -1) {
|
if (yytoken != -1) {
|
||||||
const QLatin1String s(spell[yytoken]);
|
const QLatin1String s(spell[yytoken]);
|
||||||
message = QString("Unexpected token `%1'").arg(s);
|
message = QString::fromLatin1("Unexpected token `%1'").arg(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; _tos; --_tos) {
|
for (; _tos; --_tos) {
|
||||||
@@ -600,7 +600,7 @@ AST *Parser::parse(int startToken)
|
|||||||
if (next > 0) {
|
if (next > 0) {
|
||||||
if (! yyrecovering && ! _recovered) {
|
if (! yyrecovering && ! _recovered) {
|
||||||
_recovered = true;
|
_recovered = true;
|
||||||
error(line, QString("Expected `%1'").arg(QLatin1String(spell[*tptr])));
|
error(line, QString::fromLatin1("Expected `%1'").arg(QLatin1String(spell[*tptr])));
|
||||||
}
|
}
|
||||||
|
|
||||||
yyrecovering = 3;
|
yyrecovering = 3;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
TARGET = GLSL
|
TARGET = GLSL
|
||||||
DEFINES += GLSL_BUILD_LIB QT_CREATOR
|
DEFINES += \
|
||||||
|
GLSL_BUILD_LIB \
|
||||||
|
QT_CREATOR \
|
||||||
|
QT_NO_CAST_FROM_ASCII
|
||||||
|
|
||||||
include(../../qtcreatorlibrary.pri)
|
include(../../qtcreatorlibrary.pri)
|
||||||
include(glsl-lib.pri)
|
include(glsl-lib.pri)
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ QtcLibrary {
|
|||||||
|
|
||||||
cpp.defines: base.concat([
|
cpp.defines: base.concat([
|
||||||
"QT_CREATOR",
|
"QT_CREATOR",
|
||||||
"GLSL_BUILD_LIB"
|
"GLSL_BUILD_LIB",
|
||||||
|
"QT_NO_CAST_FROM_ASCII"
|
||||||
])
|
])
|
||||||
|
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
@@ -44,4 +45,3 @@ QtcLibrary {
|
|||||||
"glsltypes.h",
|
"glsltypes.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ AST *Parser::parse(int startToken)
|
|||||||
QString message = QLatin1String("Syntax error");
|
QString message = QLatin1String("Syntax error");
|
||||||
if (yytoken != -1) {
|
if (yytoken != -1) {
|
||||||
const QLatin1String s(spell[yytoken]);
|
const QLatin1String s(spell[yytoken]);
|
||||||
message = QString("Unexpected token `%1'").arg(s);
|
message = QString::fromLatin1("Unexpected token `%1'").arg(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; _tos; --_tos) {
|
for (; _tos; --_tos) {
|
||||||
@@ -182,7 +182,7 @@ AST *Parser::parse(int startToken)
|
|||||||
if (next > 0) {
|
if (next > 0) {
|
||||||
if (! yyrecovering && ! _recovered) {
|
if (! yyrecovering && ! _recovered) {
|
||||||
_recovered = true;
|
_recovered = true;
|
||||||
error(line, QString("Expected `%1'").arg(QLatin1String(spell[*tptr])));
|
error(line, QString::fromLatin1("Expected `%1'").arg(QLatin1String(spell[*tptr])));
|
||||||
}
|
}
|
||||||
|
|
||||||
yyrecovering = 3;
|
yyrecovering = 3;
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ Semantic::ExprResult Semantic::functionIdentifier(FunctionIdentifierAST *ast)
|
|||||||
if (s->asOverloadSet() != 0 || s->asFunction() != 0)
|
if (s->asOverloadSet() != 0 || s->asFunction() != 0)
|
||||||
result.type = s->type();
|
result.type = s->type();
|
||||||
else
|
else
|
||||||
_engine->error(ast->lineno, QString("`%1' cannot be used as a function").arg(*ast->name));
|
_engine->error(ast->lineno, QString::fromLatin1("`%1' cannot be used as a function").arg(*ast->name));
|
||||||
} else {
|
} else {
|
||||||
_engine->error(ast->lineno, QString("`%1' was not declared in this scope").arg(*ast->name));
|
_engine->error(ast->lineno, QString::fromLatin1("`%1' was not declared in this scope").arg(*ast->name));
|
||||||
}
|
}
|
||||||
} else if (ast->type) {
|
} else if (ast->type) {
|
||||||
const Type *ty = type(ast->type);
|
const Type *ty = type(ast->type);
|
||||||
@@ -187,7 +187,7 @@ bool Semantic::visit(IdentifierExpressionAST *ast)
|
|||||||
if (Symbol *s = _scope->lookup(*ast->name)) {
|
if (Symbol *s = _scope->lookup(*ast->name)) {
|
||||||
_expr.type = s->type();
|
_expr.type = s->type();
|
||||||
} else {
|
} else {
|
||||||
_engine->error(ast->lineno, QString("`%1' was not declared in this scope").arg(*ast->name));
|
_engine->error(ast->lineno, QString::fromLatin1("`%1' was not declared in this scope").arg(*ast->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -225,7 +225,7 @@ bool Semantic::visit(BinaryExpressionAST *ast)
|
|||||||
if (const IndexType *idxType = left.type->asIndexType())
|
if (const IndexType *idxType = left.type->asIndexType())
|
||||||
_expr = idxType->indexElementType();
|
_expr = idxType->indexElementType();
|
||||||
else
|
else
|
||||||
_engine->error(ast->lineno, QString("Invalid type `%1' for array subscript").arg(left.type->toString()));
|
_engine->error(ast->lineno, QString::fromLatin1("Invalid type `%1' for array subscript").arg(left.type->toString()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -294,16 +294,16 @@ bool Semantic::visit(MemberAccessExpressionAST *ast)
|
|||||||
if (Symbol *s = vecTy->find(*ast->field)) {
|
if (Symbol *s = vecTy->find(*ast->field)) {
|
||||||
_expr.type = s->type();
|
_expr.type = s->type();
|
||||||
} else {
|
} else {
|
||||||
_engine->error(ast->lineno, QString("`%1' has no member named `%2'").arg(vecTy->name()).arg(*ast->field));
|
_engine->error(ast->lineno, QString::fromLatin1("`%1' has no member named `%2'").arg(vecTy->name()).arg(*ast->field));
|
||||||
}
|
}
|
||||||
} else if (const Struct *structTy = expr.type->asStructType()) {
|
} else if (const Struct *structTy = expr.type->asStructType()) {
|
||||||
if (Symbol *s = structTy->find(*ast->field)) {
|
if (Symbol *s = structTy->find(*ast->field)) {
|
||||||
_expr.type = s->type();
|
_expr.type = s->type();
|
||||||
} else {
|
} else {
|
||||||
_engine->error(ast->lineno, QString("`%1' has no member named `%2'").arg(structTy->name()).arg(*ast->field));
|
_engine->error(ast->lineno, QString::fromLatin1("`%1' has no member named `%2'").arg(structTy->name()).arg(*ast->field));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_engine->error(ast->lineno, QString("Requested for member `%1', in a non class or vec instance").arg(*ast->field));
|
_engine->error(ast->lineno, QString::fromLatin1("Requested for member `%1', in a non class or vec instance").arg(*ast->field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -375,9 +375,9 @@ bool Semantic::visit(FunctionCallExpressionAST *ast)
|
|||||||
if (id.isValid()) {
|
if (id.isValid()) {
|
||||||
if (const Function *funTy = id.type->asFunctionType()) {
|
if (const Function *funTy = id.type->asFunctionType()) {
|
||||||
if (actuals.size() < funTy->argumentCount())
|
if (actuals.size() < funTy->argumentCount())
|
||||||
_engine->error(ast->lineno, QString("not enough arguments"));
|
_engine->error(ast->lineno, QString::fromLatin1("not enough arguments"));
|
||||||
else if (actuals.size() > funTy->argumentCount())
|
else if (actuals.size() > funTy->argumentCount())
|
||||||
_engine->error(ast->lineno, QString("too many arguments"));
|
_engine->error(ast->lineno, QString::fromLatin1("too many arguments"));
|
||||||
_expr.type = funTy->returnType();
|
_expr.type = funTy->returnType();
|
||||||
} else if (const OverloadSet *overloads = id.type->asOverloadSetType()) {
|
} else if (const OverloadSet *overloads = id.type->asOverloadSetType()) {
|
||||||
QVector<GLSL::Function *> candidates;
|
QVector<GLSL::Function *> candidates;
|
||||||
@@ -733,7 +733,7 @@ bool Semantic::visit(BasicTypeAST *ast)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_engine->error(ast->lineno, QString("Unknown type `%1'").arg(QLatin1String(GLSLParserTable::spell[ast->token])));
|
_engine->error(ast->lineno, QString::fromLatin1("Unknown type `%1'").arg(QLatin1String(GLSLParserTable::spell[ast->token])));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -748,7 +748,7 @@ bool Semantic::visit(NamedTypeAST *ast)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_engine->error(ast->lineno, QString("Undefined type `%1'").arg(*ast->name));
|
_engine->error(ast->lineno, QString::fromLatin1("Undefined type `%1'").arg(*ast->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ QString VectorType::toString() const
|
|||||||
prefix = "u";
|
prefix = "u";
|
||||||
else if (elementType()->asDoubleType() != 0)
|
else if (elementType()->asDoubleType() != 0)
|
||||||
prefix = "d";
|
prefix = "d";
|
||||||
return QString("%1vec%2").arg(QLatin1String(prefix)).arg(_dimension);
|
return QString::fromLatin1("%1vec%2").arg(QLatin1String(prefix)).arg(_dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VectorType::add(Symbol *symbol)
|
void VectorType::add(Symbol *symbol)
|
||||||
@@ -274,7 +274,7 @@ QString MatrixType::toString() const
|
|||||||
prefix = "u";
|
prefix = "u";
|
||||||
else if (elementType()->asDoubleType() != 0)
|
else if (elementType()->asDoubleType() != 0)
|
||||||
prefix = "d";
|
prefix = "d";
|
||||||
return QString("%1mat%2x%3").arg(QLatin1String(prefix)).arg(_columns).arg(_rows);
|
return QString::fromLatin1("%1mat%2x%3").arg(QLatin1String(prefix)).arg(_columns).arg(_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MatrixType::isEqualTo(const Type *other) const
|
bool MatrixType::isEqualTo(const Type *other) const
|
||||||
|
|||||||
Reference in New Issue
Block a user