summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libxsd/xsd/cxx/parser/expat/elements.hxx6
-rw-r--r--libxsd/xsd/cxx/parser/expat/elements.txx5
-rw-r--r--libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx7
-rw-r--r--libxsd/xsd/cxx/tree/containers.hxx2
-rw-r--r--libxsd/xsd/cxx/xml/dom/auto-ptr.hxx3
-rw-r--r--xsd-examples/cxx/parser/performance/driver.cxx5
-rw-r--r--xsd-examples/cxx/parser/performance/time.cxx4
-rw-r--r--xsd-examples/cxx/tree/embedded/xsdbin.cxx2
-rw-r--r--xsd-examples/cxx/tree/performance/parsing.cxx3
-rw-r--r--xsd-examples/cxx/tree/performance/serialization.cxx3
-rw-r--r--xsd-examples/cxx/tree/performance/time.cxx4
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/float/driver.cxx8
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/int/driver.cxx2
-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
26 files changed, 108 insertions, 48 deletions
diff --git a/libxsd/xsd/cxx/parser/expat/elements.hxx b/libxsd/xsd/cxx/parser/expat/elements.hxx
index 5ed41f3..bd0b84c 100644
--- a/libxsd/xsd/cxx/parser/expat/elements.hxx
+++ b/libxsd/xsd/cxx/parser/expat/elements.hxx
@@ -86,6 +86,12 @@ namespace xsd
return parser_;
}
+ void
+ reset (XML_Parser parser)
+ {
+ *this = parser;
+ }
+
private:
parser_auto_ptr (const parser_auto_ptr&);
diff --git a/libxsd/xsd/cxx/parser/expat/elements.txx b/libxsd/xsd/cxx/parser/expat/elements.txx
index a1b1beb..803c53c 100644
--- a/libxsd/xsd/cxx/parser/expat/elements.txx
+++ b/libxsd/xsd/cxx/parser/expat/elements.txx
@@ -312,7 +312,7 @@ namespace xsd
if (XML_Parse (parser.get (),
buf,
- is.gcount (),
+ static_cast<int> (is.gcount ()),
is.eof ()) == XML_STATUS_ERROR)
{
r = false;
@@ -337,7 +337,8 @@ namespace xsd
//
if (auto_xml_parser_.get () == 0)
{
- auto_xml_parser_ = XML_ParserCreateNS (0, XML_Char (' '));
+ auto_xml_parser_.reset (
+ XML_ParserCreateNS (0, XML_Char (' ')));
if (auto_xml_parser_.get () == 0)
throw std::bad_alloc ();
diff --git a/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx b/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx
index 5ef2455..7bf2523 100644
--- a/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx
+++ b/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx
@@ -5,6 +5,7 @@
#include <locale>
#ifdef XSD_CXX11
+# include <cmath> // std::isfinite
# include <utility> // std::move
#endif
@@ -716,9 +717,13 @@ namespace xsd
zc_istream<C> is (str);
is.imbue (std::locale::classic ());
- //@@ TODO: now we accept scientific notations and INF/NaN.
+ // Note that std::isfinite() returns false for INF/NaN.
//
+#ifdef XSD_CXX11
+ if (!(is >> value_ && std::isfinite (value_) && is.exhausted ()))
+#else
if (!(is >> value_ && is.exhausted ()))
+#endif
throw invalid_value<C> (bits::decimal<C> (), str);
}
diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx
index f6a24ff..a7a4d10 100644
--- a/libxsd/xsd/cxx/tree/containers.hxx
+++ b/libxsd/xsd/cxx/tree/containers.hxx
@@ -1090,7 +1090,7 @@ namespace xsd
}
// Note that the container object of the two sequences being
- // swapped should be the same.
+ // swapped should be the same.
//
void
swap (sequence& x)
diff --git a/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx b/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx
index 97c9399..256f824 100644
--- a/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx
+++ b/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx
@@ -53,8 +53,11 @@ namespace xsd
unique_ptr (unique_ptr&& p): base (std::move (p)) {}
template <class T1>
unique_ptr (unique_ptr<T1>&& p): base (std::move (p)) {}
+
+#if !defined(__cplusplus) || __cplusplus < 201703L
template <class T1>
unique_ptr (std::auto_ptr<T1>&& p): base (std::move (p)) {}
+#endif
unique_ptr& operator= (unique_ptr&& p)
{
diff --git a/xsd-examples/cxx/parser/performance/driver.cxx b/xsd-examples/cxx/parser/performance/driver.cxx
index 4ac0265..6e0ae5d 100644
--- a/xsd-examples/cxx/parser/performance/driver.cxx
+++ b/xsd-examples/cxx/parser/performance/driver.cxx
@@ -302,7 +302,7 @@ main (int argc, char* argv[])
root_p.pre ();
doc.parse_begin (xml_parser, public_id);
- XML_Parse (xml_parser, buf, size, 1);
+ XML_Parse (xml_parser, buf, static_cast <int> (size), 1);
doc.parse_end ();
root_p.post_root ();
@@ -321,7 +321,8 @@ main (int argc, char* argv[])
cerr << "time: " << time << " sec" << endl;
- double ms (time.sec () * 1000000ULL + time.nsec () / 1000ULL);
+ double ms (static_cast<double> (
+ time.sec () * 1000000ULL + time.nsec () / 1000ULL));
// Calculate throughput in documents/sec.
//
diff --git a/xsd-examples/cxx/parser/performance/time.cxx b/xsd-examples/cxx/parser/performance/time.cxx
index c8c1002..53bd237 100644
--- a/xsd-examples/cxx/parser/performance/time.cxx
+++ b/xsd-examples/cxx/parser/performance/time.cxx
@@ -3,7 +3,7 @@
#include "time.hxx"
-#if defined (WIN32) || defined (__WIN32__)
+#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h> // GetSystemTimeAsFileTime
#else
@@ -19,7 +19,7 @@ namespace os
time::
time ()
{
-#if defined (WIN32) || defined (__WIN32__)
+#ifdef _WIN32
FILETIME ft;
GetSystemTimeAsFileTime (&ft);
unsigned long long v (
diff --git a/xsd-examples/cxx/tree/embedded/xsdbin.cxx b/xsd-examples/cxx/tree/embedded/xsdbin.cxx
index 3539c52..3f77078 100644
--- a/xsd-examples/cxx/tree/embedded/xsdbin.cxx
+++ b/xsd-examples/cxx/tree/embedded/xsdbin.cxx
@@ -350,7 +350,7 @@ main (int argc, char* argv[])
if (!outdir.empty ())
{
-#if defined (WIN32) || defined (__WIN32__)
+#ifdef _WIN32
hxx = outdir + '\\' + hxx;
cxx = outdir + '\\' + cxx;
#else
diff --git a/xsd-examples/cxx/tree/performance/parsing.cxx b/xsd-examples/cxx/tree/performance/parsing.cxx
index c41b57d..ba3fdee 100644
--- a/xsd-examples/cxx/tree/performance/parsing.cxx
+++ b/xsd-examples/cxx/tree/performance/parsing.cxx
@@ -145,7 +145,8 @@ parsing (const char* file, unsigned long iter, bool validate)
cerr << " time: " << time << " sec" << endl;
- double ms (time.sec () * 1000000ULL + time.nsec () / 1000ULL);
+ double ms (static_cast<double> (
+ time.sec () * 1000000ULL + time.nsec () / 1000ULL));
// Calculate throughput in documents/sec.
//
diff --git a/xsd-examples/cxx/tree/performance/serialization.cxx b/xsd-examples/cxx/tree/performance/serialization.cxx
index e81fcbd..e691b82 100644
--- a/xsd-examples/cxx/tree/performance/serialization.cxx
+++ b/xsd-examples/cxx/tree/performance/serialization.cxx
@@ -105,7 +105,8 @@ serialization (const char* file, unsigned long iter)
cerr << " time: " << time << " sec" << endl;
- double ms (time.sec () * 1000000ULL + time.nsec () / 1000ULL);
+ double ms (static_cast<double> (
+ time.sec () * 1000000ULL + time.nsec () / 1000ULL));
// Calculate throughput in documents/sec.
//
diff --git a/xsd-examples/cxx/tree/performance/time.cxx b/xsd-examples/cxx/tree/performance/time.cxx
index 48385a1..0f5413d 100644
--- a/xsd-examples/cxx/tree/performance/time.cxx
+++ b/xsd-examples/cxx/tree/performance/time.cxx
@@ -3,7 +3,7 @@
#include "time.hxx"
-#if defined (WIN32) || defined (__WIN32__)
+#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h> // GetSystemTimeAsFileTime
#else
@@ -19,7 +19,7 @@ namespace os
time::
time ()
{
-#if defined (WIN32) || defined (__WIN32__)
+#ifdef _WIN32
FILETIME ft;
GetSystemTimeAsFileTime (&ft);
unsigned long long v (
diff --git a/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx
index bb67eb7..e92c419 100644
--- a/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx
+++ b/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx
@@ -207,6 +207,11 @@ main ()
// float
//
+ // Note that some standard libraries recognize the [+-](INF|INFINITY)
+ // strings (notably libc++) and some of them don't (notably msvc and
+ // libstdc++; see Library Working Group (LWG) issue 2381 for details).
+ //
+#ifndef _LIBCPP_VERSION
{
float_pimpl<char> p;
p.pre ();
@@ -214,6 +219,7 @@ main ()
p._characters ("+INF");
assert (test_post_fail (p));
}
+#endif
{
float_pimpl<char> p;
@@ -225,6 +231,7 @@ main ()
// double
//
+#ifndef _LIBCPP_VERSION
{
double_pimpl<char> p;
p.pre ();
@@ -232,6 +239,7 @@ main ()
p._characters ("+INF");
assert (test_post_fail (p));
}
+#endif
{
double_pimpl<char> p;
diff --git a/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx
index d31d206..270cd0e 100644
--- a/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx
+++ b/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx
@@ -37,7 +37,7 @@ main ()
p._pre ();
p._characters ("-2147483648");
p._post ();
- assert (p.post_int () == -2147483648);
+ assert (p.post_int () == -2147483647 - 1);
}
{
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>