[Tarantool-patches] [PATCH 1/5] clang-format: guard various declarations

Kirill Yukhin kyukhin at tarantool.org
Fri Oct 30 14:43:48 MSK 2020


Disable clang-formatter for:
- iproto_constants.c
- constants in vy_log.c
- key comparator definitions.
- for field_def's types compatibility
---
 src/box/errcode.h          | 4 +++-
 src/box/field_def.c        | 2 ++
 src/box/iproto_constants.c | 4 ++++
 src/box/tuple_compare.cc   | 4 ++++
 src/box/vy_log.c           | 2 ++
 5 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/box/errcode.h b/src/box/errcode.h
index e6957d6..244bda1 100644
--- a/src/box/errcode.h
+++ b/src/box/errcode.h
@@ -51,7 +51,8 @@ struct errcode_record {
  * Please don't forget to do it!
  */
 
-#define ERROR_CODES(_)					    \
+/* clang-format off */
+#define ERROR_CODES(_)						 \
 	/*  0 */_(ER_UNKNOWN,			"Unknown error") \
 	/*  1 */_(ER_ILLEGAL_PARAMS,		"Illegal parameters, %s") \
 	/*  2 */_(ER_MEMORY_ISSUE,		"Failed to allocate %u bytes in %s for %s") \
@@ -273,6 +274,7 @@ struct errcode_record {
 	/*218 */_(ER_TUPLE_METADATA_IS_TOO_BIG,	"Can't create tuple: metadata size %u is too big") \
 	/*219 */_(ER_XLOG_GAP,			"%s") \
 	/*220 */_(ER_TOO_EARLY_SUBSCRIBE,	"Can't subscribe non-anonymous replica %s until join is done") \
+/* clang-format on */
 
 /*
  * !IMPORTANT! Please follow instructions at start of the file
diff --git a/src/box/field_def.c b/src/box/field_def.c
index 213e916..34cecfa 100644
--- a/src/box/field_def.c
+++ b/src/box/field_def.c
@@ -127,6 +127,7 @@ field_type_by_name_wrapper(const char *str, uint32_t len)
  * For an i row and j column the value is true, if the i type
  * values can be stored in the j type.
  */
+/* clang-format off */
 static const bool field_type_compatibility[] = {
 	   /*   ANY   UNSIGNED  STRING   NUMBER  DOUBLE  INTEGER  BOOLEAN VARBINARY SCALAR  DECIMAL   UUID    ARRAY    MAP  */
 /*   ANY    */ true,   false,   false,   false,   false,   false,   false,   false,  false,  false,  false,   false,   false,
@@ -143,6 +144,7 @@ static const bool field_type_compatibility[] = {
 /*   ARRAY  */ true,   false,   false,   false,   false,   false,   false,   false,  false,  false,  false,   true,    false,
 /*    MAP   */ true,   false,   false,   false,   false,   false,   false,   false,  false,  false,  false,   false,   true,
 };
+/* clang-format on */
 
 bool
 field_type1_contains_type2(enum field_type type1, enum field_type type2)
diff --git a/src/box/iproto_constants.c b/src/box/iproto_constants.c
index 029d988..af3ab60 100644
--- a/src/box/iproto_constants.c
+++ b/src/box/iproto_constants.c
@@ -30,6 +30,8 @@
  */
 #include "iproto_constants.h"
 
+/* clang-format off */
+
 const unsigned char iproto_key_type[IPROTO_KEY_MAX] =
 {
 	/* {{{ header */
@@ -226,3 +228,5 @@ const char *vy_row_index_key_strs[VY_ROW_INDEX_KEY_MAX] = {
 	NULL,
 	"row index",
 };
+
+/* clang-format on */
diff --git a/src/box/tuple_compare.cc b/src/box/tuple_compare.cc
index 0946d77..0f3f18b 100644
--- a/src/box/tuple_compare.cc
+++ b/src/box/tuple_compare.cc
@@ -1144,6 +1144,7 @@ struct comparator_signature {
 /**
  * field1 no, field1 type, field2 no, field2 type, ...
  */
+/* clang-format off */
 static const comparator_signature cmp_arr[] = {
 	COMPARATOR(0, FIELD_TYPE_UNSIGNED)
 	COMPARATOR(0, FIELD_TYPE_STRING)
@@ -1160,6 +1161,7 @@ static const comparator_signature cmp_arr[] = {
 	COMPARATOR(0, FIELD_TYPE_UNSIGNED, 1, FIELD_TYPE_STRING  , 2, FIELD_TYPE_STRING)
 	COMPARATOR(0, FIELD_TYPE_STRING  , 1, FIELD_TYPE_STRING  , 2, FIELD_TYPE_STRING)
 };
+/* clang-format on */
 
 #undef COMPARATOR
 
@@ -1330,6 +1332,7 @@ struct comparator_with_key_signature
 #define KEY_COMPARATOR(...) \
 	{ TupleCompareWithKey<0, __VA_ARGS__>::compare, { __VA_ARGS__ } },
 
+/* clang-format off */
 static const comparator_with_key_signature cmp_wk_arr[] = {
 	KEY_COMPARATOR(0, FIELD_TYPE_UNSIGNED, 1, FIELD_TYPE_UNSIGNED, 2, FIELD_TYPE_UNSIGNED)
 	KEY_COMPARATOR(0, FIELD_TYPE_STRING  , 1, FIELD_TYPE_UNSIGNED, 2, FIELD_TYPE_UNSIGNED)
@@ -1345,6 +1348,7 @@ static const comparator_with_key_signature cmp_wk_arr[] = {
 	KEY_COMPARATOR(1, FIELD_TYPE_UNSIGNED, 2, FIELD_TYPE_STRING)
 	KEY_COMPARATOR(1, FIELD_TYPE_STRING  , 2, FIELD_TYPE_STRING)
 };
+/* clang-format on */
 
 /**
  * A functional index tuple compare.
diff --git a/src/box/vy_log.c b/src/box/vy_log.c
index d23b1c1..06b2596 100644
--- a/src/box/vy_log.c
+++ b/src/box/vy_log.c
@@ -68,6 +68,7 @@
  * Integer key of a field in the vy_log_record structure.
  * Used for packing a record in MsgPack.
  */
+/* clang-format off */
 enum vy_log_key {
 	VY_LOG_KEY_LSM_ID		= 0,
 	VY_LOG_KEY_RANGE_ID		= 1,
@@ -130,6 +131,7 @@ static const char *vy_log_type_name[] = {
 	[VY_LOG_REBOOTSTRAP]		= "rebootstrap",
 	[VY_LOG_ABORT_REBOOTSTRAP]	= "abort_rebootstrap",
 };
+/* clang-format on */
 
 /** Batch of vylog records that must be written in one go. */
 struct vy_log_tx {
-- 
1.8.3.1



More information about the Tarantool-patches mailing list