summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-11-09 18:08:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-11-09 18:08:46 +0200
commit3ae1f7b11a7b5d92f945369adb4b458b451c27f0 (patch)
tree81ebd54b62a469cc2f823e41a4d9f4a67d77db57
parent22b59d8d176ea0d329dcd5b074f38640367ad02c (diff)
Add bug: position pragmas don't work in macros
-rw-r--r--bug/list37
1 files changed, 37 insertions, 0 deletions
diff --git a/bug/list b/bug/list
index b9d28ac..4c62aeb 100644
--- a/bug/list
+++ b/bug/list
@@ -48,3 +48,40 @@
odb: error: unable to extract profile paths
See email from <axel50397@gmail.com>/23-Oct-2014.
+
+- Position pragmas in macros don't work
+
+ #include <odb/core.hxx>
+
+ #define ODB_COUNT(obj, key) \
+ PRAGMA_DB(view object(obj)) \
+ struct obj##_count \
+ { \
+ PRAGMA_DB(column("count(" + obj::key + ")")) \
+ int count; \
+ };
+
+ /*
+ #define ODB_COUNT(obj, key) \
+ struct obj##_count \
+ { \
+ int count; \
+ }; \
+ PRAGMA_DB(view(obj##_count) object(obj)) \
+ PRAGMA_DB(member(obj##_count::count) \
+ column("count(" + obj::key + ")")) \
+ */
+
+ #pragma db object
+ struct test
+ {
+ #pragma db id
+ int id;
+ };
+
+ ODB_COUNT(test, id)
+
+ The reason it doesn't work is because we use the macro expansion
+ point as the location of the pragmas inside the macro. Fixing this
+ properly won't be simple. Perhaps simply document as a limitation
+ where we describe PRAGMA_DB.