Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS"

This reverts commit 19538cac1e.

This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand.
pull/8869/head
Jiri Horner 8 years ago
parent 0016bfe926
commit acce2ded76
  1. 9
      modules/ts/include/opencv2/ts/ts_perf.hpp

@ -93,11 +93,6 @@ private:
* CV_ENUM and CV_FLAGS - macro to create printable wrappers for defines and enums * * CV_ENUM and CV_FLAGS - macro to create printable wrappers for defines and enums *
\*****************************************************************************************/ \*****************************************************************************************/
// helper macros to force expansion of macro arguments before stringification
// "#" normally blocks argument expansion
#define CV_STRINGIFY_ARGS(...) CV_STRINGIFY_ARGS_(__VA_ARGS__)
#define CV_STRINGIFY_ARGS_(...) #__VA_ARGS__
#define CV_ENUM(class_name, ...) \ #define CV_ENUM(class_name, ...) \
namespace { \ namespace { \
using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \ using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \
@ -106,7 +101,7 @@ private:
operator int() const { return val_; } \ operator int() const { return val_; } \
void PrintTo(std::ostream* os) const { \ void PrintTo(std::ostream* os) const { \
const int vals[] = { __VA_ARGS__ }; \ const int vals[] = { __VA_ARGS__ }; \
const char* svals = CV_STRINGIFY_ARGS(__VA_ARGS__); \ const char* svals = #__VA_ARGS__; \
for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \ for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \
while(isspace(svals[pos]) || svals[pos] == ',') ++pos; \ while(isspace(svals[pos]) || svals[pos] == ',') ++pos; \
int start = pos; \ int start = pos; \
@ -135,7 +130,7 @@ private:
void PrintTo(std::ostream* os) const { \ void PrintTo(std::ostream* os) const { \
using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \ using namespace cv;using namespace cv::cuda; using namespace cv::ocl; \
const int vals[] = { __VA_ARGS__ }; \ const int vals[] = { __VA_ARGS__ }; \
const char* svals = CV_STRINGIFY_ARGS(__VA_ARGS__); \ const char* svals = #__VA_ARGS__; \
int value = val_; \ int value = val_; \
bool first = true; \ bool first = true; \
for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \ for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \

Loading…
Cancel
Save