From 81b48dc3a7480c3df87d4293722b5a3d5f0de2c2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 1 Feb 2011 10:53:31 +0200 Subject: Pass profile paths to plugin; handle profile options --- odb/plugin.cxx | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'odb/plugin.cxx') diff --git a/odb/plugin.cxx b/odb/plugin.cxx index 5b9efc1..a611dfe 100644 --- a/odb/plugin.cxx +++ b/odb/plugin.cxx @@ -11,9 +11,12 @@ #include // std::strcpy #include +#include + #include #include #include +#include #include #include #include @@ -22,8 +25,14 @@ using namespace std; using namespace semantics; +using cutl::fs::path; +using cutl::fs::invalid_path; + +typedef vector paths; + int plugin_is_GPL_compatible; auto_ptr options_; +paths profile_paths_; // A prefix of the _cpp_file struct. This struct is not part of the // public interface so we have to resort to this technique (based on @@ -154,6 +163,14 @@ plugin_init (plugin_name_args* plugin_info, plugin_gcc_version*) { plugin_argument& a (plugin_info->argv[i]); + // Handle service options. + // + if (strcmp (a.key, "svc-path") == 0) + { + profile_paths_.push_back (path (a.value)); + continue; + } + string opt (strlen (a.key) > 1 ? "--" : "-"); opt += a.key; @@ -168,7 +185,19 @@ plugin_init (plugin_name_args* plugin_info, plugin_gcc_version*) } int argc (static_cast (argv.size ())); - cli::argv_file_scanner scan (argc, &argv[0], "--options-file"); + + profile_data pd (profile_paths_, "odb plugin"); + cli::argv_file_scanner::option_info oi[3]; + oi[0].option = "--options-file"; + oi[0].search_func = 0; + oi[1].option = "-p"; + oi[1].search_func = &profile_search; + oi[1].arg = &pd; + oi[2].option = "--profile"; + oi[2].search_func = &profile_search; + oi[2].arg = &pd; + + cli::argv_file_scanner scan (argc, &argv[0], oi, 3); options_.reset ( new options (scan, cli::unknown_mode::fail, cli::unknown_mode::fail)); -- cgit v1.1