Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make attributes whose values are lists of structs that have nullables/optionals at least compile. #11105

Conversation

bzbarsky-apple
Copy link
Contributor

This doesn't give us correct behavior across all of our bindings
(chip-tool command line, yaml, darwin, python, java). But it at least
allows code generation to produce output and allows that output to
compile.

More work is needed to address the various TODO issues.

Problem

Adding an attribute whose type is a list of structs which can have optional or nullable members fails to compile. And if those members are "interesting" enough (structs, lists), fails to codegen.

Change overview

Make those cases at least codegen succcessfully, though at the cost of ignoring a bunch of struct members in various places.

Testing

Ran codegen locally and compiled.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for printing list member of struct element of list attribute }}

{{! TODO: Add support for printing list member of struct element of list attribute }}
ChipLogProgress(chipTool, " {{asLowerCamelCase name}}: list member of struct element of list attribute printing not supported yet");
{{else if (isOctetString type)}}
ChipLogProgress(Zcl, " {{asSymbol label}}: %zu", {{>fieldValue}}.size());
{{else if (isCharString type)}}
ChipLogProgress(Zcl, " {{asSymbol label}}: %.*s", static_cast<int>({{>fieldValue}}.size()), {{>fieldValue}}.data());
{{else if isStruct}}
{{! TODO: Add support for printing struct member of struct element of list attribute }}
ChipLogProgress(chipTool, " {{asLowerCamelCase name}}: struct member of struct element of list attribute printing not supported yet");
{{else}}
ChipLogProgress(chipTool, " {{asLowerCamelCase name}}: {{asPrintFormat type}}", {{>fieldValue}});


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for printing struct member of struct element of list attribute }}

{{! TODO: Add support for printing struct member of struct element of list attribute }}
ChipLogProgress(chipTool, " {{asLowerCamelCase name}}: struct member of struct element of list attribute printing not supported yet");
{{else}}
ChipLogProgress(chipTool, " {{asLowerCamelCase name}}: {{asPrintFormat type}}", {{>fieldValue}});
{{/if}}
{{#if isNullable}}
}
{{/if}}
{{#if isOptional}}
}
{{/if}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");

, "({{#chip_attribute_list_entryTypes}}{{#if isOptional}}{{! TODO: Add support for optional types here }}{{else if isNullable}}{{! TODO: Add support for nullable types here }}{{else if isArray}}{{! TODO: Add support for lists here }}{{else if isStruct}}{{! TODO: Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");
VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find {{asUpperCamelCase name}}Attribute constructor"));
{{/if}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for optional types here }}

{{! TODO: Add support for optional types here }}
{{else if isNullable}}
{{! TODO: Add support for nullable types here }}
{{else if isArray}}
{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
jbyteArray {{asLowerCamelCase name}} = env->NewByteArray(entry.{{asLowerCamelCase name}}.size());
env->SetByteArrayRegion({{asLowerCamelCase name}}, 0, entry.{{asLowerCamelCase name}}.size(), reinterpret_cast<const jbyte *>(entry.{{asLowerCamelCase name}}.data()));
{{else if (isCharString type)}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for nullable types here }}

{{! TODO: Add support for nullable types here }}
{{else if isArray}}
{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
jbyteArray {{asLowerCamelCase name}} = env->NewByteArray(entry.{{asLowerCamelCase name}}.size());
env->SetByteArrayRegion({{asLowerCamelCase name}}, 0, entry.{{asLowerCamelCase name}}.size(), reinterpret_cast<const jbyte *>(entry.{{asLowerCamelCase name}}.data()));
{{else if (isCharString type)}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for lists here }}

{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
jbyteArray {{asLowerCamelCase name}} = env->NewByteArray(entry.{{asLowerCamelCase name}}.size());
env->SetByteArrayRegion({{asLowerCamelCase name}}, 0, entry.{{asLowerCamelCase name}}.size(), reinterpret_cast<const jbyte *>(entry.{{asLowerCamelCase name}}.data()));
{{else if (isCharString type)}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for structs here }}

{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
jbyteArray {{asLowerCamelCase name}} = env->NewByteArray(entry.{{asLowerCamelCase name}}.size());
env->SetByteArrayRegion({{asLowerCamelCase name}}, 0, entry.{{asLowerCamelCase name}}.size(), reinterpret_cast<const jbyte *>(entry.{{asLowerCamelCase name}}.data()));
{{else if (isCharString type)}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for optional types here }}

{{! TODO: Add support for optional types here }}
{{else if isNullable}}
{{! TODO: Add support for nullable types here }}
{{else if isArray}}
{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else}}
{{asLowerCamelCase name}}{{#not_last}}, {{/not_last}}
{{/if}}
{{/chip_attribute_list_entryTypes}}


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for nullable types here }}

