summaryrefslogtreecommitdiffhomepage
path: root/migration
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-22 04:28:00 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-28 08:58:40 +0100
commite3e8caf61bbc22c3b278ce8bd36501b73806d524 (patch)
treeac24885c76082486e1fbd12ef5f525ea5d566d24 /migration
parent01b80e4f56cc9f5120a9a34690e6f593006e5585 (diff)
actually expand __COUNTER__
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.hpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/migration/migration.hpp b/migration/migration.hpp
index 2c1fee5b..a3035247 100644
--- a/migration/migration.hpp
+++ b/migration/migration.hpp
@@ -57,19 +57,14 @@ namespace detail {
};
}
-#ifndef __COUNTER__
-# error "oops, need __COUNTER__ extension for preprocessor"
-#endif
+#define OPENTRACK_MIGRATION3(type, ctr) \
+ static const char init_##ctr = (::migrations::detail::registrator<type>{}, 0);
-#define MIGRATE_EXPAND2(x) x
-#define MIGRATE_EXPAND1(x) MIGRATE_EXPAND2(x)
-#define MIGRATE_EXPANDED2(type, ctr) \
- static ::migrations::detail::registrator<type> opentrack_migration_registrator_ ## ctr
-#define MIGRATE_EXPANDED1(type, ctr) \
- MIGRATE_EXPANDED2(type, ctr)
+#define OPENTRACK_MIGRATION2(type, ctr) \
+ OPENTRACK_MIGRATION3(type, ctr)
#define OPENTRACK_MIGRATION(type) \
- MIGRATE_EXPANDED1(type, MIGRATE_EXPAND1(__COUNTER__))
+ OPENTRACK_MIGRATION2(type, __COUNTER__)
struct migration
{