This is the mail archive of the gcc-prs@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]

objc/7836: problem casting id as id<protocol>


>Number:         7836
>Category:       objc
>Synopsis:       problem casting id as id<protocol>
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 05 06:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paul E. Johnson
>Release:        unknown-1.0
>Organization:
>Environment:
GNU/Linux, gcc 3.1/3.2
>Description:
The Swarm libraries (www.swarm.org) compile with gcc-3.0, but with gcc-3.1/3.2, we get some new warnings about protocols.
 
We have plenty of places where we cast ids as (id <whatever_protocol>) and when the thing we cast does not actually implement all the methods  in the protocol, then the compiler warns us about it.  In the 3.0 gcc, 
we did not get warnings.  If we use the flag -Wno-error instead of -Werror, then the build of Swarm libraries finishes and programs that 
run with the libraries work.
 
 
Consider this method:
 
 
- setProbe: (id <Probe>)theProbe
 {
    myProbe = (id <MessageProbe>) theProbe;

    return self;
 }
 
 The compiler warns that  "warning: object does not conform to the `MessageProbe' protocol".  It no longer trusts us to make the cast the  way we wnat it.  Its warning is correct, "theProbe" does not conform.
 
But we don't want the warning. We have the compiler set to treat warnings as errors.
>How-To-Repeat:
Try compiling the Swarm libraries! If you want to try, I'd suggest on of the development snaps, for example:

ftp://ftp.swarm.org/pub/swarm/src/testing/swarm-2002-05-14.tar.gz
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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