public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [RFA/gdbserver] Move malloc.h include to server.h.
Date: Wed, 01 Sep 2010 17:10:00 -0000	[thread overview]
Message-ID: <1283360985-30122-1-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <201009011241.10997.pedro@codesourcery.com>

As discussed:

This patch moves all includes of malloc.h, which were introduced
purely to get access to alloca's declaration, to server.h, next
to the include of alloca.h.

There is one exception: gdbreplay.c, which does not include server.h.
In this case, the include of alloca.h was simply moved up a bit, next
to the include of malloc.h.

gdb/gdbserver/ChangeLog:

        * gdbserver/gdbreplay.c: Move include of alloca.h up, next to
        include of malloc.h.
        * gdbserver/server.h: Add include of malloc.h.
        * gdbserver/mem-break.c: Remove include of malloc.h.
        * gdbserver/server.c, gdbserver/tracepoint.c, gdbserver/utils.c,
        gdbserver/win32-low.c: Likewise.

Tested on x86_64-linux. I also verified that gdbserver still builds
on MinGW...

---
 gdb/gdbserver/gdbreplay.c  |    6 +++---
 gdb/gdbserver/mem-break.c  |    3 ---
 gdb/gdbserver/server.c     |    3 ---
 gdb/gdbserver/server.h     |    5 +++++
 gdb/gdbserver/tracepoint.c |    3 ---
 gdb/gdbserver/utils.c      |    3 ---
 gdb/gdbserver/win32-low.c  |    1 -
 7 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 4996ffa..1f65111 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -54,15 +54,15 @@
 #if HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
 #endif
+#if HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #if HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if USE_WIN32API
 #include <winsock2.h>
 #endif
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
 
 #ifndef HAVE_SOCKLEN_T
 typedef int socklen_t;
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 687414b..1b08415 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -20,9 +20,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "server.h"
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
 
 const unsigned char *breakpoint_data;
 int breakpoint_len;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index c406abe..528b658 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -28,9 +28,6 @@
 #if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
 
 ptid_t cont_thread;
 ptid_t general_thread;
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 286c80a..d5f32e8 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -41,6 +41,11 @@
 #ifdef HAVE_ALLOCA_H
 #include <alloca.h>
 #endif
+/* On some systems such as MinGW, alloca is declared in malloc.h
+   (there is no alloca.h).  */
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
 
 #if !HAVE_DECL_STRERROR
 #ifndef strerror
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index f068ce4..138d920 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -22,9 +22,6 @@
 #include <unistd.h>
 #include <sys/time.h>
 #include <stddef.h>
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
 #if HAVE_STDINT_H
 #include <stdint.h>
 #endif
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 7de086c..aee7e96 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -24,9 +24,6 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
 
 #ifdef IN_PROCESS_AGENT
 #  define PREFIX "ipa: "
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index dd26d73..5aea8b9 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -31,7 +31,6 @@
 #include <tlhelp32.h>
 #include <psapi.h>
 #include <sys/param.h>
-#include <malloc.h>
 #include <process.h>
 
 #ifndef USE_WIN32API
-- 
1.7.1

  reply	other threads:[~2010-09-01 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 19:06 [RFA/commit] include alloca.h if available Joel Brobecker
2010-08-31 19:55 ` Pedro Alves
2010-09-01  1:59   ` Joel Brobecker
2010-09-01  4:38     ` Joel Brobecker
2010-09-01 11:41       ` Pedro Alves
2010-09-01 17:10         ` Joel Brobecker [this message]
2010-09-01 17:12           ` [RFA/gdbserver] Move malloc.h include to server.h Pedro Alves
2010-09-01 17:30             ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283360985-30122-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).