This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Patches to build on DJGPP
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 9 Aug 2008 22:41:46 +0100
- Subject: Patches to build on DJGPP
Here are the left over patches I used to build GDB on DJGPP.
GDB changes:
- "missing sentinel in function calls" warnings:
NULL is not a pointer in djgpp, it's #define NULL 0. Recent gcc's
bark on cases like the concat calls I'm fixing, if the last argument
is not a pointer.
- cp-name-parse.y
There's a call to snprintf in it. DJGPP gets it from libiberty.
I needed to include config.h, so HAVE_DECL_SNPRINTF is defined when
libiberty.h is included, which then declares snprintf.
- gdb_select.h
Include sys/types.h to pick up fd_set.
Include <time.h> in posix-hdep.c, because that's where select is
declared. (?)
The readline bits, the patch explains what's needed.
Here's the error log
gcc -DHAVE_CONFIG_H -I. -I../../readline -DRL_LIBRARY_VERSION='"5.1"' -O0 -g3
-c ../../readline/support/wcwidth.c
In file included from ../../readline/support/wcwidth.c:9:
c:/djgpp/include/wchar.h:24: error: expected '=', ',', ';', 'asm'
or '__attribut
e__' before 'typedef'
../../readline/support/wcwidth.c: In function 'wcwidth':
../../readline/support/wcwidth.c:130: warning: comparison is always false due
to
limited range of data type
../../readline/support/wcwidth.c:130: warning: comparison is always true due
to
limited range of data type
make.exe: *** [wcwidth.o] Error 1
- libbfd
cc1.exe: warnings being treated as errors
../../bfd/archive.c: In function '_bfd_archive_bsd_update_armap_timestamp':
../../bfd/archive.c:2314: warning: comparison between signed and unsigned
time_t in djgpp is unsigned int, armap_timestamp is long.
There's a comment at the definition of armap_timestamp, claiming that it
isn't time_t until more compilers support it.
--
Pedro Alves
gdb/
2008-08-09 Pedro Alves <pedro@codesourcery.com>
* buildsym.c (start_subfile): Cast sentinel NULL to void*.
* cp-name-parser.y: Include "config.h".
* posix-hdep.c [__GO32__]: Include time.h.
* xml-tdesc.c (fetch_xml_from_file): Cast sentinel NULL to void*.
* gdb_select.h: Include sys/types.h if available.
readline/
2008-08-09 Pedro Alves <pedro@codesourcery.com>
* signals.c (rl_set_sighandler): Guard access to SIGWINCH.
* wcwidth.c [__GO32__]: Include wctype.h before wchar.h.
bfd/
2008-08-09 Pedro Alves <pedro@codesourcery.com>
* archive.c (_bfd_archive_bsd_update_armap_timestamp): Cast stat
st_mtime to long before comparison.
---
bfd/archive.c | 2 +-
gdb/buildsym.c | 2 +-
gdb/cp-name-parser.y | 1 +
gdb/gdb_select.h | 4 ++++
gdb/posix-hdep.c | 6 ++++++
gdb/xml-tdesc.c | 2 +-
readline/signals.c | 4 ++++
readline/support/wcwidth.c | 5 +++++
8 files changed, 23 insertions(+), 3 deletions(-)
Index: src/gdb/buildsym.c
===================================================================
--- src.orig/gdb/buildsym.c 2008-08-09 20:55:28.000000000 +0100
+++ src/gdb/buildsym.c 2008-08-09 22:27:04.000000000 +0100
@@ -547,7 +547,7 @@ start_subfile (char *name, char *dirname
&& !IS_ABSOLUTE_PATH (subfile->name)
&& subfile->dirname != NULL)
subfile_name = concat (subfile->dirname, SLASH_STRING,
- subfile->name, NULL);
+ subfile->name, (void*) NULL);
else
subfile_name = subfile->name;
Index: src/gdb/cp-name-parser.y
===================================================================
--- src.orig/gdb/cp-name-parser.y 2008-08-09 20:55:32.000000000 +0100
+++ src/gdb/cp-name-parser.y 2008-08-09 22:27:04.000000000 +0100
@@ -36,6 +36,7 @@ Boston, MA 02110-1301, USA. */
#include <unistd.h>
#include <string.h>
+#include "config.h"
#include "safe-ctype.h"
#include "libiberty.h"
#include "demangle.h"
Index: src/gdb/posix-hdep.c
===================================================================
--- src.orig/gdb/posix-hdep.c 2008-08-09 20:55:39.000000000 +0100
+++ src/gdb/posix-hdep.c 2008-08-09 22:27:04.000000000 +0100
@@ -24,6 +24,12 @@
#include "gdb_select.h"
+#ifdef __GO32__
+/* DJGPP defines the fd_set type in sys/types.h, but `select' goes
+ here. */
+# include <time.h>
+#endif
+
/* The strerror() function can return NULL for errno values that are
out of range. Provide a "safe" version that always returns a
printable string. */
Index: src/gdb/xml-tdesc.c
===================================================================
--- src.orig/gdb/xml-tdesc.c 2008-08-09 20:55:45.000000000 +0100
+++ src/gdb/xml-tdesc.c 2008-08-09 22:27:04.000000000 +0100
@@ -443,7 +443,7 @@ fetch_xml_from_file (const char *filenam
if (dirname && *dirname)
{
- char *fullname = concat (dirname, "/", filename, NULL);
+ char *fullname = concat (dirname, "/", filename, (void*) NULL);
if (fullname == NULL)
nomem (0);
file = fopen (fullname, FOPEN_RT);
Index: src/gdb/gdb_select.h
===================================================================
--- src.orig/gdb/gdb_select.h 2008-08-09 20:55:36.000000000 +0100
+++ src/gdb/gdb_select.h 2008-08-09 22:27:04.000000000 +0100
@@ -24,6 +24,10 @@
#include <sys/select.h>
#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
#ifdef USE_WIN32API
#include <winsock2.h>
#endif
Index: src/readline/signals.c
===================================================================
--- src.orig/readline/signals.c 2008-08-09 20:55:52.000000000 +0100
+++ src/readline/signals.c 2008-08-09 22:27:04.000000000 +0100
@@ -251,7 +251,11 @@ rl_set_sighandler (sig, handler, ohandle
struct sigaction act;
act.sa_handler = handler;
+#if defined (SIGWINCH)
act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
+#else
+ act.sa_flags = 0;
+#endif
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
sigaction (sig, &act, &old_handler);
Index: src/readline/support/wcwidth.c
===================================================================
--- src.orig/readline/support/wcwidth.c 2008-08-09 20:55:59.000000000 +0100
+++ src/readline/support/wcwidth.c 2008-08-09 22:27:04.000000000 +0100
@@ -6,6 +6,11 @@
* Markus Kuhn -- 2001-09-08 -- public domain
*/
+#ifdef __GO32__
+/* DJGPP needs to include this before including wchar.h. */
+# include <wctype.h>
+#endif
+
#include <wchar.h>
struct interval {
Index: src/bfd/archive.c
===================================================================
--- src.orig/bfd/archive.c 2008-08-09 20:56:09.000000000 +0100
+++ src/bfd/archive.c 2008-08-09 22:27:04.000000000 +0100
@@ -2311,7 +2311,7 @@ _bfd_archive_bsd_update_armap_timestamp
/* Can't read mod time for some reason. */
return TRUE;
}
- if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
+ if (((long) archstat.st_mtime) <= bfd_ardata (arch)->armap_timestamp)
/* OK by the linker's rules. */
return TRUE;