]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix some clang compile warnings
authorMikko Rasa <tdb@tdb.fi>
Fri, 6 Jan 2017 10:27:40 +0000 (12:27 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 6 Jan 2017 10:27:40 +0000 (12:27 +0200)
source/batch.cpp
source/gl.h
source/mesh.cpp
source/programbuilder.cpp
source/programcompiler.h
source/programsyntax.h
source/resourcemanager.cpp

index 3d7dfc720ad901d40832e77510d3159339910e29..cba63567497499260222b4f7cbe6dd1194d2abbe 100644 (file)
@@ -64,7 +64,7 @@ Batch::Batch(PrimitiveType t):
        /* Make sure we have glEnable/DisableClientState to go with
        NV_primitive_restart */
        if(!MSP_primitive_restart && NV_primitive_restart)
-               (bool)MSP_legacy_features;
+               (void)(bool)MSP_legacy_features;
 }
 
 Batch::~Batch()
index f7cba6b7aeaa098ff9ff6811c63cff6fa583ef4a..d558706cb1e000858b6e9006e83200679b25c308 100644 (file)
@@ -2,10 +2,13 @@
 #define MSP_GL_GL_H_
 
 #ifdef __APPLE__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wkeyword-macro"
 #define extern extern __attribute__((weak_import))
 #include <OpenGL/gl.h>
 #include <OpenGL/glext.h>
 #undef extern
+#pragma clang diagnostic pop
 #elif defined(__ANDROID__)
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
index 55d7fc0648df0920dfb93419344d6ee53fdd30a5..8c1e79c49b3efaffbfcdbf0216a7105a15bd5fe9 100644 (file)
@@ -275,7 +275,7 @@ Mesh::AsyncLoader::AsyncLoader(Mesh &m, IO::Seekable &i):
        phase(0)
 {
        // Make sure the extension is initialized in the rendering thread.
-       (bool)NV_primitive_restart;
+       (void)(bool)NV_primitive_restart;
 
        mesh.disallow_rendering = true;
        if(mesh.defer_buffers)
index e4739da0b738a5fd727bfe53410aaec0a40238de..247c249b380901623e1dfc02ac573966e445a89f 100644 (file)
@@ -893,7 +893,7 @@ void ProgramBuilder::ShaderVariable::resolve_space(const string &space)
                        (*i)->resolve_space(space);
 }
 
