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 sure we handle subclasses properly when we use instancetype. #25169

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

We should not be claiming to return instancetype if we actually always return an instance of our class.

Fixes #23384

@github-actions
Copy link

PR #25169: Size comparison from e35345c to 5f53844

Full report (1 build for cc32xx)
platform target config section e35345c 5f53844 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 642217 642217 0 0.0
(read/write) 203696 203696 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197096 197096 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 934242 934242 0 0.0
.debug_aranges 87472 87472 0 0.0
.debug_frame 300288 300288 0 0.0
.debug_info 20361460 20361460 0 0.0
.debug_line 2661258 2661258 0 0.0
.debug_loc 2797585 2797585 0 0.0
.debug_ranges 281768 281768 0 0.0
.debug_str 3020435 3020435 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105705 105705 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377379 377379 0 0.0
.symtab 256048 256048 0 0.0
.text 534392 534392 0 0.0

We should not be claiming to return instancetype if we actually always return an
instance of our class.

Fixes project-chip#23384
@github-actions
Copy link

PR #25169: Size comparison from 03fc0b5 to 00e30e2

Increases (2 builds for bl602, telink)
platform target config section 03fc0b5 00e30e2 change % change
bl602 lighting-app bl602+rpc .text 1056018 1056020 2 0.0
telink thermostat tlsr9518adk80d (read/write) 875752 875760 8 0.0
text 594324 594326 2 0.0
Decreases (8 builds for bl602, bl702, cc32xx, psoc6, telink)
platform target config section 03fc0b5 00e30e2 change % change
bl602 lighting-app bl602 .text 1025086 1025084 -2 -0.0
bl702 lighting-app bl702 .debug_info 40701841 40701840 -1 -0.0
.text 954682 954680 -2 -0.0
bl702+rpc .debug_info 45117268 45117267 -1 -0.0
.text 1032092 1032090 -2 -0.0
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20360345 20360344 -1 -0.0
psoc6 all-clusters cy8ckit_062s2_43012 .debug_info 28074894 28074892 -2 -0.0
lock cy8ckit_062s2_43012 .debug_info 23217240 23217239 -1 -0.0
telink all-clusters-app tlsr9518adk80d text 686848 686846 -2 -0.0
all-clusters-minimal-app tlsr9518adk80d text 648368 648366 -2 -0.0
Full report (23 builds for bl602, bl702, cc32xx, cyw30739, linux, psoc6, qpg, telink)
platform target config section 03fc0b5 00e30e2 change % change
bl602 lighting-app bl602 (read/write) 1348706 1348706 0 0.0
.bss 94690 94690 0 0.0
.data 9736 9736 0 0.0
.text 1025086 1025084 -2 -0.0
bl602+rpc (read/write) 1394130 1394130 0 0.0
.bss 102738 102738 0 0.0
.data 10128 10128 0 0.0
.text 1056018 1056020 2 0.0
bl702 lighting-app bl702 0 0 0 0.0
(read only) 3358 3358 0 0.0
(read/write) 1187267 1187267 0 0.0
.bleromro 6342 6342 0 0.0
.bleromrw 124 124 0 0.0
.boot2 292 292 0 0.0
.bss 69793 69793 0 0.0
.bss_psram 30064 30064 0 0.0
.comment 48 48 0 0.0
.data 4064 4064 0 0.0
.debug_abbrev 1556113 1556113 0 0.0
.debug_aranges 134376 134376 0 0.0
.debug_frame 492532 492532 0 0.0
.debug_info 40701841 40701840 -1 -0.0
.debug_line 5284141 5284141 0 0.0
.debug_loc 3417622 3417622 0 0.0
.debug_ranges 372072 372072 0 0.0
.debug_str 3575802 3575802 0 0.0
.hbn 536 536 0 0.0
.hbn_noinit 260 260 0 0.0
.init 342 342 0 0.0
.init_array 144 144 0 0.0
.psram 0 0 0 0.0
.riscv.attributes 47 47 0 0.0
.rodata 107568 107568 0 0.0
.rsvd 2960 2960 0 0.0
.sha_ocram 72 72 0 0.0
.shstrtab 304 304 0 0.0
.stack 2048 2048 0 0.0
.strtab 573412 573412 0 0.0
.symtab 173472 173472 0 0.0
.tcm_data 36 36 0 0.0
.tcmcode 3358 3358 0 0.0
.text 954682 954680 -2 -0.0
bl702+rpc 0 0 0 0.0
(read only) 3358 3358 0 0.0
(read/write) 1280415 1280415 0 0.0
.bleromro 6342 6342 0 0.0
.bleromrw 124 124 0 0.0
.boot2 292 292 0 0.0
.bss 77841 77841 0 0.0
.bss_psram 30320 30320 0 0.0
.comment 48 48 0 0.0
.data 4608 4608 0 0.0
.debug_abbrev 1704359 1704359 0 0.0
.debug_aranges 142616 142616 0 0.0
.debug_frame 520296 520296 0 0.0
.debug_info 45117268 45117267 -1 -0.0
.debug_line 5683184 5683184 0 0.0
.debug_loc 3614576 3614576 0 0.0
.debug_ranges 395848 395848 0 0.0
.debug_str 3979339 3979339 0 0.0
.hbn 536 536 0 0.0
.hbn_noinit 260 260 0 0.0
.init 342 342 0 0.0
.init_array 160 160 0 0.0
.psram 0 0 0 0.0
.riscv.attributes 47 47 0 0.0
.rodata 122208 122208 0 0.0
.rsvd 2960 2960 0 0.0
.sha_ocram 72 72 0 0.0
.shstrtab 304 304 0 0.0
.stack 2048 2048 0 0.0
.strtab 634476 634476 0 0.0
.symtab 191936 191936 0 0.0
.tcm_data 36 36 0 0.0
.tcmcode 3358 3358 0 0.0
.text 1032092 1032090 -2 -0.0
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 642217 642217 0 0.0
(read/write) 203696 203696 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197096 197096 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 934242 934242 0 0.0
.debug_aranges 87448 87448 0 0.0
.debug_frame 300212 300212 0 0.0
.debug_info 20360345 20360344 -1 -0.0
.debug_line 2661062 2661062 0 0.0
.debug_loc 2797107 2797107 0 0.0
.debug_ranges 281744 281744 0 0.0
.debug_str 3019502 3019502 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105705 105705 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377379 377379 0 0.0
.symtab 256048 256048 0 0.0
.text 534392 534392 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 585986 585986 0 0.0
.app_xip_area 462860 462860 0 0.0
.bss 65568 65568 0 0.0
.data 740 740 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 590058 590058 0 0.0
.app_xip_area 461628 461628 0 0.0
.bss 70864 70864 0 0.0
.data 748 748 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 550974 550974 0 0.0
.app_xip_area 433352 433352 0 0.0
.bss 60104 60104 0 0.0
.data 696 696 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
linux chip-tool-ipv6only arm64 (read only) 12060708 12060708 0 0.0
(read/write) 729224 729224 0 0.0
.bss 34136 34136 0 0.0
.data 3008 3008 0 0.0
.data.rel.ro 671552 671552 0 0.0
.dynamic 560 560 0 0.0
.got 15328 15328 0 0.0
.init 24 24 0 0.0
.init_array 208 208 0 0.0
.rodata 585780 585780 0 0.0
.text 9744372 9744372 0 0.0
thermostat-no-ble arm64 (read only) 2516220 2516220 0 0.0
(read/write) 145096 145096 0 0.0
.bss 56312 56312 0 0.0
.data 1832 1832 0 0.0
.data.rel.ro 77568 77568 0 0.0
.dynamic 560 560 0 0.0
.got 5336 5336 0 0.0
.init 24 24 0 0.0
.init_array 432 432 0 0.0
.rodata 151320 151320 0 0.0
.text 2102752 2102752 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 0 0 0 0.0
(read only) 840952 840952 0 0.0
(read/write) 1760276 1760276 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 189720 189720 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2672 2672 0 0.0
.debug_abbrev 1257355 1257355 0 0.0
.debug_aranges 111496 111496 0 0.0
.debug_frame 374608 374608 0 0.0
.debug_info 28074894 28074892 -2 -0.0
.debug_line 3795435 3795435 0 0.0
.debug_loc 3692531 3692531 0 0.0
.debug_ranges 363464 363464 0 0.0
.debug_str 3528327 3528327 0 0.0
.heap 840952 840952 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 580224 580224 0 0.0
.symtab 425120 425120 0 0.0
.text 1559496 1559496 0 0.0
.zero.table 8 8 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 0 0 0 0.0
(read only) 841752 841752 0 0.0
(read/write) 1700836 1700836 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 188920 188920 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2672 2672 0 0.0
.debug_abbrev 1242900 1242900 0 0.0
.debug_aranges 110760 110760 0 0.0
.debug_frame 377044 377044 0 0.0
.debug_info 27621029 27621029 0 0.0
.debug_line 3803918 3803918 0 0.0
.debug_loc 3675957 3675957 0 0.0
.debug_ranges 361432 361432 0 0.0
.debug_str 3515590 3515590 0 0.0
.heap 841752 841752 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 539857 539857 0 0.0
.symtab 410192 410192 0 0.0
.text 1500856 1500856 0 0.0
.zero.table 8 8 0 0.0
light cy8ckit_062s2_43012 0 0 0 0.0
(read only) 850072 850072 0 0.0
(read/write) 1614324 1614324 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 180808 180808 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2464 2464 0 0.0
.debug_abbrev 1078288 1078288 0 0.0
.debug_aranges 102960 102960 0 0.0
.debug_frame 347296 347296 0 0.0
.debug_info 22964134 22964134 0 0.0
.debug_line 3356551 3356551 0 0.0
.debug_loc 3351431 3351431 0 0.0
.debug_ranges 319944 319944 0 0.0
.debug_str 3314336 3314336 0 0.0
.heap 850072 850072 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 475364 475364 0 0.0
.symtab 377968 377968 0 0.0
.text 1422664 1422664 0 0.0
.zero.table 8 8 0 0.0
lock cy8ckit_062s2_43012 0 0 0 0.0
(read only) 845088 845088 0 0.0
(read/write) 1648508 1648508 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 185776 185776 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2480 2480 0 0.0
.debug_abbrev 1080317 1080317 0 0.0
.debug_aranges 103408 103408 0 0.0
.debug_frame 349200 349200 0 0.0
.debug_info 23217240 23217239 -1 -0.0
.debug_line 3358988 3358988 0 0.0
.debug_loc 3376363 3376363 0 0.0
.debug_ranges 322544 322544 0 0.0
.debug_str 3333467 3333467 0 0.0
.heap 845088 845088 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 479595 479595 0 0.0
.symtab 380496 380496 0 0.0
.text 1451864 1451864 0 0.0
.zero.table 8 8 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1150636 1150636 0 0.0
.bss 99820 99820 0 0.0
.data 852 852 0 0.0
.text 597732 597732 0 0.0
lock-app qpg6105+debug (read/write) 1118204 1118204 0 0.0
.bss 96316 96316 0 0.0
.data 864 864 0 0.0
.text 565304 565304 0 0.0
telink all-clusters-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 1015724 1015724 0 0.0
bss 97788 97788 0 0.0
text 686848 686846 -2 -0.0
all-clusters-minimal-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 951424 951424 0 0.0
bss 96840 96840 0 0.0
text 648368 648366 -2 -0.0
contact-sensor-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 855956 855956 0 0.0
bss 88968 88968 0 0.0
text 578910 578910 0 0.0
light-switch-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 871668 871668 0 0.0
bss 89052 89052 0 0.0
text 592914 592914 0 0.0
lighting-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 949720 949720 0 0.0
bss 97196 97196 0 0.0
text 658980 658980 0 0.0
ota-requestor-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 883060 883060 0 0.0
bss 89996 89996 0 0.0
text 602720 602720 0 0.0
thermostat tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 875752 875760 8 0.0
bss 90444 90444 0 0.0
text 594324 594326 2 0.0

@bzbarsky-apple bzbarsky-apple merged commit 5b358b2 into project-chip:master Feb 17, 2023
@bzbarsky-apple bzbarsky-apple deleted the darwin-instancetype branch February 17, 2023 23:47
lecndav pushed a commit to lecndav/connectedhomeip that referenced this pull request Mar 22, 2023
…oject-chip#25169)

We should not be claiming to return instancetype if we actually always return an
instance of our class.

Fixes project-chip#23384
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.

Figure out whether we are mis-using instancetype in the Darwin APIs
4 participants