lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] xmlwrapp '-Wswitch-enum' warning [Was: xmlwrapp '-Wnull-dereferenc


From: Greg Chicares
Subject: [lmi] xmlwrapp '-Wswitch-enum' warning [Was: xmlwrapp '-Wnull-dereference' warning]
Date: Fri, 22 Mar 2019 01:16:42 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 2019-03-22 00:23, Greg Chicares wrote:
> Enabling '-Wnull-dereference' for lmi builds

Later, enabling '-Wswitch-enum' found:

/opt/lmi/third_party/src/libxml/node.cxx:518:12: error: enumeration value 
'XML_ATTRIBUTE_NODE' not handled in switch [-Werror=switch-enum]
/opt/lmi/third_party/src/libxml/node.cxx:518:12: error: enumeration value 
'XML_HTML_DOCUMENT_NODE' not handled in switch [-Werror=switch-enum]
/opt/lmi/third_party/src/libxml/node.cxx:518:12: error: enumeration value 
'XML_DOCB_DOCUMENT_NODE' not handled in switch [-Werror=switch-enum]

which, if desired, might be prevented thus:

         case XML_XINCLUDE_END:          return type_xinclude;
+        case XML_ATTRIBUTE_NODE:        // fall through
+        case XML_HTML_DOCUMENT_NODE:    // fall through
+        case XML_DOCB_DOCUMENT_NODE:    // fall through
         default:                        return type_element;

So many cases are listed explicitly that adding the few that aren't may
be a good idea. Optionally removing 'default:' (while preserving its code)
is a matter of style, which might be good if this is the only 'default:'
in the library, or not good if every other 'switch' has a 'default:'.

Whether or not this suggestion and the one in the preceding message are
adopted into xmlwrapp doesn't matter for lmi, whose makefiles will exempt
xmlwrapp from these warnings.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]