-void ProgramBuilder::ShaderVariable::resolve_array(const StandardFeatures &features, unsigned size_hint)
+void ProgramBuilder::ShaderVariable::resolve_array(const StandardFeatures &feat, unsigned size_hint)
 {
        if(array_size)
                return;
@@ -910,9 +910,9 @@ void ProgramBuilder::ShaderVariable::resolve_array(const StandardFeatures &featu
        if(variable && variable->scope==UNIFORM)
        {
                if(array_subscript=="MAX_LIGHTS")
-                       array_size = features.max_lights;
+                       array_size = feat.max_lights;
                else if(array_subscript=="MAX_CLIP_PLANES")
-                       array_size = features.max_clip_planes;
+                       array_size = feat.max_clip_planes;
                else if(isnumrc(array_subscript))
                        array_size = lexical_cast<unsigned>(array_subscript);
                else
@@ -936,7 +936,7 @@ void ProgramBuilder::ShaderVariable::resolve_array(const StandardFeatures &featu
        {
                for(list<ShaderVariable *>::const_iterator i=referenced_vars.begin(); i!=referenced_vars.end(); ++i)
                        if(!(*i)->array_subscript.empty() && !(*i)->array_size)
-                               (*i)->resolve_array(features, array_size);
+                               (*i)->resolve_array(feat, array_size);
        }
 }
 
@@ -1092,19 +1092,19 @@ string ProgramBuilder::ShaderVariable::create_declaration(char iface, bool loop)
                return format("%s %s%s", variable->type, resolved_name, array);
 }
 
-string ProgramBuilder::ShaderVariable::create_replacement(VariableScope from_scope, unsigned enabled_scopes, const char *loop) const
+string ProgramBuilder::ShaderVariable::create_replacement(VariableScope from_scope, unsigned scopes, const char *loop) const
 {
        string replacement = resolved_name;
        InterfaceFlags iface = NO_INTERFACE;
        if(variable)
        {
                iface = get_interface_flags(from_scope);
-               VariableScope prev_scope = previous_scope(from_scope, enabled_scopes);
+               VariableScope prev_scope = previous_scope(from_scope, scopes);
                if((iface&INPUT) && interfaces[prev_scope])
                        replacement = format("%c_%s", interfaces[prev_scope], replacement);
                else if(inlined)
                {
-                       replacement = create_expression(enabled_scopes, loop);
+                       replacement = create_expression(scopes, loop);
                        if(inline_parens)
                                replacement = "("+replacement+")";
                        return replacement;
@@ -1123,12 +1123,12 @@ string ProgramBuilder::ShaderVariable::create_replacement(VariableScope from_sco
        return replacement;
 }
 
-string ProgramBuilder::ShaderVariable::create_expression(unsigned enabled_scopes, const char *loop) const
+string ProgramBuilder::ShaderVariable::create_expression(unsigned scopes, const char *loop) const
 {
        map<string, string> replace_map;
        for(list<ShaderVariable *>::const_iterator i=referenced_vars.begin(); i!=referenced_vars.end(); ++i)
        {
-               string replacement = (*i)->create_replacement(variable->scope, enabled_scopes, loop);
+               string replacement = (*i)->create_replacement(variable->scope, scopes, loop);
                if(replacement!=(*i)->name)
                        replace_map[(*i)->name] = replacement;
        }
index ac1f910d530dd7b53c984c195d3d4310d372c39f..5bb7147496b3190f730db4a878395f81fe2fb519 100644 (file)
@@ -40,6 +40,7 @@ private:
 
                virtual void apply(ProgramSyntax::Stage &);
                const std::string &get_result() const { return formatted; }
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::Literal &);
                virtual void visit(ProgramSyntax::ParenthesizedExpression &);
@@ -71,6 +72,7 @@ private:
                std::list<T *> nodes;
 
                const ResultType &get_result() const { return nodes; }
+               using Visitor::visit;
                virtual void visit(T &n) { nodes.push_back(&n); }
        };
 
@@ -83,6 +85,7 @@ private:
 
                DeclarationCombiner();
 
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::FunctionDeclaration &);
                virtual void visit(ProgramSyntax::VariableDeclaration &);
@@ -101,6 +104,7 @@ private:
                VariableResolver();
 
                virtual void apply(ProgramSyntax::Stage &);
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::VariableReference &);
                virtual void visit(ProgramSyntax::MemberAccess &);
@@ -115,6 +119,7 @@ private:
        {
                std::map<std::string, std::vector<ProgramSyntax::FunctionDeclaration *> > functions;
 
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::FunctionCall &);
                virtual void visit(ProgramSyntax::FunctionDeclaration &);
        };
@@ -128,6 +133,7 @@ private:
 
                void flatten_block(ProgramSyntax::Block &);
                void apply_and_increment(ProgramSyntax::Block &, std::list<RefPtr<ProgramSyntax::Node> >::iterator &);
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
        };
 
@@ -142,6 +148,7 @@ private:
 
                static std::string get_out_prefix(ProgramSyntax::StageType);
                virtual void apply(ProgramSyntax::Stage &);
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                std::string change_prefix(const std::string &, const std::string &) const;
                bool generate_interface(ProgramSyntax::VariableDeclaration &, const std::string &, const std::string &);
@@ -153,6 +160,7 @@ private:
 
        struct VariableRenamer: Visitor
        {
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::VariableReference &);
                virtual void visit(ProgramSyntax::VariableDeclaration &);
        };
