[cfe-dev] objc_selector definition problem

Steve Naroff snaroff at apple.com
Sun Feb 24 08:27:29 PST 2008


David,

I just fixed this for you (http://llvm.org/viewvc/llvm-project?view=rev&revision=47538 
).

Please note the FIXME. If the other ObjC decls are giving you a  
problem, feel free to move the rest of them. I'd do it, however I'm  
working on some other stuff at the moment.

Thanks for the bug!

snaroff

On Feb 24, 2008, at 7:07 AM, David Chisnall wrote:

> Hi,
>
> In Sema.cpp, the SEL type is declared as a pointer to a struct
> objc_selector, which is an opaque type.  There seems to be a problem
> defining this.  When compiling a trivial Objective-C program[1] the
> following error appears:
>
> /usr/include/objc/objc.h:63:14: error: incomplete definition of type
> 'objc_selector'
>     return s1->sel_id == s2->sel_id;
>            ~~^
>
> It appears that the objc_selector type is still treated as opaque,
> even though it is now defined.  The objc.h header contains:
>
> typedef const struct objc_selector
> {
>   void *sel_id;
>   const char *sel_types;
> } *SEL;
>
> inline static BOOL
> sel_eq (SEL s1, SEL s2)
> {
>   if (s1 == 0 || s2 == 0)
>     return s1 == s2;
>   else
>     return s1->sel_id == s2->sel_id;
> }
>
> The penultimate line in this listing is the one which raises the
> error, even though the objc_selector type is defined immediately
> before the function.
>
> Note: This compiles fine as a C program, where the implicit definition
> of objc_selector is not present.
>
> David
>
> [1]
> #include <objc/objc.h>
>
> int main(void)
> {
>     return 0;
> }
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list