Re: [PATCH] Cygwin accomodations for newer gccs

Elena Zannoni
2001-04-05T06:40:00Z

main.c + symfile.c approved.

Thanks
Elena

Christopher Faylor writes:
> Newer versions of gcc for Cygwin no longer implicitly define WIN32
> conditionals.
>
> This patch fixes that problem.
>
> cgf
>
> Wed Apr 4 21:48:42 2001 Christopher Faylor <cgf@cygnus.com>
>
> * main.c: Remove windows.h use.
> (gdbtk_test): Use PATH_MAX for home var calculation.
> * remote-e7000.c (e7000_parse_device): Accomodate CYGWIN as well as
> WIN32 in colon test.
> * ser-tcp.c: Use modern __CYGWIN__ conditional.
> * source.c (mod_path): Add __CYGWIN__ conditional to WIN32 test.
> (openp): Ditto.
> * symfile.c (symfile_bfd_open): Ditto.
> * gdbtk/generic/gdbtk.c: Ditto.
>
> Index: main.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/main.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 main.c
> --- main.c 2001/04/05 00:04:45 1.8
> +++ main.c 2001/04/05 01:55:58
> @@ -91,7 +91,6 @@ extern int enable_external_editor;
> extern char *external_editor_command;
>
> #ifdef __CYGWIN__
> -#include <windows.h> /* for MAX_PATH */
> #include <sys/cygwin.h> /* for cygwin32_conv_to_posix_path */
> #endif
>
> @@ -535,13 +534,13 @@ extern int gdbtk_test (char *);
> *before* all the command line arguments are processed; it sets
> global parameters, which are independent of what file you are
> debugging or what directory you are in. */
> -#ifdef __CYGWIN32__
> +#ifdef __CYGWIN__
> {
> char *tmp = getenv ("HOME");
>
> if (tmp != NULL)
> {
> - homedir = (char *) alloca (MAX_PATH + 1);
> + homedir = (char *) alloca (PATH_MAX + 1);
> cygwin32_conv_to_posix_path (tmp, homedir);
> }
> else
> Index: remote-e7000.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/remote-e7000.c,v
> retrieving revision 1.17
> diff -u -p -r1.17 remote-e7000.c
> --- remote-e7000.c 2001/03/06 08:21:12 1.17
> +++ remote-e7000.c 2001/04/05 01:55:58
> @@ -543,7 +543,7 @@ or \t\ttarget e7000 tcp_remote <host>[:<
> or \t\ttarget e7000 pc\n");
> }
>
> -#if !defined(__GO32__) && !defined(_WIN32)
> +#if !defined(__GO32__) && !defined(_WIN32) && !defined(__CYGWIN__)
> /* FIXME! test for ':' is ambiguous */
> if (n == 1 && strchr (dev_name, ':') == 0)
> {
> Index: ser-tcp.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/ser-tcp.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 ser-tcp.c
> --- ser-tcp.c 2001/03/06 08:21:16 1.3
> +++ ser-tcp.c 2001/04/05 01:55:58
> @@ -29,7 +29,7 @@
> #include <arpa/inet.h>
> #include <netdb.h>
> #include <sys/socket.h>
> -#ifndef __CYGWIN32__
> +#ifndef __CYGWIN__
> #include <netinet/tcp.h>
> #endif
>
> Index: source.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/source.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 source.c
> --- source.c 2001/03/27 20:36:24 1.11
> +++ source.c 2001/04/05 01:55:59
> @@ -331,7 +331,7 @@ mod_path (char *dirname, char **which_pa
> }
>
> if (!(SLASH_P (*name) && p <= name + 1) /* "/" */
> -#if defined(_WIN32) || defined(__MSDOS__)
> +#if defined(_WIN32) || defined(__MSDOS__) || defined(__CYGWIN__)
> /* On MS-DOS and MS-Windows, h:\ is different from h: */
> && !(!SLASH_P (*name) && ROOTED_P (name) && p <= name + 3) /* d:/ */
> #endif
> @@ -370,7 +370,7 @@ mod_path (char *dirname, char **which_pa
>
> if (name[0] == '~')
> name = tilde_expand (name);
> -#if defined(_WIN32) || defined(__MSDOS__)
> +#if defined(_WIN32) || defined(__MSDOS__) || defined(__CYGWIN__)
> else if (ROOTED_P (name) && p == name + 2) /* "d:" => "d:." */
> name = concat (name, ".", NULL);
> #endif
> @@ -526,7 +526,7 @@ openp (char *path, int try_cwd_first, ch
> if (!path)
> path = ".";
>
> -#ifdef _WIN32
> +#if defined(_WIN32) || defined(__CYGWIN__)
> mode |= O_BINARY;
> #endif
>
> Index: symfile.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/symfile.c,v
> retrieving revision 1.30
> diff -u -p -r1.30 symfile.c
> --- symfile.c 2001/03/27 20:36:24 1.30
> +++ symfile.c 2001/04/05 01:55:59
> @@ -1052,7 +1052,7 @@ symfile_bfd_open (char *name)
>
> /* Look down path for it, allocate 2nd new malloc'd copy. */
> desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
> -#if defined(__GO32__) || defined(_WIN32)
> +#if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__)
> if (desc < 0)
> {
> char *exename = alloca (strlen (name) + 5);
> Index: gdbtk/generic/gdbtk.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/gdbtk/generic/gdbtk.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 gdbtk.c
> --- gdbtk.c 2001/04/05 00:04:28 1.9
> +++ gdbtk.c 2001/04/05 01:55:59
> @@ -34,7 +34,7 @@
> #include "demangle.h"
> #include "version.h"
>
> -#ifdef _WIN32
> +#if defined(_WIN32) || defined(__CYGWIN__)
> #define WIN32_LEAN_AND_MEAN
> #include <windows.h>
> #endif
>