aboutsummaryrefslogtreecommitdiff
path: root/tracer
diff options
context:
space:
mode:
Diffstat (limited to 'tracer')
-rw-r--r--tracer/makefile1
-rw-r--r--tracer/object/test.hxx4
-rw-r--r--tracer/pragma/driver.cxx26
-rw-r--r--tracer/pragma/makefile101
-rw-r--r--tracer/pragma/test.hxx42
-rw-r--r--tracer/pragma/test.std0
-rw-r--r--tracer/template/test.hxx4
-rw-r--r--tracer/types/test.hxx8
8 files changed, 178 insertions, 8 deletions
diff --git a/tracer/makefile b/tracer/makefile
index 3e94d91..c94af17 100644
--- a/tracer/makefile
+++ b/tracer/makefile
@@ -8,6 +8,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
tests := \
template \
object \
+pragma \
transaction \
types
diff --git a/tracer/object/test.hxx b/tracer/object/test.hxx
index dfa6603..e7adee3 100644
--- a/tracer/object/test.hxx
+++ b/tracer/object/test.hxx
@@ -8,7 +8,7 @@
#include <odb/core.hxx>
-#pragma odb object
+#pragma db object
struct object
{
object (unsigned long id)
@@ -20,7 +20,7 @@ struct object
{
}
- #pragma odb id
+ #pragma db id
unsigned long id_;
};
diff --git a/tracer/pragma/driver.cxx b/tracer/pragma/driver.cxx
new file mode 100644
index 0000000..c227d4e
--- /dev/null
+++ b/tracer/pragma/driver.cxx
@@ -0,0 +1,26 @@
+// file : tracer/pragma/driver.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test #pragma db parsing.
+//
+
+#include <memory>
+#include <cassert>
+#include <iostream>
+
+#include <odb/exceptions.hxx>
+#include <odb/transaction.hxx>
+#include <odb/tracer/database.hxx>
+
+#include "test.hxx"
+#include "test-odb.hxx"
+
+using namespace std;
+using namespace odb;
+
+int
+main ()
+{
+}
diff --git a/tracer/pragma/makefile b/tracer/pragma/makefile
new file mode 100644
index 0000000..1994267
--- /dev/null
+++ b/tracer/pragma/makefile
@@ -0,0 +1,101 @@
+# file : tracer/pragma/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
+
+cxx_tun := driver.cxx
+odb_hdr := test.hxx
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(odb_hdr:.hxx=-odb.o))
+cxx_od := $(cxx_obj:.o=.o.d)
+
+driver := $(out_base)/driver
+dist := $(out_base)/.dist
+test := $(out_base)/.test
+clean := $(out_base)/.clean
+
+# Import.
+#
+$(call import,\
+ $(scf_root)/import/odb/stub.make,\
+ odb: odb,odb-rules: odb_rules)
+
+$(call import,\
+ $(scf_root)/import/libodb/stub.make,\
+ l: odb.l,cpp-options: odb.l.cpp-options)
+
+$(call import,\
+ $(scf_root)/import/libodb-tracer/stub.make,\
+ l: odb_tracer.l,cpp-options: odb_tracer.l.cpp-options)
+
+# Build.
+#
+$(driver): $(cxx_obj) $(odb_tracer.l) $(odb.l)
+$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
+$(cxx_obj) $(cxx_od): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
+
+genf := $(addprefix $(odb_hdr:.hxx=-odb),.hxx .ixx .cxx)
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(odb)
+$(gen): odb := $(odb)
+$(gen) $(dist): export odb_options += --database tracer
+$(gen): cpp_options := -I$(out_base)
+$(gen): $(odb_tracer.l.cpp-options) $(odb.l.cpp-options)
+
+$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
+
+# Alias for default target.
+#
+$(out_base)/: $(driver)
+
+# Dist
+#
+$(dist): sources := $(cxx_tun)
+$(dist): headers := $(odb_hdr)
+$(dist): data_dist := test.std
+$(dist): export name := $(notdir $(src_base))
+$(dist): export extra_dist := $(data_dist) $(name)-vc9.vcproj \
+$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters
+$(dist):
+ $(call dist-data,$(sources) $(headers) $(data_dist))
+ $(call meta-automake,../template/Makefile.am)
+ $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj)
+ $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj)
+
+# Test.
+#
+$(test): $(driver) $(src_base)/test.std
+ $(call message,test $<,$< | diff -u $(src_base)/test.std -)
+
+# Clean.
+#
+$(clean): \
+ $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(cxx_obj)) \
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(addprefix $(out_base)/,$(odb_hdr:.hxx=-odb.cxx.hxx.clean))
+
+# Generated .gitignore.
+#
+ifeq ($(out_base),$(src_base))
+$(driver): | $(out_base)/.gitignore
+
+$(out_base)/.gitignore: files := driver $(genf)
+$(clean): $(out_base)/.gitignore.clean
+
+$(call include,$(bld_root)/git/gitignore.make)
+endif
+
+# How to.
+#
+$(call include,$(bld_root)/dist.make)
+$(call include,$(bld_root)/meta/vc9proj.make)
+$(call include,$(bld_root)/meta/vc10proj.make)
+$(call include,$(bld_root)/meta/automake.make)
+
+$(call include,$(odb_rules))
+$(call include,$(bld_root)/cxx/cxx-d.make)
+$(call include,$(bld_root)/cxx/cxx-o.make)
+$(call include,$(bld_root)/cxx/o-e.make)
diff --git a/tracer/pragma/test.hxx b/tracer/pragma/test.hxx
new file mode 100644
index 0000000..2dc499d
--- /dev/null
+++ b/tracer/pragma/test.hxx
@@ -0,0 +1,42 @@
+// file : tracer/template/test.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef TEST_HXX
+#define TEST_HXX
+
+#include <odb/core.hxx>
+
+#pragma db value(bool) type ("INT")
+
+struct x {};
+#pragma db value (x)
+
+namespace N
+{
+ #pragma db object
+ struct object1
+ {
+ object1 () {}
+
+ #pragma db id
+ unsigned long id_;
+
+ #pragma db member type ("INT")
+ bool b_;
+ };
+
+ struct object2
+ {
+ object2 () {}
+
+ unsigned long id_;
+ };
+
+ #pragma db object (object2)
+}
+
+PRAGMA_DB (member (N::object2::id_) id auto);
+
+#endif // TEST_HXX
diff --git a/tracer/pragma/test.std b/tracer/pragma/test.std
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tracer/pragma/test.std
diff --git a/tracer/template/test.hxx b/tracer/template/test.hxx
index 06d7155..c85ddde 100644
--- a/tracer/template/test.hxx
+++ b/tracer/template/test.hxx
@@ -8,7 +8,7 @@
#include <odb/core.hxx>
-#pragma odb object
+#pragma db object
struct object
{
object (unsigned long id)
@@ -20,7 +20,7 @@ struct object
{
}
- #pragma odb id
+ #pragma db id
unsigned long id_;
};
diff --git a/tracer/types/test.hxx b/tracer/types/test.hxx
index 965f133..8537e16 100644
--- a/tracer/types/test.hxx
+++ b/tracer/types/test.hxx
@@ -15,19 +15,19 @@ typedef int num_t;
typedef num_t num_type;
-#pragma odb object
+#pragma db object
struct object1
{
typedef int int_type;
- #pragma odb id
+ #pragma db id
int_type id_;
};
-#pragma odb object
+#pragma db object
struct object2
{
- #pragma odb id
+ #pragma db id
num_type num_;
};