aboutsummaryrefslogtreecommitdiff
path: root/odb/odb.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-01-18 13:55:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-20 15:43:46 +0200
commit6edf2ab594e9d4f20957e5ad8508fa0c1981bdaf (patch)
tree9b941bc27c332938dcbef14b2c38ed88cd3f62f6 /odb/odb.cxx
parented217daec5d498b79c9503269d3529c9948378b4 (diff)
Recognize preprocessor options (-D/-U) in default options file
Diffstat (limited to 'odb/odb.cxx')
-rw-r--r--odb/odb.cxx57
1 files changed, 57 insertions, 0 deletions
diff --git a/odb/odb.cxx b/odb/odb.cxx
index c3b8e58..28635da 100644
--- a/odb/odb.cxx
+++ b/odb/odb.cxx
@@ -225,6 +225,7 @@ main (int argc, char* argv[])
// Parse the default options file if we have one.
//
strings def_inc_dirs;
+ strings def_defines;
#ifdef DEFAULT_OPTIONS_FILE
{
path file (DEFAULT_OPTIONS_FILE);
@@ -264,6 +265,57 @@ main (int argc, char* argv[])
def_inc_dirs.push_back (a);
}
}
+ // -framework (Mac OS X)
+ //
+ else if (a == "-framework")
+ {
+ def_inc_dirs.push_back (a);
+
+ if (!s.more () || (a = s.next ()).empty ())
+ {
+ e << file << ": error: expected argument for the -framework "
+ << "option" << endl;
+ return 1;
+ }
+
+ def_inc_dirs.push_back (a);
+ }
+ // -D
+ //
+ else if (n > 1 && a[0] == '-' && a[1] == 'D')
+ {
+ def_defines.push_back (a);
+
+ if (n == 2) // -D macro
+ {
+ if (!s.more () || (a = s.next ()).empty ())
+ {
+ e << file << ": error: expected argument for the -D option"
+ << endl;
+ return 1;
+ }
+
+ def_defines.push_back (a);
+ }
+ }
+ // -U
+ //
+ else if (n > 1 && a[0] == '-' && a[1] == 'U')
+ {
+ def_defines.push_back (a);
+
+ if (n == 2) // -U macro
+ {
+ if (!s.more () || (a = s.next ()).empty ())
+ {
+ e << file << ": error: expected argument for the -U option"
+ << endl;
+ return 1;
+ }
+
+ def_defines.push_back (a);
+ }
+ }
else
plugin_args.push_back (a);
}
@@ -278,6 +330,11 @@ main (int argc, char* argv[])
args.push_back ("-Wunknown-pragmas");
args.push_back ("-fplugin=" + plugin.string ());
+ // Add the default preprocessor defines (-D/-U) before the user-supplied
+ // ones.
+ //
+ args.insert (args.end (), def_defines.begin (), def_defines.end ());
+
// Parse driver options.
//
bool first_x (true);