delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/12/03:35:12

Date: Tue, 12 May 1998 10:34:02 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Andris Pavenis <pavenis AT lanet DOT lv>
cc: djgpp AT delorie DOT com
Subject: Re: / and \ in gcc2.8.1
In-Reply-To: <B0000029905@stargate.astr.lu.lv>
Message-ID: <Pine.SUN.3.91.980512103343.22504B-100000@is>
MIME-Version: 1.0

On Mon, 11 May 1998, Andris Pavenis wrote:

> > That's okay, but I would suggest to grep the sources once again (unless 
> > you already did that) to make sure there are no more '/' in other places 
> > which aren't covered by these two changes.
> 
> DOS works Ok with both '\\' and '/'. So perhaps it's enough to fix the names 
> which appears in output. Defining DIR_SEPARATOR='\\' forces gcc to
> understand correctly both separators, but '\\' appears in output
> what I don't want. Problem with TMPDIR is fixed so.

Sorry, I haven't yet time to have a good look at GCC 2.8.x sources, so
my comments were general and might have missed the point.  

What I meant to say was that if GCC makes decisions based on tests for
a '/' in specific places in file names, then all those code parts
which make such decisions might have bugs in the DJGPP port, since on
DOS/Windows GCC can get file names with either '/' or '\\' and even a
mixed case, like d:\foo\bar/cpp.exe.

For example, many Unix programs find the basename of a file like this:

	 char *basename = strrchr (filename, '/');
	 if (basename)
	   basename++;
	 else
	   basename = filename;

This will fail if filename uses backslashes, and will have subtle bugs
if filename uses both forward- and backslashes, like in d:/foo\bar.

That is why I suggested to grep all the sources for any explicit use
of '/'.  Since I didn't look at the sources, I don't know whether GCC
parses file names like the fragment above does.  I also don't know
whether setting DIR_SEPARATOR='\\' solves all related problems, since
at least theoretically, there could be cases, like file names with
drive letters, where this alone is not enough.  But again, this is
just theory, not based on specific observations of the GCC 2.8.x
sources.

> Perhaps output produced by gcc option '-v' is not dangerous as it is used
> for diagnostic purposes only, so there is no need to fix it.

I don't know.  Since GCC 2.7.2 outputs file names without massaging
them, I'd say let's leave them alone (i.e. with the original style of
slashes that GCC saw) in 2.8.1 until we have a good reason to change
that.  I would even say that printing them without any changes has a
debugging value, since you see exactly how the user configured his/her
system.

> The second place is output of cpp.exe (names of primary file and included
> ones). The names of these files is used to generate dependencies and
> also for debug information when option -gstabs is used. So I think we should
> provide that only '/' appears in output.

I agree.  Anything that's used by Make should have forward slashes.

> Only some days are gone since upload of previous archives. Perhaps we 
> must give some time for other problems to appear. 

Okay, but I would then suggest to post the workaround (set
TMPDIR/TMP/TEMP with foward slashes) to djgpp-announce.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019