gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check that selectors exist


From: Nicola Pero
Subject: Re: How to check that selectors exist
Date: Wed, 7 Aug 2002 09:01:24 +0100 (BST)

> >  1. it doesn't work with the GNU runtime and there is no obvious way of
> > making it work (because of the way selectors are internally handled by 
> > the
> > compiler, GNU ones are typed, while Apple ones are not etc);  so it 
> > would
> > be a next runtime only patch for now (and maybe for very long).
> 
> It works with GNU runtime.
> Only thing is that it will have wrong line number in the warning.

Ok - thanks - very good point


> Let's take a look at another selector warning (already part of FSF 
> sources)
> 
> [...]
>
> [dpatel:/tmp]$ gcc3 -Wselector -c selector-1.m
> selector-1.m:31: warning: potential selector conflict for method `b1ar'
> selector-1.m:5: warning: found `+(int)b1ar'
> selector-1.m:22: warning: found `+(void)b1ar'
> selector-1.m:16: warning: found `+(void)b1ar'

Yep - I think this code is trying to do something different - which is
trying to spy in your code and detect undeclared private methods having
conflicting selectors with well declared ones.  (Btw, it's probably not
very useful in most cases, since what is going to cause conflicts are
private undeclared methods inside classes from third-party libraries,
which the compiler can't check in any way).

But, trying to be flexible and reach a compromise, I see your point that
the existing -Wselector code already does the check at the end of
compilation, and already emits warnings with non-existing line numbers
:-), so doing the new check at the end of compilation inside -Wselector
would be consistent with what it already does.

Would it be a reasonable agreement for you to add your code to -Wselector,
and then for me to add a new warning, something like
-Wundeclared-selector, which checks that each @selector() has been
declared (and only with a single signature) before it has been used ?

That way, you have your code in -Wselector, we address Ferguson's point
that my check would be a check on `coding style' and so should be a
separate warning, and we also address my and Adam Fedor's point that
traditional linear checking of @selector()s when they are found against
currently declared methods is a more linear, consistent and predictable
behaviour - then we would simply use -Wundeclared-selector in our code
instead of -Wselector to get the behaviour we expect from the compiler
(you instead use -Wselector and get the behaviour - a different one - that
you expect).

So: -Wselector would perform checks on the whole selectors table at the
end of compilation, while -Wundeclared-selector would check, when a
@selector() is found, that is has been already declared (and only with a
single signature).

Would that be a reasonable agreement for you ?  If so, I'm happy with your
change going in, and I'll try to implement a -Wundeclared-selector and
submit a patch.  :-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]