From 6ffb11cd2259534c559e2984a3b0c60afc905a0b Mon Sep 17 00:00:00 2001 From: lmat Date: Sat, 10 Mar 2018 11:42:45 -0500 Subject: [PATCH] Correct switch fallthrough warnings GCC 7.3.0 gave the following warning: src/pugixml.cpp:10193:5: warning: this statement may fall through [-Wimplicit-fallthrough=] without these attributes. --- src/pugixml.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 9e6fe48..4d3e7b4 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -10267,9 +10267,9 @@ PUGI__NS_BEGIN if (_rettype == xpath_type_boolean) return _data.variable->get_boolean(); + __attribute__ ((fallthrough)); } - // fallthrough default: { switch (_rettype) @@ -10402,9 +10402,9 @@ PUGI__NS_BEGIN if (_rettype == xpath_type_number) return _data.variable->get_number(); + __attribute__ ((fallthrough)); } - // fallthrough default: { switch (_rettype) @@ -10683,12 +10683,11 @@ PUGI__NS_BEGIN case ast_variable: { assert(_rettype == _data.variable->type()); - if (_rettype == xpath_type_string) return xpath_string::from_const(_data.variable->get_string()); + __attribute__ ((fallthrough)); } - // fallthrough default: { switch (_rettype) @@ -10835,9 +10834,9 @@ PUGI__NS_BEGIN return ns; } + __attribute__ ((fallthrough)); } - // fallthrough default: assert(false && "Wrong expression for return type node set"); // unreachable return xpath_node_set_raw();