summaryrefslogtreecommitdiff
path: root/xsd
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-19 17:12:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-02-25 13:45:49 +0300
commitfea8db080353e408a38ad9b66b50b1c9dfaf96de (patch)
tree19c060eb9d6b66104f3bff3e5ea940dd7441c74d /xsd
parent5e527213a2430bb3018e5eebd909aef294edf9b5 (diff)
Various fixes
Diffstat (limited to 'xsd')
-rw-r--r--xsd/NEWS2
-rw-r--r--xsd/xsd/cxx/parser/element-validation-source.cxx12
-rw-r--r--xsd/xsd/cxx/parser/state-processor.cxx8
-rw-r--r--xsd/xsd/cxx/parser/validator.cxx7
-rw-r--r--xsd/xsd/cxx/tree/counter.cxx23
-rw-r--r--xsd/xsd/cxx/tree/default-value.cxx4
-rw-r--r--xsd/xsd/cxx/tree/default-value.hxx8
-rw-r--r--xsd/xsd/cxx/tree/elements.hxx4
-rw-r--r--xsd/xsd/cxx/tree/fundamental-header.hxx2
-rw-r--r--xsd/xsd/cxx/tree/name-processor.cxx2
-rw-r--r--xsd/xsd/cxx/tree/serialization-source.cxx23
-rw-r--r--xsd/xsd/cxx/tree/validator.cxx5
-rw-r--r--xsd/xsd/xsd.cxx2
13 files changed, 68 insertions, 34 deletions
diff --git a/xsd/NEWS b/xsd/NEWS
index 03f5942..9e33814 100644
--- a/xsd/NEWS
+++ b/xsd/NEWS
@@ -879,7 +879,7 @@ Version 2.0.0
* MSVC 7.1 has a limit on the length of the "if else if" chain. This
results in ICE when compiling generated code for enumerations with
a large number of values. This version addresses this issue. Thanks
- to Cyrille Chépélov <cyrille at chepelov.org> for reporting this and
+ to Cyrille Chépélov <cyrille at chepelov.org> for reporting this and
suggesting a fix.
diff --git a/xsd/xsd/cxx/parser/element-validation-source.cxx b/xsd/xsd/cxx/parser/element-validation-source.cxx
index a5379c2..b5e1e9d 100644
--- a/xsd/xsd/cxx/parser/element-validation-source.cxx
+++ b/xsd/xsd/cxx/parser/element-validation-source.cxx
@@ -710,9 +710,9 @@ namespace CXX
os << "count = 0;"
<< "state = " << next_state_ << "UL;"
- << "// Fall through." << endl
- << "}" // else
- << "}"; // case
+ << "}" // else
+ << "}" // case
+ << "// Fall through." << endl;
}
virtual void
@@ -831,9 +831,9 @@ namespace CXX
os << "count = 0;"
<< "state = " << next_state_ << "UL;"
- << "// Fall through." << endl
- << "}" // else
- << "}"; // case
+ << "}" // else
+ << "}" // case
+ << "// Fall through." << endl;
}
private:
diff --git a/xsd/xsd/cxx/parser/state-processor.cxx b/xsd/xsd/cxx/parser/state-processor.cxx
index b380895..a2b8fbf 100644
--- a/xsd/xsd/cxx/parser/state-processor.cxx
+++ b/xsd/xsd/cxx/parser/state-processor.cxx
@@ -156,8 +156,8 @@ namespace CXX
depth_ = depth;
prefixes_.insert (prefixes_.end (),
- t.prefixes_.begin ().base (),
- t.prefixes_.end ().base ());
+ t.prefixes_.begin (),
+ t.prefixes_.end ());
if (min == 1 &&
p.context ().get<size_t> ("effective-min") == 0)
@@ -231,8 +231,8 @@ namespace CXX
if (prefix)
{
prefixes_.insert (prefixes_.end (),
- t.prefixes_.begin ().base (),
- t.prefixes_.end ().base ());
+ t.prefixes_.begin (),
+ t.prefixes_.end ());
if (p.context ().get<size_t> ("effective-min") != 0)
min = 1;
diff --git a/xsd/xsd/cxx/parser/validator.cxx b/xsd/xsd/cxx/parser/validator.cxx
index 83429cf..8e8161a 100644
--- a/xsd/xsd/cxx/parser/validator.cxx
+++ b/xsd/xsd/cxx/parser/validator.cxx
@@ -255,6 +255,8 @@ namespace CXX
Traversal::Element,
ValidationContext
{
+ using Schema::traverse;
+
Traverser (ValidationContext& c)
: ValidationContext (c),
any_ (c)
@@ -395,6 +397,9 @@ namespace CXX
Traversal::Attribute,
ValidationContext
{
+ using Schema::traverse;
+ using Complex::traverse;
+
AnonymousType (ValidationContext& c)
: ValidationContext (c),
anonymous_error_issued_ (false)
@@ -448,7 +453,7 @@ namespace CXX
virtual void
traverse (SemanticGraph::Element& e)
{
- if (skip (e)) return;
+ if (skip (e)) return;
if (traverse_common (e))
{
diff --git a/xsd/xsd/cxx/tree/counter.cxx b/xsd/xsd/cxx/tree/counter.cxx
index 94bcc87..3fee0b1 100644
--- a/xsd/xsd/cxx/tree/counter.cxx
+++ b/xsd/xsd/cxx/tree/counter.cxx
@@ -241,18 +241,23 @@ namespace CXX
schema >> sources >> schema;
- Traversal::Names schema_names;
- Traversal::Namespace ns;
- Traversal::Names ns_names;
- GlobalType global_type (ctx, counts);
- GlobalElement global_element (ctx, counts);
+ // The GlobalElement object destructor updates the counts, so make sure
+ // that this object is destroyed before we return the counts.
+ //
+ {
+ Traversal::Names schema_names;
+ Traversal::Namespace ns;
+ Traversal::Names ns_names;
+ GlobalType global_type (ctx, counts);
+ GlobalElement global_element (ctx, counts);
- schema >> schema_names >> ns >> ns_names;
+ schema >> schema_names >> ns >> ns_names;
- ns_names >> global_element;
- ns_names >> global_type;
+ ns_names >> global_element;
+ ns_names >> global_type;
- schema.dispatch (tu);
+ schema.dispatch (tu);
+ }
return counts;
}
diff --git a/xsd/xsd/cxx/tree/default-value.cxx b/xsd/xsd/cxx/tree/default-value.cxx
index aefeda3..fd1c8c4 100644
--- a/xsd/xsd/cxx/tree/default-value.cxx
+++ b/xsd/xsd/cxx/tree/default-value.cxx
@@ -602,7 +602,7 @@ namespace CXX
// Binary.
//
static unsigned char
- base64_decode (unsigned char c)
+ base64_decode (wchar_t c)
{
unsigned char r = 0xFF;
@@ -800,7 +800,7 @@ namespace CXX
}
static unsigned char
- hex_decode (unsigned char c)
+ hex_decode (wchar_t c)
{
unsigned char r = 0xFF;
diff --git a/xsd/xsd/cxx/tree/default-value.hxx b/xsd/xsd/cxx/tree/default-value.hxx
index 5485669..149982f 100644
--- a/xsd/xsd/cxx/tree/default-value.hxx
+++ b/xsd/xsd/cxx/tree/default-value.hxx
@@ -15,6 +15,8 @@ namespace CXX
{
struct IsLiteralValue: IsFundamentalType, Traversal::Complex
{
+ using IsFundamentalType::traverse;
+
IsLiteralValue (bool& r);
virtual void
@@ -48,6 +50,9 @@ namespace CXX
Context
{
+ using Traversal::NodeDispatcher::dispatch;
+ using Traversal::EdgeDispatcher::dispatch;
+
LiteralValue (Context&);
String
@@ -214,6 +219,9 @@ namespace CXX
Context
{
+ using Traversal::NodeDispatcher::dispatch;
+ using Traversal::EdgeDispatcher::dispatch;
+
InitValue (Context&);
void
diff --git a/xsd/xsd/cxx/tree/elements.hxx b/xsd/xsd/cxx/tree/elements.hxx
index ed5eb77..4d10def 100644
--- a/xsd/xsd/cxx/tree/elements.hxx
+++ b/xsd/xsd/cxx/tree/elements.hxx
@@ -1616,6 +1616,8 @@ namespace CXX
Traversal::Attribute,
Context
{
+ using Complex::traverse;
+
// The second version outputs the argument name and stores
// in in the base_arg string.
//
@@ -1776,6 +1778,8 @@ namespace CXX
Traversal::Attribute,
Context
{
+ using Complex::traverse;
+
CtorArgsWithoutBase (Context& c, CtorArgType, bool arg, bool first);
virtual void
diff --git a/xsd/xsd/cxx/tree/fundamental-header.hxx b/xsd/xsd/cxx/tree/fundamental-header.hxx
index a470154..0ea82cf 100644
--- a/xsd/xsd/cxx/tree/fundamental-header.hxx
+++ b/xsd/xsd/cxx/tree/fundamental-header.hxx
@@ -76,6 +76,8 @@ namespace CXX
Traversal::Fundamental::Entities,
Context
{
+ using Namespace::traverse;
+
FundamentalNamespace (Context& c)
: DocumentedNamespace (c),
Context (c),
diff --git a/xsd/xsd/cxx/tree/name-processor.cxx b/xsd/xsd/cxx/tree/name-processor.cxx
index e26a5d8..6ca616e 100644
--- a/xsd/xsd/cxx/tree/name-processor.cxx
+++ b/xsd/xsd/cxx/tree/name-processor.cxx
@@ -1808,6 +1808,8 @@ namespace CXX
Context
{
+ using Namespace::traverse;
+
FundamentalNamespace (Context& c)
: Context (c)
{
diff --git a/xsd/xsd/cxx/tree/serialization-source.cxx b/xsd/xsd/cxx/tree/serialization-source.cxx
index 3e9fffb..9be7499 100644
--- a/xsd/xsd/cxx/tree/serialization-source.cxx
+++ b/xsd/xsd/cxx/tree/serialization-source.cxx
@@ -334,6 +334,10 @@ namespace CXX
{
// sequence
//
+ // Always pass the sequence element reference to typeid() to
+ // suppress the Clang's 'expression with side effects will be
+ // evaluated despite being used as an operand to typeid' warning.
+ //
if (ordered)
os << "const " << type << "& x (i." << aname <<
" ()[b->index]);"
@@ -343,13 +347,12 @@ namespace CXX
<< "b (i." << aname << " ().begin ()), " <<
"n (i." << aname << " ().end ());" << endl
<< "b != n; ++b)"
- << "{";
-
- char const* x (ordered ? "x" : "*b");
+ << "{"
+ << "const " << type << "& x (*b);" << endl;
if (poly)
{
- os << "if (typeid (" << type << ") == typeid (" << x << "))"
+ os << "if (typeid (" << type << ") == typeid (x))"
<< "{"
<< xerces_ns << "::DOMElement& s (" << endl
<< "::xsd::cxx::xml::dom::create_element (" << endl
@@ -357,14 +360,14 @@ namespace CXX
<< (ns ? strlit (ns) + L",\n" : L"")
<< "e));"
<< endl
- << "s << " << x << ";"
+ << "s << x;"
<< "}"
<< "else" << endl
<< "tsm.serialize (" << endl
<< strlit (e.name ()) << "," << endl
<< strlit (ns) << "," << endl
<< (e.global_p () ? "true" : "false") << ", " <<
- (e.qualified_p () ? "true" : "false") << ", e, " << x << ");";
+ (e.qualified_p () ? "true" : "false") << ", e, x);";
}
else
{
@@ -379,17 +382,17 @@ namespace CXX
{
case st_other:
{
- os << "s << " << x << ";";
+ os << "s << x;";
break;
}
case st_double:
{
- os << "s << " << as_double_type << " (" << x << ");";
+ os << "s << " << as_double_type << " (x);";
break;
}
case st_decimal:
{
- os << "s << " << as_decimal_type << " (" << x << ");";
+ os << "s << " << as_decimal_type << " (x);";
break;
}
}
@@ -800,7 +803,7 @@ namespace CXX
{
bool o (ordered_p (c));
- size_t start, count;
+ size_t start (0), count (0);
if (o)
{
diff --git a/xsd/xsd/cxx/tree/validator.cxx b/xsd/xsd/cxx/tree/validator.cxx
index dc6572c..46deb6c 100644
--- a/xsd/xsd/cxx/tree/validator.cxx
+++ b/xsd/xsd/cxx/tree/validator.cxx
@@ -274,6 +274,8 @@ namespace CXX
Traversal::Element,
ValidationContext
{
+ using Schema::traverse;
+
Traverser (ValidationContext& c)
: ValidationContext (c), any_ (c)
{
@@ -420,6 +422,9 @@ namespace CXX
Traversal::Attribute,
ValidationContext
{
+ using Schema::traverse;
+ using Complex::traverse;
+
AnonymousType (ValidationContext& c)
: ValidationContext (c),
anonymous_error_issued_ (false)
diff --git a/xsd/xsd/xsd.cxx b/xsd/xsd/xsd.cxx
index 90f9a86..f1d22fc 100644
--- a/xsd/xsd/xsd.cxx
+++ b/xsd/xsd/xsd.cxx
@@ -14,7 +14,7 @@
#include <libxsd-frontend/parser.hxx>
#include <libxsd-frontend/transformations/anonymous.hxx>
-#include <libxsd-frontend/transformations/enum-synthesis.cxx>
+#include <libxsd-frontend/transformations/enum-synthesis.hxx>
#include <libxsd-frontend/transformations/restriction.hxx>
#include <libxsd-frontend/transformations/schema-per-type.hxx>
#include <libxsd-frontend/transformations/simplifier.hxx>