From: Alexander Alekhin Date: Fri, 25 Nov 2016 11:56:00 +0000 (+0300) Subject: ts: CV_ENUM fix static initialization order fiasco X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1395^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a3f1a31b2545de9a7666aed785feec710cd1896;p=platform%2Fupstream%2Fopencv.git ts: CV_ENUM fix static initialization order fiasco --- diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp index 5b15a9e..bfa1811 100644 --- a/modules/ts/include/opencv2/ts/ts_perf.hpp +++ b/modules/ts/include/opencv2/ts/ts_perf.hpp @@ -95,11 +95,11 @@ private: #define CV_ENUM(class_name, ...) \ namespace { \ + using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \ struct class_name { \ class_name(int val = 0) : val_(val) {} \ operator int() const { return val_; } \ void PrintTo(std::ostream* os) const { \ - using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \ const int vals[] = { __VA_ARGS__ }; \ const char* svals = #__VA_ARGS__; \ for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \ @@ -115,8 +115,7 @@ private: *os << "UNKNOWN"; \ } \ static ::testing::internal::ParamGenerator all() { \ - using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \ - static class_name vals[] = { __VA_ARGS__ }; \ + const class_name vals[] = { __VA_ARGS__ }; \ return ::testing::ValuesIn(vals); \ } \ private: int val_; \