@@ -172,6 +180,7 @@ private:
 
                DeclarationReorderer();
 
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::InterfaceLayout &) { kind = LAYOUT; }
                virtual void visit(ProgramSyntax::StructDeclaration &) { kind = STRUCT; }
@@ -191,6 +200,7 @@ private:
                InlineableFunctionLocator();
 
                const ResultType &get_result() const { return inlineable; }
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::FunctionCall &);
                virtual void visit(ProgramSyntax::FunctionDeclaration &);
        };
@@ -205,6 +215,7 @@ private:
                FunctionInliner(const std::set<ProgramSyntax::FunctionDeclaration *> &);
 
                void visit_and_inline(RefPtr<ProgramSyntax::Expression> &);
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::UnaryExpression &);
                virtual void visit(ProgramSyntax::BinaryExpression &);
@@ -223,6 +234,7 @@ private:
                ExpressionEvaluator();
                ExpressionEvaluator(const ValueMap &);
 
+               using ProgramSyntax::NodeVisitor::visit;
                virtual void visit(ProgramSyntax::Literal &);
                virtual void visit(ProgramSyntax::ParenthesizedExpression &);
                virtual void visit(ProgramSyntax::VariableReference &);
@@ -237,6 +249,7 @@ private:
 
                ConstantConditionEliminator();
 
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::Assignment &);
                virtual void visit(ProgramSyntax::VariableDeclaration &);
@@ -271,6 +284,7 @@ private:
 
                virtual void apply(ProgramSyntax::Stage &);
                const ResultType &get_result() const { return unused_nodes; }
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::VariableReference &);
                virtual void visit(ProgramSyntax::MemberAccess &);
                virtual void visit(ProgramSyntax::BinaryExpression &);
@@ -295,6 +309,7 @@ private:
                std::set<ProgramSyntax::FunctionDeclaration *> used_definitions;
 
                const ResultType &get_result() const { return unused_nodes; }
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::FunctionCall &);
                virtual void visit(ProgramSyntax::FunctionDeclaration &);
        };
@@ -306,6 +321,7 @@ private:
                NodeRemover() { }
                NodeRemover(const std::set<ProgramSyntax::Node *> &);
 
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::Block &);
                virtual void visit(ProgramSyntax::VariableDeclaration &);
        };
@@ -320,6 +336,7 @@ private:
                LegacyConverter(const Version &);
 
                bool check_version(const Version &);
+               using Visitor::visit;
                virtual void visit(ProgramSyntax::VariableReference &);
                virtual void visit(ProgramSyntax::FunctionCall &);
                virtual void visit(ProgramSyntax::VariableDeclaration &);
index d681c50b924065f69a1ae990381af884d00bef0e..b72d401d1ffc1b81ccf2f70affc7e39250e8c147 100644 (file)
@@ -336,6 +336,7 @@ struct NodeVisitor
 
 struct TraversingVisitor: NodeVisitor
 {
+       using NodeVisitor::visit;
        virtual void visit(Block &);
        virtual void visit(ParenthesizedExpression &);
        virtual void visit(MemberAccess &);
index 6b4f0f2434c79cb44514caffd11b2a507e92911e..9835adde3e8dd7efffe038f6eeb7f39a7c26101c 100644 (file)
@@ -414,13 +414,13 @@ void ResourceManager::LoadingThread::main()
        }
 }
 
-ResourceManager::ManagedResource *ResourceManager::LoadingThread::front(LoadQueue &queue)
+ResourceManager::ManagedResource *ResourceManager::LoadingThread::front(LoadQueue &que)
 {
        MutexLock lock(queue_mutex);
-       if(queue.empty())
+       if(que.empty())
                return 0;
 
-       return queue.front();
+       return que.front();
 }
 
 void ResourceManager::LoadingThread::add_resource(ManagedResource &r)