From d4cbe214123574469ccdefdfe2e4ef51526b9606 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 25 May 2013 12:07:44 -0400 Subject: Don't generate explicit query template instantiations for reuse-abstract classes It is unnecessary plus there is no table name. --- odb/common-query.cxx | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/odb/common-query.cxx b/odb/common-query.cxx index b15515c..68fcb21 100644 --- a/odb/common-query.cxx +++ b/odb/common-query.cxx @@ -835,22 +835,31 @@ traverse (type& c) // if (!ext.empty ()) { - os << "#ifdef " << ext << endl - << endl; + bool has_ptr (has_a (c, test_pointer | exclude_base)); + bool reuse_abst (abstract (c) && !polymorphic (c)); - if (has_a (c, test_pointer | exclude_base)) + if (has_ptr || !reuse_abst) { - bool true_ (true); //@@ (im)perfect forwarding. - bool false_ (false); + os << "#ifdef " << ext << endl + << endl; - instance t (c, false_, true_); - t->traverse (c); - } + if (has_ptr) + { + bool true_ (true); //@@ (im)perfect forwarding. + bool false_ (false); - generate_inst (c); + instance t (c, false_, true_); + t->traverse (c); + } - os << "#endif // " << ext << endl - << endl; + // Don't generate it for reuse-abstract classes. + // + if (!reuse_abst) + generate_inst (c); + + os << "#endif // " << ext << endl + << endl; + } } } else @@ -877,9 +886,10 @@ traverse (type& c) t->traverse (c); } - // Explicit template instantiations. + // Explicit template instantiations. Don't generate it for reuse- + // abstract classes. // - if (multi_dynamic) + if (multi_dynamic && (!abstract (c) || polymorphic (c))) generate_inst (c); } } -- cgit v1.1