[nemiver] Fix 'set-but-unused' warning from GCC 4.6



commit 09d41f54f140d978266f1b5006e0947ae2f5d588
Author: Dodji Seketeli <dodji gnome org>
Date:   Fri Apr 1 19:35:19 2011 +0200

    Fix 'set-but-unused' warning from GCC 4.6
    
    	* src/common/nmv-connection-manager.cc (parse_connection_string):
    	Remove dead variable 'parsed_host'.
    	* src/dbgengine/nmv-gdb-engine.cc
    	(GDBEngine::extract_global_variable_list): Likewise for 'cur'.
    	* src/dbgengine/nmv-gdbmi-parser.cc
    	(GDBMIParser::parse_threads_list): Likewise for
    	'current_thread_id'.
    	(GDBMIParser::parse_var_changed_list): Likewise for
    	'type_changed'.  Use the 'in_scope' (otherwise unused) variable
    	value to initialise the resulting instance of IDebugger::Variable.
    	* src/dbgengine/nmv-i-debugger.h: (IDebugger::IVariable):  Add an
    	in_scope member and the related accessors.
    	* src/langs/nmv-cpp-parser.cc (Parser::parse_qualified_id): Remove
    	dead variable 'has_template'.
    	* src/uicommon/nmv-source-editor.cc
    	(SourceEditor::Priv::update_line_col_label): Remove dead
    	'line_count' variable.

 src/common/nmv-connection-manager.cc |    3 --
 src/dbgengine/nmv-gdb-engine.cc      |    2 -
 src/dbgengine/nmv-gdbmi-parser.cc    |   12 ++++++----
 src/dbgengine/nmv-i-debugger.h       |   37 +++++++++++++++++++++++-----------
 src/langs/nmv-cpp-parser.cc          |    3 +-
 src/uicommon/nmv-source-editor.cc    |    4 ---
 6 files changed, 33 insertions(+), 28 deletions(-)
