From ac83439900ab5ed4febe68375d3936ae2a59d707 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 24 Jul 2011 14:52:31 +0200 Subject: Allow pragmas to be either overriding or accumulating --- odb/pragma.hxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'odb/pragma.hxx') 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_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 { -- cgit v1.1