This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[3/4] RFC: introduce gdb_vecs.h
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 19 Jan 2012 13:26:20 -0700
- Subject: [3/4] RFC: introduce gdb_vecs.h
I needed a VEC(char_ptr) in another header for patch #4; but this is a
pain because it is already defined in tracepoint.h, so there can be
clashes depending.
This patch introduces gdb_vecs.h and moves the DEF_VEC_P there.
We could add other vector definitions there as well.
This is a bit of a hack, but I think it is basically the best we can do
given how vec.h works.
Another possibility here is just including vec.h from defs.h and doing
the DEF_VEC_P there. I thought I'd pull this patch out separately in
case anybody prefers that approach, or some other; I can implement it.
Tom
2012-01-19 Tom Tromey <tromey@redhat.com>
* ada-lang.c: Include gdb_vecs.h.
* charset.c: Include gdb_vecs.h.
* tracepoint.h: Include gdb_vecs.h.
* gdb_vecs.h: New file.
---
gdb/ada-lang.c | 3 +--
gdb/charset.c | 3 +--
gdb/gdb_vecs.h | 28 ++++++++++++++++++++++++++++
gdb/tracepoint.h | 3 +--
4 files changed, 31 insertions(+), 6 deletions(-)
create mode 100644 gdb/gdb_vecs.h
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 29956d7..11ff73f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -57,6 +57,7 @@
#include "observer.h"
#include "vec.h"
#include "stack.h"
+#include "gdb_vecs.h"
#include "psymtab.h"
#include "value.h"
@@ -5628,8 +5629,6 @@ symbol_completion_match (const char *sym_name,
return sym_name;
}
-DEF_VEC_P (char_ptr);
-
/* A companion function to ada_make_symbol_completion_list().
Check if SYM_NAME represents a symbol which name would be suitable
to complete TEXT (TEXT_LEN is the length of TEXT), in which case
diff --git a/gdb/charset.c b/gdb/charset.c
index f32736a..62977d1 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -27,6 +27,7 @@
#include "vec.h"
#include "environ.h"
#include "arch-utils.h"
+#include "gdb_vecs.h"
#include <stddef.h>
#include "gdb_string.h"
@@ -717,8 +718,6 @@ wchar_iterate (struct wchar_iterator *iter,
extern initialize_file_ftype _initialize_charset; /* -Wmissing-prototype */
-DEF_VEC_P (char_ptr);
-
static VEC (char_ptr) *charsets;
#ifdef PHONY_ICONV
diff --git a/gdb/gdb_vecs.h b/gdb/gdb_vecs.h
new file mode 100644
index 0000000..04bd711
--- /dev/null
+++ b/gdb/gdb_vecs.h
@@ -0,0 +1,28 @@
+/* Some commonly-used VEC types.
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#ifndef GDB_VECS_H
+#define GDB_VECS_H
+
+#include "vec.h"
+
+DEF_VEC_P (char_ptr);
+
+#endif /* GDB_VECS_H */
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 8a1e77c..00c4d7c 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -22,6 +22,7 @@
#include "breakpoint.h"
#include "target.h"
#include "memrange.h"
+#include "gdb_vecs.h"
/* A trace state variable is a value managed by a target being
traced. A trace state variable (or tsv for short) can be accessed
@@ -143,8 +144,6 @@ extern char *default_collect;
/* Struct to collect random info about tracepoints on the target. */
-DEF_VEC_P (char_ptr);
-
struct uploaded_tp
{
int number;
--
1.7.6.5