{{! TODO: Add support for nullable types here }}
{{else if isArray}}
{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else}}
{{asLowerCamelCase name}}{{#not_last}}, {{/not_last}}
{{/if}}
{{/chip_attribute_list_entryTypes}}
);
VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create {{asUpperCamelCase name}}Attribute object"));


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for lists here }}

{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else}}
{{asLowerCamelCase name}}{{#not_last}}, {{/not_last}}
{{/if}}
{{/chip_attribute_list_entryTypes}}
);
VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create {{asUpperCamelCase name}}Attribute object"));


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for structs here }}

{{! TODO: Add support for structs here }}
{{else}}
{{asLowerCamelCase name}}{{#not_last}}, {{/not_last}}
{{/if}}
{{/chip_attribute_list_entryTypes}}
);
VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create {{asUpperCamelCase name}}Attribute object"));


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for optional types here }}

{{! TODO: Add support for optional types here }}
{{else if isNullable}}
{{! TODO: Add support for nullable types here }}
{{else if isArray}}
{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
public byte[] {{asLowerCamelCase name}};
{{else if (isCharString type)}}
public String {{asLowerCamelCase name}};


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for nullable types here }}

{{! TODO: Add support for nullable types here }}
{{else if isArray}}
{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
public byte[] {{asLowerCamelCase name}};
{{else if (isCharString type)}}
public String {{asLowerCamelCase name}};


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for lists here }}

{{! TODO: Add support for lists here }}
{{else if isStruct}}
{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
public byte[] {{asLowerCamelCase name}};
{{else if (isCharString type)}}
public String {{asLowerCamelCase name}};


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for structs here }}

{{! TODO: Add support for structs here }}
{{else if (isOctetString type)}}
public byte[] {{asLowerCamelCase name}};
{{else if (isCharString type)}}
public String {{asLowerCamelCase name}};


This comment was generated by todo based on a TODO comment in cb9ce4a in #11105. cc @bzbarsky-apple.

@todo
Copy link

todo bot commented Oct 28, 2021

Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");

, "({{#chip_attribute_list_entryTypes}}{{#if isOptional}}{{! TODO: Add support for optional types here }}{{else if isNullable}}{{! TODO: Add support for nullable types here }}{{else if isArray}}{{! TODO: Add support for lists here }}{{else if isStruct}}{{! TODO: Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");
VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find {{asUpperCamelCase name}}Attribute constructor"));
{{/if}}


This comment was generated by todo based on a TODO comment in 9779e59 in #11105. cc @bzbarsky-apple.

@github-actions
Copy link

github-actions bot commented Oct 28, 2021

PR #11105: Size comparison from 36329e1 to 9779e59

Increases above 0.2%:

