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

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Nov 8 18:09:08 MSK 2020


Hi!

See 2 comments below.

On 30.10.2020 12:43, Kirill Yukhin wrote:
> 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(_)						 \

1. Why did you change the second line? It is still misaligned,
and this whole list of error codes does not align \ anyway.

>  	/*  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 */
> 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 */
> +

2. What is the rule by which you decide when need an empty
line after format comment and when not?

>  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 */


More information about the Tarantool-patches mailing list