---
diff --git a/src/common/nmv-connection-manager.cc b/src/common/nmv-connection-manager.cc
index 360ccbd..35520e4 100644
--- a/src/common/nmv-connection-manager.cc
+++ b/src/common/nmv-connection-manager.cc
@@ -153,7 +153,6 @@ parse_connection_string (const common::UString &a_str,
         goto parse_schemaname;
     }
     if (common::parsing_utils::is_host_name_char (a_str[i])) {
-        bool parsed_host (false);
         host += a_str[i];
         ++i;
         CHECK_INDEX (i);
@@ -162,13 +161,11 @@ parse_connection_string (const common::UString &a_str,
             if (a_str[i] == ':') {
                 ++i;
                 CHECK_INDEX (i);
-                parsed_host = true;
                 goto parse_port;
             };
             if (a_str[i] == '/') {
                 ++i;
                 CHECK_INDEX (i);
-                parsed_host= true;
                 goto parse_schemaname;
             }
             if (common::parsing_utils::is_host_name_char (a_str[i])) {
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 90450be..316db86 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -4641,7 +4641,6 @@ GDBEngine::extract_global_variable_list (Output &a_output,
     InitDeclaratorPtr init_decl;
     ParserPtr parser;
     bool found = false;
-    unsigned cur = 0;
     list<Output::OutOfBandRecord>::const_iterator oobr_it =
                                     a_output.out_of_band_records ().begin ();
 fetch_file:
@@ -4659,7 +4658,6 @@ fetch_file:
     }
     if (!found)
         goto out;
-    cur = 5;
     file_name = str.substr (5);
     file_name.chomp ();
     file_name.erase (file_name.length ()-1, 1);
diff --git a/src/dbgengine/nmv-gdbmi-parser.cc b/src/dbgengine/nmv-gdbmi-parser.cc
index b76d970..84d6fad 100644
--- a/src/dbgengine/nmv-gdbmi-parser.cc
+++ b/src/dbgengine/nmv-gdbmi-parser.cc
@@ -2350,7 +2350,7 @@ GDBMIParser::parse_threads_list (UString::size_type a_from,
 
     GDBMIResultSafePtr gdbmi_result;
     std::list<int> thread_ids;
-    unsigned int num_threads = 0, current_thread_id = 0;
+    unsigned int num_threads = 0;
 
     // We loop, parsing GDB/MI RESULT constructs and ',' until we reach '\n'
     while (true) {
@@ -2411,8 +2411,9 @@ GDBMIParser::parse_threads_list (UString::size_type a_from,
             // If we've got a RESULT which variable is "current-thread-id",
             // expect the result to be a string which is the id of the current
             // thread.
-            current_thread_id =
+            unsigned current_thread_id =
                 atoi (gdbmi_result->value ()->get_string_content ().c_str ());
+            thread_ids.push_back (current_thread_id);
         } else {
             // Let's consume the unknown RESULT which we might have gotten for
             // now.
@@ -3553,7 +3554,7 @@ GDBMIParser::parse_var_changed_list (UString::size_type a_from,
         list<GDBMIResultSafePtr> comps =
                 (*value_it)->get_tuple_content ()->content ();
         UString n, v, internal_name, value;
-        bool in_scope = false, type_changed = false;
+        bool in_scope = true;
         IDebugger::VariableSafePtr var;
         // Walk the list of components of the child variable and really
         // build the damn variable
@@ -3573,7 +3574,7 @@ GDBMIParser::parse_var_changed_list (UString::size_type a_from,
             } else if (n == "in_scope") {
                 in_scope = (v == "true");
             } else if (n == "type_changed") {
-                type_changed = (v == "true");
+                // type_changed = (v == "true");
             }
         }
         if (!internal_name.empty ()) {
@@ -3581,7 +3582,8 @@ GDBMIParser::parse_var_changed_list (UString::size_type a_from,
                     (new IDebugger::Variable (internal_name,
                                               "" /* name */,
                                               value,
-                                              "" /* type */));
+                                              "" /* type */,
+                                              in_scope));
             a_vars.push_back (var);
         }
     }
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 978f5e8..6fce75f 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -371,43 +371,52 @@ public:
         // If empty, it can be set by calling
         // IDebugger::query_variable_path_expr()
         UString m_path_expression;
+        bool m_in_scope;
 
     public:
         Variable (const UString &a_internal_name,
                   const UString &a_name,
                   const UString &a_value,
-                  const UString &a_type) :
-            m_internal_name (a_internal_name),
+                  const UString &a_type,
+                  bool a_in_scope = true)
+            : m_internal_name (a_internal_name),
             m_name (a_name),
             m_value (a_value),
             m_type (a_type),
             m_parent (0),
-            m_num_expected_children (0)
+            m_num_expected_children (0),
+            m_in_scope (a_in_scope)
 
         {
         }
 
         Variable (const UString &a_name,
                   const UString &a_value,
-                  const UString &a_type) :
-            m_name (a_name),
+                  const UString &a_type,
+                  bool a_in_scope = true)
+            : m_name (a_name),
             m_value (a_value),
             m_type (a_type),
             m_parent (0),
-            m_num_expected_children (0)
+            m_num_expected_children (0),
+            m_in_scope (a_in_scope)
 
         {
         }
 
-        Variable (const UString &a_name) :
-            m_name (a_name),
+        Variable (const UString &a_name)
+            : m_name (a_name),
             m_parent (0),
-            m_num_expected_children (0)
+            m_num_expected_children (0),
+            m_in_scope (true)
+                
         {}
 
-        Variable () :
-            m_parent (0),
-            m_num_expected_children (0)
+        Variable ()
+            : m_parent (0),
+            m_num_expected_children (0),
+            m_in_scope (true)
+                
         {}
 
         const VariableList& members () const {return m_members;}
@@ -751,6 +760,10 @@ public:
         {
             m_path_expression = a_expr;
         }
+
+        bool in_scope () const {return m_in_scope;}
+        void in_scope (bool a) {m_in_scope = a;}
+
     };//end class Variable
 
     enum State {
diff --git a/src/langs/nmv-cpp-parser.cc b/src/langs/nmv-cpp-parser.cc
index acf63b6..a04a972 100644
--- a/src/langs/nmv-cpp-parser.cc
+++ b/src/langs/nmv-cpp-parser.cc
@@ -1268,7 +1268,7 @@ out:
 bool
 Parser::parse_qualified_id (QualifiedIDExprPtr &a_expr)
 {
-    bool result=false, has_template=false;
+    bool result=false;
     UnqualifiedIDExprPtr id;
     Token token;
     QNamePtr scope;
@@ -1286,7 +1286,6 @@ Parser::parse_qualified_id (QualifiedIDExprPtr &a_expr)
             && token.get_kind () == Token::KEYWORD
             && token.get_str_value () == "template") {
             LEXER.consume_next_token ();
-            has_template=true;
         }
         if (!parse_unqualified_id (id)) {goto error;}
         expr.reset (new QualifiedIDExpr (scope, id));
diff --git a/src/uicommon/nmv-source-editor.cc b/src/uicommon/nmv-source-editor.cc
index d5f96ed..4cc294b 100644
--- a/src/uicommon/nmv-source-editor.cc
+++ b/src/uicommon/nmv-source-editor.cc
@@ -668,10 +668,6 @@ struct SourceEditor::Priv {
     void
     update_line_col_label ()
     {
-        int line_count = 0;
-        if (source_view && source_view->get_buffer ()) {
-            line_count = source_view->get_buffer ()->get_line_count ();
-        }
         UString message;
         message.printf (_("Line: %i, Column: %i"),
                         non_asm_ctxt.current_line,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]