]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove useless declarations of main() from shaders
authorMikko Rasa <tdb@tdb.fi>
Fri, 16 Dec 2016 21:52:39 +0000 (23:52 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 16 Dec 2016 21:52:39 +0000 (23:52 +0200)
source/programcompiler.cpp

index 13b203b4f4ace5e93fbf5c27a155d94ffe540c51..0d61c6853c737a75bac34212114077e1b691286c 100644 (file)
@@ -1447,7 +1447,7 @@ void ProgramCompiler::UnusedFunctionLocator::visit(FunctionDeclaration &func)
 {
        TraversingVisitor::visit(func);
 
-       if(func.name!="main" && !used_definitions.count(&func))
+       if((func.name!="main" || func.body.body.empty()) && !used_definitions.count(&func))
                unused_nodes.insert(&func);
 }