diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-29 09:27:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-29 09:27:29 +0200 |
commit | 73edd8b28ac415b6fdb7d8c7f8728dc7f8de75d0 (patch) | |
tree | 6e0559cc3d74d62d1531ad2b2d509da978fb4afd /odb/pragma.cxx | |
parent | bdd75a3074e9c572187a24a38d37b9f1af742c7b (diff) |
Make container pragmas also work on types in addition to members
Diffstat (limited to 'odb/pragma.cxx')
-rw-r--r-- | odb/pragma.cxx | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/odb/pragma.cxx b/odb/pragma.cxx index 9970376..002a25c 100644 --- a/odb/pragma.cxx +++ b/odb/pragma.cxx @@ -117,12 +117,7 @@ check_decl_type (tree d, string const& name, string const& p, location_t l) p == "id" || p == "auto" || p == "column" || - p == "value_column" || - p == "index_column" || - p == "key_column" || - p == "id_column" || p == "inverse" || - p == "unordered" || p == "transient") { if (tc != FIELD_DECL) @@ -144,11 +139,12 @@ check_decl_type (tree d, string const& name, string const& p, location_t l) } else if (p == "table") { - // Table can be used for both members (container) and types. + // Table can be used for both members (container) and types (container + // or object). // - if (tc != FIELD_DECL && tc != RECORD_TYPE) + if (tc != FIELD_DECL && !TYPE_P (d)) { - error_at (l, "name %qs in db pragma %qs does not refer to a class " + error_at (l, "name %qs in db pragma %qs does not refer to a type " "or data member", name.c_str (), pc); return false; } @@ -176,6 +172,33 @@ check_decl_type (tree d, string const& name, string const& p, location_t l) return false; } } + else if (p == "value_column" || + p == "index_column" || + p == "key_column" || + p == "id_column") + { + // Container columns can be used for both members (container) and + // types (container). + // + if (tc != FIELD_DECL && !TYPE_P (d)) + { + error_at (l, "name %qs in db pragma %qs does not refer to a type " + "or data member", name.c_str (), pc); + return false; + } + } + else if (p == "unordered") + { + // Unordered can be used for both members (container) and + // types (container). + // + if (tc != FIELD_DECL && !TYPE_P (d)) + { + error_at (l, "name %qs in db pragma %qs does not refer to a type " + "or data member", name.c_str (), pc); + return false; + } + } else { error ("unknown db pragma %qs", pc); |