@@ -93,6 +93,11 @@ class MatType
93
93
* CV_ENUM and CV_FLAGS - macro to create printable wrappers for defines and enums *
94
94
\*****************************************************************************************/
95
95
96
+ // helper macros to force expansion of macro arguments before stringification
97
+ // "#" normally blocks argument expansion
98
+ #define CV_STRINGIFY_ARGS (...) CV_STRINGIFY_ARGS_(__VA_ARGS__)
99
+ #define CV_STRINGIFY_ARGS_ (...) #__VA_ARGS__
100
+
96
101
#define CV_ENUM (class_name, ...) \
97
102
namespace { \
98
103
using namespace cv ; using namespace cv ::cuda; using namespace cv ::ocl; \
@@ -101,7 +106,7 @@ class MatType
101
106
operator int () const { return val_; } \
102
107
void PrintTo (std::ostream* os) const { \
103
108
const int vals[] = { __VA_ARGS__ }; \
104
- const char * svals = # __VA_ARGS__; \
109
+ const char * svals = CV_STRINGIFY_ARGS ( __VA_ARGS__); \
105
110
for (int i = 0 , pos = 0 ; i < (int )(sizeof (vals)/sizeof (int )); ++i) { \
106
111
while (isspace (svals[pos]) || svals[pos] == ' ,' ) ++pos; \
107
112
int start = pos; \
@@ -130,7 +135,7 @@ class MatType
130
135
void PrintTo (std::ostream* os) const { \
131
136
using namespace cv ; using namespace cv ::cuda; using namespace cv ::ocl; \
132
137
const int vals[] = { __VA_ARGS__ }; \
133
- const char * svals = # __VA_ARGS__; \
138
+ const char * svals = CV_STRINGIFY_ARGS ( __VA_ARGS__); \
134
139
int value = val_; \
135
140
bool first = true ; \
136
141
for (int i = 0 , pos = 0 ; i < (int )(sizeof (vals)/sizeof (int )); ++i) { \
0 commit comments