[Tarantool-patches] [PATCH 1/2] Remove C99 extension usage from C++ file

Kirill Yukhin kyukhin at tarantool.org
Tue Oct 6 12:59:35 MSK 2020


File mp_error.cc was using a C99 feature called "designated
initializers" which was catched by Clang v12.

Remove this usage.
---
 src/box/mp_error.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/box/mp_error.cc b/src/box/mp_error.cc
index 61cf5e1..36fbcef 100644
--- a/src/box/mp_error.cc
+++ b/src/box/mp_error.cc
@@ -97,6 +97,16 @@ enum {
 	MP_ERROR_MAX,
 };
 
+static const char *const mp_error_field_to_json_key[MP_ERROR_MAX] = {
+	"\"type\": ",
+	"\"file\": ",
+	"\"line\": ",
+	"\"message\": ",
+	"\"errno\": ",
+	"\"code\": ",
+	"\"fields\": ",
+};
+
 /**
  * The structure is used for storing parameters
  * during decoding MP_ERROR.
@@ -561,16 +571,6 @@ error_unpack_unsafe(const char **data)
 	return err;
 }
 
-static const char *const mp_error_field_to_json_key[MP_ERROR_MAX] = {
-	[MP_ERROR_TYPE] =	"\"type\": ",
-	[MP_ERROR_FILE] =	"\"file\": ",
-	[MP_ERROR_LINE] =	"\"line\": ",
-	[MP_ERROR_MESSAGE] =	"\"message\": ",
-	[MP_ERROR_ERRNO] =	"\"errno\": ",
-	[MP_ERROR_CODE] =	"\"code\": ",
-	[MP_ERROR_FIELDS] =	"\"fields\": ",
-};
-
 /**
  * Include this file into self with a few template parameters
  * to create mp_snprint_error() and mp_fprint_error() functions
-- 
1.8.3.1



More information about the Tarantool-patches mailing list