This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFC] -Wid-clash-LEN broken


>>>>> "Neil" == Neil Booth <neil@daikokuya.demon.co.uk> 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
warning.

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                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]