[Mono-devel-list] Re: System.XML warning

Atsushi Eno atsushi at ximian.com
Thu Mar 17 17:14:50 EST 2005


Hello,

Comments inline.

Marek Safar wrote:
> Hello Eno,
> 
> I would like to commit my next mcs patche which improves our warning 
> detection.
> However, same as in the first case I would like to reduce the number of 
> BCL warnings to acceptable level.
> I am going to enable warning CS0169 and in the attachment is list of 
> warnings in System.XML namespace compiled with
> improved mcs. Could you please have a look at this list and either 
> remove them or give me hint which of them can be removed (I expect 
> almost every).
> 
> Please be noticed that this is output of mcs compiler and any other 
> compiler is not able to detect this warning as good as mcs does.
> 
> Regards,
> Marek
> 
> 
> ------------------------------------------------------------------------
> 
> System.Xml/XmlReader.cs(1051) warning CS0169: The private method 'System.Xml.XmlReader.CheckSupport()' is never used

This is used in NET_2_0 part of code.
Should we enclose ALL of such members in _nasty_ preprocessor
directives? Does it ease developers read it?

> Mono.Xml.Schema/XsdValidatingReader.cs(231) warning CS0169: The private method 'Mono.Xml.Schema.XsdValidatingReader.ReadTypedValueCore()' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(84) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.nameTable' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(91) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.nodes' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(92) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.attributes' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(93) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.namespaces' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(96) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.atomicStringPool' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(97) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.nonAtomicStringPool' is never used
> Mono.Xml.XPath/DTMXPathDocument2.cs(100) warning CS0169: The private field 'Mono.Xml.XPath.DTMXPathDocument2.idTable' is never used
> Mono.Xml.Xsl/GenericOutputter.cs(78) warning CS0169: The private field 'Mono.Xml.Xsl.GenericOutputter._isVariable' is never used
> Mono.Xml.Xsl/XslTransformProcessor.cs(56) warning CS0169: The private field 'Mono.Xml.Xsl.XslTransformProcessor.outputStylesheetXmlns' is never used
> System.Xml/DTDReader.cs(1441) warning CS0169: The private method 'System.Xml.DTDReader.ReadCharacterReference()' is never used

Removed.

> System.Xml/DTDValidatingReader.cs(350) warning CS0169: The private method 'Mono.Xml.DTDValidatingReader.OnValidationEvent( object,  System.Xml.Schema.ValidationEventArgs)' is never used

Commented out.

> System.Xml/XmlNode.cs(714) warning CS0219: The variable 'node' is assigned but its value is never used

Removed.

> System.Xml/XmlNodeChangedEventArgs.cs(40) warning CS0169: The private field 'System.Xml.XmlNodeChangedEventArgs._oldValue' is never used
> System.Xml/XmlNodeChangedEventArgs.cs(41) warning CS0169: The private field 'System.Xml.XmlNodeChangedEventArgs._newValue' is never used

They are used in NET_2_0 members.

> System.Xml/XmlTextReader.cs(1672) warning CS0168: The variable 'dummyValue' is declared but never used

It is _required_ even though it is actually not used (otherwise mcs/csc
will reject this code). CSC never reports it as warning and I think
that regarding it as a warning is bad design.

> System.Xml/XmlUrlResolver.cs(41) warning CS0169: The private property 'System.Xml.XmlUrlResolver.webClient' is never used
> System.Xml/XmlParserInput.cs(178) warning CS0169: The private method 'System.Xml.XmlParserInput.ParseCharReference( string)' is never used
> System.Xml/XmlParserInput.cs(190) warning CS0169: The private method 'System.Xml.XmlParserInput.ParseKnownEntityReference( string)' is never used

Removed.

> System.Xml.XPath/XPathDocument.cs(473) warning CS0169: The private method 'System.Xml.XPath.XPathDocument.Initialize( System.Xml.XmlReader,  System.Xml.XmlSpace,  bool)' is never used

It is related to NET_2_0 profile.

> System.Xml.Xsl/XslTransform.cs(337) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.Save( System.Xml.XmlReader,  System.IO.TextWriter)' is never used

Removed.

> System.Xml.Xsl/XslTransform.cs(604) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xsltCleanupGlobals()' is never used
> System.Xml.Xsl/XslTransform.cs(611) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlNewDoc( string)' is never used
> System.Xml.Xsl/XslTransform.cs(614) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlSaveFile( string,  System.IntPtr)' is never used
> System.Xml.Xsl/XslTransform.cs(626) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlCleanupParser()' is never used
> System.Xml.Xsl/XslTransform.cs(629) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlDocDumpMemory( System.IntPtr, ref System.IntPtr&, ref int&)' is never used
> System.Xml.Xsl/XslTransform.cs(632) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlFree( System.IntPtr)' is never used
> System.Xml.Xsl/XslTransform.cs(649) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.valuePop( System.IntPtr)' is never used
> System.Xml.Xsl/XslTransform.cs(652) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.valuePush( System.IntPtr,  System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used
> System.Xml.Xsl/XslTransform.cs(655) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathFreeObject( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used
> System.Xml.Xsl/XslTransform.cs(658) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewCString( string)' is never used
> System.Xml.Xsl/XslTransform.cs(661) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewFloat( double)' is never used
> System.Xml.Xsl/XslTransform.cs(664) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewBoolean( int)' is never used
> System.Xml.Xsl/XslTransform.cs(667) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewNodeSet( System.IntPtr)' is never used
> System.Xml.Xsl/XslTransform.cs(670) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToBoolean( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used
> System.Xml.Xsl/XslTransform.cs(673) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToNumber( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used
> System.Xml.Xsl/XslTransform.cs(676) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToString( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used
> System.Xml.Xsl/XslTransform.cs(679) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathStringFunction( System.IntPtr,  int)' is never used

Why are they reported as never used? They are actually in use.

> System.Xml.Schema/XmlSchemaChoice.cs(172) warning CS0169: The private method 'System.Xml.Schema.XmlSchemaChoice.ValidateRecurseLax( System.Xml.Schema.XmlSchemaGroupBase,  System.Xml.Schema.ValidationEventHandler,  System.Xml.Schema.XmlSchema,  bool)' is never used

I think it is old implementation but not sure right now, so just
commented out.

> System.Xml.Schema/XmlSchemaCollection.cs(145) warning CS0169: The private method 'System.Xml.Schema.XmlSchemaCollection.GetSafeNs( string)' is never used

Removed old code.

> System.Xml.Schema/XmlSchemaSet.cs(134) warning CS3019: CLS compliance checking will not be performed on 'System.Xml.Schema.XmlSchemaSet.XmlResolver' because it is private or internal

This is reported just because this type is public only under NET_2_0.
When there are such types, should we put NET_2_0 on every such
attributes?

Those changes will be checked in after the upcoming release task.

BTW how can we verify that those sources became clean after
manual warning elimination?

Also, I think that some part of those warning report feature are
problematic. For example,

	- I think there is no (or little) need to report not-in-use
	  private methods. When we found such methods that we don't
	  know what it is, we usually grep (usually) single file
	  and notice that it is not in use. I believe that why MS
	  csc has such reporting feature for unused fields is that
	  they might be confused with local variables or parameters.
	  I don't think mcs should not let developers to be puritan
	  that believes ALL unused members MUST be eliminated.

	- As I noted above, there are unexpected unused field check
	  that at least csc does not regard as should-be-warned.

Atsushi Eno



More information about the Mono-devel-list mailing list