platform target config section 36329e1 9779e59 change % change
linux all-clusters-app debug (read only) 1653505 1666337 12832 0.8
.text 1383346 1396178 12832 0.9
chip-tool debug (read only) 4262469 4277309 14840 0.3
.rodata 214032 214992 960 0.4
.text 3785589 3799301 13712 0.4
Increases (2 builds for linux)
platform target config section 36329e1 9779e59 change % change
linux all-clusters-app debug (read only) 1653505 1666337 12832 0.8
(read/write) 119136 119168 32 0.0
.data.rel.ro 61536 61568 32 0.1
.text 1383346 1396178 12832 0.9
chip-tool debug (read only) 4262469 4277309 14840 0.3
(read/write) 122208 122272 64 0.1
.data.rel.ro 97536 97600 64 0.1
.rodata 214032 214992 960 0.4
.text 3785589 3799301 13712 0.4
Full report (20 builds for efr32, k32w, linux, p6, qpg, telink)
platform target config section 36329e1 9779e59 change % change
efr32 lighting-app BRD4161A (read only) 737476 737476 0 0.0
(read/write) 115428 115428 0 0.0
.bss 113676 113676 0 0.0
.data 1752 1752 0 0.0
.text 737468 737468 0 0.0
BRD4161A+rpc (read only) 724916 724916 0 0.0
(read/write) 132032 132032 0 0.0
.bss 130180 130180 0 0.0
.data 1852 1852 0 0.0
.text 724908 724908 0 0.0
lock-app BRD4161A (read only) 716756 716756 0 0.0
(read/write) 113244 113244 0 0.0
.bss 111532 111532 0 0.0
.data 1712 1712 0 0.0
.text 716748 716748 0 0.0
window-app BRD4161A (read only) 717660 717660 0 0.0
(read/write) 113568 113568 0 0.0
.bss 111852 111852 0 0.0
.data 1716 1716 0 0.0
.text 717652 717652 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 701024 701024 0 0.0
.bss 78688 78688 0 0.0
.data 1900 1900 0 0.0
.text 614636 614636 0 0.0
lock-app k32w061+debug (read/write) 592980 592980 0 0.0
.bss 69172 69172 0 0.0
.data 1864 1864 0 0.0
.text 516144 516144 0 0.0
shell k32w061+debug (read/write) 425252 425252 0 0.0
.bss 63256 63256 0 0.0
.data 672 672 0 0.0
.text 359620 359620 0 0.0
linux all-clusters-app debug (read only) 1653505 1666337 12832 0.8
(read/write) 119136 119168 32 0.0
.bss 51376 51376 0 0.0
.data 978 978 0 0.0
.data.rel.ro 61536 61568 32 0.1
.dynamic 592 592 0 0.0
.got 4088 4088 0 0.0
.init 27 27 0 0.0
.init_array 520 520 0 0.0
.rodata 137845 137845 0 0.0
.text 1383346 1396178 12832 0.9
bridge-app debug+rpc (read only) 1282421 1282421 0 0.0
(read/write) 85192 85192 0 0.0
.bss 51856 51856 0 0.0
.data 976 976 0 0.0
.data.rel.ro 27368 27368 0 0.0
.dynamic 592 592 0 0.0
.got 3952 3952 0 0.0
.init 27 27 0 0.0
.init_array 400 400 0 0.0
.rodata 110812 110812 0 0.0
.text 1076245 1076245 0 0.0
chip-tool debug (read only) 4262469 4277309 14840 0.3
(read/write) 122208 122272 64 0.1
.bss 17680 17680 0 0.0
.data 1584 1584 0 0.0
.data.rel.ro 97536 97600 64 0.1
.dynamic 592 592 0 0.0
.got 4368 4368 0 0.0
.init 27 27 0 0.0
.init_array 424 424 0 0.0
.rodata 214032 214992 960 0.4
.text 3785589 3799301 13712 0.4
lighting-app debug+rpc (read only) 1541401 1541401 0 0.0
(read/write) 102032 102032 0 0.0
.bss 41208 41208 0 0.0
.data 1106 1106 0 0.0
.data.rel.ro 54448 54448 0 0.0
.dynamic 608 608 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 528 528 0 0.0
.rodata 128977 128977 0 0.0
.text 1279922 1279922 0 0.0
ota-provider-app debug (read only) 1238937 1238937 0 0.0
(read/write) 67904 67904 0 0.0
.bss 37440 37440 0 0.0
.data 752 752 0 0.0
.data.rel.ro 24616 24616 0 0.0
.dynamic 592 592 0 0.0
.got 4016 4016 0 0.0
.init 27 27 0 0.0
.init_array 440 440 0 0.0
.rodata 110984 110984 0 0.0
.text 1031730 1031730 0 0.0
ota-requestor-app debug (read only) 1301033 1301033 0 0.0
(read/write) 76648 76648 0 0.0
.bss 45216 45216 0 0.0
.data 816 816 0 0.0
.data.rel.ro 25496 25496 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 512 512 0 0.0
.rodata 127680 127680 0 0.0
.text 1075490 1075490 0 0.0
shell debug (read only) 787361 787361 0 0.0
(read/write) 57792 57792 0 0.0
.bss 16168 16168 0 0.0
.data 242 242 0 0.0
.data.rel.ro 36880 36880 0 0.0
.dynamic 592 592 0 0.0
.got 3528 3528 0 0.0
.init 27 27 0 0.0
.init_array 336 336 0 0.0
.rodata 77519 77519 0 0.0
.text 608258 608258 0 0.0
tv-app debug (read only) 1774529 1774529 0 0.0
(read/write) 289656 289656 0 0.0
.bss 223280 223280 0 0.0
.data 2032 2032 0 0.0
.data.rel.ro 58704 58704 0 0.0
.dynamic 592 592 0 0.0
.got 4408 4408 0 0.0
.init 27 27 0 0.0
.init_array 608 608 0 0.0
.rodata 154776 154776 0 0.0
.text 1477442 1477442 0 0.0
p6 lock-app default (read/write) 2169096 2169096 0 0.0
.bss 67168 67168 0 0.0
.data 2416 2416 0 0.0
.heap 963760 963760 0 0.0
.text 1127360 1127360 0 0.0
qpg lighting-app qpg6100+debug (read only) 491240 491240 0 0.0
(read/write) 114144 114144 0 0.0
.bss 52400 52400 0 0.0
.data 1000 1000 0 0.0
.text 485920 485920 0 0.0
lock-app qpg6100+debug (read only) 467580 467580 0 0.0
(read/write) 114140 114140 0 0.0
.bss 51352 51352 0 0.0
.data 956 956 0 0.0
.text 462260 462260 0 0.0
persistent-storage-app qpg6100+debug (read only) 155244 155244 0 0.0
(read/write) 114140 114140 0 0.0
.bss 27752 27752 0 0.0
.data 372 372 0 0.0
.text 149924 149924 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 664518 664518 0 0.0
bss 69944 69944 0 0.0
noinit 33216 33216 0 0.0
text 458068 458068 0 0.0

