aboutsummaryrefslogtreecommitdiff
path: root/odb/pragma.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-24 14:52:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-24 14:52:31 +0200
commitac83439900ab5ed4febe68375d3936ae2a59d707 (patch)
tree705d6930ee10d1963f8061da0d64bd45f6301a10 /odb/pragma.hxx
parent81ea37904e4959414b53b225b4b5e56e1b561bdc (diff)
Allow pragmas to be either overriding or accumulating
Diffstat (limited to 'odb/pragma.hxx')
-rw-r--r--odb/pragma.hxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/odb/pragma.hxx b/odb/pragma.hxx
index d8c4ab5..1fc034a 100644
--- a/odb/pragma.hxx
+++ b/odb/pragma.hxx
@@ -15,17 +15,27 @@
struct pragma
{
- pragma (std::string const& n, std::string const& v, tree tn, location_t l)
- : name (n), value (v), node (tn), loc (l)
+ enum mode_type {override, accumulate};
+
+ pragma (mode_type m,
+ std::string const& n,
+ std::string const& v,
+ tree tn,
+ location_t l)
+ : mode (m), name (n), value (v), node (tn), loc (l)
{
}
bool
operator< (pragma const& y) const
{
- return name < y.name;
+ if (mode == override)
+ return name < y.name;
+ else
+ return name < y.name || (name == y.name && loc < y.loc);
}
+ mode_type mode;
std::string name;
std::string value;
tree node;
@@ -34,8 +44,8 @@ struct pragma
typedef std::vector<pragma> pragma_list;
-// A set of pragmas. Insertion of a pragma with the same name
-// overrides the old value.
+// A set of pragmas. Insertion of a pragma with the same name and override
+// mode overrides the old value.
//
struct pragma_set: std::set<pragma>
{