Skip to content
Permalink
Browse files

include: json: reorder designated initializers

This patch reorders designated initializers to satisfy C++ requiring
that designated initializers appear in the same order as the members
they initialize.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
  • Loading branch information...
mrfuchs authored and andrewboie committed Jul 18, 2019
1 parent 779381b commit 477399627df082c758cfbdbdaec9c92a42a0af7b
Showing with 29 additions and 29 deletions.
  1. +29 −29 include/data/json.h
@@ -130,10 +130,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
#define JSON_OBJ_DESCR_PRIM(struct_, field_name_, type_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = type_, \
.offset = offsetof(struct_, field_name_), \
}

/**
@@ -164,10 +164,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
#define JSON_OBJ_DESCR_OBJECT(struct_, field_name_, sub_descr_) \
{ \
.field_name = (#field_name_), \
.field_name_len = (sizeof(#field_name_) - 1), \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = (sizeof(#field_name_) - 1), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, field_name_), \
.object = { \
.sub_descr = sub_descr_, \
.sub_descr_len = ARRAY_SIZE(sub_descr_), \
@@ -203,15 +203,15 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
len_field_, elem_type_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = elem_type_, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@@ -260,19 +260,19 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
len_field_, elem_descr_, elem_descr_len_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, len_field_), \
.object = { \
.sub_descr = elem_descr_, \
.sub_descr_len = elem_descr_len_, \
}, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@@ -330,19 +330,19 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
elem_descr_, elem_descr_len_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_LIST_START, \
.array = { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, len_field_), \
.object = { \
.sub_descr = elem_descr_, \
.sub_descr_len = elem_descr_len_, \
}, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@@ -369,10 +369,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
struct_field_name_, type_) \
{ \
.field_name = (json_field_name_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.type = type_, \
.offset = offsetof(struct_, struct_field_name_), \
}

/**
@@ -395,10 +395,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
struct_field_name_, sub_descr_) \
{ \
.field_name = (json_field_name_), \
.field_name_len = (sizeof(json_field_name_) - 1), \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = (sizeof(json_field_name_) - 1), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, struct_field_name_), \
.object = { \
.sub_descr = sub_descr_, \
.sub_descr_len = ARRAY_SIZE(sub_descr_), \
@@ -431,15 +431,15 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
elem_type_) \
{ \
.field_name = (json_field_name_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, struct_field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = elem_type_, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@@ -497,18 +497,18 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
elem_descr_len_) \
{ \
.field_name = json_field_name_, \
.field_name_len = sizeof(json_field_name_) - 1, \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, struct_field_name_), \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, len_field_), \
.object = { \
.sub_descr = elem_descr_, \
.sub_descr_len = elem_descr_len_, \
}, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}

0 comments on commit 4773996

Please sign in to comment.
You can’t perform that action at this time.