@bzbarsky-apple bzbarsky-apple force-pushed the compiling-optional-struct-in-list-codegen branch from 9779e59 to 6b2d9a9 Compare October 28, 2021 04:56
@todo
Copy link

todo bot commented Oct 28, 2021

Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");

, "({{#chip_attribute_list_entryTypes}}{{#if isOptional}}{{! TODO: Add support for optional types here }}{{else if isNullable}}{{! TODO: Add support for nullable types here }}{{else if isArray}}{{! TODO: Add support for lists here }}{{else if isStruct}}{{! TODO: Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");
VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find {{asUpperCamelCase name}}Attribute constructor"));
{{/if}}


This comment was generated by todo based on a TODO comment in 6b2d9a9 in #11105. cc @bzbarsky-apple.

@github-actions
Copy link

github-actions bot commented Oct 28, 2021

PR #11105: Size comparison from 36329e1 to 6b2d9a9

Increases above 0.2%:

platform target config section 36329e1 6b2d9a9 change % change
linux all-clusters-app debug (read only) 1653505 1666337 12832 0.8
.text 1383346 1396178 12832 0.9
chip-tool debug (read only) 4262469 4277309 14840 0.3
.rodata 214032 214992 960 0.4
.text 3785589 3799301 13712 0.4
Increases (5 builds for esp32, linux, mbed)
platform target config section 36329e1 6b2d9a9 change % change
esp32 all-clusters-app c3devkit (read only) 875926 877630 1704 0.2
(read/write) 1308672 1308688 16 0.0
.flash.rodata 199744 199760 16 0.0
.flash.text 875926 877630 1704 0.2
m5stack (read only) 907187 908875 1688 0.2
(read/write) 428460 428476 16 0.0
.flash.rodata 208468 208484 16 0.0
.flash.text 907187 908875 1688 0.2
linux all-clusters-app debug (read only) 1653505 1666337 12832 0.8
(read/write) 119136 119168 32 0.0
.data.rel.ro 61536 61568 32 0.1
.text 1383346 1396178 12832 0.9
chip-tool debug (read only) 4262469 4277309 14840 0.3
(read/write) 122208 122272 64 0.1
.data.rel.ro 97536 97600 64 0.1
.rodata 214032 214992 960 0.4
.text 3785589 3799301 13712 0.4
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2290664 2292600 1936 0.1
.text 1253264 1255200 1936 0.2
Full report (37 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 36329e1 6b2d9a9 change % change
efr32 lighting-app BRD4161A (read only) 737476 737476 0 0.0
(read/write) 115428 115428 0 0.0
.bss 113676 113676 0 0.0
.data 1752 1752 0 0.0
.text 737468 737468 0 0.0
BRD4161A+rpc (read only) 724916 724916 0 0.0
(read/write) 132032 132032 0 0.0
.bss 130180 130180 0 0.0
.data 1852 1852 0 0.0
.text 724908 724908 0 0.0
lock-app BRD4161A (read only) 716756 716756 0 0.0
(read/write) 113244 113244 0 0.0
.bss 111532 111532 0 0.0
.data 1712 1712 0 0.0
.text 716748 716748 0 0.0
window-app BRD4161A (read only) 717660 717660 0 0.0
(read/write) 113568 113568 0 0.0
.bss 111852 111852 0 0.0
.data 1716 1716 0 0.0
.text 717652 717652 0 0.0
esp32 all-clusters-app c3devkit (read only) 875926 877630 1704 0.2
(read/write) 1308672 1308688 16 0.0
.dram0.bss 59248 59248 0 0.0
.dram0.data 16448 16448 0 0.0
.flash.rodata 199744 199760 16 0.0
.flash.text 875926 877630 1704 0.2
.iram0.text 57554 57554 0 0.0
m5stack (read only) 907187 908875 1688 0.2
(read/write) 428460 428476 16 0.0
.dram0.bss 61744 61744 0 0.0
.dram0.data 32084 32084 0 0.0
.flash.rodata 208468 208484 16 0.0
.flash.text 907187 908875 1688 0.2
.iram0.text 125115 125115 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 701024 701024 0 0.0
.bss 78688 78688 0 0.0
.data 1900 1900 0 0.0
.text 614636 614636 0 0.0
lock-app k32w061+debug (read/write) 592980 592980 0 0.0
.bss 69172 69172 0 0.0
.data 1864 1864 0 0.0
.text 516144 516144 0 0.0
shell k32w061+debug (read/write) 425252 425252 0 0.0
.bss 63256 63256 0 0.0
.data 672 672 0 0.0
.text 359620 359620 0 0.0
linux all-clusters-app debug (read only) 1653505 1666337 12832 0.8
(read/write) 119136 119168 32 0.0
.bss 51376 51376 0 0.0
.data 978 978 0 0.0
.data.rel.ro 61536 61568 32 0.1
.dynamic 592 592 0 0.0
.got 4088 4088 0 0.0
.init 27 27 0 0.0
.init_array 520 520 0 0.0
.rodata 137845 137845 0 0.0
.text 1383346 1396178 12832 0.9
bridge-app debug+rpc (read only) 1282421 1282421 0 0.0
(read/write) 85192 85192 0 0.0
.bss 51856 51856 0 0.0
.data 976 976 0 0.0
.data.rel.ro 27368 27368 0 0.0
.dynamic 592 592 0 0.0
.got 3952 3952 0 0.0
.init 27 27 0 0.0
.init_array 400 400 0 0.0
.rodata 110812 110812 0 0.0
.text 1076245 1076245 0 0.0
chip-tool debug (read only) 4262469 4277309 14840 0.3
(read/write) 122208 122272 64 0.1
.bss 17680 17680 0 0.0
.data 1584 1584 0 0.0
.data.rel.ro 97536 97600 64 0.1
.dynamic 592 592 0 0.0
.got 4368 4368 0 0.0
.init 27 27 0 0.0
.init_array 424 424 0 0.0
.rodata 214032 214992 960 0.4
.text 3785589 3799301 13712 0.4
lighting-app debug+rpc (read only) 1541401 1541401 0 0.0
(read/write) 102032 102032 0 0.0
.bss 41208 41208 0 0.0
.data 1106 1106 0 0.0
.data.rel.ro 54448 54448 0 0.0
.dynamic 608 608 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 528 528 0 0.0
.rodata 128977 128977 0 0.0
.text 1279922 1279922 0 0.0
ota-provider-app debug (read only) 1238937 1238937 0 0.0
(read/write) 67904 67904 0 0.0
.bss 37440 37440 0 0.0
.data 752 752 0 0.0
.data.rel.ro 24616 24616 0 0.0
.dynamic 592 592 0 0.0
.got 4016 4016 0 0.0
.init 27 27 0 0.0
.init_array 440 440 0 0.0
.rodata 110984 110984 0 0.0
.text 1031730 1031730 0 0.0
ota-requestor-app debug (read only) 1301033 1301033 0 0.0
(read/write) 76648 76648 0 0.0
.bss 45216 45216 0 0.0
.data 816 816 0 0.0
.data.rel.ro 25496 25496 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 512 512 0 0.0
.rodata 127680 127680 0 0.0
.text 1075490 1075490 0 0.0
shell debug (read only) 787361 787361 0 0.0
(read/write) 57792 57792 0 0.0
.bss 16168 16168 0 0.0
.data 242 242 0 0.0
.data.rel.ro 36880 36880 0 0.0
.dynamic 592 592 0 0.0
.got 3528 3528 0 0.0
.init 27 27 0 0.0
.init_array 336 336 0 0.0
.rodata 77519 77519 0 0.0
.text 608258 608258 0 0.0
tv-app debug (read only) 1774529 1774529 0 0.0
(read/write) 289656 289656 0 0.0
.bss 223280 223280 0 0.0
.data 2032 2032 0 0.0
.data.rel.ro 58704 58704 0 0.0
.dynamic 592 592 0 0.0
.got 4408 4408 0 0.0
.init 27 27 0 0.0
.init_array 608 608 0 0.0
.rodata 154776 154776 0 0.0
.text 1477442 1477442 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2290664 2292600 1936 0.1
.bss 180620 180620 0 0.0
.data 5192 5192 0 0.0
.heap 850632 850632 0 0.0
.text 1253264 1255200 1936 0.2
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2274992 2274992 0 0.0
.bss 172820 172820 0 0.0
.data 5568 5568 0 0.0
.heap 858056 858056 0 0.0
.text 1237592 1237592 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2252712 2252712 0 0.0
.bss 171724 171724 0 0.0
.data 5552 5552 0 0.0
.heap 859168 859168 0 0.0
.text 1215312 1215312 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139744 1139744 0 0.0
.bss 11752 11752 0 0.0
.data 4368 4368 0 0.0
.heap 1020328 1020328 0 0.0
.text 103128 103128 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2048984 2048984 0 0.0
.bss 156208 156208 0 0.0
.data 4968 4968 0 0.0
.heap 875272 875272 0 0.0
.text 1011584 1011584 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 862911 862911 0 0.0
bss 112132 112132 0 0.0
rodata 97528 97528 0 0.0
text 577624 577624 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 823735 823735 0 0.0
bss 108372 108372 0 0.0
rodata 88304 88304 0 0.0
text 550800 550800 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 787902 787902 0 0.0
bss 113504 113504 0 0.0
rodata 92768 92768 0 0.0
text 507092 507092 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 839583 839583 0 0.0
bss 111168 111168 0 0.0
rodata 93880 93880 0 0.0
text 559108 559108 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 764882 764882 0 0.0
bss 112576 112576 0 0.0
rodata 89188 89188 0 0.0
text 488668 488668 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497323 497323 0 0.0
bss 51824 51824 0 0.0
rodata 45776 45776 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 844287 844287 0 0.0
bss 111304 111304 0 0.0
rodata 95128 95128 0 0.0
text 562320 562320 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 839575 839575 0 0.0
bss 111200 111200 0 0.0
rodata 93904 93904 0 0.0
text 558952 558952 0 0.0
shell nrf52840dk_nrf52840 (read/write) 776435 776435 0 0.0
bss 109072 109072 0 0.0
rodata 72536 72536 0 0.0
text 520236 520236 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 691490 691490 0 0.0
bss 110056 110056 0 0.0
rodata 67180 67180 0 0.0
text 440848 440848 0 0.0
p6 lock-app default (read/write) 2169096 2169096 0 0.0
.bss 67168 67168 0 0.0
.data 2416 2416 0 0.0
.heap 963760 963760 0 0.0
.text 1127360 1127360 0 0.0
qpg lighting-app qpg6100+debug (read only) 491240 491240 0 0.0
(read/write) 114144 114144 0 0.0
.bss 52400 52400 0 0.0
.data 1000 1000 0 0.0
.text 485920 485920 0 0.0
lock-app qpg6100+debug (read only) 467580 467580 0 0.0
(read/write) 114140 114140 0 0.0
.bss 51352 51352 0 0.0
.data 956 956 0 0.0
.text 462260 462260 0 0.0
persistent-storage-app qpg6100+debug (read only) 155244 155244 0 0.0
(read/write) 114140 114140 0 0.0
.bss 27752 27752 0 0.0
.data 372 372 0 0.0
.text 149924 149924 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 664518 664518 0 0.0
bss 69944 69944 0 0.0
noinit 33216 33216 0 0.0
text 458068 458068 0 0.0

…/optionals at least compile.

This doesn't give us correct behavior across all of our bindings
(chip-tool command line, yaml, darwin, python, java).  But it at least
allows code generation to produce output and allows that output to
compile.

More work is needed to address the various TODO issues.
@bzbarsky-apple bzbarsky-apple force-pushed the compiling-optional-struct-in-list-codegen branch from 6b2d9a9 to 80ddf15 Compare October 29, 2021 17:48
@todo
Copy link

todo bot commented Oct 29, 2021

Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");

, "({{#chip_attribute_list_entryTypes}}{{#if isOptional}}{{! TODO: Add support for optional types here }}{{else if isNullable}}{{! TODO: Add support for nullable types here }}{{else if isArray}}{{! TODO: Add support for lists here }}{{else if isStruct}}{{! TODO: Add support for structs here }}{{else if (isString type)}}{{#if (isOctetString type)}}[B{{else}}Ljava/lang/String;{{/if}}{{else}}{{asJniSignature type}}{{/if}}{{/chip_attribute_list_entryTypes}})V");
VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find {{asUpperCamelCase name}}Attribute constructor"));
{{/if}}


