This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] include libiberty.h in gdbserver.h
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 22 Aug 2012 20:46:14 +0800
- Subject: [PATCH] include libiberty.h in gdbserver.h
Hi,
Some macros have been defined in libiberty.h and ansidecl.h, but we
define them again in server.h. libiberty.h has been included in
gdbserver, so I think we can use the macros defined in 'libiberty.h' and
'ansidecl.h' in gdbserver. so this patch is to include them, and
remove these macros in server.h.
Rebuild GDBserver for x86-linux and mingw32. OK to apply?
gdb/gdbserver:
2012-08-22 Yao Qi <yao@codesourcery.com>
* ax.c, tracepoint.c: Replace ATTR_FORMAT with ATTRIBUTE_PRINTF.
* server.h: Include 'libiberty.h' and 'ansidecl.h'.
Remove macro ATTR_NORETURN, ATTR_FORMAT, and ATTR_MALLOC.
Remove declarations of xmalloc, xreallloc, xstrdup and
freeargv.
Replace ATTR_NORETURN with ATTRIBUTE_NORETURN.
Replace ATTR_FORMAT with ATTRIBUTE_PRINTF.
---
gdb/gdbserver/ax.c | 2 +-
gdb/gdbserver/server.h | 41 ++++++-----------------------------------
gdb/gdbserver/tracepoint.c | 2 +-
3 files changed, 8 insertions(+), 37 deletions(-)
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 95a5b7e..f0a4ecc 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -26,6 +26,9 @@
#include "wincecompat.h"
#endif
+#include "libiberty.h"
+#include "ansidecl.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -66,32 +69,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 _
@@ -363,16 +340,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