X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.cpp;h=1458d01eaaba8743d40e90bb9b030790dca3cad9;hb=15562a0c458fd655b6907c285951085f38270e27;hp=f8ecc5eeefd34aaad243accf7034d9cee8513ca0;hpb=a1ba04add302e7712d127b46d8d11386987a0aea;p=libs%2Fgl.git diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index f8ecc5ee..1458d01e 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -173,6 +173,17 @@ void DeclarationValidator::visit(InterfaceBlock &iface) void DeclarationValidator::visit(FunctionDeclaration &func) { + string key = func.name+func.signature; + map::const_iterator i = overloaded_functions.find(key); + if(i==overloaded_functions.end()) + overloaded_functions.insert(make_pair(key, &func)); + else if(func.return_type_declaration && i->second->return_type_declaration!=func.return_type_declaration) + { + error(func, format("Conflicting return type '%s' for function '%s'", func.return_type_declaration->name, func.name)); + if(i->second->return_type_declaration) + add_info(*i->second, format("Previously declared as returning '%s'", i->second->return_type_declaration->name)); + } + if(Statement *previous = find_definition(func.name)) { if(!dynamic_cast(previous)) @@ -225,6 +236,13 @@ void ReferenceValidator::visit(InterfaceBlockReference &iface) error(iface, format("Use of unlinked input block '%s'", iface.name)); } +void ReferenceValidator::visit(FunctionCall &call) +{ + if(!call.declaration && !call.constructor) + error(call, format("Call to undeclared function '%s'", call.name)); + TraversingVisitor::visit(call); +} + void ReferenceValidator::visit(VariableDeclaration &var) { if(!var.type_declaration)