diff options
Diffstat (limited to 'odb')
63 files changed, 1487 insertions, 674 deletions
diff --git a/odb/.gitignore b/odb/.gitignore index 7e97b78..4fd410e 100644 --- a/odb/.gitignore +++ b/odb/.gitignore @@ -1,3 +1,2 @@ -odb -odb.so -#options.?xx +/odb +/options.?xx diff --git a/odb/buildfile b/odb/buildfile index 8c8d458..34a6329 100644 --- a/odb/buildfile +++ b/odb/buildfile @@ -32,22 +32,6 @@ if ($cxx.target.class != 'windows') # plugin{*}: install = bin/ -# Unless cross-compiling, pass the C++ compiler's recall path as the g++ -# name. At some point we should also make it configurable. -# -# Note that we used to compare complete target triplets but that prooved too -# strict. For example, we may be running on x86_64-apple-darwin17.7.0 while -# the compiler is targeting x86_64-apple-darwin17.3.0. -# -if ($cxx.target.cpu == $build.host.cpu && \ - $cxx.target.system == $build.host.system) -{ - gxx_name = $recall($cxx.path) - gxx_name = $regex.replace($gxx_name, '\\', '\\\\') # Escape back slashes. -} -else - gxx_name = g++ - import libs = libcutl%lib{cutl} import libs += libstudxml%lib{studxml} @@ -65,6 +49,20 @@ exe{odb}: cxx{odb} exe{odb}: libus{odb}: bin.whole = false exe{odb}: plugin{odb}: include = adhoc +# Target metadata, see also --build2-metadata in odb.cxx. +# +# While ODB itself doesn't use any environment variables, it uses GCC +# underneath which does (see "Environment Variables Affecting GCC"). +# +exe{odb}: +{ + export.metadata = 1 odb + odb.name = [string] odb + odb.version = [string] $version + odb.checksum = [string] $version + odb.environment = [strings] CPATH CPLUS_INCLUDE_PATH GCC_EXEC_PREFIX COMPILER_PATH +} + plugin{odb}: libus{odb} switch $cxx.target.system @@ -80,49 +78,83 @@ switch $cxx.target.system plugin{odb}: cxx.loptions += -undefined dynamic_lookup } -libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs +libus{odb}: {hxx ixx txx cxx}{** -odb -options -pregenerated/**} $libs # Build options. # -cxx.poptions += "-I$plugin_dir/include" "-DODB_GXX_NAME=\"$gxx_name\"" +# Note: escape backslashes in gxx_name. +# +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. -# Pass the copyright notice extracted from the LICENSE file. +## Consumption build ($develop == false). # -copyright = $process.run_regex(cat $src_root/LICENSE, \ - 'Copyright \(c\) (.+)\.', \ - '\1') -obj{odb}: cxx.poptions += -DODB_COPYRIGHT=\"$copyright\" +# Use pregenerated versions in the consumption build. +# +libus{odb}: pregenerated/{hxx ixx cxx}{**}: include = (!$develop) + +if! $develop + cxx.poptions =+ "-I($src_base/pregenerated)" # Note: must come first. + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{hxx ixx cxx}{*}: dist = (!$develop) -# Generated options parser. # -# @@ TMP: currently generated code is committed to allow building from git. +## + +## Development build ($develop == true). +# + +libus{odb}: {hxx ixx cxx}{options}: include = $develop + +if $develop + import! [metadata] cli = cli%exe{cli} + +# In the development build distribute regenerated {hxx ixx cxx}{options}, +# remapping their locations to the paths of the pregenerated versions (which +# are only distributed in the consumption build; see above). This way we make +# sure that the distributed files are always up-to-date. # -if $cli.configured +<{hxx ixx cxx}{options}>: cli{options} $cli { - cli.cxx{options}: cli{options} - - cli.options += --include-with-brackets --include-prefix odb \ ---guard-prefix ODB --generate-file-scanner --generate-specifier \ ---generate-modifier --generate-description --suppress-undocumented \ ---cxx-prologue '#include <odb/option-parsers.hxx>' - - cli.cxx{*}: - { - # Include the generated cli files into the distribution and don't remove - # them when cleaning in src (so that clean results in a state identical to - # distributed). - # - dist = true - clean = ($src_root != $out_root) - - # We keep the generated code in the repository so copy it back to src in - # case of a forwarded configuration. - # - backlink = overwrite - } + dist = ($develop ? pregenerated/odb/ : false) + + # Symlink the generated code in src for convenience of development. + # + backlink = true } +% +if $develop +{{ + options = --include-with-brackets --include-prefix odb --guard-prefix ODB \ + --generate-file-scanner --generate-specifier --generate-modifier \ + --generate-description --suppress-undocumented \ + --cxx-prologue '#include <odb/option-parsers.hxx>' + + $cli $options -o $out_base $path($<[0]) + + # If the result differs from the pregenerated version, copy it over. + # + if diff $src_base/pregenerated/odb/options.hxx $path($>[0]) >- && \ + diff $src_base/pregenerated/odb/options.ixx $path($>[1]) >- && \ + diff $src_base/pregenerated/odb/options.cxx $path($>[2]) >- + exit + end + + cp $path($>[0]) $src_base/pregenerated/odb/options.hxx + cp $path($>[1]) $src_base/pregenerated/odb/options.ixx + cp $path($>[2]) $src_base/pregenerated/odb/options.cxx +}} + +# +## + +# Pass the copyright notice extracted from the LICENSE file. +# +obj{odb}: cxx.poptions += -DODB_COPYRIGHT=\"$copyright\" # Don't install any of the plugin's headers. # diff --git a/odb/context.cxx b/odb/context.cxx index e220d0e..13fc1b3 100644 --- a/odb/context.cxx +++ b/odb/context.cxx @@ -1472,7 +1472,7 @@ utype (semantics::data_member& m, } } - if (s->global_scope ()) + if (!s->named_p () || s->global_scope ()) break; } @@ -1882,8 +1882,13 @@ schema (semantics::scope& s) const namespace_* ns (dynamic_cast<namespace_*> (ps)); - if (ns == 0) - continue; // Some other scope. + if (ns == 0) // Some other scope. + { + if (!ps->named_p ()) + break; + + continue; + } if (ns->extension ()) ns = &ns->original (); @@ -1920,7 +1925,8 @@ schema (semantics::scope& s) const n.swap (r); } - if (r.fully_qualified () || ns->global_scope ()) + if (r.fully_qualified () || + ns->global_scope ()) // Note: namespaces always named. break; } @@ -1952,8 +1958,13 @@ table_name_prefix (semantics::scope& s) const namespace_* ns (dynamic_cast<namespace_*> (ps)); - if (ns == 0) - continue; // Some other scope. + if (ns == 0) // Some other scope. + { + if (!ps->named_p ()) + break; + + continue; + } if (ns->extension ()) ns = &ns->original (); @@ -1964,7 +1975,7 @@ table_name_prefix (semantics::scope& s) const r = n.uname () + r; } - if (ns->global_scope ()) + if (ns->global_scope ()) // Note: namespaces always named. break; } @@ -2130,6 +2141,90 @@ table_name (semantics::data_member& m, table_prefix const& p) const return r; } +string context:: +table_options (semantics::class_& c) +{ + string r; + + // Accumulate options from class. + // + // @@ Should we also get them from bases? + // + // @@ Note for some databases (like SQLite), options are seperated with + // comma, not space. Likely the same issue in the column_options(). + // + if (c.count ("options")) + { + strings const& o (c.get<strings> ("options")); + + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } + } + + return r; +} + +string context:: +table_options (semantics::data_member& m, semantics::type& c) +{ + string r; + + // Accumulate options from container and member. + // + // @@ Currently there is no way to assign options to the container type. If + // we use the value specifier, then it ends up being treated as a value + // type. To support this we will probably need to invent the container + // specifier. + // + if (c.count ("options")) + { + strings const& o (c.get<strings> ("options")); + + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } + } + + if (m.count ("options")) + { + strings const& o (m.get<strings> ("options")); + + for (strings::const_iterator i (o.begin ()); i != o.end (); ++i) + { + if (i->empty ()) + r.clear (); + else + { + if (!r.empty ()) + r += ' '; + + r += *i; + } + } + } + + return r; +} + // context::column_prefix // context::column_prefix:: diff --git a/odb/context.hxx b/odb/context.hxx index da975f3..ec4505b 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -17,8 +17,8 @@ #include <cstddef> // std::size_t #include <iostream> -#include <cutl/re.hxx> -#include <cutl/shared-ptr.hxx> +#include <libcutl/re.hxx> +#include <libcutl/shared-ptr.hxx> #include <odb/options.hxx> #include <odb/features.hxx> @@ -1342,6 +1342,14 @@ public: qname table_name (semantics::data_member&, table_prefix const&) const; + string + table_options (semantics::class_&); + + // Table options for the container member. + // + string + table_options (semantics::data_member&, semantics::type& ct); + // // struct column_prefix diff --git a/odb/diagnostics.hxx b/odb/diagnostics.hxx index 91ec068..46f2272 100644 --- a/odb/diagnostics.hxx +++ b/odb/diagnostics.hxx @@ -10,7 +10,7 @@ #include <cstddef> #include <iostream> -#include <cutl/fs/path.hxx> +#include <libcutl/fs/path.hxx> #include <odb/location.hxx> diff --git a/odb/gcc.hxx b/odb/gcc.hxx index 9b644d7..e5fecef 100644 --- a/odb/gcc.hxx +++ b/odb/gcc.hxx @@ -151,15 +151,19 @@ gcc_tree_code_name (gcc_tree_code_type tc) {return tree_code_name[tc];} #define DECL_CHAIN(x) TREE_CHAIN(x) #endif -// In GCC 6, ANON_AGGRNAME_P became anon_aggrname_p(). +// In GCC 6 ANON_AGGRNAME_P became anon_aggrname_p(). +// In GCC 10 anon_aggrname_p() became IDENTIFIER_ANON_P. // #if BUILDING_GCC_MAJOR < 6 -# define anon_aggrname_p(X) ANON_AGGRNAME_P(X) +# define IDENTIFIER_ANON_P(X) ANON_AGGRNAME_P(X) +#elif BUILDING_GCC_MAJOR < 10 +# define IDENTIFIER_ANON_P(X) anon_aggrname_p(X) #endif // In GCC 9: // // INCLUDED_FROM Became linemap_included_from_linemap(). +// // LAST_SOURCE_LINE Was removed apparently as no longer used. Studying // the line-map.h diff from 8.3 suggests that the old // implementation should still work. @@ -189,4 +193,23 @@ LAST_SOURCE_LINE (const line_map_ordinary* map) #endif +// In GCC 11: +// +// lookup_qualified_name() has a new interface. +// +// DECL_IS_BUILTIN became DECL_IS_UNDECLARED_BUILTIN. +// +#if BUILDING_GCC_MAJOR >= 11 + +inline tree +lookup_qualified_name (tree scope, tree name, bool type, bool complain) +{ + return lookup_qualified_name ( + scope, name, (type ? LOOK_want::TYPE : LOOK_want::NORMAL), complain); +} + +#define DECL_IS_BUILTIN(decl) DECL_IS_UNDECLARED_BUILTIN(decl) + +#endif + #endif // ODB_GCC_HXX diff --git a/odb/generator.cxx b/odb/generator.cxx index 09a971c..ec0fefe 100644 --- a/odb/generator.cxx +++ b/odb/generator.cxx @@ -9,18 +9,18 @@ #include <sstream> #include <iostream> -#include <cutl/fs/auto-remove.hxx> +#include <libcutl/fs/auto-remove.hxx> -#include <cutl/compiler/code-stream.hxx> -#include <cutl/compiler/cxx-indenter.hxx> -#include <cutl/compiler/sloc-counter.hxx> +#include <libcutl/compiler/code-stream.hxx> +#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 <cutl/xml/parser.hxx> -#include <cutl/xml/serializer.hxx> +#include <libcutl/xml/parser.hxx> +#include <libcutl/xml/serializer.hxx> #endif #include <odb/version.hxx> diff --git a/odb/location.hxx b/odb/location.hxx index b16018b..cc59196 100644 --- a/odb/location.hxx +++ b/odb/location.hxx @@ -7,7 +7,7 @@ #include <odb/gcc-fwd.hxx> #include <cstddef> -#include <cutl/fs/path.hxx> +#include <libcutl/fs/path.hxx> struct location { diff --git a/odb/odb.cxx b/odb/odb.cxx index 5381668..701f6e1 100644 --- a/odb/odb.cxx +++ b/odb/odb.cxx @@ -18,7 +18,7 @@ # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif -# include <windows.h> // CreatePipe, CreateProcess +# include <windows.h> // CreatePipe, CreateProcess, GetTemp*, MAX_PATH # include <io.h> // _open_osfhandle # include <fcntl.h> // _O_TEXT #endif @@ -31,7 +31,8 @@ #include <iostream> #include <ext/stdio_filebuf.h> -#include <cutl/fs/path.hxx> +#include <libcutl/fs/path.hxx> +#include <libcutl/fs/auto-remove.hxx> #include <odb/version.hxx> #include <odb/options.hxx> @@ -44,6 +45,7 @@ using namespace std; using cutl::fs::path; using cutl::fs::invalid_path; +using cutl::fs::auto_remove; typedef vector<string> strings; typedef vector<path> paths; @@ -90,6 +92,16 @@ struct process_info struct process_failure {}; +#ifdef _WIN32 +// Deal with Windows command line length limit. +// +static auto_remove +fixup_cmd_line (vector<const char*>& args, + size_t start, + const char* name, + string& arg); +#endif + // Start another process using the specified command line. Connect the // newly created process' stdin to out_fd. Also if connect_* are true, // connect the created process' stdout and stderr to in_*fd. Issue @@ -259,9 +271,7 @@ main (int argc, char* argv[]) file = dd / file; // For diagnostics. } - int ac (3); - const char* av[4] = {argv[0], "--file", file.string ().c_str (), 0}; - cli::argv_file_scanner s (ac, const_cast<char**> (av), "--file"); + cli::argv_file_scanner s (file.string ()); bool first_x (true); @@ -381,11 +391,15 @@ main (int argc, char* argv[]) // Parse driver options. // + // We scan expanding --options-file in order to allow specifying ad hoc + // options (-I, etc) in options files. + // bool first_x (true); - for (int i = 1; i < argc; ++i) + for (cli::argv_file_scanner scan (argc, argv, "--options-file"); + scan.more (); ) { - string a (argv[i]); + string a (scan.next ()); size_t n (a.size ()); // -v @@ -399,14 +413,14 @@ main (int argc, char* argv[]) // else if (a == "-x") { - if (++i == argc || argv[i][0] == '\0') + const char* v; + if (!scan.more () || (v = scan.next ())[0] == '\0') { - e << argv[0] << ": error: expected argument for the -x option" << endl; + e << argv[0] << ": error: expected argument for the -x option" + << endl; return 1; } - a = argv[i]; - if (first_x) { first_x = false; @@ -414,13 +428,13 @@ main (int argc, char* argv[]) // If it doesn't start with '-', then it must be the g++ // executable name. Update the first argument with it. // - if (a[0] != '-') - args[0] = a; + if (v[0] != '-') + args[0] = v; else - args.push_back (a); + args.push_back (v); } else - args.push_back (a); + args.push_back (v); } // -I // @@ -430,14 +444,15 @@ main (int argc, char* argv[]) if (n == 2) // -I /path { - if (++i == argc || argv[i][0] == '\0') + const char* v; + if (!scan.more () || (v = scan.next ())[0] == '\0') { e << argv[0] << ": error: expected argument for the -I option" << endl; return 1; } - args.push_back (argv[i]); + args.push_back (v); } } // -isystem, -iquote, -idirafter, and -framework (Mac OS X) @@ -449,14 +464,15 @@ main (int argc, char* argv[]) { args.push_back (a); - if (++i == argc || argv[i][0] == '\0') + const char* v; + if (!scan.more () || (v = scan.next ())[0] == '\0') { e << argv[0] << ": error: expected argument for the " << a << " option" << endl; return 1; } - args.push_back (argv[i]); + args.push_back (v); } // -D // @@ -466,14 +482,15 @@ main (int argc, char* argv[]) if (n == 2) // -D macro { - if (++i == argc || argv[i][0] == '\0') + const char* v; + if (!scan.more () || (v = scan.next ())[0] == '\0') { e << argv[0] << ": error: expected argument for the -D option" << endl; return 1; } - args.push_back (argv[i]); + args.push_back (v); } } // -U @@ -484,14 +501,15 @@ main (int argc, char* argv[]) if (n == 2) // -U macro { - if (++i == argc || argv[i][0] == '\0') + const char* v; + if (!scan.more () || (v = scan.next ())[0] == '\0') { e << argv[0] << ": error: expected argument for the -U option" << endl; return 1; } - args.push_back (argv[i]); + args.push_back (v); } } // Store everything else in a list so that we can parse it with the @@ -577,7 +595,7 @@ main (int argc, char* argv[]) int ac (static_cast<int> (av.size ())); cli::argv_file_scanner::option_info oi[3]; - oi[0].option = "--options-file"; + oi[0].option = "--options-file"; // Keep in case profile uses it. oi[0].search_func = 0; oi[1].option = "-p"; oi[2].option = "--profile"; @@ -592,20 +610,41 @@ main (int argc, char* argv[]) cli::argv_file_scanner scan (ac, &av[0], oi, 3); options ops (scan); + // Handle --build2-metadata (see also buildfile). + // + if (ops.build2_metadata_specified ()) + { + ostream& o (cout); + + // Note that the export.metadata variable should be the first non- + // blank/comment line. + // + 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.environment = [strings] CPATH CPLUS_INCLUDE_PATH GCC_EXEC_PREFIX COMPILER_PATH" << endl; + + return 0; + } + // Handle --version. // if (ops.version ()) { - cout << "ODB object-relational mapping (ORM) compiler for C++ " + ostream& o (cout); + + o << "ODB object-relational mapping (ORM) compiler for C++ " ODB_COMPILER_VERSION_STR << endl; #ifdef ODB_BUILD2 - cout << "Copyright (c) " << ODB_COPYRIGHT << "." << endl; + o << "Copyright (c) " << ODB_COPYRIGHT << "." << endl; #endif - cout << "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; + o << "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; return 0; } @@ -614,8 +653,10 @@ main (int argc, char* argv[]) // if (ops.help ()) { - cout << "Usage: " << argv[0] << " [options] file [file ...]" << endl - << "Options:" << endl; + ostream& o (cout); + + o << "Usage: " << argv[0] << " [options] file [file ...]" << endl + << "Options:" << endl; options::print_usage (cout); return 0; @@ -666,6 +707,11 @@ main (int argc, char* argv[]) args[3] = "-std=c++1z"; break; } + case cxx_version::cxx20: + { + args[3] = "-std=c++2a"; + break; + } } } @@ -866,6 +912,14 @@ main (int argc, char* argv[]) } } + // Deal with Windows command line length limit. + // +#ifdef _WIN32 + string ops_file_arg; + auto_remove opt_file_rm ( + fixup_cmd_line (exec_args, 1, argv[0], ops_file_arg)); +#endif + process_info pi (start_process (&exec_args[0], argv[0], false, true)); { @@ -1299,6 +1353,11 @@ profile_paths (strings const& sargs, char const* name) exec_args.push_back ("-"); // Compile stdin. exec_args.push_back (0); +#ifdef _WIN32 + string ops_file_arg; + auto_remove opt_file_rm (fixup_cmd_line (exec_args, 1, name, ops_file_arg)); +#endif + process_info pi (start_process (&exec_args[0], name, true)); close (pi.out_fd); // Preprocess empty file. @@ -1813,6 +1872,134 @@ print_error (char const* name) LocalFree (msg); } +// On Windows we need to protect command line arguments with spaces using +// quotes. Since there could be actual quotes in the value, we need to escape +// them. +// +static void +append_quoted (string& cmd_line, const char* ca) +{ + string a (ca); + bool quote (a.find (' ') != string::npos); + + if (quote) + cmd_line += '"'; + + for (size_t i (0); i < a.size (); ++i) + { + if (a[i] == '"') + cmd_line += "\\\""; + else + cmd_line += a[i]; + } + + if (quote) + cmd_line += '"'; +} + +// Deal with Windows command line length limit. +// +// The best approach seems to be passing the command line in an "options file" +// ("response file" in Microsoft's terminology). +// +static auto_remove +fixup_cmd_line (vector<const char*>& args, + size_t start, + const char* name, + string& arg) +{ + // Calculate the would-be command line length similar to how start_process() + // implementation does it. + // + size_t n (0); + string s; + for (const char* a: args) + { + if (a != nullptr) + { + if (n != 0) + n++; // For the space separator. + + s.clear (); + append_quoted (s, a); + n += s.size (); + } + } + + if (n <= 32766) // 32768 - "Unicode terminating null character". + return auto_remove (); + + // Create the temporary file. + // + char d[MAX_PATH + 1], p[MAX_PATH + 1]; + if (GetTempPathA (sizeof (d), d) == 0 || + GetTempFileNameA (d, "odb-options-", 0, p) == 0) + { + print_error (name); + throw process_failure (); + } + + auto_remove rm = auto_remove (path (p)); + try + { + ofstream ofs (p); + if (!ofs.is_open ()) + { + cerr << name << ": error: unable to open '" << p << "' in write mode" + << endl; + throw process_failure (); + } + + ofs.exceptions (ios_base::badbit | ios_base::failbit); + + // Write the arguments to file. + // + // The format is a space-separated list of potentially-quoted arguments + // with support for backslash-escaping. + // + string b; + for (size_t i (start), n (args.size () - 1); i != n; ++i) + { + const char* a (args[i]); + + // We will most likely have backslashes so just do it. + // + { + for (b.clear (); *a != '\0'; ++a) + { + if (*a != '\\') + b += *a; + else + b += "\\\\"; + } + + a = b.c_str (); + } + + s.clear (); + append_quoted (s, a); + ofs << (i != start ? " " : "") << s; + } + + ofs << '\n'; + ofs.close (); + } + catch (const ios_base::failure&) + { + cerr << name << ": error: unable to write to '" << p << "'" << endl; + throw process_failure (); + } + + // Rewrite the command line. + // + arg = string ("@") + p; + args.resize (start); + args.push_back (arg.c_str()); + args.push_back (nullptr); + + return rm; +} + static process_info start_process (char const* args[], char const* name, bool err, bool out) { @@ -1878,26 +2065,7 @@ start_process (char const* args[], char const* name, bool err, bool out) if (p != args) cmd_line += ' '; - // On Windows we need to protect values with spaces using quotes. - // Since there could be actual quotes in the value, we need to - // escape them. - // - string a (*p); - bool quote (a.find (' ') != string::npos); - - if (quote) - cmd_line += '"'; - - for (size_t i (0); i < a.size (); ++i) - { - if (a[i] == '"') - cmd_line += "\\\""; - else - cmd_line += a[i]; - } - - if (quote) - cmd_line += '"'; + append_quoted (cmd_line, *p); } // Prepare other info. diff --git a/odb/option-functions.cxx b/odb/option-functions.cxx index 00d36cd..7eda934 100644 --- a/odb/option-functions.cxx +++ b/odb/option-functions.cxx @@ -101,7 +101,7 @@ process_options (options& o) o.odb_file_suffix ().insert (make_pair (db, "-odb-" + db.string ())); o.sql_file_suffix ().insert (make_pair (db, "-" + db.string ())); o.schema_file_suffix ().insert (make_pair (db, "-schema-" + db.string ())); - o.changelog_file_suffix ().insert (make_pair (db, "-" + db.string ())); + o.changelog_file_suffix ().insert (make_pair (db, '-' + db.string ())); } // Set default --default-database value. diff --git a/odb/option-types.cxx b/odb/option-types.cxx index aac0288..c4a030b 100644 --- a/odb/option-types.cxx +++ b/odb/option-types.cxx @@ -18,7 +18,8 @@ static const char* cxx_version_[] = "c++98", "c++11", "c++14", - "c++17" + "c++17", + "c++20" }; string cxx_version:: @@ -43,6 +44,8 @@ operator>> (istream& is, cxx_version& v) v = cxx_version::cxx14; else if (s == "c++17") v = cxx_version::cxx17; + else if (s == "c++20") + v = cxx_version::cxx20; else is.setstate (istream::failbit); } diff --git a/odb/option-types.hxx b/odb/option-types.hxx index 4739892..869fc83 100644 --- a/odb/option-types.hxx +++ b/odb/option-types.hxx @@ -22,7 +22,8 @@ struct cxx_version cxx98, cxx11, cxx14, - cxx17 + cxx17, + cxx20 }; cxx_version (value v = value (0)) : v_ (v) {} diff --git a/odb/options.cli b/odb/options.cli index e202159..17ee438 100644 --- a/odb/options.cli +++ b/odb/options.cli @@ -5,6 +5,7 @@ include <set>; include <vector>; include <string>; include <cstddef>; +include <cstdint>; include <odb/option-types.hxx>; @@ -14,6 +15,8 @@ class options // Wrapper options. These are not passed to the plugin. // + std::uint64_t --build2-metadata; // Leave undocumented/hidden. + bool --help {"Print usage information and exit."}; bool --version {"Print version and exit."}; @@ -306,11 +309,15 @@ class options // Language. // + // @@ TODO: perhaps we should switch to latest to match how we build + // runtime by default? + // cxx_version --std = cxx_version::cxx98 { "<version>", "Specify the C++ standard that should be used during compilation. - Valid values are \cb{c++98} (default), \cb{c++11}, and \cb{c++14}." + Valid values are \cb{c++98} (default), \cb{c++11}, \cb{c++14}, + \cb{c++17}, and \cb{c++20}." }; // Diagnostics. diff --git a/odb/parser.cxx b/odb/parser.cxx index 7286fca..c026808 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -176,6 +176,7 @@ private: unit* unit_; scope* scope_; + vector<scope*> class_scopes_; // Current hierarchy of class-like scopes. size_t error_; decl_set decls_; @@ -263,6 +264,11 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) if (stub || !COMPLETE_TYPE_P (c)) return *c_node; + // Note: "include" the base classes into the class scope (see comment for + // self-typedefs in emit_type_decl()). + // + class_scopes_.push_back (c_node); + // Traverse base information. // tree bis (TYPE_BINFO (c)); @@ -557,6 +563,8 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) diagnose_unassoc_pragmas (decls); scope_ = prev_scope; + class_scopes_.pop_back (); + return *c_node; } @@ -583,6 +591,8 @@ emit_union (tree u, path const& file, size_t line, size_t clmn, bool stub) if (stub || !COMPLETE_TYPE_P (u)) return *u_node; + class_scopes_.push_back (u_node); + // Collect member declarations so that we can traverse them in // the source code order. // @@ -728,6 +738,7 @@ emit_union (tree u, path const& file, size_t line, size_t clmn, bool stub) diagnose_unassoc_pragmas (decls); scope_ = prev_scope; + class_scopes_.pop_back (); return *u_node; } @@ -890,15 +901,23 @@ collect (tree ns) { case TYPE_DECL: { - if (DECL_NAME (decl) != NULL_TREE) - decls_.insert (decl); + // Skip special type declarations. + // + if (DECL_NAME (decl) == NULL_TREE) + continue; + + tree type (TREE_TYPE (decl)); + if (LAMBDA_TYPE_P (type)) + continue; + decls_.insert (decl); break; } case TEMPLATE_DECL: { if (DECL_CLASS_TEMPLATE_P (decl)) decls_.insert (decl); + break; } default: @@ -934,9 +953,10 @@ collect (tree ns) if (!DECL_IS_BUILTIN (decl) || DECL_NAMESPACE_STD_P (decl)) { + tree dn (DECL_NAME (decl)); + if (trace) { - tree dn (DECL_NAME (decl)); char const* name (dn ? IDENTIFIER_POINTER (dn) : "<anonymous>"); ts << "namespace " << name << " at " @@ -944,7 +964,12 @@ collect (tree ns) << DECL_SOURCE_LINE (decl) << endl; } - collect (decl); + // Skip anonymous namespaces (there could be nothing of interest to us + // inside but they wreck havoc with our attempts to sort declarations + // into namespaces). + // + if (dn != 0) + collect (decl); } } } @@ -1071,6 +1096,8 @@ emit () break; } } + + assert (class_scopes_.empty ()); } // Diagnose any position pragmas that haven't been associated. @@ -1095,14 +1122,14 @@ emit_type_decl (tree decl) // says that in typedef struct {} S; S becomes struct's // name. // - if (anon_aggrname_p (decl_name)) + if (IDENTIFIER_ANON_P (decl_name)) { tree d (TYPE_NAME (t)); if (d != NULL_TREE && !DECL_ARTIFICIAL (d) && DECL_NAME (d) != NULL_TREE && - !anon_aggrname_p (DECL_NAME (d))) + !IDENTIFIER_ANON_P (DECL_NAME (d))) { decl = d; decl_name = DECL_NAME (decl); @@ -1193,6 +1220,58 @@ emit_type_decl (tree decl) size_t c (DECL_SOURCE_COLUMN (decl)); type& node (emit_type (t, decl_access (decl), f, l, c)); + + // Omit inner self-typedefs (e.g., a class typedefs itself in its own + // scope). Such aliases don't buy us anything (in particular, they cannot + // be used to form an fq-name) but they do cause scoping cycles if this + // name happens to be used to find outer scope (see scope::scope_()). + // Note that this means we can now have class template instantiations that + // are not named and therefore don't belong to any scope. + // + // Note that emit_type() might still enter this decl as a hint. It's fuzzy + // whether this is harmless or not. + // + // Note also that using the normal scope hierarchy does not work in more + // complex cases where templates cross-self-typedef. So instead we now use + // a special-purpose mechanism (class_scopes_). Note for this to work + // correctly (hopefully), the class should be "in scope" for its bases. + // Here is a representative examples (inspired by code in Eigen): + // + // template <typename M> + // struct PlainObjectBase + // { + // typedef M Self; + // }; + // + // template <typename T, int X, int Y> + // struct Matrix: PlainObjectBase<Matrix<T, X, Y>> + // { + // typedef PlainObjectBase<Matrix> Base; + // typedef Matrix Self; + // }; + // + // typedef Matrix<double, 3, 1> Vector3d; + // + // Here we want both Self's (but not Base) to be skipped. + // + if (scope* s = dynamic_cast<scope*> (&node)) + { + for (auto i (class_scopes_.rbegin ()); i != class_scopes_.rend (); ++i) + { + if (s == *i) + { + if (trace) + { + string s (emit_type_name (t, false)); + + ts << "omitting inner self-typedef " << s << " (" << &node + << ") -> " << name << " at " << f << ":" << l << endl; + } + return 0; + } + } + } + typedefs& edge (unit_->new_edge<typedefs> (*scope_, node, name)); // Find our hint. @@ -1319,6 +1398,8 @@ emit_class_template (tree t, bool stub) if (stub || !COMPLETE_TYPE_P (c)) return *ct_node; + class_scopes_.push_back (ct_node); + // Collect member declarations so that we can traverse them in // the source code order. For now we are only interested in // nested class template declarations. @@ -1374,6 +1455,7 @@ emit_class_template (tree t, bool stub) diagnose_unassoc_pragmas (decls); scope_ = prev_scope; + class_scopes_.pop_back (); return *ct_node; } @@ -1402,6 +1484,8 @@ emit_union_template (tree t, bool stub) if (stub || !COMPLETE_TYPE_P (u)) return *ut_node; + class_scopes_.push_back (ut_node); + // Collect member declarations so that we can traverse them in // the source code order. For now we are only interested in // nested class template declarations. @@ -1457,6 +1541,7 @@ emit_union_template (tree t, bool stub) diagnose_unassoc_pragmas (decls); scope_ = prev_scope; + class_scopes_.pop_back (); return *ut_node; } @@ -1719,7 +1804,7 @@ create_type (tree t, ts << "start anon/stub " << gcc_tree_code_name(tc) << " at " << file << ":" << line << endl; - if (d == NULL_TREE || anon_aggrname_p (DECL_NAME (d))) + if (d == NULL_TREE || IDENTIFIER_ANON_P (DECL_NAME (d))) { if (tc == RECORD_TYPE) r = &emit_class<class_> (t, file, line, clmn); @@ -1816,7 +1901,7 @@ create_type (tree t, ts << "start anon/stub " << gcc_tree_code_name(tc) << " at " << file << ":" << line << endl; - if (d == NULL_TREE || anon_aggrname_p (DECL_NAME (d))) + if (d == NULL_TREE || IDENTIFIER_ANON_P (DECL_NAME (d))) { r = &emit_enum (t, access, file, line, clmn); } @@ -2045,9 +2130,12 @@ emit_type_name (tree type, bool direct) if (i != 0) id += ", "; - // Assume type-only arguments. + // Assume integer and type-only arguments. // - id += emit_type_name (a); + if (TREE_CODE (a) == INTEGER_CST) + id += to_string (integer_value (a)); + else + id += emit_type_name (a); } id += '>'; diff --git a/odb/plugin.cxx b/odb/plugin.cxx index aff90ee..c065a8a 100644 --- a/odb/plugin.cxx +++ b/odb/plugin.cxx @@ -14,8 +14,8 @@ #include <cassert> #include <iostream> -#include <cutl/re.hxx> -#include <cutl/fs/path.hxx> +#include <libcutl/re.hxx> +#include <libcutl/fs/path.hxx> #include <odb/pragma.hxx> #include <odb/parser.hxx> diff --git a/odb/pragma.cxx b/odb/pragma.cxx index bd1d848..6668733 100644 --- a/odb/pragma.cxx +++ b/odb/pragma.cxx @@ -1643,8 +1643,6 @@ handle_pragma (cxx_lexer& l, return; } - // base - // if (l.next (tl, &tn) != CPP_NUMBER || TREE_CODE (tn) != INTEGER_CST) { error (l) << "unsigned integer expected as batch size" << endl; diff --git a/odb/pragma.hxx b/odb/pragma.hxx index 45b3528..0d4d3f1 100644 --- a/odb/pragma.hxx +++ b/odb/pragma.hxx @@ -13,9 +13,9 @@ #include <odb/option-types.hxx> // database -#include <cutl/container/any.hxx> -#include <cutl/container/multi-index.hxx> -#include <cutl/compiler/context.hxx> +#include <libcutl/container/any.hxx> +#include <libcutl/container/multi-index.hxx> +#include <libcutl/compiler/context.hxx> struct virt_declaration { diff --git a/odb/options.cxx b/odb/pregenerated/odb/options.cxx index fedf8c5..da22570 100644 --- a/odb/options.cxx +++ b/odb/pregenerated/odb/options.cxx @@ -16,6 +16,7 @@ #include <set> #include <string> #include <vector> +#include <utility> #include <ostream> #include <sstream> #include <cstring> @@ -197,6 +198,7 @@ namespace cli else ++i_; + ++start_position_; return r; } else @@ -207,11 +209,20 @@ namespace cli skip () { if (i_ < argc_) + { ++i_; + ++start_position_; + } else throw eos_reached (); } + std::size_t argv_scanner:: + position () + { + return start_position_; + } + // argv_file_scanner // int argv_file_scanner::zero_argc_ = 0; @@ -322,6 +333,7 @@ namespace cli { hold_[i_ == 0 ? ++i_ : --i_].swap (args_.front ().value); args_.pop_front (); + ++start_position_; return hold_[i_].c_str (); } } @@ -335,7 +347,10 @@ namespace cli if (args_.empty ()) return base::skip (); else + { args_.pop_front (); + ++start_position_; + } } const argv_file_scanner::option_info* argv_file_scanner:: @@ -348,6 +363,12 @@ namespace cli return 0; } + std::size_t argv_file_scanner:: + position () + { + return start_position_; + } + void argv_file_scanner:: load (const std::string& file) { @@ -460,12 +481,28 @@ namespace cli if (oi->search_func != 0) { - std::string f (oi->search_func (s2.c_str (), oi->arg)); + string f (oi->search_func (s2.c_str (), oi->arg)); if (!f.empty ()) load (f); } else + { + // If the path of the file being parsed is not simple and the + // path of the file that needs to be loaded is relative, then + // complete the latter using the former as a base. + // +#ifndef _WIN32 + string::size_type p (file.find_last_of ('/')); + bool c (p != string::npos && s2[0] != '/'); +#else + string::size_type p (file.find_last_of ("/\\")); + bool c (p != string::npos && s2[1] != ':'); +#endif + if (c) + s2.insert (0, file, 0, p + 1); + load (s2); + } continue; } @@ -518,10 +555,31 @@ namespace cli struct parser<bool> { static void - parse (bool& x, scanner& s) + parse (bool& x, bool& xs, scanner& s) { - s.next (); - x = true; + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; } }; @@ -543,6 +601,17 @@ namespace cli }; template <typename X> + struct parser<std::pair<X, std::size_t> > + { + static void + parse (std::pair<X, std::size_t>& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser<X>::parse (x.first, xs, s); + } + }; + + template <typename X> struct parser<std::vector<X> > { static void @@ -556,11 +625,11 @@ namespace cli } }; - template <typename X> - struct parser<std::set<X> > + template <typename X, typename C> + struct parser<std::set<X, C> > { static void - parse (std::set<X>& c, bool& xs, scanner& s) + parse (std::set<X, C>& c, bool& xs, scanner& s) { X x; bool dummy; @@ -570,16 +639,17 @@ namespace cli } }; - template <typename K, typename V> - struct parser<std::map<K, V> > + template <typename K, typename V, typename C> + struct parser<std::map<K, V, C> > { static void - parse (std::map<K, V>& m, bool& xs, scanner& s) + parse (std::map<K, V, C>& m, bool& xs, scanner& s) { const char* o (s.next ()); if (s.more ()) { + std::size_t pos (s.position ()); std::string ov (s.next ()); std::string::size_type p = ov.find ('='); @@ -589,23 +659,24 @@ namespace cli std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); int ac (2); - char* av[] = + char* av[] = { - const_cast<char*> (o), 0 + const_cast<char*> (o), + 0 }; bool dummy; if (!kstr.empty ()) { av[1] = const_cast<char*> (kstr.c_str ()); - argv_scanner s (0, ac, av); + argv_scanner s (0, ac, av, false, pos); parser<K>::parse (k, dummy, s); } if (!vstr.empty ()) { av[1] = const_cast<char*> (vstr.c_str ()); - argv_scanner s (0, ac, av); + argv_scanner s (0, ac, av, false, pos); parser<V>::parse (v, dummy, s); } @@ -618,6 +689,56 @@ namespace cli } }; + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); + + int ac (2); + char* av[] = + { + const_cast<char*> (o), + 0 + }; + + bool dummy; + if (!kstr.empty ()) + { + av[1] = const_cast<char*> (kstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (k, v)); + } + else + throw missing_value (o); + + xs = true; + } + }; + template <typename X, typename T, T X::*M> void thunk (X& x, scanner& s) @@ -625,6 +746,14 @@ namespace cli parser<T>::parse (x.*M, s); } + template <typename X, bool X::*M> + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + template <typename X, typename T, T X::*M, bool X::*S> void thunk (X& x, scanner& s) @@ -634,14 +763,15 @@ namespace cli } #include <map> -#include <cstring> // options // options:: options () -: help_ (), +: build2_metadata_ (), + build2_metadata_specified_ (false), + help_ (), version_ (), I_ (), I_specified_ (false), @@ -852,7 +982,9 @@ options (int& argc, bool erase, ::cli::unknown_mode opt, ::cli::unknown_mode arg) -: help_ (), +: build2_metadata_ (), + build2_metadata_specified_ (false), + help_ (), version_ (), I_ (), I_specified_ (false), @@ -1066,7 +1198,9 @@ options (int start, bool erase, ::cli::unknown_mode opt, ::cli::unknown_mode arg) -: help_ (), +: build2_metadata_ (), + build2_metadata_specified_ (false), + help_ (), version_ (), I_ (), I_specified_ (false), @@ -1280,7 +1414,9 @@ options (int& argc, bool erase, ::cli::unknown_mode opt, ::cli::unknown_mode arg) -: help_ (), +: build2_metadata_ (), + build2_metadata_specified_ (false), + help_ (), version_ (), I_ (), I_specified_ (false), @@ -1496,7 +1632,9 @@ options (int start, bool erase, ::cli::unknown_mode opt, ::cli::unknown_mode arg) -: help_ (), +: build2_metadata_ (), + build2_metadata_specified_ (false), + help_ (), version_ (), I_ (), I_specified_ (false), @@ -1708,7 +1846,9 @@ options:: options (::cli::scanner& s, ::cli::unknown_mode opt, ::cli::unknown_mode arg) -: help_ (), +: build2_metadata_ (), + build2_metadata_specified_ (false), + help_ (), version_ (), I_ (), I_specified_ (false), @@ -2296,6 +2436,15 @@ static _cli_options_desc_type _cli_options_desc_; void options:: fill (::cli::options& os) { + // --build2-metadata + // + { + ::cli::option_names a; + std::string dv; + ::cli::option o ("--build2-metadata", a, false, dv); + os.push_back (o); + } + // --help // { @@ -3355,339 +3504,342 @@ struct _cli_options_map_init { _cli_options_map_init () { - _cli_options_map_["--help"] = - &::cli::thunk< options, bool, &options::help_ >; - _cli_options_map_["--version"] = - &::cli::thunk< options, bool, &options::version_ >; - _cli_options_map_["-I"] = + _cli_options_map_["--build2-metadata"] = + &::cli::thunk< options, std::uint64_t, &options::build2_metadata_, + &options::build2_metadata_specified_ >; + _cli_options_map_["--help"] = + &::cli::thunk< options, &options::help_ >; + _cli_options_map_["--version"] = + &::cli::thunk< options, &options::version_ >; + _cli_options_map_["-I"] = &::cli::thunk< options, std::vector<std::string>, &options::I_, &options::I_specified_ >; - _cli_options_map_["-D"] = + _cli_options_map_["-D"] = &::cli::thunk< options, std::vector<std::string>, &options::D_, &options::D_specified_ >; - _cli_options_map_["-U"] = + _cli_options_map_["-U"] = &::cli::thunk< options, std::vector<std::string>, &options::U_, &options::U_specified_ >; - _cli_options_map_["--database"] = + _cli_options_map_["--database"] = &::cli::thunk< options, std::vector< ::database>, &options::database_, &options::database_specified_ >; - _cli_options_map_["-d"] = + _cli_options_map_["-d"] = &::cli::thunk< options, std::vector< ::database>, &options::database_, &options::database_specified_ >; - _cli_options_map_["--multi-database"] = + _cli_options_map_["--multi-database"] = &::cli::thunk< options, ::multi_database, &options::multi_database_, &options::multi_database_specified_ >; - _cli_options_map_["-m"] = + _cli_options_map_["-m"] = &::cli::thunk< options, ::multi_database, &options::multi_database_, &options::multi_database_specified_ >; - _cli_options_map_["--default-database"] = + _cli_options_map_["--default-database"] = &::cli::thunk< options, ::database, &options::default_database_, &options::default_database_specified_ >; - _cli_options_map_["--generate-query"] = - &::cli::thunk< options, bool, &options::generate_query_ >; - _cli_options_map_["-q"] = - &::cli::thunk< options, bool, &options::generate_query_ >; - _cli_options_map_["--generate-prepared"] = - &::cli::thunk< options, bool, &options::generate_prepared_ >; - _cli_options_map_["--omit-unprepared"] = - &::cli::thunk< options, bool, &options::omit_unprepared_ >; - _cli_options_map_["--generate-session"] = - &::cli::thunk< options, bool, &options::generate_session_ >; - _cli_options_map_["-e"] = - &::cli::thunk< options, bool, &options::generate_session_ >; - _cli_options_map_["--generate-schema"] = - &::cli::thunk< options, bool, &options::generate_schema_ >; - _cli_options_map_["-s"] = - &::cli::thunk< options, bool, &options::generate_schema_ >; - _cli_options_map_["--generate-schema-only"] = - &::cli::thunk< options, bool, &options::generate_schema_only_ >; - _cli_options_map_["--suppress-migration"] = - &::cli::thunk< options, bool, &options::suppress_migration_ >; - _cli_options_map_["--suppress-schema-version"] = - &::cli::thunk< options, bool, &options::suppress_schema_version_ >; - _cli_options_map_["--schema-version-table"] = + _cli_options_map_["--generate-query"] = + &::cli::thunk< options, &options::generate_query_ >; + _cli_options_map_["-q"] = + &::cli::thunk< options, &options::generate_query_ >; + _cli_options_map_["--generate-prepared"] = + &::cli::thunk< options, &options::generate_prepared_ >; + _cli_options_map_["--omit-unprepared"] = + &::cli::thunk< options, &options::omit_unprepared_ >; + _cli_options_map_["--generate-session"] = + &::cli::thunk< options, &options::generate_session_ >; + _cli_options_map_["-e"] = + &::cli::thunk< options, &options::generate_session_ >; + _cli_options_map_["--generate-schema"] = + &::cli::thunk< options, &options::generate_schema_ >; + _cli_options_map_["-s"] = + &::cli::thunk< options, &options::generate_schema_ >; + _cli_options_map_["--generate-schema-only"] = + &::cli::thunk< options, &options::generate_schema_only_ >; + _cli_options_map_["--suppress-migration"] = + &::cli::thunk< options, &options::suppress_migration_ >; + _cli_options_map_["--suppress-schema-version"] = + &::cli::thunk< options, &options::suppress_schema_version_ >; + _cli_options_map_["--schema-version-table"] = &::cli::thunk< options, database_map<qname>, &options::schema_version_table_, &options::schema_version_table_specified_ >; - _cli_options_map_["--schema-format"] = + _cli_options_map_["--schema-format"] = &::cli::thunk< options, database_map<std::set< ::schema_format> >, &options::schema_format_, &options::schema_format_specified_ >; - _cli_options_map_["--omit-drop"] = - &::cli::thunk< options, bool, &options::omit_drop_ >; - _cli_options_map_["--omit-create"] = - &::cli::thunk< options, bool, &options::omit_create_ >; - _cli_options_map_["--schema-name"] = + _cli_options_map_["--omit-drop"] = + &::cli::thunk< options, &options::omit_drop_ >; + _cli_options_map_["--omit-create"] = + &::cli::thunk< options, &options::omit_create_ >; + _cli_options_map_["--schema-name"] = &::cli::thunk< options, database_map<std::string>, &options::schema_name_, &options::schema_name_specified_ >; - _cli_options_map_["--fkeys-deferrable-mode"] = + _cli_options_map_["--fkeys-deferrable-mode"] = &::cli::thunk< options, database_map<deferrable>, &options::fkeys_deferrable_mode_, &options::fkeys_deferrable_mode_specified_ >; - _cli_options_map_["--default-pointer"] = + _cli_options_map_["--default-pointer"] = &::cli::thunk< options, std::string, &options::default_pointer_, &options::default_pointer_specified_ >; - _cli_options_map_["--session-type"] = + _cli_options_map_["--session-type"] = &::cli::thunk< options, std::string, &options::session_type_, &options::session_type_specified_ >; - _cli_options_map_["--profile"] = + _cli_options_map_["--profile"] = &::cli::thunk< options, std::string, &options::profile_, &options::profile_specified_ >; - _cli_options_map_["-p"] = + _cli_options_map_["-p"] = &::cli::thunk< options, std::string, &options::profile_, &options::profile_specified_ >; - _cli_options_map_["--at-once"] = - &::cli::thunk< options, bool, &options::at_once_ >; - _cli_options_map_["--schema"] = + _cli_options_map_["--at-once"] = + &::cli::thunk< options, &options::at_once_ >; + _cli_options_map_["--schema"] = &::cli::thunk< options, database_map<qname>, &options::schema_, &options::schema_specified_ >; - _cli_options_map_["--export-symbol"] = + _cli_options_map_["--export-symbol"] = &::cli::thunk< options, database_map<std::string>, &options::export_symbol_, &options::export_symbol_specified_ >; - _cli_options_map_["--extern-symbol"] = + _cli_options_map_["--extern-symbol"] = &::cli::thunk< options, database_map<std::string>, &options::extern_symbol_, &options::extern_symbol_specified_ >; - _cli_options_map_["--std"] = + _cli_options_map_["--std"] = &::cli::thunk< options, cxx_version, &options::std_, &options::std_specified_ >; - _cli_options_map_["--warn-hard-add"] = - &::cli::thunk< options, bool, &options::warn_hard_add_ >; - _cli_options_map_["--warn-hard-delete"] = - &::cli::thunk< options, bool, &options::warn_hard_delete_ >; - _cli_options_map_["--warn-hard"] = - &::cli::thunk< options, bool, &options::warn_hard_ >; - _cli_options_map_["--output-dir"] = + _cli_options_map_["--warn-hard-add"] = + &::cli::thunk< options, &options::warn_hard_add_ >; + _cli_options_map_["--warn-hard-delete"] = + &::cli::thunk< options, &options::warn_hard_delete_ >; + _cli_options_map_["--warn-hard"] = + &::cli::thunk< options, &options::warn_hard_ >; + _cli_options_map_["--output-dir"] = &::cli::thunk< options, std::string, &options::output_dir_, &options::output_dir_specified_ >; - _cli_options_map_["-o"] = + _cli_options_map_["-o"] = &::cli::thunk< options, std::string, &options::output_dir_, &options::output_dir_specified_ >; - _cli_options_map_["--input-name"] = + _cli_options_map_["--input-name"] = &::cli::thunk< options, std::string, &options::input_name_, &options::input_name_specified_ >; - _cli_options_map_["--changelog"] = + _cli_options_map_["--changelog"] = &::cli::thunk< options, database_map<std::string>, &options::changelog_, &options::changelog_specified_ >; - _cli_options_map_["--changelog-in"] = + _cli_options_map_["--changelog-in"] = &::cli::thunk< options, database_map<std::string>, &options::changelog_in_, &options::changelog_in_specified_ >; - _cli_options_map_["--changelog-out"] = + _cli_options_map_["--changelog-out"] = &::cli::thunk< options, database_map<std::string>, &options::changelog_out_, &options::changelog_out_specified_ >; - _cli_options_map_["--changelog-dir"] = + _cli_options_map_["--changelog-dir"] = &::cli::thunk< options, database_map<std::string>, &options::changelog_dir_, &options::changelog_dir_specified_ >; - _cli_options_map_["--init-changelog"] = - &::cli::thunk< options, bool, &options::init_changelog_ >; - _cli_options_map_["--odb-file-suffix"] = + _cli_options_map_["--init-changelog"] = + &::cli::thunk< options, &options::init_changelog_ >; + _cli_options_map_["--odb-file-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::odb_file_suffix_, &options::odb_file_suffix_specified_ >; - _cli_options_map_["--sql-file-suffix"] = + _cli_options_map_["--sql-file-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::sql_file_suffix_, &options::sql_file_suffix_specified_ >; - _cli_options_map_["--schema-file-suffix"] = + _cli_options_map_["--schema-file-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::schema_file_suffix_, &options::schema_file_suffix_specified_ >; - _cli_options_map_["--changelog-file-suffix"] = + _cli_options_map_["--changelog-file-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::changelog_file_suffix_, &options::changelog_file_suffix_specified_ >; - _cli_options_map_["--hxx-suffix"] = + _cli_options_map_["--hxx-suffix"] = &::cli::thunk< options, std::string, &options::hxx_suffix_, &options::hxx_suffix_specified_ >; - _cli_options_map_["--ixx-suffix"] = + _cli_options_map_["--ixx-suffix"] = &::cli::thunk< options, std::string, &options::ixx_suffix_, &options::ixx_suffix_specified_ >; - _cli_options_map_["--cxx-suffix"] = + _cli_options_map_["--cxx-suffix"] = &::cli::thunk< options, std::string, &options::cxx_suffix_, &options::cxx_suffix_specified_ >; - _cli_options_map_["--sql-suffix"] = + _cli_options_map_["--sql-suffix"] = &::cli::thunk< options, std::string, &options::sql_suffix_, &options::sql_suffix_specified_ >; - _cli_options_map_["--changelog-suffix"] = + _cli_options_map_["--changelog-suffix"] = &::cli::thunk< options, std::string, &options::changelog_suffix_, &options::changelog_suffix_specified_ >; - _cli_options_map_["--hxx-prologue"] = + _cli_options_map_["--hxx-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::hxx_prologue_, &options::hxx_prologue_specified_ >; - _cli_options_map_["--ixx-prologue"] = + _cli_options_map_["--ixx-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::ixx_prologue_, &options::ixx_prologue_specified_ >; - _cli_options_map_["--cxx-prologue"] = + _cli_options_map_["--cxx-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::cxx_prologue_, &options::cxx_prologue_specified_ >; - _cli_options_map_["--schema-prologue"] = + _cli_options_map_["--schema-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::schema_prologue_, &options::schema_prologue_specified_ >; - _cli_options_map_["--sql-prologue"] = + _cli_options_map_["--sql-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_prologue_, &options::sql_prologue_specified_ >; - _cli_options_map_["--migration-prologue"] = + _cli_options_map_["--migration-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::migration_prologue_, &options::migration_prologue_specified_ >; - _cli_options_map_["--sql-interlude"] = + _cli_options_map_["--sql-interlude"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_interlude_, &options::sql_interlude_specified_ >; - _cli_options_map_["--hxx-epilogue"] = + _cli_options_map_["--hxx-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::hxx_epilogue_, &options::hxx_epilogue_specified_ >; - _cli_options_map_["--ixx-epilogue"] = + _cli_options_map_["--ixx-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::ixx_epilogue_, &options::ixx_epilogue_specified_ >; - _cli_options_map_["--cxx-epilogue"] = + _cli_options_map_["--cxx-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::cxx_epilogue_, &options::cxx_epilogue_specified_ >; - _cli_options_map_["--schema-epilogue"] = + _cli_options_map_["--schema-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::schema_epilogue_, &options::schema_epilogue_specified_ >; - _cli_options_map_["--sql-epilogue"] = + _cli_options_map_["--sql-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_epilogue_, &options::sql_epilogue_specified_ >; - _cli_options_map_["--migration-epilogue"] = + _cli_options_map_["--migration-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::migration_epilogue_, &options::migration_epilogue_specified_ >; - _cli_options_map_["--hxx-prologue-file"] = + _cli_options_map_["--hxx-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::hxx_prologue_file_, &options::hxx_prologue_file_specified_ >; - _cli_options_map_["--ixx-prologue-file"] = + _cli_options_map_["--ixx-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::ixx_prologue_file_, &options::ixx_prologue_file_specified_ >; - _cli_options_map_["--cxx-prologue-file"] = + _cli_options_map_["--cxx-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::cxx_prologue_file_, &options::cxx_prologue_file_specified_ >; - _cli_options_map_["--schema-prologue-file"] = + _cli_options_map_["--schema-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::schema_prologue_file_, &options::schema_prologue_file_specified_ >; - _cli_options_map_["--sql-prologue-file"] = + _cli_options_map_["--sql-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_prologue_file_, &options::sql_prologue_file_specified_ >; - _cli_options_map_["--migration-prologue-file"] = + _cli_options_map_["--migration-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::migration_prologue_file_, &options::migration_prologue_file_specified_ >; - _cli_options_map_["--sql-interlude-file"] = + _cli_options_map_["--sql-interlude-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_interlude_file_, &options::sql_interlude_file_specified_ >; - _cli_options_map_["--hxx-epilogue-file"] = + _cli_options_map_["--hxx-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::hxx_epilogue_file_, &options::hxx_epilogue_file_specified_ >; - _cli_options_map_["--ixx-epilogue-file"] = + _cli_options_map_["--ixx-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::ixx_epilogue_file_, &options::ixx_epilogue_file_specified_ >; - _cli_options_map_["--cxx-epilogue-file"] = + _cli_options_map_["--cxx-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::cxx_epilogue_file_, &options::cxx_epilogue_file_specified_ >; - _cli_options_map_["--schema-epilogue-file"] = + _cli_options_map_["--schema-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::schema_epilogue_file_, &options::schema_epilogue_file_specified_ >; - _cli_options_map_["--sql-epilogue-file"] = + _cli_options_map_["--sql-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_epilogue_file_, &options::sql_epilogue_file_specified_ >; - _cli_options_map_["--migration-epilogue-file"] = + _cli_options_map_["--migration-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::migration_epilogue_file_, &options::migration_epilogue_file_specified_ >; - _cli_options_map_["--odb-prologue"] = + _cli_options_map_["--odb-prologue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::odb_prologue_, &options::odb_prologue_specified_ >; - _cli_options_map_["--odb-prologue-file"] = + _cli_options_map_["--odb-prologue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::odb_prologue_file_, &options::odb_prologue_file_specified_ >; - _cli_options_map_["--odb-epilogue"] = + _cli_options_map_["--odb-epilogue"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::odb_epilogue_, &options::odb_epilogue_specified_ >; - _cli_options_map_["--odb-epilogue-file"] = + _cli_options_map_["--odb-epilogue-file"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::odb_epilogue_file_, &options::odb_epilogue_file_specified_ >; - _cli_options_map_["--table-prefix"] = + _cli_options_map_["--table-prefix"] = &::cli::thunk< options, database_map<std::string>, &options::table_prefix_, &options::table_prefix_specified_ >; - _cli_options_map_["--index-suffix"] = + _cli_options_map_["--index-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::index_suffix_, &options::index_suffix_specified_ >; - _cli_options_map_["--fkey-suffix"] = + _cli_options_map_["--fkey-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::fkey_suffix_, &options::fkey_suffix_specified_ >; - _cli_options_map_["--sequence-suffix"] = + _cli_options_map_["--sequence-suffix"] = &::cli::thunk< options, database_map<std::string>, &options::sequence_suffix_, &options::sequence_suffix_specified_ >; - _cli_options_map_["--sql-name-case"] = + _cli_options_map_["--sql-name-case"] = &::cli::thunk< options, database_map<name_case>, &options::sql_name_case_, &options::sql_name_case_specified_ >; - _cli_options_map_["--table-regex"] = + _cli_options_map_["--table-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::table_regex_, &options::table_regex_specified_ >; - _cli_options_map_["--column-regex"] = + _cli_options_map_["--column-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::column_regex_, &options::column_regex_specified_ >; - _cli_options_map_["--index-regex"] = + _cli_options_map_["--index-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::index_regex_, &options::index_regex_specified_ >; - _cli_options_map_["--fkey-regex"] = + _cli_options_map_["--fkey-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::fkey_regex_, &options::fkey_regex_specified_ >; - _cli_options_map_["--sequence-regex"] = + _cli_options_map_["--sequence-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sequence_regex_, &options::sequence_regex_specified_ >; - _cli_options_map_["--statement-regex"] = + _cli_options_map_["--statement-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::statement_regex_, &options::statement_regex_specified_ >; - _cli_options_map_["--sql-name-regex"] = + _cli_options_map_["--sql-name-regex"] = &::cli::thunk< options, database_map<std::vector<std::string> >, &options::sql_name_regex_, &options::sql_name_regex_specified_ >; - _cli_options_map_["--sql-name-regex-trace"] = - &::cli::thunk< options, bool, &options::sql_name_regex_trace_ >; - _cli_options_map_["--accessor-regex"] = + _cli_options_map_["--sql-name-regex-trace"] = + &::cli::thunk< options, &options::sql_name_regex_trace_ >; + _cli_options_map_["--accessor-regex"] = &::cli::thunk< options, std::vector<std::string>, &options::accessor_regex_, &options::accessor_regex_specified_ >; - _cli_options_map_["--accessor-regex-trace"] = - &::cli::thunk< options, bool, &options::accessor_regex_trace_ >; - _cli_options_map_["--modifier-regex"] = + _cli_options_map_["--accessor-regex-trace"] = + &::cli::thunk< options, &options::accessor_regex_trace_ >; + _cli_options_map_["--modifier-regex"] = &::cli::thunk< options, std::vector<std::string>, &options::modifier_regex_, &options::modifier_regex_specified_ >; - _cli_options_map_["--modifier-regex-trace"] = - &::cli::thunk< options, bool, &options::modifier_regex_trace_ >; - _cli_options_map_["--include-with-brackets"] = - &::cli::thunk< options, bool, &options::include_with_brackets_ >; - _cli_options_map_["--include-prefix"] = + _cli_options_map_["--modifier-regex-trace"] = + &::cli::thunk< options, &options::modifier_regex_trace_ >; + _cli_options_map_["--include-with-brackets"] = + &::cli::thunk< options, &options::include_with_brackets_ >; + _cli_options_map_["--include-prefix"] = &::cli::thunk< options, std::string, &options::include_prefix_, &options::include_prefix_specified_ >; - _cli_options_map_["--include-regex"] = + _cli_options_map_["--include-regex"] = &::cli::thunk< options, std::vector<std::string>, &options::include_regex_, &options::include_regex_specified_ >; - _cli_options_map_["--include-regex-trace"] = - &::cli::thunk< options, bool, &options::include_regex_trace_ >; - _cli_options_map_["--guard-prefix"] = + _cli_options_map_["--include-regex-trace"] = + &::cli::thunk< options, &options::include_regex_trace_ >; + _cli_options_map_["--guard-prefix"] = &::cli::thunk< options, std::string, &options::guard_prefix_, &options::guard_prefix_specified_ >; - _cli_options_map_["--show-sloc"] = - &::cli::thunk< options, bool, &options::show_sloc_ >; - _cli_options_map_["--sloc-limit"] = + _cli_options_map_["--show-sloc"] = + &::cli::thunk< options, &options::show_sloc_ >; + _cli_options_map_["--sloc-limit"] = &::cli::thunk< options, std::size_t, &options::sloc_limit_, &options::sloc_limit_specified_ >; - _cli_options_map_["--options-file"] = + _cli_options_map_["--options-file"] = &::cli::thunk< options, std::string, &options::options_file_, &options::options_file_specified_ >; - _cli_options_map_["-x"] = + _cli_options_map_["-x"] = &::cli::thunk< options, std::vector<std::string>, &options::x_, &options::x_specified_ >; - _cli_options_map_["-v"] = - &::cli::thunk< options, bool, &options::v_ >; - _cli_options_map_["--trace"] = - &::cli::thunk< options, bool, &options::trace_ >; - _cli_options_map_["--mysql-engine"] = + _cli_options_map_["-v"] = + &::cli::thunk< options, &options::v_ >; + _cli_options_map_["--trace"] = + &::cli::thunk< options, &options::trace_ >; + _cli_options_map_["--mysql-engine"] = &::cli::thunk< options, std::string, &options::mysql_engine_, &options::mysql_engine_specified_ >; - _cli_options_map_["--sqlite-override-null"] = - &::cli::thunk< options, bool, &options::sqlite_override_null_ >; - _cli_options_map_["--sqlite-lax-auto-id"] = - &::cli::thunk< options, bool, &options::sqlite_lax_auto_id_ >; - _cli_options_map_["--pgsql-server-version"] = + _cli_options_map_["--sqlite-override-null"] = + &::cli::thunk< options, &options::sqlite_override_null_ >; + _cli_options_map_["--sqlite-lax-auto-id"] = + &::cli::thunk< options, &options::sqlite_lax_auto_id_ >; + _cli_options_map_["--pgsql-server-version"] = &::cli::thunk< options, ::pgsql_version, &options::pgsql_server_version_, &options::pgsql_server_version_specified_ >; - _cli_options_map_["--oracle-client-version"] = + _cli_options_map_["--oracle-client-version"] = &::cli::thunk< options, ::oracle_version, &options::oracle_client_version_, &options::oracle_client_version_specified_ >; - _cli_options_map_["--oracle-warn-truncation"] = - &::cli::thunk< options, bool, &options::oracle_warn_truncation_ >; - _cli_options_map_["--mssql-server-version"] = + _cli_options_map_["--oracle-warn-truncation"] = + &::cli::thunk< options, &options::oracle_warn_truncation_ >; + _cli_options_map_["--mssql-server-version"] = &::cli::thunk< options, ::mssql_version, &options::mssql_server_version_, &options::mssql_server_version_specified_ >; - _cli_options_map_["--mssql-short-limit"] = + _cli_options_map_["--mssql-short-limit"] = &::cli::thunk< options, unsigned int, &options::mssql_short_limit_, &options::mssql_short_limit_specified_ >; } @@ -3801,7 +3953,7 @@ _parse (::cli::scanner& s, cf[2] = '\0'; int ac (1); - char* av[] = + char* av[] = { cf }; diff --git a/odb/options.hxx b/odb/pregenerated/odb/options.hxx index 241c8a9..74406a0 100644 --- a/odb/options.hxx +++ b/odb/pregenerated/odb/options.hxx @@ -238,6 +238,14 @@ namespace cli // for the two previous arguments up until a call to a third // peek() or next(). // + // The position() function returns a monotonically-increasing + // number which, if stored, can later be used to determine the + // relative position of the argument returned by the following + // call to next(). Note that if multiple scanners are used to + // extract arguments from multiple sources, then the end + // position of the previous scanner should be used as the + // start position of the next. + // class scanner { public: @@ -255,13 +263,24 @@ namespace cli virtual void skip () = 0; + + virtual std::size_t + position () = 0; }; class argv_scanner: public scanner { public: - argv_scanner (int& argc, char** argv, bool erase = false); - argv_scanner (int start, int& argc, char** argv, bool erase = false); + argv_scanner (int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + argv_scanner (int start, + int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); int end () const; @@ -278,7 +297,11 @@ namespace cli virtual void skip (); - private: + virtual std::size_t + position (); + + protected: + std::size_t start_position_; int i_; int& argc_; char** argv_; @@ -291,16 +314,19 @@ namespace cli argv_file_scanner (int& argc, char** argv, const std::string& option, - bool erase = false); + bool erase = false, + std::size_t start_position = 0); argv_file_scanner (int start, int& argc, char** argv, const std::string& option, - bool erase = false); + bool erase = false, + std::size_t start_position = 0); argv_file_scanner (const std::string& file, - const std::string& option); + const std::string& option, + std::size_t start_position = 0); struct option_info { @@ -317,18 +343,21 @@ namespace cli char** argv, const option_info* options, std::size_t options_count, - bool erase = false); + bool erase = false, + std::size_t start_position = 0); argv_file_scanner (int start, int& argc, char** argv, const option_info* options, std::size_t options_count, - bool erase = false); + bool erase = false, + std::size_t start_position = 0); argv_file_scanner (const std::string& file, const option_info* options = 0, - std::size_t options_count = 0); + std::size_t options_count = 0, + std::size_t start_position = 0); virtual bool more (); @@ -342,6 +371,9 @@ namespace cli virtual void skip (); + virtual std::size_t + position (); + // Return the file path if the peeked at argument came from a file and // the empty string otherwise. The reference is guaranteed to be valid // till the end of the scanner lifetime. @@ -448,6 +480,8 @@ namespace cli #include <cstddef> +#include <cstdint> + #include <odb/option-types.hxx> class options @@ -489,6 +523,21 @@ class options // Option accessors and modifiers. // + const std::uint64_t& + build2_metadata () const; + + std::uint64_t& + build2_metadata (); + + void + build2_metadata (const std::uint64_t&); + + bool + build2_metadata_specified () const; + + void + build2_metadata_specified (bool); + const bool& help () const; @@ -2075,6 +2124,8 @@ class options ::cli::unknown_mode argument); public: + std::uint64_t build2_metadata_; + bool build2_metadata_specified_; bool help_; bool version_; std::vector<std::string> I_; diff --git a/odb/options.ixx b/odb/pregenerated/odb/options.ixx index e0317cb..9a78a2e 100644 --- a/odb/options.ixx +++ b/odb/pregenerated/odb/options.ixx @@ -141,14 +141,29 @@ namespace cli // argv_scanner // inline argv_scanner:: - argv_scanner (int& argc, char** argv, bool erase) - : i_ (1), argc_ (argc), argv_ (argv), erase_ (erase) + argv_scanner (int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + 1), + i_ (1), + argc_ (argc), + argv_ (argv), + erase_ (erase) { } inline argv_scanner:: - argv_scanner (int start, int& argc, char** argv, bool erase) - : i_ (start), argc_ (argc), argv_ (argv), erase_ (erase) + argv_scanner (int start, + int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + static_cast<std::size_t> (start)), + i_ (start), + argc_ (argc), + argv_ (argv), + erase_ (erase) { } @@ -164,8 +179,9 @@ namespace cli argv_file_scanner (int& argc, char** argv, const std::string& option, - bool erase) - : argv_scanner (argc, argv, erase), + bool erase, + std::size_t sp) + : argv_scanner (argc, argv, erase, sp), option_ (option), options_ (&option_info_), options_count_ (1), @@ -181,8 +197,9 @@ namespace cli int& argc, char** argv, const std::string& option, - bool erase) - : argv_scanner (start, argc, argv, erase), + bool erase, + std::size_t sp) + : argv_scanner (start, argc, argv, erase, sp), option_ (option), options_ (&option_info_), options_count_ (1), @@ -195,8 +212,9 @@ namespace cli inline argv_file_scanner:: argv_file_scanner (const std::string& file, - const std::string& option) - : argv_scanner (0, zero_argc_, 0), + const std::string& option, + std::size_t sp) + : argv_scanner (0, zero_argc_, 0, sp), option_ (option), options_ (&option_info_), options_count_ (1), @@ -214,8 +232,9 @@ namespace cli char** argv, const option_info* options, std::size_t options_count, - bool erase) - : argv_scanner (argc, argv, erase), + bool erase, + std::size_t sp) + : argv_scanner (argc, argv, erase, sp), options_ (options), options_count_ (options_count), i_ (1), @@ -229,8 +248,9 @@ namespace cli char** argv, const option_info* options, std::size_t options_count, - bool erase) - : argv_scanner (start, argc, argv, erase), + bool erase, + std::size_t sp) + : argv_scanner (start, argc, argv, erase, sp), options_ (options), options_count_ (options_count), i_ (1), @@ -241,8 +261,9 @@ namespace cli inline argv_file_scanner:: argv_file_scanner (const std::string& file, const option_info* options, - std::size_t options_count) - : argv_scanner (0, zero_argc_, 0), + std::size_t options_count, + std::size_t sp) + : argv_scanner (0, zero_argc_, 0, sp), options_ (options), options_count_ (options_count), i_ (1), @@ -300,6 +321,36 @@ namespace cli // options // +inline const std::uint64_t& options:: +build2_metadata () const +{ + return this->build2_metadata_; +} + +inline std::uint64_t& options:: +build2_metadata () +{ + return this->build2_metadata_; +} + +inline void options:: +build2_metadata (const std::uint64_t& x) +{ + this->build2_metadata_ = x; +} + +inline bool options:: +build2_metadata_specified () const +{ + return this->build2_metadata_specified_; +} + +inline void options:: +build2_metadata_specified (bool x) +{ + this->build2_metadata_specified_ = x; +} + inline const bool& options:: help () const { @@ -313,7 +364,7 @@ help () } inline void options:: -help(const bool& x) +help (const bool& x) { this->help_ = x; } @@ -331,7 +382,7 @@ version () } inline void options:: -version(const bool& x) +version (const bool& x) { this->version_ = x; } @@ -349,7 +400,7 @@ I () } inline void options:: -I(const std::vector<std::string>& x) +I (const std::vector<std::string>& x) { this->I_ = x; } @@ -361,7 +412,7 @@ I_specified () const } inline void options:: -I_specified(bool x) +I_specified (bool x) { this->I_specified_ = x; } @@ -379,7 +430,7 @@ D () } inline void options:: -D(const std::vector<std::string>& x) +D (const std::vector<std::string>& x) { this->D_ = x; } @@ -391,7 +442,7 @@ D_specified () const } inline void options:: -D_specified(bool x) +D_specified (bool x) { this->D_specified_ = x; } @@ -409,7 +460,7 @@ U () } inline void options:: -U(const std::vector<std::string>& x) +U (const std::vector<std::string>& x) { this->U_ = x; } @@ -421,7 +472,7 @@ U_specified () const } inline void options:: -U_specified(bool x) +U_specified (bool x) { this->U_specified_ = x; } @@ -439,7 +490,7 @@ database () } inline void options:: -database(const std::vector< ::database>& x) +database (const std::vector< ::database>& x) { this->database_ = x; } @@ -451,7 +502,7 @@ database_specified () const } inline void options:: -database_specified(bool x) +database_specified (bool x) { this->database_specified_ = x; } @@ -469,7 +520,7 @@ multi_database () } inline void options:: -multi_database(const ::multi_database& x) +multi_database (const ::multi_database& x) { this->multi_database_ = x; } @@ -481,7 +532,7 @@ multi_database_specified () const } inline void options:: -multi_database_specified(bool x) +multi_database_specified (bool x) { this->multi_database_specified_ = x; } @@ -499,7 +550,7 @@ default_database () } inline void options:: -default_database(const ::database& x) +default_database (const ::database& x) { this->default_database_ = x; } @@ -511,7 +562,7 @@ default_database_specified () const } inline void options:: -default_database_specified(bool x) +default_database_specified (bool x) { this->default_database_specified_ = x; } @@ -529,7 +580,7 @@ generate_query () } inline void options:: -generate_query(const bool& x) +generate_query (const bool& x) { this->generate_query_ = x; } @@ -547,7 +598,7 @@ generate_prepared () } inline void options:: -generate_prepared(const bool& x) +generate_prepared (const bool& x) { this->generate_prepared_ = x; } @@ -565,7 +616,7 @@ omit_unprepared () } inline void options:: -omit_unprepared(const bool& x) +omit_unprepared (const bool& x) { this->omit_unprepared_ = x; } @@ -583,7 +634,7 @@ generate_session () } inline void options:: -generate_session(const bool& x) +generate_session (const bool& x) { this->generate_session_ = x; } @@ -601,7 +652,7 @@ generate_schema () } inline void options:: -generate_schema(const bool& x) +generate_schema (const bool& x) { this->generate_schema_ = x; } @@ -619,7 +670,7 @@ generate_schema_only () } inline void options:: -generate_schema_only(const bool& x) +generate_schema_only (const bool& x) { this->generate_schema_only_ = x; } @@ -637,7 +688,7 @@ suppress_migration () } inline void options:: -suppress_migration(const bool& x) +suppress_migration (const bool& x) { this->suppress_migration_ = x; } @@ -655,7 +706,7 @@ suppress_schema_version () } inline void options:: -suppress_schema_version(const bool& x) +suppress_schema_version (const bool& x) { this->suppress_schema_version_ = x; } @@ -673,7 +724,7 @@ schema_version_table () } inline void options:: -schema_version_table(const database_map<qname>& x) +schema_version_table (const database_map<qname>& x) { this->schema_version_table_ = x; } @@ -685,7 +736,7 @@ schema_version_table_specified () const } inline void options:: -schema_version_table_specified(bool x) +schema_version_table_specified (bool x) { this->schema_version_table_specified_ = x; } @@ -703,7 +754,7 @@ schema_format () } inline void options:: -schema_format(const database_map<std::set< ::schema_format> >& x) +schema_format (const database_map<std::set< ::schema_format> >& x) { this->schema_format_ = x; } @@ -715,7 +766,7 @@ schema_format_specified () const } inline void options:: -schema_format_specified(bool x) +schema_format_specified (bool x) { this->schema_format_specified_ = x; } @@ -733,7 +784,7 @@ omit_drop () } inline void options:: -omit_drop(const bool& x) +omit_drop (const bool& x) { this->omit_drop_ = x; } @@ -751,7 +802,7 @@ omit_create () } inline void options:: -omit_create(const bool& x) +omit_create (const bool& x) { this->omit_create_ = x; } @@ -769,7 +820,7 @@ schema_name () } inline void options:: -schema_name(const database_map<std::string>& x) +schema_name (const database_map<std::string>& x) { this->schema_name_ = x; } @@ -781,7 +832,7 @@ schema_name_specified () const } inline void options:: -schema_name_specified(bool x) +schema_name_specified (bool x) { this->schema_name_specified_ = x; } @@ -799,7 +850,7 @@ fkeys_deferrable_mode () } inline void options:: -fkeys_deferrable_mode(const database_map<deferrable>& x) +fkeys_deferrable_mode (const database_map<deferrable>& x) { this->fkeys_deferrable_mode_ = x; } @@ -811,7 +862,7 @@ fkeys_deferrable_mode_specified () const } inline void options:: -fkeys_deferrable_mode_specified(bool x) +fkeys_deferrable_mode_specified (bool x) { this->fkeys_deferrable_mode_specified_ = x; } @@ -829,7 +880,7 @@ default_pointer () } inline void options:: -default_pointer(const std::string& x) +default_pointer (const std::string& x) { this->default_pointer_ = x; } @@ -841,7 +892,7 @@ default_pointer_specified () const } inline void options:: -default_pointer_specified(bool x) +default_pointer_specified (bool x) { this->default_pointer_specified_ = x; } @@ -859,7 +910,7 @@ session_type () } inline void options:: -session_type(const std::string& x) +session_type (const std::string& x) { this->session_type_ = x; } @@ -871,7 +922,7 @@ session_type_specified () const } inline void options:: -session_type_specified(bool x) +session_type_specified (bool x) { this->session_type_specified_ = x; } @@ -889,7 +940,7 @@ profile () } inline void options:: -profile(const std::string& x) +profile (const std::string& x) { this->profile_ = x; } @@ -901,7 +952,7 @@ profile_specified () const } inline void options:: -profile_specified(bool x) +profile_specified (bool x) { this->profile_specified_ = x; } @@ -919,7 +970,7 @@ at_once () } inline void options:: -at_once(const bool& x) +at_once (const bool& x) { this->at_once_ = x; } @@ -937,7 +988,7 @@ schema () } inline void options:: -schema(const database_map<qname>& x) +schema (const database_map<qname>& x) { this->schema_ = x; } @@ -949,7 +1000,7 @@ schema_specified () const } inline void options:: -schema_specified(bool x) +schema_specified (bool x) { this->schema_specified_ = x; } @@ -967,7 +1018,7 @@ export_symbol () } inline void options:: -export_symbol(const database_map<std::string>& x) +export_symbol (const database_map<std::string>& x) { this->export_symbol_ = x; } @@ -979,7 +1030,7 @@ export_symbol_specified () const } inline void options:: -export_symbol_specified(bool x) +export_symbol_specified (bool x) { this->export_symbol_specified_ = x; } @@ -997,7 +1048,7 @@ extern_symbol () } inline void options:: -extern_symbol(const database_map<std::string>& x) +extern_symbol (const database_map<std::string>& x) { this->extern_symbol_ = x; } @@ -1009,7 +1060,7 @@ extern_symbol_specified () const } inline void options:: -extern_symbol_specified(bool x) +extern_symbol_specified (bool x) { this->extern_symbol_specified_ = x; } @@ -1027,7 +1078,7 @@ std () } inline void options:: -std(const cxx_version& x) +std (const cxx_version& x) { this->std_ = x; } @@ -1039,7 +1090,7 @@ std_specified () const } inline void options:: -std_specified(bool x) +std_specified (bool x) { this->std_specified_ = x; } @@ -1057,7 +1108,7 @@ warn_hard_add () } inline void options:: -warn_hard_add(const bool& x) +warn_hard_add (const bool& x) { this->warn_hard_add_ = x; } @@ -1075,7 +1126,7 @@ warn_hard_delete () } inline void options:: -warn_hard_delete(const bool& x) +warn_hard_delete (const bool& x) { this->warn_hard_delete_ = x; } @@ -1093,7 +1144,7 @@ warn_hard () } inline void options:: -warn_hard(const bool& x) +warn_hard (const bool& x) { this->warn_hard_ = x; } @@ -1111,7 +1162,7 @@ output_dir () } inline void options:: -output_dir(const std::string& x) +output_dir (const std::string& x) { this->output_dir_ = x; } @@ -1123,7 +1174,7 @@ output_dir_specified () const } inline void options:: -output_dir_specified(bool x) +output_dir_specified (bool x) { this->output_dir_specified_ = x; } @@ -1141,7 +1192,7 @@ input_name () } inline void options:: -input_name(const std::string& x) +input_name (const std::string& x) { this->input_name_ = x; } @@ -1153,7 +1204,7 @@ input_name_specified () const } inline void options:: -input_name_specified(bool x) +input_name_specified (bool x) { this->input_name_specified_ = x; } @@ -1171,7 +1222,7 @@ changelog () } inline void options:: -changelog(const database_map<std::string>& x) +changelog (const database_map<std::string>& x) { this->changelog_ = x; } @@ -1183,7 +1234,7 @@ changelog_specified () const } inline void options:: -changelog_specified(bool x) +changelog_specified (bool x) { this->changelog_specified_ = x; } @@ -1201,7 +1252,7 @@ changelog_in () } inline void options:: -changelog_in(const database_map<std::string>& x) +changelog_in (const database_map<std::string>& x) { this->changelog_in_ = x; } @@ -1213,7 +1264,7 @@ changelog_in_specified () const } inline void options:: -changelog_in_specified(bool x) +changelog_in_specified (bool x) { this->changelog_in_specified_ = x; } @@ -1231,7 +1282,7 @@ changelog_out () } inline void options:: -changelog_out(const database_map<std::string>& x) +changelog_out (const database_map<std::string>& x) { this->changelog_out_ = x; } @@ -1243,7 +1294,7 @@ changelog_out_specified () const } inline void options:: -changelog_out_specified(bool x) +changelog_out_specified (bool x) { this->changelog_out_specified_ = x; } @@ -1261,7 +1312,7 @@ changelog_dir () } inline void options:: -changelog_dir(const database_map<std::string>& x) +changelog_dir (const database_map<std::string>& x) { this->changelog_dir_ = x; } @@ -1273,7 +1324,7 @@ changelog_dir_specified () const } inline void options:: -changelog_dir_specified(bool x) +changelog_dir_specified (bool x) { this->changelog_dir_specified_ = x; } @@ -1291,7 +1342,7 @@ init_changelog () } inline void options:: -init_changelog(const bool& x) +init_changelog (const bool& x) { this->init_changelog_ = x; } @@ -1309,7 +1360,7 @@ odb_file_suffix () } inline void options:: -odb_file_suffix(const database_map<std::string>& x) +odb_file_suffix (const database_map<std::string>& x) { this->odb_file_suffix_ = x; } @@ -1321,7 +1372,7 @@ odb_file_suffix_specified () const } inline void options:: -odb_file_suffix_specified(bool x) +odb_file_suffix_specified (bool x) { this->odb_file_suffix_specified_ = x; } @@ -1339,7 +1390,7 @@ sql_file_suffix () } inline void options:: -sql_file_suffix(const database_map<std::string>& x) +sql_file_suffix (const database_map<std::string>& x) { this->sql_file_suffix_ = x; } @@ -1351,7 +1402,7 @@ sql_file_suffix_specified () const } inline void options:: -sql_file_suffix_specified(bool x) +sql_file_suffix_specified (bool x) { this->sql_file_suffix_specified_ = x; } @@ -1369,7 +1420,7 @@ schema_file_suffix () } inline void options:: -schema_file_suffix(const database_map<std::string>& x) +schema_file_suffix (const database_map<std::string>& x) { this->schema_file_suffix_ = x; } @@ -1381,7 +1432,7 @@ schema_file_suffix_specified () const } inline void options:: -schema_file_suffix_specified(bool x) +schema_file_suffix_specified (bool x) { this->schema_file_suffix_specified_ = x; } @@ -1399,7 +1450,7 @@ changelog_file_suffix () } inline void options:: -changelog_file_suffix(const database_map<std::string>& x) +changelog_file_suffix (const database_map<std::string>& x) { this->changelog_file_suffix_ = x; } @@ -1411,7 +1462,7 @@ changelog_file_suffix_specified () const } inline void options:: -changelog_file_suffix_specified(bool x) +changelog_file_suffix_specified (bool x) { this->changelog_file_suffix_specified_ = x; } @@ -1429,7 +1480,7 @@ hxx_suffix () } inline void options:: -hxx_suffix(const std::string& x) +hxx_suffix (const std::string& x) { this->hxx_suffix_ = x; } @@ -1441,7 +1492,7 @@ hxx_suffix_specified () const } inline void options:: -hxx_suffix_specified(bool x) +hxx_suffix_specified (bool x) { this->hxx_suffix_specified_ = x; } @@ -1459,7 +1510,7 @@ ixx_suffix () } inline void options:: -ixx_suffix(const std::string& x) +ixx_suffix (const std::string& x) { this->ixx_suffix_ = x; } @@ -1471,7 +1522,7 @@ ixx_suffix_specified () const } inline void options:: -ixx_suffix_specified(bool x) +ixx_suffix_specified (bool x) { this->ixx_suffix_specified_ = x; } @@ -1489,7 +1540,7 @@ cxx_suffix () } inline void options:: -cxx_suffix(const std::string& x) +cxx_suffix (const std::string& x) { this->cxx_suffix_ = x; } @@ -1501,7 +1552,7 @@ cxx_suffix_specified () const } inline void options:: -cxx_suffix_specified(bool x) +cxx_suffix_specified (bool x) { this->cxx_suffix_specified_ = x; } @@ -1519,7 +1570,7 @@ sql_suffix () } inline void options:: -sql_suffix(const std::string& x) +sql_suffix (const std::string& x) { this->sql_suffix_ = x; } @@ -1531,7 +1582,7 @@ sql_suffix_specified () const } inline void options:: -sql_suffix_specified(bool x) +sql_suffix_specified (bool x) { this->sql_suffix_specified_ = x; } @@ -1549,7 +1600,7 @@ changelog_suffix () } inline void options:: -changelog_suffix(const std::string& x) +changelog_suffix (const std::string& x) { this->changelog_suffix_ = x; } @@ -1561,7 +1612,7 @@ changelog_suffix_specified () const } inline void options:: -changelog_suffix_specified(bool x) +changelog_suffix_specified (bool x) { this->changelog_suffix_specified_ = x; } @@ -1579,7 +1630,7 @@ hxx_prologue () } inline void options:: -hxx_prologue(const database_map<std::vector<std::string> >& x) +hxx_prologue (const database_map<std::vector<std::string> >& x) { this->hxx_prologue_ = x; } @@ -1591,7 +1642,7 @@ hxx_prologue_specified () const } inline void options:: -hxx_prologue_specified(bool x) +hxx_prologue_specified (bool x) { this->hxx_prologue_specified_ = x; } @@ -1609,7 +1660,7 @@ ixx_prologue () } inline void options:: -ixx_prologue(const database_map<std::vector<std::string> >& x) +ixx_prologue (const database_map<std::vector<std::string> >& x) { this->ixx_prologue_ = x; } @@ -1621,7 +1672,7 @@ ixx_prologue_specified () const } inline void options:: -ixx_prologue_specified(bool x) +ixx_prologue_specified (bool x) { this->ixx_prologue_specified_ = x; } @@ -1639,7 +1690,7 @@ cxx_prologue () } inline void options:: -cxx_prologue(const database_map<std::vector<std::string> >& x) +cxx_prologue (const database_map<std::vector<std::string> >& x) { this->cxx_prologue_ = x; } @@ -1651,7 +1702,7 @@ cxx_prologue_specified () const } inline void options:: -cxx_prologue_specified(bool x) +cxx_prologue_specified (bool x) { this->cxx_prologue_specified_ = x; } @@ -1669,7 +1720,7 @@ schema_prologue () } inline void options:: -schema_prologue(const database_map<std::vector<std::string> >& x) +schema_prologue (const database_map<std::vector<std::string> >& x) { this->schema_prologue_ = x; } @@ -1681,7 +1732,7 @@ schema_prologue_specified () const } inline void options:: -schema_prologue_specified(bool x) +schema_prologue_specified (bool x) { this->schema_prologue_specified_ = x; } @@ -1699,7 +1750,7 @@ sql_prologue () } inline void options:: -sql_prologue(const database_map<std::vector<std::string> >& x) +sql_prologue (const database_map<std::vector<std::string> >& x) { this->sql_prologue_ = x; } @@ -1711,7 +1762,7 @@ sql_prologue_specified () const } inline void options:: -sql_prologue_specified(bool x) +sql_prologue_specified (bool x) { this->sql_prologue_specified_ = x; } @@ -1729,7 +1780,7 @@ migration_prologue () } inline void options:: -migration_prologue(const database_map<std::vector<std::string> >& x) +migration_prologue (const database_map<std::vector<std::string> >& x) { this->migration_prologue_ = x; } @@ -1741,7 +1792,7 @@ migration_prologue_specified () const } inline void options:: -migration_prologue_specified(bool x) +migration_prologue_specified (bool x) { this->migration_prologue_specified_ = x; } @@ -1759,7 +1810,7 @@ sql_interlude () } inline void options:: -sql_interlude(const database_map<std::vector<std::string> >& x) +sql_interlude (const database_map<std::vector<std::string> >& x) { this->sql_interlude_ = x; } @@ -1771,7 +1822,7 @@ sql_interlude_specified () const } inline void options:: -sql_interlude_specified(bool x) +sql_interlude_specified (bool x) { this->sql_interlude_specified_ = x; } @@ -1789,7 +1840,7 @@ hxx_epilogue () } inline void options:: -hxx_epilogue(const database_map<std::vector<std::string> >& x) +hxx_epilogue (const database_map<std::vector<std::string> >& x) { this->hxx_epilogue_ = x; } @@ -1801,7 +1852,7 @@ hxx_epilogue_specified () const } inline void options:: -hxx_epilogue_specified(bool x) +hxx_epilogue_specified (bool x) { this->hxx_epilogue_specified_ = x; } @@ -1819,7 +1870,7 @@ ixx_epilogue () } inline void options:: -ixx_epilogue(const database_map<std::vector<std::string> >& x) +ixx_epilogue (const database_map<std::vector<std::string> >& x) { this->ixx_epilogue_ = x; } @@ -1831,7 +1882,7 @@ ixx_epilogue_specified () const } inline void options:: -ixx_epilogue_specified(bool x) +ixx_epilogue_specified (bool x) { this->ixx_epilogue_specified_ = x; } @@ -1849,7 +1900,7 @@ cxx_epilogue () } inline void options:: -cxx_epilogue(const database_map<std::vector<std::string> >& x) +cxx_epilogue (const database_map<std::vector<std::string> >& x) { this->cxx_epilogue_ = x; } @@ -1861,7 +1912,7 @@ cxx_epilogue_specified () const } inline void options:: -cxx_epilogue_specified(bool x) +cxx_epilogue_specified (bool x) { this->cxx_epilogue_specified_ = x; } @@ -1879,7 +1930,7 @@ schema_epilogue () } inline void options:: -schema_epilogue(const database_map<std::vector<std::string> >& x) +schema_epilogue (const database_map<std::vector<std::string> >& x) { this->schema_epilogue_ = x; } @@ -1891,7 +1942,7 @@ schema_epilogue_specified () const } inline void options:: -schema_epilogue_specified(bool x) +schema_epilogue_specified (bool x) { this->schema_epilogue_specified_ = x; } @@ -1909,7 +1960,7 @@ sql_epilogue () } inline void options:: -sql_epilogue(const database_map<std::vector<std::string> >& x) +sql_epilogue (const database_map<std::vector<std::string> >& x) { this->sql_epilogue_ = x; } @@ -1921,7 +1972,7 @@ sql_epilogue_specified () const } inline void options:: -sql_epilogue_specified(bool x) +sql_epilogue_specified (bool x) { this->sql_epilogue_specified_ = x; } @@ -1939,7 +1990,7 @@ migration_epilogue () } inline void options:: -migration_epilogue(const database_map<std::vector<std::string> >& x) +migration_epilogue (const database_map<std::vector<std::string> >& x) { this->migration_epilogue_ = x; } @@ -1951,7 +2002,7 @@ migration_epilogue_specified () const } inline void options:: -migration_epilogue_specified(bool x) +migration_epilogue_specified (bool x) { this->migration_epilogue_specified_ = x; } @@ -1969,7 +2020,7 @@ hxx_prologue_file () } inline void options:: -hxx_prologue_file(const database_map<std::vector<std::string> >& x) +hxx_prologue_file (const database_map<std::vector<std::string> >& x) { this->hxx_prologue_file_ = x; } @@ -1981,7 +2032,7 @@ hxx_prologue_file_specified () const } inline void options:: -hxx_prologue_file_specified(bool x) +hxx_prologue_file_specified (bool x) { this->hxx_prologue_file_specified_ = x; } @@ -1999,7 +2050,7 @@ ixx_prologue_file () } inline void options:: -ixx_prologue_file(const database_map<std::vector<std::string> >& x) +ixx_prologue_file (const database_map<std::vector<std::string> >& x) { this->ixx_prologue_file_ = x; } @@ -2011,7 +2062,7 @@ ixx_prologue_file_specified () const } inline void options:: -ixx_prologue_file_specified(bool x) +ixx_prologue_file_specified (bool x) { this->ixx_prologue_file_specified_ = x; } @@ -2029,7 +2080,7 @@ cxx_prologue_file () } inline void options:: -cxx_prologue_file(const database_map<std::vector<std::string> >& x) +cxx_prologue_file (const database_map<std::vector<std::string> >& x) { this->cxx_prologue_file_ = x; } @@ -2041,7 +2092,7 @@ cxx_prologue_file_specified () const } inline void options:: -cxx_prologue_file_specified(bool x) +cxx_prologue_file_specified (bool x) { this->cxx_prologue_file_specified_ = x; } @@ -2059,7 +2110,7 @@ schema_prologue_file () } inline void options:: -schema_prologue_file(const database_map<std::vector<std::string> >& x) +schema_prologue_file (const database_map<std::vector<std::string> >& x) { this->schema_prologue_file_ = x; } @@ -2071,7 +2122,7 @@ schema_prologue_file_specified () const } inline void options:: -schema_prologue_file_specified(bool x) +schema_prologue_file_specified (bool x) { this->schema_prologue_file_specified_ = x; } @@ -2089,7 +2140,7 @@ sql_prologue_file () } inline void options:: -sql_prologue_file(const database_map<std::vector<std::string> >& x) +sql_prologue_file (const database_map<std::vector<std::string> >& x) { this->sql_prologue_file_ = x; } @@ -2101,7 +2152,7 @@ sql_prologue_file_specified () const } inline void options:: -sql_prologue_file_specified(bool x) +sql_prologue_file_specified (bool x) { this->sql_prologue_file_specified_ = x; } @@ -2119,7 +2170,7 @@ migration_prologue_file () } inline void options:: -migration_prologue_file(const database_map<std::vector<std::string> >& x) +migration_prologue_file (const database_map<std::vector<std::string> >& x) { this->migration_prologue_file_ = x; } @@ -2131,7 +2182,7 @@ migration_prologue_file_specified () const } inline void options:: -migration_prologue_file_specified(bool x) +migration_prologue_file_specified (bool x) { this->migration_prologue_file_specified_ = x; } @@ -2149,7 +2200,7 @@ sql_interlude_file () } inline void options:: -sql_interlude_file(const database_map<std::vector<std::string> >& x) +sql_interlude_file (const database_map<std::vector<std::string> >& x) { this->sql_interlude_file_ = x; } @@ -2161,7 +2212,7 @@ sql_interlude_file_specified () const } inline void options:: -sql_interlude_file_specified(bool x) +sql_interlude_file_specified (bool x) { this->sql_interlude_file_specified_ = x; } @@ -2179,7 +2230,7 @@ hxx_epilogue_file () } inline void options:: -hxx_epilogue_file(const database_map<std::vector<std::string> >& x) +hxx_epilogue_file (const database_map<std::vector<std::string> >& x) { this->hxx_epilogue_file_ = x; } @@ -2191,7 +2242,7 @@ hxx_epilogue_file_specified () const } inline void options:: -hxx_epilogue_file_specified(bool x) +hxx_epilogue_file_specified (bool x) { this->hxx_epilogue_file_specified_ = x; } @@ -2209,7 +2260,7 @@ ixx_epilogue_file () } inline void options:: -ixx_epilogue_file(const database_map<std::vector<std::string> >& x) +ixx_epilogue_file (const database_map<std::vector<std::string> >& x) { this->ixx_epilogue_file_ = x; } @@ -2221,7 +2272,7 @@ ixx_epilogue_file_specified () const } inline void options:: -ixx_epilogue_file_specified(bool x) +ixx_epilogue_file_specified (bool x) { this->ixx_epilogue_file_specified_ = x; } @@ -2239,7 +2290,7 @@ cxx_epilogue_file () } inline void options:: -cxx_epilogue_file(const database_map<std::vector<std::string> >& x) +cxx_epilogue_file (const database_map<std::vector<std::string> >& x) { this->cxx_epilogue_file_ = x; } @@ -2251,7 +2302,7 @@ cxx_epilogue_file_specified () const } inline void options:: -cxx_epilogue_file_specified(bool x) +cxx_epilogue_file_specified (bool x) { this->cxx_epilogue_file_specified_ = x; } @@ -2269,7 +2320,7 @@ schema_epilogue_file () } inline void options:: -schema_epilogue_file(const database_map<std::vector<std::string> >& x) +schema_epilogue_file (const database_map<std::vector<std::string> >& x) { this->schema_epilogue_file_ = x; } @@ -2281,7 +2332,7 @@ schema_epilogue_file_specified () const } inline void options:: -schema_epilogue_file_specified(bool x) +schema_epilogue_file_specified (bool x) { this->schema_epilogue_file_specified_ = x; } @@ -2299,7 +2350,7 @@ sql_epilogue_file () } inline void options:: -sql_epilogue_file(const database_map<std::vector<std::string> >& x) +sql_epilogue_file (const database_map<std::vector<std::string> >& x) { this->sql_epilogue_file_ = x; } @@ -2311,7 +2362,7 @@ sql_epilogue_file_specified () const } inline void options:: -sql_epilogue_file_specified(bool x) +sql_epilogue_file_specified (bool x) { this->sql_epilogue_file_specified_ = x; } @@ -2329,7 +2380,7 @@ migration_epilogue_file () } inline void options:: -migration_epilogue_file(const database_map<std::vector<std::string> >& x) +migration_epilogue_file (const database_map<std::vector<std::string> >& x) { this->migration_epilogue_file_ = x; } @@ -2341,7 +2392,7 @@ migration_epilogue_file_specified () const } inline void options:: -migration_epilogue_file_specified(bool x) +migration_epilogue_file_specified (bool x) { this->migration_epilogue_file_specified_ = x; } @@ -2359,7 +2410,7 @@ odb_prologue () } inline void options:: -odb_prologue(const database_map<std::vector<std::string> >& x) +odb_prologue (const database_map<std::vector<std::string> >& x) { this->odb_prologue_ = x; } @@ -2371,7 +2422,7 @@ odb_prologue_specified () const } inline void options:: -odb_prologue_specified(bool x) +odb_prologue_specified (bool x) { this->odb_prologue_specified_ = x; } @@ -2389,7 +2440,7 @@ odb_prologue_file () } inline void options:: -odb_prologue_file(const database_map<std::vector<std::string> >& x) +odb_prologue_file (const database_map<std::vector<std::string> >& x) { this->odb_prologue_file_ = x; } @@ -2401,7 +2452,7 @@ odb_prologue_file_specified () const } inline void options:: -odb_prologue_file_specified(bool x) +odb_prologue_file_specified (bool x) { this->odb_prologue_file_specified_ = x; } @@ -2419,7 +2470,7 @@ odb_epilogue () } inline void options:: -odb_epilogue(const database_map<std::vector<std::string> >& x) +odb_epilogue (const database_map<std::vector<std::string> >& x) { this->odb_epilogue_ = x; } @@ -2431,7 +2482,7 @@ odb_epilogue_specified () const } inline void options:: -odb_epilogue_specified(bool x) +odb_epilogue_specified (bool x) { this->odb_epilogue_specified_ = x; } @@ -2449,7 +2500,7 @@ odb_epilogue_file () } inline void options:: -odb_epilogue_file(const database_map<std::vector<std::string> >& x) +odb_epilogue_file (const database_map<std::vector<std::string> >& x) { this->odb_epilogue_file_ = x; } @@ -2461,7 +2512,7 @@ odb_epilogue_file_specified () const } inline void options:: -odb_epilogue_file_specified(bool x) +odb_epilogue_file_specified (bool x) { this->odb_epilogue_file_specified_ = x; } @@ -2479,7 +2530,7 @@ table_prefix () } inline void options:: -table_prefix(const database_map<std::string>& x) +table_prefix (const database_map<std::string>& x) { this->table_prefix_ = x; } @@ -2491,7 +2542,7 @@ table_prefix_specified () const } inline void options:: -table_prefix_specified(bool x) +table_prefix_specified (bool x) { this->table_prefix_specified_ = x; } @@ -2509,7 +2560,7 @@ index_suffix () } inline void options:: -index_suffix(const database_map<std::string>& x) +index_suffix (const database_map<std::string>& x) { this->index_suffix_ = x; } @@ -2521,7 +2572,7 @@ index_suffix_specified () const } inline void options:: -index_suffix_specified(bool x) +index_suffix_specified (bool x) { this->index_suffix_specified_ = x; } @@ -2539,7 +2590,7 @@ fkey_suffix () } inline void options:: -fkey_suffix(const database_map<std::string>& x) +fkey_suffix (const database_map<std::string>& x) { this->fkey_suffix_ = x; } @@ -2551,7 +2602,7 @@ fkey_suffix_specified () const } inline void options:: -fkey_suffix_specified(bool x) +fkey_suffix_specified (bool x) { this->fkey_suffix_specified_ = x; } @@ -2569,7 +2620,7 @@ sequence_suffix () } inline void options:: -sequence_suffix(const database_map<std::string>& x) +sequence_suffix (const database_map<std::string>& x) { this->sequence_suffix_ = x; } @@ -2581,7 +2632,7 @@ sequence_suffix_specified () const } inline void options:: -sequence_suffix_specified(bool x) +sequence_suffix_specified (bool x) { this->sequence_suffix_specified_ = x; } @@ -2599,7 +2650,7 @@ sql_name_case () } inline void options:: -sql_name_case(const database_map<name_case>& x) +sql_name_case (const database_map<name_case>& x) { this->sql_name_case_ = x; } @@ -2611,7 +2662,7 @@ sql_name_case_specified () const } inline void options:: -sql_name_case_specified(bool x) +sql_name_case_specified (bool x) { this->sql_name_case_specified_ = x; } @@ -2629,7 +2680,7 @@ table_regex () } inline void options:: -table_regex(const database_map<std::vector<std::string> >& x) +table_regex (const database_map<std::vector<std::string> >& x) { this->table_regex_ = x; } @@ -2641,7 +2692,7 @@ table_regex_specified () const } inline void options:: -table_regex_specified(bool x) +table_regex_specified (bool x) { this->table_regex_specified_ = x; } @@ -2659,7 +2710,7 @@ column_regex () } inline void options:: -column_regex(const database_map<std::vector<std::string> >& x) +column_regex (const database_map<std::vector<std::string> >& x) { this->column_regex_ = x; } @@ -2671,7 +2722,7 @@ column_regex_specified () const } inline void options:: -column_regex_specified(bool x) +column_regex_specified (bool x) { this->column_regex_specified_ = x; } @@ -2689,7 +2740,7 @@ index_regex () } inline void options:: -index_regex(const database_map<std::vector<std::string> >& x) +index_regex (const database_map<std::vector<std::string> >& x) { this->index_regex_ = x; } @@ -2701,7 +2752,7 @@ index_regex_specified () const } inline void options:: -index_regex_specified(bool x) +index_regex_specified (bool x) { this->index_regex_specified_ = x; } @@ -2719,7 +2770,7 @@ fkey_regex () } inline void options:: -fkey_regex(const database_map<std::vector<std::string> >& x) +fkey_regex (const database_map<std::vector<std::string> >& x) { this->fkey_regex_ = x; } @@ -2731,7 +2782,7 @@ fkey_regex_specified () const } inline void options:: -fkey_regex_specified(bool x) +fkey_regex_specified (bool x) { this->fkey_regex_specified_ = x; } @@ -2749,7 +2800,7 @@ sequence_regex () } inline void options:: -sequence_regex(const database_map<std::vector<std::string> >& x) +sequence_regex (const database_map<std::vector<std::string> >& x) { this->sequence_regex_ = x; } @@ -2761,7 +2812,7 @@ sequence_regex_specified () const } inline void options:: -sequence_regex_specified(bool x) +sequence_regex_specified (bool x) { this->sequence_regex_specified_ = x; } @@ -2779,7 +2830,7 @@ statement_regex () } inline void options:: -statement_regex(const database_map<std::vector<std::string> >& x) +statement_regex (const database_map<std::vector<std::string> >& x) { this->statement_regex_ = x; } @@ -2791,7 +2842,7 @@ statement_regex_specified () const } inline void options:: -statement_regex_specified(bool x) +statement_regex_specified (bool x) { this->statement_regex_specified_ = x; } @@ -2809,7 +2860,7 @@ sql_name_regex () } inline void options:: -sql_name_regex(const database_map<std::vector<std::string> >& x) +sql_name_regex (const database_map<std::vector<std::string> >& x) { this->sql_name_regex_ = x; } @@ -2821,7 +2872,7 @@ sql_name_regex_specified () const } inline void options:: -sql_name_regex_specified(bool x) +sql_name_regex_specified (bool x) { this->sql_name_regex_specified_ = x; } @@ -2839,7 +2890,7 @@ sql_name_regex_trace () } inline void options:: -sql_name_regex_trace(const bool& x) +sql_name_regex_trace (const bool& x) { this->sql_name_regex_trace_ = x; } @@ -2857,7 +2908,7 @@ accessor_regex () } inline void options:: -accessor_regex(const std::vector<std::string>& x) +accessor_regex (const std::vector<std::string>& x) { this->accessor_regex_ = x; } @@ -2869,7 +2920,7 @@ accessor_regex_specified () const } inline void options:: -accessor_regex_specified(bool x) +accessor_regex_specified (bool x) { this->accessor_regex_specified_ = x; } @@ -2887,7 +2938,7 @@ accessor_regex_trace () } inline void options:: -accessor_regex_trace(const bool& x) +accessor_regex_trace (const bool& x) { this->accessor_regex_trace_ = x; } @@ -2905,7 +2956,7 @@ modifier_regex () } inline void options:: -modifier_regex(const std::vector<std::string>& x) +modifier_regex (const std::vector<std::string>& x) { this->modifier_regex_ = x; } @@ -2917,7 +2968,7 @@ modifier_regex_specified () const } inline void options:: -modifier_regex_specified(bool x) +modifier_regex_specified (bool x) { this->modifier_regex_specified_ = x; } @@ -2935,7 +2986,7 @@ modifier_regex_trace () } inline void options:: -modifier_regex_trace(const bool& x) +modifier_regex_trace (const bool& x) { this->modifier_regex_trace_ = x; } @@ -2953,7 +3004,7 @@ include_with_brackets () } inline void options:: -include_with_brackets(const bool& x) +include_with_brackets (const bool& x) { this->include_with_brackets_ = x; } @@ -2971,7 +3022,7 @@ include_prefix () } inline void options:: -include_prefix(const std::string& x) +include_prefix (const std::string& x) { this->include_prefix_ = x; } @@ -2983,7 +3034,7 @@ include_prefix_specified () const } inline void options:: -include_prefix_specified(bool x) +include_prefix_specified (bool x) { this->include_prefix_specified_ = x; } @@ -3001,7 +3052,7 @@ include_regex () } inline void options:: -include_regex(const std::vector<std::string>& x) +include_regex (const std::vector<std::string>& x) { this->include_regex_ = x; } @@ -3013,7 +3064,7 @@ include_regex_specified () const } inline void options:: -include_regex_specified(bool x) +include_regex_specified (bool x) { this->include_regex_specified_ = x; } @@ -3031,7 +3082,7 @@ include_regex_trace () } inline void options:: -include_regex_trace(const bool& x) +include_regex_trace (const bool& x) { this->include_regex_trace_ = x; } @@ -3049,7 +3100,7 @@ guard_prefix () } inline void options:: -guard_prefix(const std::string& x) +guard_prefix (const std::string& x) { this->guard_prefix_ = x; } @@ -3061,7 +3112,7 @@ guard_prefix_specified () const } inline void options:: -guard_prefix_specified(bool x) +guard_prefix_specified (bool x) { this->guard_prefix_specified_ = x; } @@ -3079,7 +3130,7 @@ show_sloc () } inline void options:: -show_sloc(const bool& x) +show_sloc (const bool& x) { this->show_sloc_ = x; } @@ -3097,7 +3148,7 @@ sloc_limit () } inline void options:: -sloc_limit(const std::size_t& x) +sloc_limit (const std::size_t& x) { this->sloc_limit_ = x; } @@ -3109,7 +3160,7 @@ sloc_limit_specified () const } inline void options:: -sloc_limit_specified(bool x) +sloc_limit_specified (bool x) { this->sloc_limit_specified_ = x; } @@ -3127,7 +3178,7 @@ options_file () } inline void options:: -options_file(const std::string& x) +options_file (const std::string& x) { this->options_file_ = x; } @@ -3139,7 +3190,7 @@ options_file_specified () const } inline void options:: -options_file_specified(bool x) +options_file_specified (bool x) { this->options_file_specified_ = x; } @@ -3157,7 +3208,7 @@ x () } inline void options:: -x(const std::vector<std::string>& x) +x (const std::vector<std::string>& x) { this->x_ = x; } @@ -3169,7 +3220,7 @@ x_specified () const } inline void options:: -x_specified(bool x) +x_specified (bool x) { this->x_specified_ = x; } @@ -3187,7 +3238,7 @@ v () } inline void options:: -v(const bool& x) +v (const bool& x) { this->v_ = x; } @@ -3205,7 +3256,7 @@ trace () } inline void options:: -trace(const bool& x) +trace (const bool& x) { this->trace_ = x; } @@ -3223,7 +3274,7 @@ mysql_engine () } inline void options:: -mysql_engine(const std::string& x) +mysql_engine (const std::string& x) { this->mysql_engine_ = x; } @@ -3235,7 +3286,7 @@ mysql_engine_specified () const } inline void options:: -mysql_engine_specified(bool x) +mysql_engine_specified (bool x) { this->mysql_engine_specified_ = x; } @@ -3253,7 +3304,7 @@ sqlite_override_null () } inline void options:: -sqlite_override_null(const bool& x) +sqlite_override_null (const bool& x) { this->sqlite_override_null_ = x; } @@ -3271,7 +3322,7 @@ sqlite_lax_auto_id () } inline void options:: -sqlite_lax_auto_id(const bool& x) +sqlite_lax_auto_id (const bool& x) { this->sqlite_lax_auto_id_ = x; } @@ -3289,7 +3340,7 @@ pgsql_server_version () } inline void options:: -pgsql_server_version(const ::pgsql_version& x) +pgsql_server_version (const ::pgsql_version& x) { this->pgsql_server_version_ = x; } @@ -3301,7 +3352,7 @@ pgsql_server_version_specified () const } inline void options:: -pgsql_server_version_specified(bool x) +pgsql_server_version_specified (bool x) { this->pgsql_server_version_specified_ = x; } @@ -3319,7 +3370,7 @@ oracle_client_version () } inline void options:: -oracle_client_version(const ::oracle_version& x) +oracle_client_version (const ::oracle_version& x) { this->oracle_client_version_ = x; } @@ -3331,7 +3382,7 @@ oracle_client_version_specified () const } inline void options:: -oracle_client_version_specified(bool x) +oracle_client_version_specified (bool x) { this->oracle_client_version_specified_ = x; } @@ -3349,7 +3400,7 @@ oracle_warn_truncation () } inline void options:: -oracle_warn_truncation(const bool& x) +oracle_warn_truncation (const bool& x) { this->oracle_warn_truncation_ = x; } @@ -3367,7 +3418,7 @@ mssql_server_version () } inline void options:: -mssql_server_version(const ::mssql_version& x) +mssql_server_version (const ::mssql_version& x) { this->mssql_server_version_ = x; } @@ -3379,7 +3430,7 @@ mssql_server_version_specified () const } inline void options:: -mssql_server_version_specified(bool x) +mssql_server_version_specified (bool x) { this->mssql_server_version_specified_ = x; } @@ -3397,7 +3448,7 @@ mssql_short_limit () } inline void options:: -mssql_short_limit(const unsigned int& x) +mssql_short_limit (const unsigned int& x) { this->mssql_short_limit_ = x; } @@ -3409,7 +3460,7 @@ mssql_short_limit_specified () const } inline void options:: -mssql_short_limit_specified(bool x) +mssql_short_limit_specified (bool x) { this->mssql_short_limit_specified_ = x; } diff --git a/odb/processor.cxx b/odb/processor.cxx index dd0a706..d48baa7 100644 --- a/odb/processor.cxx +++ b/odb/processor.cxx @@ -1395,8 +1395,6 @@ namespace string const& prefix, bool obj_ptr) { - process_wrapper (t); - if (composite_wrapper (t)) return; @@ -1665,6 +1663,16 @@ namespace } } + // Determine if container value/index/key types are wrappers. + // + process_wrapper (*vt); + + if (it != 0) + process_wrapper (*it); + + if (kt != 0) + process_wrapper (*kt); + // Check if we are versioned. For now we are not allowing for // soft-add/delete in container keys (might be used in WHERE, // primary key). @@ -1675,16 +1683,16 @@ namespace { case ck_ordered: { - comp = composite (*vt); + comp = composite_wrapper (*vt); break; } case ck_map: case ck_multimap: { - comp = composite (*kt); + comp = composite_wrapper (*kt); if (comp == 0 || column_count (*comp).soft == 0) { - comp = composite (*vt); + comp = composite_wrapper (*vt); break; } @@ -1696,7 +1704,7 @@ namespace case ck_set: case ck_multiset: { - comp = composite (*vt); + comp = composite_wrapper (*vt); if (comp == 0 || column_count (*comp).soft == 0) { comp = 0; @@ -2186,8 +2194,13 @@ namespace namespace_* ns (dynamic_cast<namespace_*> (s)); - if (ns == 0) - continue; // Some other scope. + if (ns == 0) // Some other scope. + { + if (!s->named_p ()) + break; + + continue; + } if (ns->extension ()) ns = &ns->original (); @@ -2199,7 +2212,7 @@ namespace break; } - if (ns->global_scope ()) + if (ns->global_scope ()) // Note: namespaces always named. break; } @@ -2694,15 +2707,20 @@ namespace namespace_* ns (dynamic_cast<namespace_*> (s)); - if (ns == 0) - continue; // Some other scope. + if (ns == 0) // Some other scope. + { + if (!s->named_p ()) + break; + + continue; + } if (ns->extension ()) ns = &ns->original (); if (!ns->count ("pointer")) { - if (ns->global_scope ()) + if (ns->global_scope ()) // Note: namespace always named. break; else continue; diff --git a/odb/profile.hxx b/odb/profile.hxx index 8b892dc..b6e8e53 100644 --- a/odb/profile.hxx +++ b/odb/profile.hxx @@ -8,7 +8,7 @@ #include <vector> #include <string> -#include <cutl/fs/path.hxx> +#include <libcutl/fs/path.hxx> #include <odb/option-types.hxx> diff --git a/odb/relational/generate.hxx b/odb/relational/generate.hxx index c3d19c7..e597fb8 100644 --- a/odb/relational/generate.hxx +++ b/odb/relational/generate.hxx @@ -5,7 +5,7 @@ #define ODB_RELATIONAL_GENERATE_HXX #include <string> -#include <cutl/shared-ptr.hxx> +#include <libcutl/shared-ptr.hxx> #include <odb/context.hxx> #include <odb/semantics/relational/model.hxx> diff --git a/odb/relational/header.hxx b/odb/relational/header.hxx index 30a61ea..964aff2 100644 --- a/odb/relational/header.hxx +++ b/odb/relational/header.hxx @@ -47,6 +47,8 @@ namespace relational typedef typename member_base_impl<T>::member_info member_info; + using member_base_impl<T>::container; + virtual bool pre (member_info& mi) { diff --git a/odb/relational/inline.hxx b/odb/relational/inline.hxx index 48ababf..a609cc1 100644 --- a/odb/relational/inline.hxx +++ b/odb/relational/inline.hxx @@ -678,6 +678,10 @@ namespace relational virtual void generate () { + if (versioned ()) + os << "#include <odb/schema-version.hxx>" << endl + << endl; + if (features.polymorphic_object && options.generate_query ()) os << "#include <odb/details/unique-ptr.hxx>" << endl << endl; diff --git a/odb/relational/model.hxx b/odb/relational/model.hxx index b7a07ea..fdfa8fd 100644 --- a/odb/relational/model.hxx +++ b/odb/relational/model.hxx @@ -555,9 +555,9 @@ namespace relational } virtual string - table_options (semantics::data_member&, semantics::type&) + table_options (semantics::data_member& m, semantics::type& ct) { - return ""; + return context::table_options (m, ct); } virtual void @@ -784,9 +784,9 @@ namespace relational class_ (sema_rel::model& model): model_ (model) {} virtual string - table_options (type&) + table_options (type& c) { - return ""; + return context::table_options (c); } virtual void diff --git a/odb/relational/mysql/model.cxx b/odb/relational/mysql/model.cxx index 2ec9d8b..17ed4c0 100644 --- a/odb/relational/mysql/model.cxx +++ b/odb/relational/mysql/model.cxx @@ -110,10 +110,23 @@ namespace relational member_create (base const& x): base (x) {} virtual string - table_options (semantics::data_member&, semantics::type&) + table_options (semantics::data_member& m, semantics::type& c) { + string r (relational::member_create::table_options (m, c)); + string const& engine (options.mysql_engine ()); - return engine != "default" ? "ENGINE=" + engine : ""; + if (engine != "default") + { + // Note: MySQL table options can be separated with spaces. + // + if (!r.empty ()) + r += ' '; + + r += "ENGINE="; + r += engine; + } + + return r; } }; entry<member_create> member_create_; @@ -123,10 +136,23 @@ namespace relational class_ (base const& x): base (x) {} virtual string - table_options (type&) + table_options (type& c) { + string r (relational::class_::table_options (c)); + string const& engine (options.mysql_engine ()); - return engine != "default" ? "ENGINE=" + engine : ""; + if (engine != "default") + { + // Note: MySQL table options can be separated with spaces. + // + if (!r.empty ()) + r += ' '; + + r += "ENGINE="; + r += engine; + } + + return r; } }; entry<class_> class__; diff --git a/odb/relational/pgsql/context.cxx b/odb/relational/pgsql/context.cxx index a9f34dd..7f99f5d 100644 --- a/odb/relational/pgsql/context.cxx +++ b/odb/relational/pgsql/context.cxx @@ -85,7 +85,7 @@ namespace relational insert_send_auto_id = false; delay_freeing_statement_result = false; need_image_clone = false; - generate_bulk = false; + generate_bulk = true; global_index = true; global_fkey = false; data_->bind_vector_ = "pgsql::bind*"; diff --git a/odb/relational/pgsql/header.cxx b/odb/relational/pgsql/header.cxx index ff00eaa..c3efc3e 100644 --- a/odb/relational/pgsql/header.cxx +++ b/odb/relational/pgsql/header.cxx @@ -87,6 +87,20 @@ namespace relational } os << endl; + + if (poly_derived) + return; + + // Bulk operations batch size. + // + { + unsigned long long b (c.count ("bulk") + ? c.get<unsigned long long> ("bulk") + : 1); + + os << "static const std::size_t batch = " << b << "UL;" + << endl; + } } virtual void diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx index 580103d..b881e48 100644 --- a/odb/relational/pgsql/source.cxx +++ b/odb/relational/pgsql/source.cxx @@ -203,7 +203,7 @@ namespace relational traverse_numeric (member_info& mi) { os << b << ".type = pgsql::bind::numeric;" - << b << ".buffer = " << arg << "." << mi.var << "value.data ();" + << b << ".buffer = " << arg << "." << mi.var << "value.data_ptr ();" << b << ".capacity = " << arg << "." << mi.var << "value.capacity ();" << b << ".size = &" << arg << "." << mi.var << "size;" @@ -224,7 +224,7 @@ namespace relational { os << b << ".type = " << char_bin_buffer_types[mi.st->type - sql_type::CHAR] << ";" - << b << ".buffer = " << arg << "." << mi.var << "value.data ();" + << b << ".buffer = " << arg << "." << mi.var << "value.data_ptr ();" << b << ".capacity = " << arg << "." << mi.var << "value.capacity ();" << b << ".size = &" << arg << "." << mi.var << "size;" @@ -245,7 +245,7 @@ namespace relational traverse_varbit (member_info& mi) { os << b << ".type = pgsql::bind::varbit;" - << b << ".buffer = " << arg << "." << mi.var << "value.data ();" + << b << ".buffer = " << arg << "." << mi.var << "value.data_ptr ();" << b << ".capacity = " << arg << "." << mi.var << "value.capacity ();" << b << ".size = &" << arg << "." << mi.var << "size;" diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx index aac8d79..0f60359 100644 --- a/odb/relational/processor.cxx +++ b/odb/relational/processor.cxx @@ -1456,6 +1456,8 @@ namespace relational object_members_base::traverse (*pointer.obj); } + using object_members_base::traverse; // Unhide. + virtual void traverse_pointer (semantics::data_member& m, semantics::class_& c) { diff --git a/odb/relational/schema.hxx b/odb/relational/schema.hxx index c5e16c6..cd975b7 100644 --- a/odb/relational/schema.hxx +++ b/odb/relational/schema.hxx @@ -442,6 +442,9 @@ namespace relational traverse (*t, true); } + using add_table::traverse; // Unhide. + using alter_table::traverse; // Unhide. + using table::names; void diff --git a/odb/relational/source.cxx b/odb/relational/source.cxx index 20c431a..e00626a 100644 --- a/odb/relational/source.cxx +++ b/odb/relational/source.cxx @@ -1169,14 +1169,13 @@ traverse_object (type& c) os << ", bool top, bool dyn"; os << ")" - << "{" - << "ODB_POTENTIALLY_UNUSED (db);"; + << "{"; if (poly) - os << "ODB_POTENTIALLY_UNUSED (top);"; + os << "ODB_POTENTIALLY_UNUSED (top);" + << endl; - os << endl - << "using namespace " << db << ";" + os << "using namespace " << db << ";" << endl; if (poly) @@ -1201,7 +1200,7 @@ traverse_object (type& c) << endl; os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -1441,13 +1440,11 @@ traverse_object (type& c) << "std::size_t n," << endl << "multiple_exceptions& mex)" << "{" - << "ODB_POTENTIALLY_UNUSED (db);" - << endl << "using namespace " << db << ";" << endl; os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -1464,13 +1461,25 @@ traverse_object (type& c) << "{" << "const object_type& obj (*objs[i]);" << "callback (db, obj, callback_event::pre_persist);" - //@@ assumption: generate_grow is false + //@@ assumption: generate_grow is false or it only affects select (like + // in pgsql) so all we have to do is to increment image + // version if it grew. //@@ assumption: insert_send_auto_id is false - << "init (sts.image (i), obj, statement_insert" << - (versioned ? ", svm" : "") << ");" + << "image_type& im (sts.image (i));"; + + if (generate_grow) + os << "if ("; + + os << "init (im, obj, statement_insert" << (versioned ? ", svm" : "") << ")"; + + if (generate_grow) + os << " && i == 0)" << endl + << "im.version++"; + + os << ";" << "}"; - //@@ assumption: generate_grow is false + //@@ assumption: generate_grow: as above os << "binding& imb (sts.insert_image_binding ());" << "if (imb.version == 0)" << "{" @@ -1486,7 +1495,7 @@ traverse_object (type& c) if (bv || auto_id) { os << "binding& idb (sts.id_image_binding ());" - //@@ assumption: generate_grow is false + //@@ assumption: generate_grow: as above << "if (idb.version == 0)" << "{" << "bind (idb.bind, sts.id_image ());" @@ -1692,7 +1701,7 @@ traverse_object (type& c) sts = true; os << db << "::transaction& tr (" << db << "::transaction::current ());" - << db << "::connection& conn (tr.connection ());" + << db << "::connection& conn (tr.connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl; @@ -1787,7 +1796,7 @@ traverse_object (type& c) { os << db << "::transaction& tr (" << db << "::transaction::current ());" - << db << "::connection& conn (tr.connection ());" + << db << "::connection& conn (tr.connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl; @@ -1877,7 +1886,7 @@ traverse_object (type& c) if (!sts) os << db << "::transaction& tr (" << db << "::transaction::current ());" - << db << "::connection& conn (tr.connection ());" + << db << "::connection& conn (tr.connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl; @@ -1976,7 +1985,7 @@ traverse_object (type& c) if (!sts) os << db << "::transaction& tr (" << db << "::transaction::current ());" - << db << "::connection& conn (tr.connection ());" + << db << "::connection& conn (tr.connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl; @@ -2194,13 +2203,11 @@ traverse_object (type& c) << "std::size_t n," << endl << "multiple_exceptions& mex)" << "{" - << "ODB_POTENTIALLY_UNUSED (db);" - << endl << "using namespace " << db << ";" << "using " << db << "::update_statement;" << endl << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -2217,9 +2224,24 @@ traverse_object (type& c) if (opt != 0) os << "const version_type& v (version (obj));"; - os << "init (sts.id_image (i), id (obj)" << (opt != 0 ? ", &v" : "") << ");" - //@@ assumption: generate_grow false - << "init (sts.image (i), obj, statement_update);" + os << "init (sts.id_image (i), id (obj)" << (opt != 0 ? ", &v" : "") << ");"; + + //@@ assumption: generate_grow is false or it only affects select (like + // in pgsql) so all we have to do is to increment image + // version if it grew. + + os << "image_type& im (sts.image (i));"; + + if (generate_grow) + os << "if ("; + + os << "init (im, obj, statement_update" << (versioned ? ", svm" : "") << ")"; + + if (generate_grow) + os << " && i == 0)" << endl + << "im.version++"; + + os << ";" << "}"; // Update bindings. @@ -2228,7 +2250,7 @@ traverse_object (type& c) << "binding& imb (sts.update_image_binding ());" << endl; - //@@ assumption: generate_grow false + //@@ assumption: generate_grow: as above // os << "bool u (false);" // Avoid incrementing version twice. << "if (imb.version == 0)" @@ -2239,7 +2261,7 @@ traverse_object (type& c) << "u = true;" << "}"; - //@@ assumption: generate_grow false + //@@ assumption: generate_grow: as above // os << "if (idb.version == 0)" << "{" @@ -2321,16 +2343,15 @@ traverse_object (type& c) os << ")" << "{" - << "using namespace " << db << ";" - << endl - << "ODB_POTENTIALLY_UNUSED (db);"; + << "using namespace " << db << ";"; if (poly) - os << "ODB_POTENTIALLY_UNUSED (top);"; + os << endl + << "ODB_POTENTIALLY_UNUSED (top);"; os << endl << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl; @@ -2449,10 +2470,8 @@ traverse_object (type& c) << "{" << "using namespace " << db << ";" << endl - << "ODB_POTENTIALLY_UNUSED (db);" - << endl << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl @@ -2460,7 +2479,8 @@ traverse_object (type& c) << "init (sts.id_image (i), *ids[i]);" << endl << "binding& idb (sts.id_image_binding ());" - //@@ assumption: generate_grow false + //@@ assumption: generate_grow is false or it only affects select (like + // in pgsql). << "if (idb.version == 0)" << "{" << "bind (idb.bind, sts.id_image ());" @@ -2542,7 +2562,7 @@ traverse_object (type& c) os << "using namespace " << db << ";" << endl << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -2830,10 +2850,8 @@ traverse_object (type& c) { os << "using namespace " << db << ";" << endl - << "ODB_POTENTIALLY_UNUSED (db);" - << endl << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl @@ -2846,7 +2864,8 @@ traverse_object (type& c) << "}"; os << "binding& idb (sts.id_image_binding ());" - //@@ assumption: generate_grow false + //@@ assumption: generate_grow is false or it only affects select + // (like in pgsql). << "if (idb.version == 0)" << "{" << "bind (idb.bind, sts.id_image ());" @@ -2917,7 +2936,7 @@ traverse_object (type& c) os << "}"; os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -3110,7 +3129,7 @@ traverse_object (type& c) if (!abst) { os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -3217,7 +3236,7 @@ traverse_object (type& c) if (!abst) { os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -3909,7 +3928,7 @@ traverse_object (type& c) << endl << "object_type& obj (static_cast<object_type&> (r));" << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());" << endl @@ -4135,7 +4154,7 @@ traverse_object (type& c) // os << "result< " << traits << "::object_type >" << endl << traits << "::" << endl - << "query (database&, const query_base_type& q)" + << "query (database& db, const query_base_type& q)" << "{" << "using namespace " << db << ";" << "using odb::details::shared;" @@ -4143,7 +4162,7 @@ traverse_object (type& c) << endl; os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << endl << "statements_type& sts (" << endl << "conn.statement_cache ().find_object<object_type> ());"; @@ -4224,12 +4243,12 @@ traverse_object (type& c) // erase_query // os << "unsigned long long " << traits << "::" << endl - << "erase_query (database&, const query_base_type& q)" + << "erase_query (database& db, const query_base_type& q)" << "{" << "using namespace " << db << ";" << endl << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << endl << "std::string text (erase_query_statement);" << "if (!q.empty ())" @@ -4363,16 +4382,15 @@ traverse_object (type& c) << "static_cast<select_statement*> (pq.stmt.get ())));" << endl; - os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + os << db << "::transaction& tr (" << db << "::transaction::current ());" << endl << "// The connection used by the current transaction and the" << endl << "// one used to prepare this statement must be the same." << endl << "//" << endl - << "assert (&conn == &st->connection ());" + << "assert (q.verify_connection (tr));" << endl << "statements_type& sts (" << endl - << "conn.statement_cache ().find_object<object_type> ());"; + << "st->connection ().statement_cache ().find_object<object_type> ());"; if (versioned) os << "const schema_version_migration& svm (" << @@ -5265,9 +5283,11 @@ traverse_view (type& c) << "throw session_required ();" << endl; + // Note: db must be not NULL in order to load pointers. + // if (has_a (c, test_pointer)) os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (*db));" << endl; names (c, init_view_pointer_member_pre_names_); @@ -5514,7 +5534,7 @@ traverse_view (type& c) { os << "result< " << traits << "::view_type >" << endl << traits << "::" << endl - << "query (database&, const query_base_type& q)" + << "query (database& db, const query_base_type& q)" << "{" << "using namespace " << db << ";" << "using odb::details::shared;" @@ -5522,7 +5542,7 @@ traverse_view (type& c) << endl; os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + << db << "::transaction::current ().connection (db));" << "statements_type& sts (" << endl << "conn.statement_cache ().find_view<view_type> ());"; @@ -5662,16 +5682,15 @@ traverse_view (type& c) << "static_cast<select_statement*> (pq.stmt.get ())));" << endl; - os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + os << db << "::transaction& tr (" << db << "::transaction::current ());" << endl << "// The connection used by the current transaction and the" << endl << "// one used to prepare this statement must be the same." << endl << "//" << endl - << "assert (&conn == &st->connection ());" + << "assert (q.verify_connection (tr));" << endl << "statements_type& sts (" << endl - << "conn.statement_cache ().find_view<view_type> ());"; + << "st->connection ().statement_cache ().find_view<view_type> ());"; if (versioned) os << "const schema_version_migration& svm (" << diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index f82b5ad..3c6f5da 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -1370,6 +1370,8 @@ namespace relational typedef typename member_base_impl<T>::member_info member_info; + using member_base_impl<T>::container; + virtual bool pre (member_info& mi) { @@ -1751,6 +1753,8 @@ namespace relational typedef typename member_base_impl<T>::member_info member_info; + using member_base_impl<T>::container; + virtual bool pre (member_info& mi) { @@ -2025,6 +2029,8 @@ namespace relational typedef typename member_base_impl<T>::member_info member_info; + using member_base_impl<T>::container; + virtual void set_null (member_info&) = 0; @@ -2496,6 +2502,8 @@ namespace relational typedef typename member_base_impl<T>::member_info member_info; + using member_base_impl<T>::container; + virtual void get_null (string const& var) const = 0; @@ -6473,6 +6481,8 @@ namespace relational rs->base = 0; } + using class_::traverse; // Unhide. + protected: semantics::class_& c_; string scope_; @@ -6553,6 +6563,7 @@ namespace relational : typedefs_ (false), query_columns_type_ (false, false, false), view_query_columns_type_ (false), + index_ (0), grow_base_ (index_), grow_member_ (index_), grow_version_member_ (index_, "version_"), @@ -6581,6 +6592,7 @@ namespace relational typedefs_ (false), query_columns_type_ (false, false, false), view_query_columns_type_ (false), + index_ (0), grow_base_ (index_), grow_member_ (index_), grow_version_member_ (index_, "version_"), diff --git a/odb/relational/sqlite/source.cxx b/odb/relational/sqlite/source.cxx index 2624af2..5a4b9d3 100644 --- a/odb/relational/sqlite/source.cxx +++ b/odb/relational/sqlite/source.cxx @@ -399,7 +399,8 @@ namespace relational virtual void process_statement_columns (relational::statement_columns& cols, - statement_kind sk) + statement_kind sk, + bool) { statement_columns_common::process (cols, sk); } diff --git a/odb/semantics/class-template.cxx b/odb/semantics/class-template.cxx index d764b79..f8bbca4 100644 --- a/odb/semantics/class-template.cxx +++ b/odb/semantics/class-template.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/class-template.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/class-template.hxx> namespace semantics diff --git a/odb/semantics/class.cxx b/odb/semantics/class.cxx index c03de92..97cf088 100644 --- a/odb/semantics/class.cxx +++ b/odb/semantics/class.cxx @@ -3,7 +3,7 @@ #include <odb/gcc.hxx> // TYPE_HAS_DEFAULT_CONSTRUCTOR -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/class.hxx> namespace semantics @@ -25,11 +25,39 @@ namespace semantics { tree t (tree_node ()); - // TYPE_HAS_DEFAULT_CONSTRUCTOR() returns true if we have a - // deleted default ctor. locate_ctor(), on the other hand, - // returns NULL_TREE in this case. + // TYPE_HAS_DEFAULT_CONSTRUCTOR() returns true if we have a deleted + // default ctor. locate_ctor(), on the other hand, returns NULL_TREE in + // this case. // - return TYPE_HAS_DEFAULT_CONSTRUCTOR (t) && locate_ctor (t) != NULL_TREE; + if (TYPE_HAS_DEFAULT_CONSTRUCTOR (t)) + { +#if BUILDING_GCC_MAJOR >= 8 + + // Work around GCC bug 86441. Essentially, we should not trigger an + // instantiation or completion of the default ctor. As a result, we will + // assume that if we have a lazy default ctor, it is not implicitly + // deleted. + // + if (CLASSTYPE_LAZY_DEFAULT_CTOR (t)) + return true; + + for (ovl_iterator i (CLASSTYPE_CONSTRUCTORS (t)); i; ++i) + { + tree f (*i); + + if (TREE_CODE (f) == FUNCTION_DECL && DECL_DELETED_FN (f)) + continue; + + if (default_ctor_p (f)) + return true; + } +#else + return locate_ctor (t) != NULL_TREE; +#endif + + } + + return false; } bool class_:: diff --git a/odb/semantics/derived.cxx b/odb/semantics/derived.cxx index 9cf1504..771ad21 100644 --- a/odb/semantics/derived.cxx +++ b/odb/semantics/derived.cxx @@ -3,7 +3,7 @@ #include <sstream> -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/derived.hxx> using namespace std; diff --git a/odb/semantics/derived.hxx b/odb/semantics/derived.hxx index 60c4896..e58ec9f 100644 --- a/odb/semantics/derived.hxx +++ b/odb/semantics/derived.hxx @@ -416,6 +416,8 @@ namespace semantics string fq_name (names*, string& trailer) const; + using derived_type::fq_name; // Unhide. + public: array (path const&, size_t line, diff --git a/odb/semantics/elements.cxx b/odb/semantics/elements.cxx index f937f54..b5793d0 100644 --- a/odb/semantics/elements.cxx +++ b/odb/semantics/elements.cxx @@ -3,7 +3,7 @@ #include <odb/gcc.hxx> -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/cxx-lexer.hxx> @@ -56,7 +56,7 @@ namespace semantics if (p == &s) return true; - if (p->global_scope ()) + if (!p->named_p () || p->global_scope ()) break; } @@ -75,7 +75,7 @@ namespace semantics if (tree decl = TYPE_NAME (n)) name = DECL_NAME (decl); - return name != 0 && anon_aggrname_p (name); + return name != 0 && IDENTIFIER_ANON_P (name); } return true; @@ -124,7 +124,7 @@ namespace semantics if (tree decl = TYPE_NAME (type)) { name = DECL_NAME (decl); - if (name != 0 && anon_aggrname_p (name)) + if (name != 0 && IDENTIFIER_ANON_P (name)) return true; tree s (CP_DECL_CONTEXT (decl)); @@ -476,7 +476,7 @@ namespace semantics // Look in the outer scope unless requested not to or if this is // the global scope. // - if ((flags & exclude_outer) == 0 && !global_scope ()) + if ((flags & exclude_outer) == 0 && named_p () && !global_scope ()) return scope ().lookup (name, ti, flags, hidden); return 0; diff --git a/odb/semantics/elements.hxx b/odb/semantics/elements.hxx index 12164ba..699a1be 100644 --- a/odb/semantics/elements.hxx +++ b/odb/semantics/elements.hxx @@ -13,11 +13,11 @@ #include <utility> // std::pair #include <cassert> -#include <cutl/fs/path.hxx> -#include <cutl/container/graph.hxx> -#include <cutl/container/pointer-iterator.hxx> -#include <cutl/compiler/type-id.hxx> -#include <cutl/compiler/context.hxx> +#include <libcutl/fs/path.hxx> +#include <libcutl/container/graph.hxx> +#include <libcutl/container/pointer-iterator.hxx> +#include <libcutl/compiler/type-id.hxx> +#include <libcutl/compiler/context.hxx> #include <odb/gcc-fwd.hxx> #include <odb/location.hxx> diff --git a/odb/semantics/enum.cxx b/odb/semantics/enum.cxx index 7fd8204..6432986 100644 --- a/odb/semantics/enum.cxx +++ b/odb/semantics/enum.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/enum.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/enum.hxx> namespace semantics diff --git a/odb/semantics/fundamental.cxx b/odb/semantics/fundamental.cxx index 82446a1..ed4a67f 100644 --- a/odb/semantics/fundamental.cxx +++ b/odb/semantics/fundamental.cxx @@ -3,7 +3,7 @@ #include <odb/gcc.hxx> -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/fundamental.hxx> namespace semantics diff --git a/odb/semantics/namespace.cxx b/odb/semantics/namespace.cxx index 0e1442c..d9be903 100644 --- a/odb/semantics/namespace.cxx +++ b/odb/semantics/namespace.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/namespace.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/namespace.hxx> namespace semantics diff --git a/odb/semantics/relational/changelog.cxx b/odb/semantics/relational/changelog.cxx index 8cee9dd..353497f 100644 --- a/odb/semantics/relational/changelog.cxx +++ b/odb/semantics/relational/changelog.cxx @@ -4,7 +4,7 @@ #include <vector> #include <sstream> -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/changelog.hxx> #include <odb/semantics/relational/model.hxx> diff --git a/odb/semantics/relational/changeset.cxx b/odb/semantics/relational/changeset.cxx index e643285..b044a0c 100644 --- a/odb/semantics/relational/changeset.cxx +++ b/odb/semantics/relational/changeset.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/changeset.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/changeset.hxx> diff --git a/odb/semantics/relational/column.cxx b/odb/semantics/relational/column.cxx index e62a460..9d4d6e5 100644 --- a/odb/semantics/relational/column.cxx +++ b/odb/semantics/relational/column.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/column.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/column.hxx> diff --git a/odb/semantics/relational/elements.cxx b/odb/semantics/relational/elements.cxx index 192c882..de1878a 100644 --- a/odb/semantics/relational/elements.cxx +++ b/odb/semantics/relational/elements.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/elements.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/elements.hxx> #include <odb/semantics/relational/column.hxx> diff --git a/odb/semantics/relational/elements.hxx b/odb/semantics/relational/elements.hxx index 61cd4f3..06ec552 100644 --- a/odb/semantics/relational/elements.hxx +++ b/odb/semantics/relational/elements.hxx @@ -10,16 +10,16 @@ #include <string> #include <cassert> -#include <cutl/container/graph.hxx> -#include <cutl/container/pointer-iterator.hxx> -#include <cutl/compiler/context.hxx> +#include <libcutl/container/graph.hxx> +#include <libcutl/container/pointer-iterator.hxx> +#include <libcutl/compiler/context.hxx> #ifdef ODB_BUILD2 #include <libstudxml/parser.hxx> #include <libstudxml/serializer.hxx> #else -#include <cutl/xml/parser.hxx> -#include <cutl/xml/serializer.hxx> +#include <libcutl/xml/parser.hxx> +#include <libcutl/xml/serializer.hxx> namespace cutl {namespace xml {typedef parser content;}} #endif diff --git a/odb/semantics/relational/foreign-key.cxx b/odb/semantics/relational/foreign-key.cxx index b4c85f9..0357d95 100644 --- a/odb/semantics/relational/foreign-key.cxx +++ b/odb/semantics/relational/foreign-key.cxx @@ -4,7 +4,7 @@ #include <ostream> #include <istream> -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/foreign-key.hxx> diff --git a/odb/semantics/relational/index.cxx b/odb/semantics/relational/index.cxx index 7e6bb94..2329f3a 100644 --- a/odb/semantics/relational/index.cxx +++ b/odb/semantics/relational/index.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/index.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/index.hxx> diff --git a/odb/semantics/relational/key.cxx b/odb/semantics/relational/key.cxx index 318fe96..3511618 100644 --- a/odb/semantics/relational/key.cxx +++ b/odb/semantics/relational/key.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/key.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/key.hxx> #include <odb/semantics/relational/column.hxx> diff --git a/odb/semantics/relational/model.cxx b/odb/semantics/relational/model.cxx index b300274..8763045 100644 --- a/odb/semantics/relational/model.cxx +++ b/odb/semantics/relational/model.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/model.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/model.hxx> diff --git a/odb/semantics/relational/primary-key.cxx b/odb/semantics/relational/primary-key.cxx index 043374f..235340f 100644 --- a/odb/semantics/relational/primary-key.cxx +++ b/odb/semantics/relational/primary-key.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/primary-key.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/primary-key.hxx> diff --git a/odb/semantics/relational/table.cxx b/odb/semantics/relational/table.cxx index b9700b1..3bf763d 100644 --- a/odb/semantics/relational/table.cxx +++ b/odb/semantics/relational/table.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/relational/table.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/relational/table.hxx> diff --git a/odb/semantics/template.cxx b/odb/semantics/template.cxx index d49cf20..f492be0 100644 --- a/odb/semantics/template.cxx +++ b/odb/semantics/template.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/template.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/template.hxx> namespace semantics diff --git a/odb/semantics/union-template.cxx b/odb/semantics/union-template.cxx index f2c3f94..21fc9c0 100644 --- a/odb/semantics/union-template.cxx +++ b/odb/semantics/union-template.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/union-template.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/union-template.hxx> namespace semantics diff --git a/odb/semantics/union.cxx b/odb/semantics/union.cxx index 980dfa4..007ef57 100644 --- a/odb/semantics/union.cxx +++ b/odb/semantics/union.cxx @@ -1,7 +1,7 @@ // file : odb/semantics/union.cxx // license : GNU GPL v3; see accompanying LICENSE file -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/union.hxx> namespace semantics diff --git a/odb/semantics/unit.cxx b/odb/semantics/unit.cxx index fe191bc..4f92aed 100644 --- a/odb/semantics/unit.cxx +++ b/odb/semantics/unit.cxx @@ -3,7 +3,7 @@ #include <odb/gcc.hxx> -#include <cutl/compiler/type-info.hxx> +#include <libcutl/compiler/type-info.hxx> #include <odb/semantics/unit.hxx> namespace semantics diff --git a/odb/traversal/elements.hxx b/odb/traversal/elements.hxx index c4236ce..d67a6d8 100644 --- a/odb/traversal/elements.hxx +++ b/odb/traversal/elements.hxx @@ -4,7 +4,7 @@ #ifndef ODB_TRAVERSAL_ELEMENTS_HXX #define ODB_TRAVERSAL_ELEMENTS_HXX -#include <cutl/compiler/traversal.hxx> +#include <libcutl/compiler/traversal.hxx> #include <odb/semantics/elements.hxx> namespace traversal diff --git a/odb/traversal/relational/elements.hxx b/odb/traversal/relational/elements.hxx index 9ecdc6a..2b43ab0 100644 --- a/odb/traversal/relational/elements.hxx +++ b/odb/traversal/relational/elements.hxx @@ -4,7 +4,7 @@ #ifndef ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX #define ODB_TRAVERSAL_RELATIONAL_ELEMENTS_HXX -#include <cutl/compiler/traversal.hxx> +#include <libcutl/compiler/traversal.hxx> #include <odb/semantics/relational/elements.hxx> namespace traversal diff --git a/odb/validator.cxx b/odb/validator.cxx index 9c20714..bf9aa6b 100644 --- a/odb/validator.cxx +++ b/odb/validator.cxx @@ -1655,6 +1655,9 @@ namespace // temporarily redirect diagnostics to /dev/null, which is // where asm_out_file points to (see plugin.cxx). // + // Needless to say, this is very hacky and we should quickly fail + // (as we do below) if there were errors. + // int ec (errorcount); FILE* s (global_dc->printer->buffer->stream); global_dc->printer->buffer->stream = asm_out_file; diff --git a/odb/version.hxx b/odb/version.hxx index 8b4e379..4ad389a 100644 --- a/odb/version.hxx +++ b/odb/version.hxx @@ -23,12 +23,15 @@ // ODB interface version: minor, major, and alpha/beta versions. // -#define ODB_VERSION 20468 -#define ODB_VERSION_STR "2.5-b.18" +#define ODB_VERSION 20476 +#define ODB_VERSION_STR "2.5-b.26" // ODB compiler version: interface version plus the bugfix version. // -#define ODB_COMPILER_VERSION 2049968 -#define ODB_COMPILER_VERSION_STR "2.5.0-b.18" +// 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 |