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__ --- video/camera.hpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'video') diff --git a/video/camera.hpp b/video/camera.hpp index 21f4f916..4ad8417c 100644 --- a/video/camera.hpp +++ b/video/camera.hpp @@ -67,17 +67,14 @@ void register_camera(std::unique_ptr metadata); } // ns video::impl -#define OTR_REGISTER_CAMERA2(type, ctr) \ - namespace { \ - struct init_##ctr \ - { \ - static char fuzz; \ - }; \ - char init_##ctr :: fuzz = \ - (::video::impl::register_camera(std::make_unique()), 0); \ - } // anon ns - -#define OTR_REGISTER_CAMERA(type) \ +#define OTR_REGISTER_CAMERA3(type, ctr) \ + static const char init_ ## ctr = \ + (::video::impl::register_camera(std::make_unique()), 0); + +#define OTR_REGISTER_CAMERA2(type, ctr) \ + OTR_REGISTER_CAMERA3(type, ctr) + +#define OTR_REGISTER_CAMERA(type) \ OTR_REGISTER_CAMERA2(type, __COUNTER__) namespace video -- cgit v1.2.3