This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] -Wid-clash-LEN broken
- To: neil at daikokuya dot demon dot co dot uk
- Subject: Re: [RFC] -Wid-clash-LEN broken
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Sun, 20 May 2001 10:23:16 -0700
- Cc: gcc at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <20010520092334.B27658@daikokuya.demon.co.uk>
>>>>> "Neil" == Neil Booth <email@example.com> writes:
Neil> My hashtable patch inadvertently broke warning about
Neil> identifier clashes. There are 2 problems:
Oh, there are more problems that than with the old -Wid-clash:
- It's n^2 in the number of identifiers, even in the average case.
- It's useless in C++, or Java, despite being a language-independent
option, since it checks mangled names as well.
In my opinion, we shouldn't be doing this in the hashtable at all.
*If* we wish to continue to support this warning, the front-end lexer
(i.e., c_lex when returning CPP_NAME) should set a bit on the
TREE_IDENTIFIER to indicate "should be checked for clashes" and then
we should make a final pass over the table to warn about possible
identifier clashes. That eliminates the n^2 behavior (should be n log
n in the number of identifiers -- you sort and then run through the
sorted table doing strncmp), allows front-ends to use or not use this
capability, and sepparates it out from the main path of identifier
table use. Then we need to document which front-ends actually use the
On the other hand, I think this warning is pretty much useless at this
point, and I think we could probably just remove this warning.
More globally, if it takes an average-case n^2 algorithm to do, and n
is going to be bigger than 10, it shouldn't be in the compiler, unless
somehow required for correctness.
My two cents,
Mark Mitchell firstname.lastname@example.org
CodeSourcery, LLC http://www.codesourcery.com