This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/libiberty] Fix documentation issues in filename_cmp.c
> Date: Thu, 5 Apr 2007 23:12:18 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org
>
> Eli,
>
> > > 2007-04-05 Joel Brobecker <brobecker@adacore.com>
> > >
> > > * filename_cmp.c (filename_cmp): Improve documentation.
> >
> > Thanks, I am happy, as far as the documentation goes.
>
> Am I to understand that you are not happy with the code?
Well, I did have comments about that, and they were left unresolved ;-)
> 1. Fold multiple consecutive slash/backslash characters into
> single slash/backslash;
>
> To do that without modifying the source filenames, we need to
> allocate some memory locally to manipulate a copy of that filename.
This is a misunderstanding: I didn't mean that we should modify the
source file names. What I meant is that the comparison should ignore
multiple consecutive slashes, so that, say, "/foo/bar/baz" compares
equal to "/foo//bar////baz" (and to "\foo//bar\/\baz" on Windows).
(However, note that, as Chris pointed out, double slash at the
beginning of a file name, as in "//foo/bar", are significant on
Windows.)
> My take on this is that the file names we have seen, at least in
> the debugging information, have been consistent; and thus this
> enhancement would end up having no actual effect. I would wait
> until we come across a case where this is a problem before
> going that way.
I've seen quite a few of such situations, actually. And in any case,
good engineering doesn't need examples to know what's Right ;-)
> 2. The possible introduction of a bug with certain locales because
> the function used in place of strcasecmp uses tolower.
>
> For this one, as I said, I don't know, and I'm not sure where
> to start looking for the answer.
How about using your function with LANG set to various values? That
should at least tell us whether strcasecmp and tolower do the same
thing; if they do, there's no problem here.