[Top][All Lists]

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

Re: building dbuskit fails with llvm/clang

From: David Chisnall
Subject: Re: building dbuskit fails with llvm/clang
Date: Sat, 9 Apr 2011 10:39:54 +0100

On 9 Apr 2011, at 10:29, Sebastian Reitenbach wrote:

> DKArgument.m:495:14: error: equality comparison with extraneous
> parentheses [-Werror,-Wparentheses]
>          if ((type == DKDBusTypeForObjCType([sig methodReturnType])))
>               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We've been through this one before.  The added complication here is that Niels 
has picked up my habit of using -Werror to make it harder to ignore warnings, 
so a small style point is now stopping it building.

> DKEndpointManager.m:187:6: error: receiver 'GSStackTrace' is a forward
> class and corresponding @interface may not exist [-Werror]
>  [[[GSStackTrace alloc] init] release];
>     ^

Clang is a bit more aggressive about checking for messages that the receiver 
doesn't advertise understanding than gcc.  If you forward-declare a class with 
@class, then there is no guarantee that it responds to any messages.

I'm not sure why this code is using GSStackTrace, since the useful 
functionality of this class is exposed in NSException via public interfaces.

> both GSStackTrace and DKWatcher are added with @class statement. They
> are both defined within a .m file, so not possible to include/import  a
> .h file, which I'd have guessed would make the error go away.

The simplest solution is to add a private declaration of the class as:

@interface GSStackTrace : NSObject @end

I think the correct solution is to allow something like this:

@class<NSObject> GSStackTrace;

This would forward-declare the class, and also advertise that it conforms to 
the NSObject protocol.  


-- Sent from my Difference Engine

reply via email to

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