diff options
Diffstat (limited to 'odb')
-rw-r--r-- | odb/odb/buildfile | 15 | ||||
-rw-r--r-- | odb/odb/common-query.cxx | 41 | ||||
-rw-r--r-- | odb/odb/context.cxx | 9 | ||||
-rw-r--r-- | odb/odb/generator.cxx | 10 | ||||
-rw-r--r-- | odb/odb/header.cxx | 4 | ||||
-rw-r--r-- | odb/odb/odb.cxx | 60 | ||||
-rw-r--r-- | odb/odb/semantics/relational/elements.hxx | 6 | ||||
-rw-r--r-- | odb/odb/version.hxx | 37 | ||||
-rw-r--r-- | odb/odb/version.hxx.in | 50 |
9 files changed, 130 insertions, 102 deletions
diff --git a/odb/odb/buildfile b/odb/odb/buildfile index 34a6329..96eb95f 100644 --- a/odb/odb/buildfile +++ b/odb/odb/buildfile @@ -78,7 +78,19 @@ switch $cxx.target.system plugin{odb}: cxx.loptions += -undefined dynamic_lookup } -libus{odb}: {hxx ixx txx cxx}{** -odb -options -pregenerated/**} $libs +libus{odb}: {hxx ixx txx cxx}{** -odb -version -options -pregenerated/**} \ + hxx{version} $libs + +# Include the generated version header into the distribution (so that we don't +# pick up an installed one) and don't remove it when cleaning in src (so that +# clean results in a state identical to distributed). +# +hxx{version}: in{version} $src_root/manifest +hxx{version}: +{ + dist = true + clean = ($src_root != $out_root) +} # Build options. # @@ -86,7 +98,6 @@ libus{odb}: {hxx ixx txx cxx}{** -odb -options -pregenerated/**} $libs # cxx.poptions += "-I$plugin_dir/include" cxx.poptions += "-DODB_GXX_NAME=\"$regex.replace($gxx_name, '\\', '\\\\')\"" -cxx.poptions += -DODB_BUILD2 # @@ TMP while supporting other build systems. ## Consumption build ($develop == false). # diff --git a/odb/odb/common-query.cxx b/odb/odb/common-query.cxx index 517c92c..0b5d063 100644 --- a/odb/odb/common-query.cxx +++ b/odb/odb/common-query.cxx @@ -1031,14 +1031,30 @@ traverse (type& c) { // If we have the extern symbol, generate extern template declarations. // - if (!ext.empty ()) + // Without a declaration of explicit template instantiation Clang issues + // -Wundefined-var-template. Note that extern template is only available + // since C++11 and this only appears to be an issue in dynamic multi- + // database support for id_common. + // + // Note also that this break our support for multi-file circular + // dependencies (see odb-tests/common/circule/multiple/). + // + if (!ext.empty () || + (multi_dynamic && + db == database::common && + options.std () >= cxx_version::cxx11)) { bool has_ptr (has_a (c, test_pointer | exclude_base)); bool reuse_abst (abstract (c) && !polymorphic (c)); if (has_ptr || !reuse_abst) { - os << "#ifdef " << ext << endl + const string& guard ( + !ext.empty () + ? ext + : make_guard ("ODB_" + db.string () + "_QUERY_COLUMNS_DEF")); + + os << (!ext.empty () ? "#ifdef " : "#ifndef ") << guard << endl << endl; if (has_ptr) @@ -1055,7 +1071,7 @@ traverse (type& c) if (!reuse_abst) generate_inst (c); - os << "#endif // " << ext << endl + os << "#endif // " << guard << endl << endl; } } @@ -1128,7 +1144,7 @@ generate_inst (type& c) string const& type (class_fq_name (c)); // Explicit template instantiations. Here is what we need to - // instantiate + // instantiate: // // 1. Reuse inheritance bases all the way to the ultimate base. // Unlike poly inheritance, reuse inheritance uses the table @@ -1216,14 +1232,25 @@ generate_decl (type& c) // Do it before query_columns since the inheritance will trigger // instantiation and we won't be able to change visibility (GCC). // - if (obj_count != 0 && multi_dynamic && !ext.empty ()) + // See query_columns_type::traverse() for background. + // + if (obj_count != 0 && multi_dynamic && + (!ext.empty () || + (multi_dynamic && + db == database::common && + options.std () >= cxx_version::cxx11))) { - os << "#ifdef " << ext << endl + const string& guard ( + !ext.empty () + ? ext + : make_guard ("ODB_" + db.string () + "_QUERY_COLUMNS_DEF")); + + os << (!ext.empty () ? "#ifdef " : "#ifndef ") << guard << endl << endl; generate_inst (c); - os << "#endif // " << ext << endl + os << "#endif // " << guard << endl << endl; } diff --git a/odb/odb/context.cxx b/odb/odb/context.cxx index 13fc1b3..f678e64 100644 --- a/odb/odb/context.cxx +++ b/odb/odb/context.cxx @@ -2961,8 +2961,13 @@ strlit (string const& str) void context:: inst_header (bool decl, bool omit_exp) { - if (decl && !ext.empty ()) - os << ext << " "; + if (decl) + { + if (!ext.empty ()) + os << ext << " "; + else + os << "extern "; + } os << "template struct"; diff --git a/odb/odb/generator.cxx b/odb/odb/generator.cxx index ec0fefe..6348234 100644 --- a/odb/odb/generator.cxx +++ b/odb/odb/generator.cxx @@ -15,13 +15,8 @@ #include <libcutl/compiler/cxx-indenter.hxx> #include <libcutl/compiler/sloc-counter.hxx> -#ifdef ODB_BUILD2 #include <libstudxml/parser.hxx> #include <libstudxml/serializer.hxx> -#else -#include <libcutl/xml/parser.hxx> -#include <libcutl/xml/serializer.hxx> -#endif #include <odb/version.hxx> #include <odb/context.hxx> @@ -520,11 +515,12 @@ generate (options const& ops, "// Begin prologue.\n//", "//\n// End prologue."); - // Version check. + // Version check (see similar check in odb.cxx for background). // hxx << "#include <odb/version.hxx>" << endl << endl - << "#if (ODB_VERSION != " << ODB_VERSION << "UL)" << endl + << "#if LIBODB_VERSION_FULL != " << ODB_COMPILER_VERSION << "ULL || \\" << endl + << " LIBODB_SNAPSHOT != " << ODB_COMPILER_SNAPSHOT << "ULL" << endl << "#error ODB runtime version mismatch" << endl << "#endif" << endl << endl; diff --git a/odb/odb/header.cxx b/odb/odb/header.cxx index fad28b3..dacdd1d 100644 --- a/odb/odb/header.cxx +++ b/odb/odb/header.cxx @@ -777,7 +777,9 @@ namespace header << "#include <odb/wrapper-traits.hxx>" << endl << "#include <odb/pointer-traits.hxx>" << endl; -#ifndef ODB_BUILD2 + // @@ TMP: drop after 2.5.0. + // +#if 0 if (ctx.options.std () == cxx_version::cxx98) { // In case of a boost TR1 implementation, we cannot distinguish diff --git a/odb/odb/odb.cxx b/odb/odb/odb.cxx index 39079ea..2f2a75d 100644 --- a/odb/odb/odb.cxx +++ b/odb/odb/odb.cxx @@ -539,7 +539,6 @@ main (int argc, char* argv[]) if (plugin.empty ()) return 1; // Diagnostics has already been issued. -#ifdef ODB_BUILD2 #ifdef _WIN32 // Here is the problem: since the plugin is loaded by GCC (cc1plus.exe // to be precise), the DLL assembly magic we have for executables won't @@ -575,7 +574,6 @@ main (int argc, char* argv[]) _putenv (v.c_str ()); } #endif -#endif args[7] = "-fplugin=" + plugin.string (); } @@ -622,8 +620,8 @@ main (int argc, char* argv[]) o << "# build2 buildfile odb" << endl << "export.metadata = 1 odb" << endl << "odb.name = [string] odb" << endl - << "odb.version = [string] '" << ODB_COMPILER_VERSION_STR << '\'' << endl - << "odb.checksum = [string] '" << ODB_COMPILER_VERSION_STR << '\'' << endl + << "odb.version = [string] '" << ODB_COMPILER_VERSION_FULL << '\'' << endl + << "odb.checksum = [string] '" << ODB_COMPILER_VERSION_FULL << '\'' << endl << "odb.environment = [strings] CPATH CPLUS_INCLUDE_PATH GCC_EXEC_PREFIX COMPILER_PATH" << endl; return 0; @@ -636,13 +634,9 @@ main (int argc, char* argv[]) ostream& o (cout); o << "ODB object-relational mapping (ORM) compiler for C++ " - ODB_COMPILER_VERSION_STR << endl; - -#ifdef ODB_BUILD2 - o << "Copyright (c) " << ODB_COPYRIGHT << "." << endl; -#endif - - o << "This is free software; see the source for copying conditions. " + ODB_COMPILER_VERSION_STR << endl + << "Copyright (c) " << ODB_COPYRIGHT << "." << endl + << "This is free software; see the source for copying conditions. " << "There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS " << "FOR A PARTICULAR PURPOSE." << endl; @@ -742,7 +736,7 @@ main (int argc, char* argv[]) { ostringstream ostr; - ostr << ODB_COMPILER_VERSION; + ostr << ODB_COMPILER_VERSION_OLD; args.push_back ("-DODB_COMPILER_VERSION=" + ostr.str ()); } @@ -957,9 +951,14 @@ main (int argc, char* argv[]) // Make sure ODB compiler and libodb versions are compatible. // + // Note that the snapshot comparision is only necessary of the + // version is a pre-release but having it always won't hurt (it + // will be 0 for final versions). + // os << "#include <odb/version.hxx>" << endl << endl - << "#if ODB_VERSION != " << ODB_VERSION << endl + << "#if LIBODB_VERSION_FULL != " << ODB_COMPILER_VERSION << "ULL" + " || LIBODB_SNAPSHOT != " << ODB_COMPILER_SNAPSHOT << "ULL" << endl << "# error incompatible ODB compiler and runtime " << "versions" << endl << "#endif" << endl @@ -1165,7 +1164,8 @@ main (int argc, char* argv[]) // TR1 wrapper/pointer traits. // -#ifndef ODB_BUILD2 + // @@ TMP: drop after 2.5.0. +#if 0 if (ops.std () == cxx_version::cxx98) os << endl << "#ifndef BOOST_TR1_MEMORY_HPP_INCLUDED" << endl @@ -1610,16 +1610,14 @@ plugin_path (path const& drv, // bug in the extension stripping code. So for now we use the .so extension // everywhere (see also buildfile if changing this). // -//#elif defined(__APPLE__) && defined(ODB_BUILD2) +//#elif defined(__APPLE__) // char const plugin_ext[] = ".dylib"; #else char const plugin_ext[] = ".so"; #endif // Figure out the plugin base name which is just the driver name (but - // without the .exe extension on Windows). If the driver name starts with - // 'lt-', then we are running through the libtool script. Strip this prefix - // -- the shared object should be in the same directory. + // without the .exe extension on Windows). // #ifdef _WIN32 string b (drv.leaf ().base ().string ()); @@ -1627,10 +1625,6 @@ plugin_path (path const& drv, string b (drv.leaf ().string ()); #endif - bool lt (b.size () > 3 && b[0] == 'l' && b[1] == 't' && b[2] == '-'); - if (lt) - b = string (b, 3, string::npos); - path dp (driver_path (drv)); if (dp.empty ()) @@ -1642,19 +1636,7 @@ plugin_path (path const& drv, dp = dp.directory (); struct stat info; - // Regardless of whether we were given a plugin path, first try - // the current directory for the .la file. This will make sure - // running ODB from the build directory works as expected. - // - // @@ BUILD2: not going to work for build2 build. - // - path pp (dp / path (b + ".la")); - if (stat (pp.string ().c_str (), &info) == 0) - { - pp = dp / path (".libs") / path (b + ".so"); - if (stat (pp.string ().c_str (), &info) == 0) - return pp; - } + path pp; #ifdef ODB_GCC_PLUGIN_DIR // Plugin should be installed into the GCC default plugin directory. @@ -1663,9 +1645,9 @@ plugin_path (path const& drv, // was only added in GCC 4.6 so in order to support 4.5 we will have to // emulate it ourselves. // - if (!lt) + //@@ TMP: drop this after 2.5.0 since we no longer support GCC < 5. + // { - //@@ BUILD2: if/when dropping old GCC should just get rid of this. #if 1 // First get the default GCC plugin directory. // @@ -1715,10 +1697,8 @@ plugin_path (path const& drv, #endif } #elif defined (ODB_PLUGIN_PATH) - // If we were given a plugin path, use that unless we are running - // via libtool. + // If we were given a plugin path, use that. // - if (!lt) { string rp (ODB_PLUGIN_PATH); if (!rp.empty ()) diff --git a/odb/odb/semantics/relational/elements.hxx b/odb/odb/semantics/relational/elements.hxx index 06ec552..4036942 100644 --- a/odb/odb/semantics/relational/elements.hxx +++ b/odb/odb/semantics/relational/elements.hxx @@ -14,14 +14,8 @@ #include <libcutl/container/pointer-iterator.hxx> #include <libcutl/compiler/context.hxx> -#ifdef ODB_BUILD2 #include <libstudxml/parser.hxx> #include <libstudxml/serializer.hxx> -#else -#include <libcutl/xml/parser.hxx> -#include <libcutl/xml/serializer.hxx> -namespace cutl {namespace xml {typedef parser content;}} -#endif #include <odb/semantics/relational/name.hxx> diff --git a/odb/odb/version.hxx b/odb/odb/version.hxx index 4ad389a..e69de29 100644 --- a/odb/odb/version.hxx +++ b/odb/odb/version.hxx @@ -1,37 +0,0 @@ -// file : odb/version.hxx -// license : GNU GPL v3; see accompanying LICENSE file - -#ifndef ODB_VERSION_HXX -#define ODB_VERSION_HXX - -// Version format is AABBCCDD where -// -// AA - major version number -// BB - minor version number -// CC - bugfix version number -// DD - alpha / beta (DD + 50) version number -// -// When DD is not 00, 1 is subtracted from AABBCC. For example: -// -// Version AABBCCDD -// 2.0.0 02000000 -// 2.1.0 02010000 -// 2.1.1 02010100 -// 2.2.0.a1 02019901 -// 3.0.0.b2 02999952 -// - -// ODB interface version: minor, major, and alpha/beta versions. -// -#define ODB_VERSION 20476 -#define ODB_VERSION_STR "2.5-b.26" - -// ODB compiler version: interface version plus the bugfix version. -// -// NOTE: remember to update metadata to full version when switching to -// version.hxx.in. -// -#define ODB_COMPILER_VERSION 2049976 -#define ODB_COMPILER_VERSION_STR "2.5.0-b.26" - -#endif // ODB_VERSION_HXX diff --git a/odb/odb/version.hxx.in b/odb/odb/version.hxx.in new file mode 100644 index 0000000..a131c03 --- /dev/null +++ b/odb/odb/version.hxx.in @@ -0,0 +1,50 @@ +// file : odb/version.hxx.in +// license : GNU GPL v3; see accompanying LICENSE file + +#ifndef ODB_COMPILER_VERSION // Note: using the version macro itself. + +// New numeric version format is AAAAABBBBBCCCCCDDDE where: +// +// AAAAA - major version number +// BBBBB - minor version number +// CCCCC - bugfix version number +// DDD - alpha / beta (DDD + 500) version number +// E - final (0) / snapshot (1) +// +// When DDDE is not 0, 1 is subtracted from AAAAABBBBBCCCCC. For example: +// +// Version AAAAABBBBBCCCCCDDDE +// +// 0.1.0 0000000001000000000 +// 0.1.2 0000000001000020000 +// 1.2.3 0000100002000030000 +// 2.2.0-a.1 0000200001999990010 +// 3.0.0-b.2 0000299999999995020 +// 2.2.0-a.1.z 0000200001999990011 +// +#define ODB_COMPILER_VERSION $odb.version.project_number$ULL +#define ODB_COMPILER_VERSION_STR "$odb.version.project$" +#define ODB_COMPILER_VERSION_ID "$odb.version.project_id$" +#define ODB_COMPILER_VERSION_FULL "$odb.version$" + +#define ODB_COMPILER_SNAPSHOT $odb.version.snapshot_sn$ULL + +// Old/deprecated numeric version format is AABBCCDD where: +// +// AA - major version number +// BB - minor version number +// CC - bugfix version number +// DD - alpha / beta (DD + 50) version number +// +// When DD is not 00, 1 is subtracted from AABBCC. For example: +// +// Version AABBCCDD +// 2.0.0 02000000 +// 2.1.0 02010000 +// 2.1.1 02010100 +// 2.2.0.a1 02019901 +// 3.0.0.b2 02999952 +// +#define ODB_COMPILER_VERSION_OLD 2049976 + +#endif // ODB_COMPILER_VERSION |