This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: How to check that selectors exist



On Tuesday, August 6, 2002, at 01:49 AM, Nicola Pero wrote:


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.
But this will not be the first instance of warning with wrong line number.
Let's take a look at another selector warning (already part of FSF sources)

[dpatel:/tmp]$ cat -n selector-1.m
1 typedef struct objc_object { struct objc_class *class_pointer; } *id;
2 typedef struct objc_selector *SEL;
3
4 @interface FOOBAR
5 + (int) b1ar;
6 @end
7
8 @implementation FOOBAR
9 + (int) b1ar
10 {
11 }
12 @end
13
14 @interface Foo
15 - (void) foo;
16 + (void) b1ar;
17 @end
18
19 @implementation Foo
20
21 + (void) b1ar
22 {
23 }
24 - (void) foo
25 {
26 SEL a,b,c;
27 a = @selector(b1ar);
28 }
29 @end
30
[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'

You will see here that warning occurred at line number 27, but it is not
mentioned in warning message. Warning message has line number 31
(which is total_source_line + 1). And same will be true in GNU runtime
for the warning I am proposing.

-Devang

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