From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Christopher Faylor Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA?] Windows cleanup Date: Thu, 31 May 2001 19:29:00 -0000 Message-id: <3B16FD67.2C703E5E@redhat.com> References: <20010530232225.A19889@redhat.com> <20010531194013.A26851@redhat.com> X-SW-Source: 2001-05/msg00520.html Chris, I confess I cannot say much about the Windows conditionals but I trust your judgement. So, please consider the rdi-share part approved. I will try to build some ARM gdb's to test it. Regards, Fernando Christopher Faylor wrote: > > On Thu, May 31, 2001 at 05:30:55PM +0300, Eli Zaretskii wrote: > >On Wed, 30 May 2001, Christopher Faylor wrote: > >>I think that all of these qualify as obvious fixes, given that I'm the > >>Cygwin maintainer and _MSC_VER is no longer supported, however, I'd > >>like someone to verify that I properly whacked the ifdefs since I can't > >>really test things like "nindy-share". > > > >The changes look good to me, except that: > > Doh. I somehow really botched that patch. I wish I hadn't restarted my > X session so I could track down how I did that. > > Anyway, this one should be a little better. I've addressed Eli's concerns, > I think. > > Thanks to Eli and Fernando for checking this out for me and catching my > patch gaffe. > > cgf > > Wed May 30 23:02:44 2001 Christopher Faylor > > * gnu-regex.c: Eliminate obsolete check for _MSC_VER. > * utils.c (notice_quit): Remove dummy function only used for _MSC_VER. > * values.c (unpack_double): Remove obsolete check for _MSC_VER. > * defs.h: Ditto. > * m32r-rom.c: Ditto. > * p-exp.y: Ditto. > * ser-e7kpc.c: Ditto. Define WIN32_LEAN_AND_MEAN under _WIN32, for > faster compilation. > (get_ds_base): Remove _MSC_VER version of this function. > * nindy-share/ttyflush.c: Ditto. X > * rdi-share/host.h: Ditto. X > > * main.c (captured_main): Eliminate special Cygwin checks. > * ser-tcp.c: Remove unneeded __CYGWIN__ guard against system include. > > Index: defs.h > =================================================================== > RCS file: /cvs/uberbaum/gdb/defs.h,v > retrieving revision 1.50 > diff -p -r1.50 defs.h > *** defs.h 2001/05/15 00:03:36 1.50 > --- defs.h 2001/05/31 23:30:49 > *************** typedef struct ptid ptid_t; > *** 920,932 **** > #include "fopen-same.h" > #endif > > - /* Microsoft C can't deal with const pointers */ > - > - #ifdef _MSC_VER > - #define CONST_PTR > - #else > #define CONST_PTR const > - #endif > > /* Defaults for system-wide constants (if not defined by xm.h, we fake it). > FIXME: Assumes 2's complement arithmetic */ > --- 920,926 ---- > *************** extern char *getenv (const char *); > *** 1092,1102 **** > #endif > > #ifdef HAVE_STDLIB_H > - #if defined(_MSC_VER) && !defined(__cplusplus) > - /* msvc defines these in stdlib.h for c code */ > - #undef min > - #undef max > - #endif > #include > #endif > #ifndef min > --- 1086,1091 ---- > Index: gnu-regex.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/gnu-regex.c,v > retrieving revision 1.5 > diff -p -r1.5 gnu-regex.c > *** gnu-regex.c 2001/03/06 08:21:07 1.5 > --- gnu-regex.c 2001/05/31 23:30:50 > *************** static reg_errcode_t compile_range _RE_A > *** 1590,1610 **** > /* This is not an arbitrary limit: the arguments which represent offsets > into the pattern are two bytes long. So if 2^16 bytes turns out to > be too small, many things would have to change. */ > ! /* Any other compiler which, like MSC, has allocation limit below 2^16 > ! bytes will have to use approach similar to what was done below for > ! MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up > ! reallocating to 0 bytes. Such thing is not going to work too well. > ! You have been warned!! */ > ! #if defined _MSC_VER && !defined WIN32 > ! /* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. > ! The REALLOC define eliminates a flurry of conversion warnings, > ! but is not required. */ > ! # define MAX_BUF_SIZE 65500L > ! # define REALLOC(p,s) realloc ((p), (size_t) (s)) > ! #else > ! # define MAX_BUF_SIZE (1L << 16) > ! # define REALLOC(p,s) realloc ((p), (s)) > ! #endif > > /* Extend the buffer by twice its current size via realloc and > reset the pointers that pointed into the old block to point to the > --- 1590,1597 ---- > /* This is not an arbitrary limit: the arguments which represent offsets > into the pattern are two bytes long. So if 2^16 bytes turns out to > be too small, many things would have to change. */ > ! #define MAX_BUF_SIZE (1L << 16) > ! #define REALLOC(p,s) realloc ((p), (s)) > > /* Extend the buffer by twice its current size via realloc and > reset the pointers that pointed into the old block to point to the > Index: m32r-rom.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/m32r-rom.c,v > retrieving revision 1.8 > diff -p -r1.8 m32r-rom.c > *** m32r-rom.c 2001/05/04 04:15:25 1.8 > --- m32r-rom.c 2001/05/31 23:30:50 > *************** > *** 42,48 **** > > extern void report_transfer_performance (unsigned long, time_t, time_t); > > - #ifndef _MSC_VER > /* > * All this stuff just to get my host computer's IP address! > */ > --- 42,47 ---- > *************** extern void report_transfer_performance > *** 52,58 **** > #if 1 > #include /* for inet_ntoa */ > #endif > - #endif > > static char *board_addr; /* user-settable IP address for M32R-EVA */ > static char *server_addr; /* user-settable IP address for gdb host */ > --- 51,56 ---- > *************** mon2000_open (char *args, int from_tty) > *** 392,399 **** > monitor_open (args, &mon2000_cmds, from_tty); > } > > - #ifndef _MSC_VER > - > /* Function: set_board_address > Tell the BootOne monitor what it's ethernet IP address is. */ > > --- 390,395 ---- > *************** m32r_upload_command (char *args, int fro > *** 575,582 **** > clear_symtab_users (); > } > > - #endif /* ! _MSC_VER */ > - > void > _initialize_m32r_rom (void) > { > --- 571,576 ---- > *************** Specify the serial device it is connecte > *** 604,610 **** > mon2000_ops.to_open = mon2000_open; > add_target (&mon2000_ops); > > - #ifndef _MSC_VER > add_show_from_set > (add_set_cmd ("download-path", class_obscure, var_string, > (char *) &download_path, > --- 598,603 ---- > *************** Specify the serial device it is connecte > *** 630,634 **** > "Upload the srec file via the monitor's Ethernet upload capability."); > > add_com ("tload", class_obscure, m32r_load, "test upload command."); > - #endif > } > --- 623,626 ---- > Index: main.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/main.c,v > retrieving revision 1.10 > diff -p -r1.10 main.c > *** main.c 2001/05/07 19:03:11 1.10 > --- main.c 2001/05/31 23:30:51 > *************** static void print_gdb_help (struct ui_fi > *** 90,99 **** > extern int enable_external_editor; > extern char *external_editor_command; > > - #ifdef __CYGWIN__ > - #include /* for cygwin32_conv_to_posix_path */ > - #endif > - > /* Call command_loop. If it happens to return, pass that through as a > non-zero return status. */ > > --- 90,95 ---- > *************** extern int gdbtk_test (char *); > *** 534,554 **** > *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 __CYGWIN__ > - { > - char *tmp = getenv ("HOME"); > - > - if (tmp != NULL) > - { > - homedir = (char *) alloca (PATH_MAX + 1); > - cygwin32_conv_to_posix_path (tmp, homedir); > - } > - else > - homedir = NULL; > - } > - #else > homedir = getenv ("HOME"); > - #endif > if (homedir) > { > homeinit = (char *) alloca (strlen (homedir) + > --- 530,536 ---- > Index: p-exp.y > =================================================================== > RCS file: /cvs/uberbaum/gdb/p-exp.y,v > retrieving revision 1.5 > diff -p -r1.5 p-exp.y > *** p-exp.y 2001/03/19 19:05:21 1.5 > --- p-exp.y 2001/05/31 23:30:51 > *************** Foundation, Inc., 59 Temple Place - Suit > *** 58,68 **** > #include "symfile.h" /* Required by objfiles.h. */ > #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ > > - /* MSVC uses strnicmp instead of strncasecmp */ > - #ifdef _MSC_VER > - #define strncasecmp strnicmp > - #endif > - > /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), > as well as gratuitiously global symbol names, so we can have multiple > yacc generated parsers in gdb. Note that these are only the variables > --- 58,63 ---- > Index: ser-e7kpc.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/ser-e7kpc.c,v > retrieving revision 1.5 > diff -p -r1.5 ser-e7kpc.c > *** ser-e7kpc.c 2001/03/06 08:21:16 1.5 > --- ser-e7kpc.c 2001/05/31 23:30:51 > *************** > *** 24,36 **** > #include "serial.h" > #include "gdb_string.h" > > - /* MSVC uses strnicmp instead of strncasecmp */ > - #ifdef _MSC_VER > - #define strncasecmp strnicmp > - #define WIN32_LEAN_AND_MEAN > - #endif > - > #ifdef _WIN32 > #include > #endif > > --- 24,31 ---- > #include "serial.h" > #include "gdb_string.h" > > #ifdef _WIN32 > + #define WIN32_LEAN_AND_MEAN > #include > #endif > > *************** sigs[] = > *** 129,164 **** > 0 > }; > > - #ifdef _MSC_VER > - /* Get the base of the data segment. This is needed to calculate the offset > - between data segment addresses and the base of linear memory, which is where > - device registers reside. Note that this is really only necessary for > - Win32s, since Win95 and NT keep the data segment at linear 0. */ > - > - static unsigned long > - get_ds_base (void) > - { > - unsigned short dsval; > - LDT_ENTRY ldt; > - unsigned long dsbase; > - > - __asm > - { > - mov dsval, ds > - } > - > - dsbase = 0; > - > - GetThreadSelectorEntry (GetCurrentThread (), dsval, &ldt); > - > - dsbase = ldt.HighWord.Bits.BaseHi << 24 | ldt.HighWord.Bits.BaseMid << 16 > - | ldt.BaseLow; > - > - return dsbase; > - } > - #else /* !_MSC_VER */ > #define get_ds_base() 0 > - #endif /* _MSC_VER */ > > static int > e7000pc_init (void) > --- 124,130 ---- > Index: ser-tcp.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/ser-tcp.c,v > retrieving revision 1.4 > diff -p -r1.4 ser-tcp.c > *** ser-tcp.c 2001/04/05 02:02:13 1.4 > --- ser-tcp.c 2001/05/31 23:30:51 > *************** > *** 29,37 **** > #include > #include > #include > - #ifndef __CYGWIN__ > #include > - #endif > > #include > #include "gdb_string.h" > --- 29,35 ---- > Index: utils.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/utils.c,v > retrieving revision 1.40 > diff -p -r1.40 utils.c > *** utils.c 2001/04/19 23:56:13 1.40 > --- utils.c 2001/05/31 23:30:52 > *************** quit (void) > *** 868,902 **** > return_to_top_level (RETURN_QUIT); > } > > - > - #if defined(_MSC_VER) /* should test for wingdb instead? */ > - > - /* > - * Windows translates all keyboard and mouse events > - * into a message which is appended to the message > - * queue for the process. > - */ > - > - void > - notice_quit (void) > - { > - int k = win32pollquit (); > - if (k == 1) > - quit_flag = 1; > - else if (k == 2) > - immediate_quit = 1; > - } > - > - #else /* !defined(_MSC_VER) */ > - > - void > - notice_quit (void) > - { > - /* Done by signals */ > - } > - > - #endif /* !defined(_MSC_VER) */ > - > /* Control C comes here */ > void > request_quit (int signo) > --- 868,873 ---- > Index: values.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/values.c,v > retrieving revision 1.17 > diff -p -r1.17 values.c > *** values.c 2001/05/21 20:08:59 1.17 > --- values.c 2001/05/31 23:30:52 > *************** unpack_double (struct type *type, char * > *** 695,706 **** > else if (nosign) > { > /* Unsigned -- be sure we compensate for signed LONGEST. */ > - #if !defined (_MSC_VER) || (_MSC_VER > 900) > return (ULONGEST) unpack_long (type, valaddr); > - #else > - /* FIXME!!! msvc22 doesn't support unsigned __int64 -> double */ > - return (LONGEST) unpack_long (type, valaddr); > - #endif /* _MSC_VER */ > } > else > { > --- 695,701 ---- > Index: nindy-share/ttyflush.c > =================================================================== > RCS file: /cvs/uberbaum/gdb/nindy-share/ttyflush.c,v > retrieving revision 1.1.1.1 > diff -p -r1.1.1.1 ttyflush.c > *** ttyflush.c 1999/04/16 01:34:26 1.1.1.1 > --- ttyflush.c 2001/05/31 23:30:52 > *************** > *** 22,32 **** > #include "defs.h" > #include "serial.h" > > - #ifdef _MSC_VER > - # include > - # define sleep _sleep > - #endif > - > /* Flush all pending input and output for SERIAL, wait for a second, and > then if there is a character pending, discard it and flush again. */ > > --- 22,27 ---- > Index: rdi-share/host.h > =================================================================== > RCS file: /cvs/uberbaum/gdb/rdi-share/host.h,v > retrieving revision 1.1.1.1 > diff -p -r1.1.1.1 host.h > *** host.h 1999/04/16 01:34:27 1.1.1.1 > --- host.h 2001/05/31 23:30:52 > *************** > *** 59,71 **** > # define COMPILING_ON_WINDOWS_CONSOLE 1 > # define COMPILING_ON_WINDOWS 1 > #endif > - #ifdef _MSC_VER > - # define COMPILING_ON_MSDOS 1 > - # define COMPILING_ON_WINDOWS 1 > - # if defined(__cplusplus) > - # define IMPLEMENT_BOOL_AS_INT 1 /* VC++ doesn't have 'bool' (yet) */ > - # endif > - #endif > /* The '(defined(__sparc) && defined(P_tmpdir) */ > /* && !defined(__svr4__))' is to detect gcc on SunOS. */ > /* C++ compilers don't have to define __STDC__ */ > --- 59,64 ---- > *************** typedef char *ArgvType; > *** 187,194 **** > # define FILENAME_MAX 256 > #endif > > ! #if (!defined(__STDC__) && !defined(__cplusplus) && !defined(_MSC_VER)) || \ > ! defined(COMPILING_ON_SUNOS) > /* Use bcopy rather than memmove, as memmove is not available. */ > /* There does not seem to be a header for bcopy. */ > void bcopy(const char *src, char *dst, int length); > --- 180,186 ---- > # define FILENAME_MAX 256 > #endif > > ! #if (!defined(__STDC__) && !defined(__cplusplus) || defined(COMPILING_ON_SUNOS) > /* Use bcopy rather than memmove, as memmove is not available. */ > /* There does not seem to be a header for bcopy. */ > void bcopy(const char *src, char *dst, int length); -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9