After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703504 - Deadcode in catalog.c
Deadcode in catalog.c
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Reported: 2013-07-03 05:31 UTC by Gaurav
Modified: 2013-09-30 03:14 UTC
See Also:
GNOME target: ---
GNOME version: ---

Drop case XML_CATA_PREFER_NONE in debug dumps switch (765 bytes, patch)
2013-08-06 07:08 UTC, Denis Pauk
none Details | Review

Description Gaurav 2013-07-03 05:31:20 UTC
In function:

if (prefer == XML_CATA_PREFER_NONE)

The above condition means value of prefer cannot be XML_CATA_PREFER_NONE.

But in switch statement after this, there is a case statement:


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.
Comment 1 Denis Pauk 2013-08-06 07:08:46 UTC
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
Comment 2 Daniel Veillard 2013-09-30 03:14:12 UTC
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

 Denis do you have other patches pending ?

   thanks !