Re: [RFA] defs.h _WIN32 defined by Win98, too

Eli Zaretskii
2001-08-01T08:23:00Z

On Wed, 1 Aug 2001, Keith Seitz wrote:

> > > `/home/keiths/sources/insight/gdb\gdb.exe' has disappeared; keeping its
> > > symbols.
> > >
> > > Starting program: /home/keiths/sources/insight/gdb\gdb.exe
> > > Error creating process /home/keiths/sources/insight/gdb\gdb.exe (error 2)
> > > [often crashes here]
> > >
> > > Apparently, Win98 defines _WIN32 somewhere...
> >
> > So perhaps there's a bug in Cygwin ;-)
>
> Nope. Works fine on Win2000 using EXACTLY the same environment.

So you are saying that the same version of Cygwin defines _WIN32 on
Windows 98, but not on W2K? isn't that strange?

> > Anyway, didn't Chris say that _WIN32 should be removed from GDB
> > everywhere? If that's so, the ifdef _WIN32 should be simply deleted,
> > instead of lumping more ifdefs on top of it. For SLASH_STRING in
> > particular, this shouldn't be a problem at all, since Windows supports
> > forward slashes as well as backslashes, even if GDB is built with MS
> > run-time DLLs.
>
> Windows does NOT support both forward and backward slashes in this
> context. Or perhaps more correctly, cygwin does not support both.

My analysis of the problem is different; it goes like this:

- somehow, _WIN32 got defined on Windows 98;

- because _WIN32 is defined, GDB is compiled so as to use the
backslash as a directory separator in file names;

- GDB then constructs file names with a backslash, and gets
/home/keiths/sources/insight/gdb\gdb.exe instead of the normal
/home/keiths/sources/insight/gdb/gdb.exe (see the file source.c);

- the backslash confuses Cygwin library functions which manipulate file
names, probably because it doesn't grok backslashes.

> I don't
> know (and frankly don't care) who is to blame. Gdb doesn't work on Win98.

I don't argue with facts; it's clear that something breaks GDB. But I
think we need to understand why does _WIN32 get defined on some systems,
but not on others.

> As for eliminating SLASH_STRING, well, that's a much bigger and riskier
> change than the simple, pragmatic approach I've taken.

I didn't say eliminate SLASH_STRING, I said eliminate _WIN32. That is,
make SLASH_STRING always be "/", but don't replace it with a literal "/".