gdbserver/ax.c: resolve compiler warning

Message ID 55A5461C.7090107@aegee.org
State New, archived
Headers

Commit Message

Дилян Палаузов July 14, 2015, 5:25 p.m. UTC
  gdbserver/ax.c defines unconditionally "static const unsigned char 
gdb_agent_op_sizes[]", but uses it, only when "#ifndef 
IN_PROCESS_AGENT".  This leads to compiler warning of type "unused".

This patch moves the above definition within "#ifndef IN_PROCESS_AGENT".


  static const char *
@@ -89,6 +81,14 @@ gdb_agent_op_name (int op)

  #ifndef IN_PROCESS_AGENT

+static const unsigned char gdb_agent_op_sizes [gdb_agent_op_last] =
+  {
+    0
+#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE)  , SIZE
+#include "ax.def"
+#undef DEFOP
+  };
+
  /* The packet form of an agent expression consists of an 'X', number
     of bytes in expression, a comma, and then the bytes.  */
  

Patch

diff --git a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c
index c5b65fa..193d37d 100644
--- a/gdb/gdbserver/ax.c
+++ b/gdb/gdbserver/ax.c
@@ -69,14 +69,6 @@  static const char *gdb_agent_op_names 
[gdb_agent_op_last] =
  #undef DEFOP
    };

-static const unsigned char gdb_agent_op_sizes [gdb_agent_op_last] =
-  {
-    0
-#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE)  , SIZE
-#include "ax.def"
-#undef DEFOP
-  };
-
  /* A wrapper for gdb_agent_op_names that does some bounds-checking.  */