net/mlx: fix build with clang 9
[dpdk.git] / drivers / net / mlx5 / mlx5_utils.h
index b4ed8c6..ebf79b8 100644 (file)
@@ -146,9 +146,10 @@ extern int mlx5_logtype;
 
 /* Allocate a buffer on the stack and fill it with a printf format string. */
 #define MKSTR(name, ...) \
-       char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \
+       int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \
+       char name[mkstr_size_##name + 1]; \
        \
-       snprintf(name, sizeof(name), __VA_ARGS__)
+       snprintf(name, sizeof(name), "" __VA_ARGS__)
 
 /**
  * Return logarithm of the nearest power of two above input value.