From 999cd4661aa0071689171f95aa9bd35511543277 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Aug 2012 15:15:42 +0200 Subject: Don't add standard odb prologues/epilogues when tracing --- odb/odb.cxx | 113 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 53 deletions(-) (limited to 'odb/odb.cxx') diff --git a/odb/odb.cxx b/odb/odb.cxx index 2a0b38c..d89cd3e 100644 --- a/odb/odb.cxx +++ b/odb/odb.cxx @@ -719,38 +719,42 @@ main (int argc, char* argv[]) pi.out_fd, ios_base::out | ios_base::binary); ostream os (&fb); - // Add the standard prologue. - // - os << "#line 1 \"\"" << endl; + if (!ops.trace ()) + { + // Add the standard prologue. + // + os << "#line 1 \"\"" << endl; - // Make sure ODB compiler and libodb versions are compatible. - // - os << "#include " << endl - << endl - << "#if ODB_VERSION != " << ODB_VERSION << endl - << "# error incompatible ODB compiler and runtime versions" << endl - << "#endif" << endl - << endl; - - // Add ODB compiler metaprogramming tests. - // - os << "namespace odb" << endl - << "{" << endl - << "namespace compiler" << endl - << "{" << endl; + // Make sure ODB compiler and libodb versions are compatible. + // + os << "#include " << endl + << endl + << "#if ODB_VERSION != " << ODB_VERSION << endl + << "# error incompatible ODB compiler and runtime " << + "versions" << endl + << "#endif" << endl + << endl; - // operator< test, used in validator. - // - os << "template " << endl - << "bool" << endl - << "has_lt_operator (const T& x, const T& y)" << endl - << "{" << endl - << "bool r (x < y);" << endl - << "return r;" << endl - << "}" << endl; + // Add ODB compiler metaprogramming tests. + // + os << "namespace odb" << endl + << "{" << endl + << "namespace compiler" << endl + << "{" << endl; - os << "}" << endl - << "}" << endl; + // operator< test, used in validator. + // + os << "template " << endl + << "bool" << endl + << "has_lt_operator (const T& x, const T& y)" << endl + << "{" << endl + << "bool r (x < y);" << endl + << "return r;" << endl + << "}" << endl; + + os << "}" << endl + << "}" << endl; + } // Add custom prologue if any. // @@ -848,34 +852,37 @@ main (int argc, char* argv[]) os << endl; } - // Add the standard epilogue at the end so that we see all - // the declarations. - // - os << "#line 1 \"\"" << endl; + if (!ops.trace ()) + { + // Add the standard epilogue at the end so that we see all + // the declarations. + // + os << "#line 1 \"\"" << endl; - // Includes for standard smart pointers. The Boost TR1 header - // may or may not delegate to the GCC implementation. In either - // case, the necessary declarations will be provided so we don't - // need to do anything. - // - os << "#include " << endl - << "#ifndef BOOST_TR1_MEMORY_HPP_INCLUDED" << endl - << "# include " << endl - << "#endif" << endl; + // Includes for standard smart pointers. The Boost TR1 header + // may or may not delegate to the GCC implementation. In either + // case, the necessary declarations will be provided so we don't + // need to do anything. + // + os << "#include " << endl + << "#ifndef BOOST_TR1_MEMORY_HPP_INCLUDED" << endl + << "# include " << endl + << "#endif" << endl; - // Standard wrapper traits. - // - os << "#include " << endl - << "#include " << endl; + // Standard wrapper traits. + // + os << "#include " << endl + << "#include " << endl; - // Standard pointer traits. - // - os << "#include " << endl - << "#include " << endl; + // Standard pointer traits. + // + os << "#include " << endl + << "#include " << endl; - // Standard container traits. - // - os << "#include " << endl; + // Standard container traits. + // + os << "#include " << endl; + } } // Filter the output stream looking for communication from the -- cgit v1.1