AlanQuatermain/aqtoolkit

Warnings and Analysis warnings

GerTeunis opened this issue · 5 comments

First of all, great work on aqxmlparser, a real win for my project.
I try to create as clean as code I can and can't stand warnings and analysis warnings.
Sadly aqxmlparser does throw some of them, when I compile I get the following warning and analysis warnings:

Analysis

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1138:9 Incorrect decrement of the reference count of an object is not owned at this point by the caller

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1187:3 Value stored to 'saxHandler' is never read

Warnings

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:115:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:115: warning: 'NSObject' may not respond to '-stream:handleEvent:'

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:115:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:115: warning: (Messages without a matching method signature

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:153:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:153: warning: 'NSObject' may not respond to '-stream:handleEvent:'

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:159:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:159: warning: 'NSObject' may not respond to '-stream:handleEvent:'

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1098:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1098: warning: class 'AQXMLParser' does not implement the 'NSStreamDelegate' protocol

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1228:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1228: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:parseErrorOccurred:' from distinct Objective-C type

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1332:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1332: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:didStartMappingPrefix:toURI:' from distinct Objective-C type

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1354:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1354: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:didEndMappingPrefix:' from distinct Objective-C type

I've added the latest version from git now.

Fix 1: add to AQXMLParser
@interface AQXMLParser : NSObject

Still warnings about the NSXMLParser AQXMLParser mismatch
/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:965:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:965: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:parseErrorOccurred:' from distinct Objective-C type

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1072:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1072: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:didStartMappingPrefix:toURI:' from distinct Objective-C type

/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1094:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:1094: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:didEndMappingPrefix:' from distinct Objective-C type

I use AQXMLParserDelegate in my setDelegate method

It sounds like you're declaring your delegate class to implement the NSXMLParserDelegate protocol rather than the AQXMLParserDelegate protocol, would that be correct? I haven't seen these warnings in a long time now, not since copying the NS version to my own header file and changing all the NS* classes to AQ*.

Thank you for your reply.

I use on class which uses the AQXMLParserDelegate: copy paste:
@interface NZB : NSObject <NSCoding, AQXMLParserDelegate> {
NSString *uiTitle;
NSString *nzbFileName;
[...]

And get warning:
/Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:965:0 /Users/gerteunis/Documents/NZBVortex/Classes/XML/AQXMLParser.m:965: warning: incompatible Objective-C types 'struct AQXMLParser *', expected 'struct NSXMLParser *' when passing argument 1 of 'parser:parseErrorOccurred:' from distinct Objective-C type

Funny isn't it? Have absolutely no clue what I did wrong here.

I'm scratching my head on this one too. Maybe #import the AQXMLParser header before Foundation.h? For whatever reason, the compiler is seeing the NSXMLParser version first, and so is comparing against that.

Overall I'm not inclined to worry about it— the same thing happens when calling -isEqual: and other methods implemented with different parameter types on different classes; the compiler can 'choose' to type against the one taking an NSDate, when really you're looking for the NSString version.

Whatever I do I do not seem to get them 'fixed'
No problem though; I am just ignoring them.

Thanks alan!