Commit 5f10acd5 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Erik Verbruggen
Browse files

GLSL: Compile with QT_NO_CAST_FROM_ASCII



Change-Id: Ib959a9aa39d8f87b0f0b5e297547913c1daa9c14
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent abc85671
......@@ -580,7 +580,7 @@ AST *Parser::parse(int startToken)
QString message = QLatin1String("Syntax error");
if (yytoken != -1) {
const QLatin1String s(spell[yytoken]);
message = QString("Unexpected token `%1'").arg(s);
message = QString::fromLatin1("Unexpected token `%1'").arg(s);
}
for (; _tos; --_tos) {
......@@ -600,7 +600,7 @@ AST *Parser::parse(int startToken)
if (next > 0) {
if (! yyrecovering && ! _recovered) {
_recovered = true;
error(line, QString("Expected `%1'").arg(QLatin1String(spell[*tptr])));
error(line, QString::fromLatin1("Expected `%1'").arg(QLatin1String(spell[*tptr])));
}
yyrecovering = 3;
......
TEMPLATE = lib
TARGET = GLSL
DEFINES += GLSL_BUILD_LIB QT_CREATOR
DEFINES += \
GLSL_BUILD_LIB \
QT_CREATOR \
QT_NO_CAST_FROM_ASCII
include(../../qtcreatorlibrary.pri)
include(glsl-lib.pri)
......
......@@ -6,7 +6,8 @@ QtcLibrary {
cpp.defines: base.concat([
"QT_CREATOR",
"GLSL_BUILD_LIB"
"GLSL_BUILD_LIB",
"QT_NO_CAST_FROM_ASCII"
])
Depends { name: "cpp" }
......@@ -44,4 +45,3 @@ QtcLibrary {
"glsltypes.h",
]
}
......@@ -162,7 +162,7 @@ AST *Parser::parse(int startToken)
QString message = QLatin1String("Syntax error");
if (yytoken != -1) {
const QLatin1String s(spell[yytoken]);
message = QString("Unexpected token `%1'").arg(s);
message = QString::fromLatin1("Unexpected token `%1'").arg(s);
}
for (; _tos; --_tos) {
......@@ -182,7 +182,7 @@ AST *Parser::parse(int startToken)
if (next > 0) {
if (! yyrecovering && ! _recovered) {
_recovered = true;
error(line, QString("Expected `%1'").arg(QLatin1String(spell[*tptr])));
error(line, QString::fromLatin1("Expected `%1'").arg(QLatin1String(spell[*tptr])));
}
yyrecovering = 3;
......
......@@ -125,9 +125,9 @@ Semantic::ExprResult Semantic::functionIdentifier(FunctionIdentifierAST *ast)
if (s->asOverloadSet() != 0 || s->asFunction() != 0)
result.type = s->type();
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 {
_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) {
const Type *ty = type(ast->type);
......@@ -187,7 +187,7 @@ bool Semantic::visit(IdentifierExpressionAST *ast)
if (Symbol *s = _scope->lookup(*ast->name)) {
_expr.type = s->type();
} 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;
......@@ -225,7 +225,7 @@ bool Semantic::visit(BinaryExpressionAST *ast)
if (const IndexType *idxType = left.type->asIndexType())
_expr = idxType->indexElementType();
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;
......@@ -294,16 +294,16 @@ bool Semantic::visit(MemberAccessExpressionAST *ast)
if (Symbol *s = vecTy->find(*ast->field)) {
_expr.type = s->type();
} 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()) {
if (Symbol *s = structTy->find(*ast->field)) {
_expr.type = s->type();
} 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 {
_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;
......@@ -375,9 +375,9 @@ bool Semantic::visit(FunctionCallExpressionAST *ast)
if (id.isValid()) {
if (const Function *funTy = id.type->asFunctionType()) {
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())
_engine->error(ast->lineno, QString("too many arguments"));
_engine->error(ast->lineno, QString::fromLatin1("too many arguments"));
_expr.type = funTy->returnType();
} else if (const OverloadSet *overloads = id.type->asOverloadSetType()) {
QVector<GLSL::Function *> candidates;
......@@ -733,7 +733,7 @@ bool Semantic::visit(BasicTypeAST *ast)
break;
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;
......@@ -748,7 +748,7 @@ bool Semantic::visit(NamedTypeAST *ast)
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;
......
......@@ -150,7 +150,7 @@ QString VectorType::toString() const
prefix = "u";
else if (elementType()->asDoubleType() != 0)
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)
......@@ -274,7 +274,7 @@ QString MatrixType::toString() const
prefix = "u";
else if (elementType()->asDoubleType() != 0)
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
......
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