GNOME Bugzilla – Bug 703504
Deadcode in catalog.c
Last modified: 2013-09-30 03:14:12 UTC
In function: xmlCatalogSetDefaultPrefer if (prefer == XML_CATA_PREFER_NONE) return(ret); The above condition means value of prefer cannot be XML_CATA_PREFER_NONE. But in switch statement after this, there is a case statement: case XML_CATA_PREFER_NONE: break; This case will never be reached, so it is logically dead code. Either, above if condition should be removed or case should not be XML_CATA_PREFER_NONE.
Created attachment 250921 [details] [review] Drop case XML_CATA_PREFER_NONE in debug dumps switch This value used for return current value of preferences so debug not needed
The problem is that gcc fails to handle the problem correctly and raise a warning about not handling all cases in switch. catalog.c: In function 'xmlCatalogSetDefaultPrefer__internal_alias': catalog.c:3544:2: warning: enumeration value 'XML_CATA_PREFER_NONE' not handled in switch [-Wswitch] switch (prefer) { ^ The best is to convert the last case to use a default: and return at that point, it seems it should cover all cases https://git.gnome.org/browse/libxml2/commit/?id=b8bdc258dec460c0d07b50223792e26bc78b2f2d Denis do you have other patches pending ? thanks ! Daniel