aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-27 11:58:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-27 11:58:50 +0200
commit72c8c02e5c841da2ec07a74d0a385c89209937a4 (patch)
tree037e08c35e824209fa7bf721d76c7f65bbb788cd
parentaa6aee72b74f6d1f0eece7d2f57ca7d71173214e (diff)
Make sure we don't process sourced schemas more than once
-rw-r--r--xsd/cxx/elements.hxx16
-rw-r--r--xsd/cxx/parser/attribute-validation-source.cxx2
-rw-r--r--xsd/cxx/parser/characters-validation-source.cxx2
-rw-r--r--xsd/cxx/parser/driver-source.cxx2
-rw-r--r--xsd/cxx/parser/element-validation-source.cxx2
-rw-r--r--xsd/cxx/parser/impl-header.cxx2
-rw-r--r--xsd/cxx/parser/impl-source.cxx2
-rw-r--r--xsd/cxx/parser/name-processor.cxx2
-rw-r--r--xsd/cxx/parser/parser-forward.cxx2
-rw-r--r--xsd/cxx/parser/parser-header.cxx2
-rw-r--r--xsd/cxx/parser/parser-inline.cxx2
-rw-r--r--xsd/cxx/parser/parser-source.cxx2
-rw-r--r--xsd/cxx/parser/state-processor.cxx2
-rw-r--r--xsd/cxx/parser/type-processor.cxx4
-rw-r--r--xsd/cxx/parser/validator.cxx6
-rw-r--r--xsd/cxx/tree/counter.cxx2
-rw-r--r--xsd/cxx/tree/name-processor.cxx2
-rw-r--r--xsd/cxx/tree/parser-header.cxx2
-rw-r--r--xsd/cxx/tree/parser-source.cxx2
-rw-r--r--xsd/cxx/tree/serialization-header.cxx2
-rw-r--r--xsd/cxx/tree/serialization-source.cxx2
-rw-r--r--xsd/cxx/tree/stream-extraction-source.cxx2
-rw-r--r--xsd/cxx/tree/stream-header.cxx2
-rw-r--r--xsd/cxx/tree/stream-insertion-header.cxx2
-rw-r--r--xsd/cxx/tree/stream-insertion-source.cxx2
-rw-r--r--xsd/cxx/tree/stream-source.cxx2
-rw-r--r--xsd/cxx/tree/tree-forward.cxx2
-rw-r--r--xsd/cxx/tree/tree-header.cxx2
-rw-r--r--xsd/cxx/tree/tree-inline.cxx2
-rw-r--r--xsd/cxx/tree/tree-source.cxx2
-rw-r--r--xsd/cxx/tree/validator.cxx4
-rw-r--r--xsd/processing/inheritance/processor.cxx19
32 files changed, 66 insertions, 37 deletions
diff --git a/xsd/cxx/elements.hxx b/xsd/cxx/elements.hxx
index b0a38d1..f9fa619 100644
--- a/xsd/cxx/elements.hxx
+++ b/xsd/cxx/elements.hxx
@@ -438,6 +438,21 @@ namespace CXX
return 0;
}
+ // Sources traverser that goes into each schema only once.
+ //
+ struct Sources: Traversal::Sources
+ {
+ virtual void
+ traverse (SemanticGraph::Sources& s)
+ {
+ if (schemas_.insert (&s.schema ()).second)
+ Traversal::Sources::traverse (s);
+ }
+
+ private:
+ Cult::Containers::Set<SemanticGraph::Schema*> schemas_;
+ };
+
// Usual namespace mapping.
//
struct Namespace: Traversal::Namespace
@@ -476,7 +491,6 @@ namespace CXX
ScopeTracker* st_;
};
-
//
//
template <typename X>
diff --git a/xsd/cxx/parser/attribute-validation-source.cxx b/xsd/cxx/parser/attribute-validation-source.cxx
index 014308e..2f07125 100644
--- a/xsd/cxx/parser/attribute-validation-source.cxx
+++ b/xsd/cxx/parser/attribute-validation-source.cxx
@@ -385,7 +385,7 @@ namespace CXX
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
diff --git a/xsd/cxx/parser/characters-validation-source.cxx b/xsd/cxx/parser/characters-validation-source.cxx
index 2dbcdac..69803e5 100644
--- a/xsd/cxx/parser/characters-validation-source.cxx
+++ b/xsd/cxx/parser/characters-validation-source.cxx
@@ -56,7 +56,7 @@ namespace CXX
//
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
diff --git a/xsd/cxx/parser/driver-source.cxx b/xsd/cxx/parser/driver-source.cxx
index 6be536c..b04bbf1 100644
--- a/xsd/cxx/parser/driver-source.cxx
+++ b/xsd/cxx/parser/driver-source.cxx
@@ -656,7 +656,7 @@ namespace CXX
SemanticGraph::Element* root (0);
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
diff --git a/xsd/cxx/parser/element-validation-source.cxx b/xsd/cxx/parser/element-validation-source.cxx
index 5053c25..4f55ad1 100644
--- a/xsd/cxx/parser/element-validation-source.cxx
+++ b/xsd/cxx/parser/element-validation-source.cxx
@@ -1578,7 +1578,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
diff --git a/xsd/cxx/parser/impl-header.cxx b/xsd/cxx/parser/impl-header.cxx
index 4b3fe6e..5d47cae 100644
--- a/xsd/cxx/parser/impl-header.cxx
+++ b/xsd/cxx/parser/impl-header.cxx
@@ -207,7 +207,7 @@ namespace CXX
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Includes includes (ctx, Includes::impl_header);
Traversal::Names schema_names;
diff --git a/xsd/cxx/parser/impl-source.cxx b/xsd/cxx/parser/impl-source.cxx
index 1881c29..be30b6b 100644
--- a/xsd/cxx/parser/impl-source.cxx
+++ b/xsd/cxx/parser/impl-source.cxx
@@ -362,7 +362,7 @@ namespace CXX
<< endl;
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
Traversal::Names names;
diff --git a/xsd/cxx/parser/name-processor.cxx b/xsd/cxx/parser/name-processor.cxx
index dff4050..d1bbf09 100644
--- a/xsd/cxx/parser/name-processor.cxx
+++ b/xsd/cxx/parser/name-processor.cxx
@@ -1163,7 +1163,7 @@ namespace CXX
//
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
diff --git a/xsd/cxx/parser/parser-forward.cxx b/xsd/cxx/parser/parser-forward.cxx
index 10d29ad..5451268 100644
--- a/xsd/cxx/parser/parser-forward.cxx
+++ b/xsd/cxx/parser/parser-forward.cxx
@@ -85,7 +85,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
diff --git a/xsd/cxx/parser/parser-header.cxx b/xsd/cxx/parser/parser-header.cxx
index 3a7d86f..1dd01b2 100644
--- a/xsd/cxx/parser/parser-header.cxx
+++ b/xsd/cxx/parser/parser-header.cxx
@@ -1411,7 +1411,7 @@ namespace CXX
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Includes includes (ctx, Includes::header);
Traversal::Names schema_names;
diff --git a/xsd/cxx/parser/parser-inline.cxx b/xsd/cxx/parser/parser-inline.cxx
index f2ad7ad..b3805c6 100644
--- a/xsd/cxx/parser/parser-inline.cxx
+++ b/xsd/cxx/parser/parser-inline.cxx
@@ -381,7 +381,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
diff --git a/xsd/cxx/parser/parser-source.cxx b/xsd/cxx/parser/parser-source.cxx
index c8b50d3..547a02f 100644
--- a/xsd/cxx/parser/parser-source.cxx
+++ b/xsd/cxx/parser/parser-source.cxx
@@ -930,7 +930,7 @@ namespace CXX
}
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Namespace ns (ctx);
diff --git a/xsd/cxx/parser/state-processor.cxx b/xsd/cxx/parser/state-processor.cxx
index 360a88c..568154d 100644
--- a/xsd/cxx/parser/state-processor.cxx
+++ b/xsd/cxx/parser/state-processor.cxx
@@ -300,7 +300,7 @@ namespace CXX
process (SemanticGraph::Schema& tu, SemanticGraph::Path const&)
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names schema_names;
Traversal::Namespace ns;
Traversal::Names ns_names;
diff --git a/xsd/cxx/parser/type-processor.cxx b/xsd/cxx/parser/type-processor.cxx
index f54ced4..2207a10 100644
--- a/xsd/cxx/parser/type-processor.cxx
+++ b/xsd/cxx/parser/type-processor.cxx
@@ -286,7 +286,7 @@ namespace CXX
//
Traversal::Schema schema;
Traversal::Schema xs_schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Implies implies;
schema >> sources >> schema;
@@ -320,7 +320,7 @@ namespace CXX
SemanticGraph::Element* root (0);
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
diff --git a/xsd/cxx/parser/validator.cxx b/xsd/cxx/parser/validator.cxx
index 0dc32fa..81f1579 100644
--- a/xsd/cxx/parser/validator.cxx
+++ b/xsd/cxx/parser/validator.cxx
@@ -374,7 +374,7 @@ namespace CXX
private:
Containers::Set<String> types_;
- Traversal::Sources sources_;
+ Sources sources_;
Traversal::Names schema_names_;
Traversal::Namespace ns_;
@@ -485,7 +485,7 @@ namespace CXX
Containers::Set<String> types_;
- Traversal::Sources sources_;
+ Sources sources_;
Traversal::Names schema_names_;
Traversal::Namespace ns_;
@@ -698,7 +698,7 @@ namespace CXX
SemanticGraph::Element* element (0);
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
diff --git a/xsd/cxx/tree/counter.cxx b/xsd/cxx/tree/counter.cxx
index 5a89bbe..6888b2a 100644
--- a/xsd/cxx/tree/counter.cxx
+++ b/xsd/cxx/tree/counter.cxx
@@ -244,7 +244,7 @@ namespace CXX
Context ctx (std::wcerr, tu, path, options, counts, false, 0, 0, 0, 0);
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
diff --git a/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx
index 965e5ad..b731b82 100644
--- a/xsd/cxx/tree/name-processor.cxx
+++ b/xsd/cxx/tree/name-processor.cxx
@@ -2064,7 +2064,7 @@ namespace CXX
//
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
diff --git a/xsd/cxx/tree/parser-header.cxx b/xsd/cxx/tree/parser-header.cxx
index 68244a6..61eb79a 100644
--- a/xsd/cxx/tree/parser-header.cxx
+++ b/xsd/cxx/tree/parser-header.cxx
@@ -460,7 +460,7 @@ namespace CXX
<< endl;
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
ElementFunction element (ctx);
diff --git a/xsd/cxx/tree/parser-source.cxx b/xsd/cxx/tree/parser-source.cxx
index ed71d52..c4fcf57 100644
--- a/xsd/cxx/tree/parser-source.cxx
+++ b/xsd/cxx/tree/parser-source.cxx
@@ -528,7 +528,7 @@ namespace CXX
<< endl;
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx, first, last);
ElementFunction element (ctx);
diff --git a/xsd/cxx/tree/serialization-header.cxx b/xsd/cxx/tree/serialization-header.cxx
index ec2f656..c7b9c1f 100644
--- a/xsd/cxx/tree/serialization-header.cxx
+++ b/xsd/cxx/tree/serialization-header.cxx
@@ -550,7 +550,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
diff --git a/xsd/cxx/tree/serialization-source.cxx b/xsd/cxx/tree/serialization-source.cxx
index f262966..6519d32 100644
--- a/xsd/cxx/tree/serialization-source.cxx
+++ b/xsd/cxx/tree/serialization-source.cxx
@@ -1302,7 +1302,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx, first, last);
diff --git a/xsd/cxx/tree/stream-extraction-source.cxx b/xsd/cxx/tree/stream-extraction-source.cxx
index 91a1b3d..c2bbeb0 100644
--- a/xsd/cxx/tree/stream-extraction-source.cxx
+++ b/xsd/cxx/tree/stream-extraction-source.cxx
@@ -764,7 +764,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
diff --git a/xsd/cxx/tree/stream-header.cxx b/xsd/cxx/tree/stream-header.cxx
index 7004e20..76c1ac9 100644
--- a/xsd/cxx/tree/stream-header.cxx
+++ b/xsd/cxx/tree/stream-header.cxx
@@ -159,7 +159,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
diff --git a/xsd/cxx/tree/stream-insertion-header.cxx b/xsd/cxx/tree/stream-insertion-header.cxx
index 8fc3933..8d00eb0 100644
--- a/xsd/cxx/tree/stream-insertion-header.cxx
+++ b/xsd/cxx/tree/stream-insertion-header.cxx
@@ -154,7 +154,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
diff --git a/xsd/cxx/tree/stream-insertion-source.cxx b/xsd/cxx/tree/stream-insertion-source.cxx
index ee98f96..9af8a33 100644
--- a/xsd/cxx/tree/stream-insertion-source.cxx
+++ b/xsd/cxx/tree/stream-insertion-source.cxx
@@ -538,7 +538,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
diff --git a/xsd/cxx/tree/stream-source.cxx b/xsd/cxx/tree/stream-source.cxx
index bdbf989..7c4954c 100644
--- a/xsd/cxx/tree/stream-source.cxx
+++ b/xsd/cxx/tree/stream-source.cxx
@@ -465,7 +465,7 @@ namespace CXX
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx, first, last);
diff --git a/xsd/cxx/tree/tree-forward.cxx b/xsd/cxx/tree/tree-forward.cxx
index dd6d444..2c6ad1b 100644
--- a/xsd/cxx/tree/tree-forward.cxx
+++ b/xsd/cxx/tree/tree-forward.cxx
@@ -302,7 +302,7 @@ namespace CXX
<< "//" << endl;
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx);
diff --git a/xsd/cxx/tree/tree-header.cxx b/xsd/cxx/tree/tree-header.cxx
index ed9ab60..e02e768 100644
--- a/xsd/cxx/tree/tree-header.cxx
+++ b/xsd/cxx/tree/tree-header.cxx
@@ -3869,7 +3869,7 @@ namespace CXX
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
DocumentedNamespace ns (ctx);
diff --git a/xsd/cxx/tree/tree-inline.cxx b/xsd/cxx/tree/tree-inline.cxx
index 431bc0a..45a62e1 100644
--- a/xsd/cxx/tree/tree-inline.cxx
+++ b/xsd/cxx/tree/tree-inline.cxx
@@ -1035,7 +1035,7 @@ namespace CXX
}
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx, first, last);
diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx
index c972357..d322027 100644
--- a/xsd/cxx/tree/tree-source.cxx
+++ b/xsd/cxx/tree/tree-source.cxx
@@ -3518,7 +3518,7 @@ namespace CXX
}
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Traversal::Names names_ns, names;
Namespace ns (ctx, first, last);
diff --git a/xsd/cxx/tree/validator.cxx b/xsd/cxx/tree/validator.cxx
index 00ec7f9..1fc29ca 100644
--- a/xsd/cxx/tree/validator.cxx
+++ b/xsd/cxx/tree/validator.cxx
@@ -401,7 +401,7 @@ namespace CXX
private:
Containers::Set<String> types_;
- Traversal::Sources sources_;
+ Sources sources_;
Traversal::Names schema_names_;
Traversal::Namespace ns_;
@@ -512,7 +512,7 @@ namespace CXX
Containers::Set<String> types_;
- Traversal::Sources sources_;
+ Sources sources_;
Traversal::Names schema_names_;
Traversal::Namespace ns_;
diff --git a/xsd/processing/inheritance/processor.cxx b/xsd/processing/inheritance/processor.cxx
index 91ab627..318e3e4 100644
--- a/xsd/processing/inheritance/processor.cxx
+++ b/xsd/processing/inheritance/processor.cxx
@@ -391,6 +391,21 @@ namespace Processing
};
+ // Sources traverser that goes into each schema only once.
+ //
+ struct Sources: Traversal::Sources
+ {
+ virtual void
+ traverse (SemanticGraph::Sources& s)
+ {
+ if (schemas_.insert (&s.schema ()).second)
+ Traversal::Sources::traverse (s);
+ }
+
+ private:
+ Cult::Containers::Set<SemanticGraph::Schema*> schemas_;
+ };
+
// Go into included/imported schemas while making sure we don't
// process the same stuff more than once.
//
@@ -420,7 +435,7 @@ namespace Processing
if (!s.context ().count ("processing-inheritance-seen"))
{
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
schema >> sources >> schema;
schema >> *this;
@@ -456,7 +471,7 @@ namespace Processing
// rely on the order of types in the schema.
//
Traversal::Schema schema;
- Traversal::Sources sources;
+ Sources sources;
Uses uses (tu, failed);
schema >> sources >> schema;