This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] include libiberty.h in gdbserver.h


On 08/25/2012 01:16 AM, Pedro Alves wrote:
> Makes me a little nervous (the current use of bits of libiberty in
> gdbserver is already a hack, and this spreads it), but okay.
> 
> Don't we need to update Makefile dependencies to make $server_h
> depend on ...include/libiberty.h and ...include/ansidecl.h ?

I am checking this in, with tracking dependency on
include/libiberty.h and include/ansidecl.h.

-- 
Yao

gdb/gdbserver:

2012-08-29  Yao Qi  <yao@codesourcery.com>

	* ax.c, tracepoint.c: Replace ATTR_FORMAT with ATTRIBUTE_PRINTF.
	* server.h: Include 'libiberty.h' and 'ansidecl.h'.
	(ATTR_NORETURN, ATTR_FORMAT, ATTR_MALLOC): Remove.
	Remove declarations of xmalloc, xreallloc, xstrdup and
	freeargv.
	* Makefile.in (libiberty_h): New.
	(server_h): Append dependencies 'libiberty.h' and 'ansidecl.h'.
	(linux-bfin-low.o): Append dependency 'libiberty.h'.
---
 gdb/gdbserver/Makefile.in  |    5 ++++-
 gdb/gdbserver/ax.c         |    2 +-
 gdb/gdbserver/server.h     |   41 ++++++-----------------------------------
 gdb/gdbserver/tracepoint.c |    2 +-
 4 files changed, 12 insertions(+), 38 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index f62799e..489cf35 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -416,6 +416,7 @@ linux_osdata_h = $(srcdir)/../common/linux-osdata.h
 vec_h = $(srcdir)/../common/vec.h
 gdb_vecs_h = $(srcdir)/../common/gdb_vecs.h
 host_defs_h = $(srcdir)/../common/host-defs.h
+libiberty_h = $(srcdir)/../../include/libiberty.h
 # Since everything must include server.h, we make that depend on
 # generated files.
 server_h = $(srcdir)/server.h $(regcache_h) $(srcdir)/target.h \
@@ -427,6 +428,8 @@ server_h = $(srcdir)/server.h $(regcache_h) $(srcdir)/target.h \
 		$(srcdir)/../common/gdb_locale.h \
 		$(ptid_h) \
 		$(signals_h) \
+		$(libiberty_h) \
+		$(srcdir)/../../include/ansidecl.h \
 		$(generated_files)
 
 gdbthread_h = $(srcdir)/gdbthread.h $(target_h) $(srcdir)/server.h
@@ -550,7 +553,7 @@ linux-low.o: linux-low.c $(linux_low_h) $(linux_ptrace_h) $(linux_procfs_h) \
 
 linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h) \
 	$(gdb_proc_service_h)
-linux-bfin-low.o: linux-bfin-low.c $(linux_low_h) $(server_h)
+linux-bfin-low.o: linux-bfin-low.c $(linux_low_h) $(server_h) $(libiberty_h)
 linux-cris-low.o: linux-cris-low.c $(linux_low_h) $(server_h)
 linux-crisv32-low.o: linux-crisv32-low.c $(linux_low_h) $(server_h)
 linux-ia64-low.o: linux-ia64-low.c $(linux_low_h) $(server_h)
diff --git a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c
index 70e9322..df49d00 100644
--- a/gdb/gdbserver/ax.c
+++ b/gdb/gdbserver/ax.c
@@ -20,7 +20,7 @@
 #include "ax.h"
 #include "format.h"
 
-static void ax_vdebug (const char *, ...) ATTR_FORMAT (printf, 1, 2);
+static void ax_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
 
 #ifdef IN_PROCESS_AGENT
 int debug_agent = 0;
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index a6ba0db..e93ad00 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -27,6 +27,9 @@
 #include "wincecompat.h"
 #endif
 
+#include "libiberty.h"
+#include "ansidecl.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -67,32 +70,6 @@ extern int vasprintf(char **strp, const char *fmt, va_list ap);
 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
 #endif
 
-#ifndef ATTR_NORETURN
-#if defined(__GNUC__) && (__GNUC__ > 2 \
-			  || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
-#define ATTR_NORETURN __attribute__ ((noreturn))
-#else
-#define ATTR_NORETURN           /* nothing */
-#endif
-#endif
-
-#ifndef ATTR_FORMAT
-#if defined(__GNUC__) && (__GNUC__ > 2 \
-			  || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4))
-#define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y)))
-#else
-#define ATTR_FORMAT(type, x, y) /* nothing */
-#endif
-#endif
-
-#ifndef ATTR_MALLOC
-#if defined(__GNUC__) && (__GNUC__ >= 3)
-#define ATTR_MALLOC __attribute__ ((__malloc__))
-#else
-#define ATTR_MALLOC             /* nothing */
-#endif
-#endif
-
 /* Define underscore macro, if not available, to be able to use it inside
    code shared with gdb in common directory.  */
 #ifndef _
@@ -364,16 +341,10 @@ void monitor_output (const char *msg);
 /* Functions from utils.c */
 #include "common-utils.h"
 
-void *xmalloc (size_t) ATTR_MALLOC;
-void *xrealloc (void *, size_t);
-void *xcalloc (size_t, size_t) ATTR_MALLOC;
-char *xstrdup (const char *) ATTR_MALLOC;
-void freeargv (char **argv);
-
 void perror_with_name (const char *string);
-void error (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
-void fatal (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
-void warning (const char *string,...) ATTR_FORMAT (printf, 1, 2);
+void error (const char *string,...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+void fatal (const char *string,...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+void warning (const char *string,...) ATTRIBUTE_PRINTF (1, 2);
 char *paddress (CORE_ADDR addr);
 char *pulongest (ULONGEST u);
 char *plongest (LONGEST l);
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 7ad77f0..1bc563d 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -57,7 +57,7 @@
 
 */
 
-static void trace_vdebug (const char *, ...) ATTR_FORMAT (printf, 1, 2);
+static void trace_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
 
 static void
 trace_vdebug (const char *fmt, ...)
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]