This comment was generated by todo based on a TODO comment in 80ddf15 in #11105. cc @bzbarsky-apple.

@github-actions
Copy link

github-actions bot commented Oct 29, 2021

PR #11105: Size comparison from 69423bc to 80ddf15

Increases above 0.2%:

platform target config section 69423bc 80ddf15 change % change
linux all-clusters-app debug (read only) 1655017 1667849 12832 0.8
.text 1385090 1397922 12832 0.9
chip-tool debug (read only) 4268221 4283061 14840 0.3
.rodata 214800 215760 960 0.4
.text 3790453 3804165 13712 0.4
Increases (5 builds for esp32, linux, mbed)
platform target config section 69423bc 80ddf15 change % change
esp32 all-clusters-app c3devkit (read only) 876522 878226 1704 0.2
(read/write) 1308160 1308176 16 0.0
.flash.rodata 199632 199648 16 0.0
.flash.text 876522 878226 1704 0.2
m5stack (read only) 907855 909439 1584 0.2
(read/write) 427940 427956 16 0.0
.flash.rodata 208348 208364 16 0.0
.flash.text 907855 909439 1584 0.2
linux all-clusters-app debug (read only) 1655017 1667849 12832 0.8
.text 1385090 1397922 12832 0.9
chip-tool debug (read only) 4268221 4283061 14840 0.3
(read/write) 122240 122336 96 0.1
.data.rel.ro 97568 97648 80 0.1
.rodata 214800 215760 960 0.4
.text 3790453 3804165 13712 0.4
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2291080 2293016 1936 0.1
.text 1253680 1255616 1936 0.2
Full report (37 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 69423bc 80ddf15 change % change
efr32 lighting-app BRD4161A (read only) 737864 737864 0 0.0
(read/write) 115028 115028 0 0.0
.bss 113276 113276 0 0.0
.data 1752 1752 0 0.0
.text 737856 737856 0 0.0
BRD4161A+rpc (read only) 725304 725304 0 0.0
(read/write) 131636 131636 0 0.0
.bss 129780 129780 0 0.0
.data 1852 1852 0 0.0
.text 725296 725296 0 0.0
lock-app BRD4161A (read only) 717144 717144 0 0.0
(read/write) 112844 112844 0 0.0
.bss 111132 111132 0 0.0
.data 1712 1712 0 0.0
.text 717136 717136 0 0.0
window-app BRD4161A (read only) 718048 718048 0 0.0
(read/write) 113172 113172 0 0.0
.bss 111452 111452 0 0.0
.data 1716 1716 0 0.0
.text 718040 718040 0 0.0
esp32 all-clusters-app c3devkit (read only) 876522 878226 1704 0.2
(read/write) 1308160 1308176 16 0.0
.dram0.bss 58848 58848 0 0.0
.dram0.data 16448 16448 0 0.0
.flash.rodata 199632 199648 16 0.0
.flash.text 876522 878226 1704 0.2
.iram0.text 57554 57554 0 0.0
m5stack (read only) 907855 909439 1584 0.2
(read/write) 427940 427956 16 0.0
.dram0.bss 61344 61344 0 0.0
.dram0.data 32084 32084 0 0.0
.flash.rodata 208348 208364 16 0.0
.flash.text 907855 909439 1584 0.2
.iram0.text 125115 125115 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 700984 700984 0 0.0
.bss 78288 78288 0 0.0
.data 1900 1900 0 0.0
.text 614996 614996 0 0.0
lock-app k32w061+debug (read/write) 592940 592940 0 0.0
.bss 68772 68772 0 0.0
.data 1864 1864 0 0.0
.text 516504 516504 0 0.0
shell k32w061+debug (read/write) 425252 425252 0 0.0
.bss 63256 63256 0 0.0
.data 672 672 0 0.0
.text 359620 359620 0 0.0
linux all-clusters-app debug (read only) 1655017 1667849 12832 0.8
(read/write) 118720 118720 0 0.0
.bss 50960 50960 0 0.0
.data 978 978 0 0.0
.data.rel.ro 61536 61536 0 0.0
.dynamic 592 592 0 0.0
.got 4088 4088 0 0.0
.init 27 27 0 0.0
.init_array 520 520 0 0.0
.rodata 137685 137685 0 0.0
.text 1385090 1397922 12832 0.9
bridge-app debug+rpc (read only) 1283285 1283285 0 0.0
(read/write) 84776 84776 0 0.0
.bss 51440 51440 0 0.0
.data 976 976 0 0.0
.data.rel.ro 27368 27368 0 0.0
.dynamic 592 592 0 0.0
.got 3952 3952 0 0.0
.init 27 27 0 0.0
.init_array 400 400 0 0.0
.rodata 110660 110660 0 0.0
.text 1077333 1077333 0 0.0
chip-tool debug (read only) 4268221 4283061 14840 0.3
(read/write) 122240 122336 96 0.1
.bss 17680 17680 0 0.0
.data 1584 1584 0 0.0
.data.rel.ro 97568 97648 80 0.1
.dynamic 592 592 0 0.0
.got 4368 4368 0 0.0
.init 27 27 0 0.0
.init_array 424 424 0 0.0
.rodata 214800 215760 960 0.4
.text 3790453 3804165 13712 0.4
lighting-app debug+rpc (read only) 1542193 1542193 0 0.0
(read/write) 101648 101648 0 0.0
.bss 40824 40824 0 0.0
.data 1106 1106 0 0.0
.data.rel.ro 54448 54448 0 0.0
.dynamic 608 608 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 528 528 0 0.0
.rodata 128753 128753 0 0.0
.text 1281010 1281010 0 0.0
ota-provider-app debug (read only) 1240097 1240097 0 0.0
(read/write) 67488 67488 0 0.0
.bss 37024 37024 0 0.0
.data 752 752 0 0.0
.data.rel.ro 24616 24616 0 0.0
.dynamic 592 592 0 0.0
.got 4016 4016 0 0.0
.init 27 27 0 0.0
.init_array 440 440 0 0.0
.rodata 110824 110824 0 0.0
.text 1033122 1033122 0 0.0
ota-requestor-app debug (read only) 1303273 1303273 0 0.0
(read/write) 76744 76744 0 0.0
.bss 45280 45280 0 0.0
.data 816 816 0 0.0
.data.rel.ro 25528 25528 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 512 512 0 0.0
.rodata 127456 127456 0 0.0
.text 1078002 1078002 0 0.0
shell debug (read only) 787153 787153 0 0.0
(read/write) 57760 57760 0 0.0
.bss 16168 16168 0 0.0
.data 242 242 0 0.0
.data.rel.ro 36848 36848 0 0.0
.dynamic 592 592 0 0.0
.got 3528 3528 0 0.0
.init 27 27 0 0.0
.init_array 336 336 0 0.0
.rodata 77519 77519 0 0.0
.text 608098 608098 0 0.0
tv-app debug (read only) 1774873 1774873 0 0.0
(read/write) 289240 289240 0 0.0
.bss 222864 222864 0 0.0
.data 2032 2032 0 0.0
.data.rel.ro 58704 58704 0 0.0
.dynamic 592 592 0 0.0
.got 4408 4408 0 0.0
.init 27 27 0 0.0
.init_array 608 608 0 0.0
.rodata 154104 154104 0 0.0
.text 1478530 1478530 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2291080 2293016 1936 0.1
.bss 180220 180220 0 0.0
.data 5192 5192 0 0.0
.heap 851032 851032 0 0.0
.text 1253680 1255616 1936 0.2
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2275352 2275352 0 0.0
.bss 172420 172420 0 0.0
.data 5568 5568 0 0.0
.heap 858456 858456 0 0.0
.text 1237952 1237952 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2253072 2253072 0 0.0
.bss 171324 171324 0 0.0
.data 5552 5552 0 0.0
.heap 859568 859568 0 0.0
.text 1215672 1215672 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139744 1139744 0 0.0
.bss 11752 11752 0 0.0
.data 4368 4368 0 0.0
.heap 1020328 1020328 0 0.0
.text 103128 103128 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2048976 2048976 0 0.0
.bss 156208 156208 0 0.0
.data 4968 4968 0 0.0
.heap 875272 875272 0 0.0
.text 1011576 1011576 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 862847 862847 0 0.0
bss 111732 111732 0 0.0
rodata 97432 97432 0 0.0
text 578072 578072 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 823707 823707 0 0.0
bss 107972 107972 0 0.0
rodata 88212 88212 0 0.0
text 551248 551248 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 787870 787870 0 0.0
bss 113104 113104 0 0.0
rodata 92672 92672 0 0.0
text 507540 507540 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 839555 839555 0 0.0
bss 110768 110768 0 0.0
rodata 93788 93788 0 0.0
text 559556 559556 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 764850 764850 0 0.0
bss 112176 112176 0 0.0
rodata 89092 89092 0 0.0
text 489116 489116 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497323 497323 0 0.0
bss 51824 51824 0 0.0
rodata 45776 45776 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 844223 844223 0 0.0
bss 110904 110904 0 0.0
rodata 95032 95032 0 0.0
text 562768 562768 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 839543 839543 0 0.0
bss 110800 110800 0 0.0
rodata 93808 93808 0 0.0
text 559400 559400 0 0.0
shell nrf52840dk_nrf52840 (read/write) 776435 776435 0 0.0
bss 109072 109072 0 0.0
rodata 72536 72536 0 0.0
text 520236 520236 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 691490 691490 0 0.0
bss 110056 110056 0 0.0
rodata 67180 67180 0 0.0
text 440848 440848 0 0.0
p6 lock-app default (read/write) 2169488 2169488 0 0.0
.bss 66768 66768 0 0.0
.data 2416 2416 0 0.0
.heap 964160 964160 0 0.0
.text 1127752 1127752 0 0.0
qpg lighting-app qpg6100+debug (read only) 490944 490944 0 0.0
(read/write) 114144 114144 0 0.0
.bss 50888 50888 0 0.0
.data 1000 1000 0 0.0
.text 485624 485624 0 0.0
lock-app qpg6100+debug (read only) 467300 467300 0 0.0
(read/write) 114140 114140 0 0.0
.bss 49840 49840 0 0.0
.data 956 956 0 0.0
.text 461980 461980 0 0.0
persistent-storage-app qpg6100+debug (read only) 155236 155236 0 0.0
(read/write) 114140 114140 0 0.0
.bss 27752 27752 0 0.0
.data 372 372 0 0.0
.text 149916 149916 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 664562 664562 0 0.0
bss 69544 69544 0 0.0
noinit 33216 33216 0 0.0
text 458596 458596 0 0.0

@bzbarsky-apple bzbarsky-apple merged commit 21cb1d9 into project-chip:master Oct 29, 2021
@bzbarsky-apple bzbarsky-apple deleted the compiling-optional-struct-in-list-codegen branch October 29, 2021 19:01
PSONALl pushed a commit to PSONALl/connectedhomeip that referenced this pull request Dec 3, 2021
…/optionals at least compile. (project-chip#11105)

This doesn't give us correct behavior across all of our bindings
(chip-tool command line, yaml, darwin, python, java).  But it at least
allows code generation to produce output and allows that output to
compile.

More work is needed to address the various TODO issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants