From e3e8caf61bbc22c3b278ce8bd36501b73806d524 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Mar 2019 04:28:00 +0100 Subject: actually expand __COUNTER__ --- migration/migration.hpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'migration') 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{}, 0); -#define MIGRATE_EXPAND2(x) x -#define MIGRATE_EXPAND1(x) MIGRATE_EXPAND2(x) -#define MIGRATE_EXPANDED2(type, ctr) \ - static ::migrations::detail::registrator 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 { -- cgit v1.2.3