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 binary comparison operators are const to fix C++20 #33033

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

mspang
Copy link
Contributor

@mspang mspang commented Apr 17, 2024

Fix errors of the form

../../src/system/tests/TestSystemPacketBuffer.cpp:1063:72: error: C++20 says that these are ambiguous, even though the second is reversed: [-Werror]
 1063 |                             NL_TEST_ASSERT(inSuite, config_1.handle == original_handle_1);
      |                                                                        ^~~~~~~~~~~~~~~~~
../../third_party/nlunit-test/repo/src/nlunit-test.h:366:15: note: in definition of macro ‘NL_TEST_ASSERT’
  366 |         if (!(inCondition))                             \
      |               ^~~~~~~~~~~
../../src/system/SystemPacketBuffer.h:690:10: note: candidate 1: ‘bool chip::System::PacketBufferHandle::operator==(const chip::System::PacketBufferHandle&)’
  690 |     bool operator==(const PacketBufferHandle & aOther) { return mBuffer == aOther.mBuffer; }
      |          ^~~~~~~~
../../src/system/SystemPacketBuffer.h:690:10: note: candidate 2: ‘bool chip::System::PacketBufferHandle::operator==(const chip::System::PacketBufferHandle&)’ (reversed)
../../src/system/SystemPacketBuffer.h:690:10: note: try making the operator a ‘const’ member function

when compiling with cpp_standard="gnu++20" by making sure comparators are const members.

Fix errors of the form

../../src/system/tests/TestSystemPacketBuffer.cpp:1063:72: error: C++20 says that these are ambiguous, even though the second is reversed: [-Werror]
 1063 |                             NL_TEST_ASSERT(inSuite, config_1.handle == original_handle_1);
      |                                                                        ^~~~~~~~~~~~~~~~~
../../third_party/nlunit-test/repo/src/nlunit-test.h:366:15: note: in definition of macro ‘NL_TEST_ASSERT’
  366 |         if (!(inCondition))                             \
      |               ^~~~~~~~~~~
../../src/system/SystemPacketBuffer.h:690:10: note: candidate 1: ‘bool chip::System::PacketBufferHandle::operator==(const chip::System::PacketBufferHandle&)’
  690 |     bool operator==(const PacketBufferHandle & aOther) { return mBuffer == aOther.mBuffer; }
      |          ^~~~~~~~
../../src/system/SystemPacketBuffer.h:690:10: note: candidate 2: ‘bool chip::System::PacketBufferHandle::operator==(const chip::System::PacketBufferHandle&)’ (reversed)
../../src/system/SystemPacketBuffer.h:690:10: note: try making the operator a ‘const’ member function

when compiling with cpp_standard="gnu++20" by making sure comparators
are const members.
@mspang mspang force-pushed the for-chip/cpp20-fix branch from cee1b27 to 4368822 Compare April 17, 2024 19:48
@mspang mspang changed the title Make sure binary operators are const to fix C++20 Make sure binary comparison operators are const to fix C++20 Apr 17, 2024
@mspang mspang marked this pull request as ready for review April 17, 2024 19:50
Copy link

github-actions bot commented Apr 17, 2024

PR #33033: Size comparison from 035d302 to 4368822

Increases (2 builds for linux)
platform target config section 035d302 4368822 change % change
linux chip-tool debug (read only) 12084641 12084801 160 0.0
.text 10924835 10924995 160 0.0
chip-tool-ipv6only arm64 (read/write) 587232 587376 144 0.0
Decreases (1 build for linux)
platform target config section 035d302 4368822 change % change
linux chip-tool-ipv6only arm64 (read only) 11403972 11403828 -144 -0.0
.text 10166024 10165880 -144 -0.0
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
platform target config section 035d302 4368822 change % change
bl602 lighting-app bl602 (read/write) 1443066 1443066 0 0.0
.bss 85448 85448 0 0.0
.data 9504 9504 0 0.0
.rodata 159068 159068 0 0.0
.text 1108384 1108384 0 0.0
bl602+mfd (read/write) 1457490 1457490 0 0.0
.bss 85616 85616 0 0.0
.data 9480 9480 0 0.0
.rodata 158028 158028 0 0.0
.text 1123702 1123702 0 0.0
bl602+rpc (read/write) 1490466 1490466 0 0.0
.bss 93488 93488 0 0.0
.data 9880 9880 0 0.0
.rodata 166644 166644 0 0.0
.text 1139774 1139774 0 0.0
bl702 lighting-app bl702 (read only) 3478 3478 0 0.0
(read/write) 1207927 1207927 0 0.0
.bss 11185 11185 0 0.0
.data 3696 3696 0 0.0
.rodata 108432 108432 0 0.0
.text 977684 977684 0 0.0
bl702+mfd (read only) 3478 3478 0 0.0
(read/write) 1218743 1218743 0 0.0
.bss 11361 11361 0 0.0
.data 3672 3672 0 0.0
.rodata 107372 107372 0 0.0
.text 989438 989438 0 0.0
bl702+rpc (read only) 3478 3478 0 0.0
(read/write) 1299407 1299407 0 0.0
.bss 19669 19669 0 0.0
.data 4232 4232 0 0.0
.rodata 123804 123804 0 0.0
.text 1052392 1052392 0 0.0
bl706-eth (read/write) 1025193 1025193 0 0.0
.bss 23760 23760 0 0.0
.data 3256 3256 0 0.0
.rodata 101756 101756 0 0.0
.text 768388 768388 0 0.0
bl706-wifi (read/write) 1259846 1259846 0 0.0
.bss 10645 10645 0 0.0
.data 3696 3696 0 0.0
.rodata 122756 122756 0 0.0
.text 1000280 1000280 0 0.0
bl702l lighting-app bl702l (read/write) 1177784 1177784 0 0.0
.bss 16396 16396 0 0.0
.data 5056 5056 0 0.0
.rodata 102436 102436 0 0.0
.text 970550 970550 0 0.0
bl702l+mfd (read only) 512 512 0 0.0
(read/write) 1188676 1188676 0 0.0
.bss 16572 16572 0 0.0
.data 5040 5040 0 0.0
.rodata 101376 101376 0 0.0
.text 982872 982872 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 (read only) 782820 782820 0 0.0
(read/write) 171640 171640 0 0.0
.bss 93596 93596 0 0.0
.data 3584 3584 0 0.0
.rodata 82628 82628 0 0.0
.text 699928 699928 0 0.0
lock-ftd LP_EM_CC1354P10_6 (read only) 798804 798804 0 0.0
(read/write) 182112 182112 0 0.0
.bss 104084 104084 0 0.0
.data 3576 3576 0 0.0
.rodata 76716 76716 0 0.0
.text 721820 721820 0 0.0
lock-mtd LP_EM_CC1354P10_6 (read only) 787572 787572 0 0.0
(read/write) 176232 176232 0 0.0
.bss 98204 98204 0 0.0
.data 3576 3576 0 0.0
.rodata 103532 103532 0 0.0
.text 683776 683776 0 0.0
pump-app LP_EM_CC1354P10_6 (read only) 739884 739884 0 0.0
(read/write) 170600 170600 0 0.0
.bss 92336 92336 0 0.0
.data 3568 3568 0 0.0
.rodata 78292 78292 0 0.0
.text 661328 661328 0 0.0
pump-controller-app LP_EM_CC1354P10_6 (read only) 725516 725516 0 0.0
(read/write) 170824 170824 0 0.0
.bss 92560 92560 0 0.0
.data 3568 3568 0 0.0
.rodata 74068 74068 0 0.0
.text 651184 651184 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL (read only) 586950 586950 0 0.0
(read/write) 208096 208096 0 0.0
.bss 201324 201324 0 0.0
.data 1648 1648 0 0.0
.rodata 87502 87502 0 0.0
.text 497324 497324 0 0.0
lock CC3235SF_LAUNCHXL (read only) 631766 631766 0 0.0
(read/write) 208352 208352 0 0.0
.bss 201728 201728 0 0.0
.data 1504 1504 0 0.0
.rodata 107854 107854 0 0.0
.text 521792 521792 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 569783 569783 0 0.0
.app_xip_area 459709 459709 0 0.0
.bss 64900 64900 0 0.0
.data 752 752 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 551999 551999 0 0.0
.app_xip_area 437253 437253 0 0.0
.bss 69564 69564 0 0.0
.data 760 760 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor cyw930739m2evb_01 (read/write) 573111 573111 0 0.0
.app_xip_area 464533 464533 0 0.0
.bss 63444 63444 0 0.0
.data 712 712 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
switch cyw930739m2evb_01 (read/write) 565063 565063 0 0.0
.app_xip_area 453301 453301 0 0.0
.bss 66548 66548 0 0.0
.data 792 792 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4187C (read/write) 1068480 1068480 0 0.0
.bss 179904 179904 0 0.0
.data 3424 3424 0 0.0
.text 885132 885132 0 0.0
lock-app BRD4338a (read/write) 960724 960724 0 0.0
.bss 210236 210236 0 0.0
.data 30272 30272 0 0.0
.text 700848 700848 0 0.0
window-app BRD4187C (read/write) 1134380 1134380 0 0.0
.bss 164504 164504 0 0.0
.data 3328 3328 0 0.0
.text 966528 966528 0 0.0
esp32 all-clusters-app c3devkit (read only) 1213674 1213674 0 0.0
(read/write) 1750368 1750368 0 0.0
.dram0.bss 74328 74328 0 0.0
.dram0.data 13628 13628 0 0.0
.flash.rodata 252880 252880 0 0.0
.flash.text 1213674 1213674 0 0.0
.iram0.text 75530 75530 0 0.0
m5stack (read only) 1256271 1256271 0 0.0
(read/write) 536652 536652 0 0.0
.dram0.bss 81064 81064 0 0.0
.dram0.data 35180 35180 0 0.0
.flash.rodata 284488 284488 0 0.0
.flash.text 1250107 1250107 0 0.0
.iram0.text 125403 125403 0 0.0
linux air-purifier-app debug (read only) 2647317 2647317 0 0.0
(read/write) 130032 130032 0 0.0
.bss 46728 46728 0 0.0
.data 2272 2272 0 0.0
.data.rel.ro 75080 75080 0 0.0
.dynamic 608 608 0 0.0
.got 4520 4520 0 0.0
.init 27 27 0 0.0
.init_array 800 800 0 0.0
.rodata 185392 185392 0 0.0
.text 2282933 2282933 0 0.0
all-clusters-app debug (read only) 5956929 5956929 0 0.0
(read/write) 481512 481512 0 0.0
.bss 135040 135040 0 0.0
.data 4560 4560 0 0.0
.data.rel.ro 334472 334472 0 0.0
.dynamic 624 624 0 0.0
.got 5328 5328 0 0.0
.init 27 27 0 0.0
.init_array 1440 1440 0 0.0
.rodata 351760 351760 0 0.0
.text 5170387 5170387 0 0.0
all-clusters-minimal-app debug (read only) 5236873 5236873 0 0.0
(read/write) 237464 237464 0 0.0
.bss 127872 127872 0 0.0
.data 4464 4464 0 0.0
.data.rel.ro 98056 98056 0 0.0
.dynamic 624 624 0 0.0
.got 5248 5248 0 0.0
.init 27 27 0 0.0
.init_array 1168 1168 0 0.0
.rodata 290410 290410 0 0.0
.text 4710339 4710339 0 0.0
bridge-app debug (read only) 4628817 4628817 0 0.0
(read/write) 218344 218344 0 0.0
.bss 118400 118400 0 0.0
.data 6240 6240 0 0.0
.data.rel.ro 86976 86976 0 0.0
.dynamic 624 624 0 0.0
.got 5216 5216 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 230794 230794 0 0.0
.text 4176323 4176323 0 0.0
chip-tool debug (read only) 12084641 12084801 160 0.0
(read/write) 523104 523104 0 0.0
.bss 94744 94744 0 0.0
.data 5122 5122 0 0.0
.data.rel.ro 416000 416000 0 0.0
.dynamic 624 624 0 0.0
.got 5736 5736 0 0.0
.init 27 27 0 0.0
.init_array 832 832 0 0.0
.rodata 451449 451449 0 0.0
.text 10924835 10924995 160 0.0
chip-tool-ipv6only arm64 (read only) 11403972 11403828 -144 -0.0
(read/write) 587232 587376 144 0.0
.bss 103720 103720 0 0.0
.data 4512 4512 0 0.0
.data.rel.ro 455936 455936 0 0.0
.dynamic 512 512 0 0.0
.got 17112 17112 0 0.0
.init 24 24 0 0.0
.init_array 280 280 0 0.0
.rodata 356260 356260 0 0.0
.text 10166024 10165880 -144 -0.0
lighting-app debug+rpc+ui (read only) 5552929 5552929 0 0.0
(read/write) 227112 227112 0 0.0
.bss 119344 119344 0 0.0
.data 4864 4864 0 0.0
.data.rel.ro 95376 95376 0 0.0
.dynamic 672 672 0 0.0
.got 5856 5856 0 0.0
.init 27 27 0 0.0
.init_array 976 976 0 0.0
.rodata 354676 354676 0 0.0
.text 4950163 4950163 0 0.0
lock-app debug (read only) 4694681 4694681 0 0.0
(read/write) 205568 205568 0 0.0
.bss 113704 113704 0 0.0
.data 4160 4160 0 0.0
.data.rel.ro 81000 81000 0 0.0
.dynamic 624 624 0 0.0
.got 5168 5168 0 0.0
.init 27 27 0 0.0
.init_array 880 880 0 0.0
.rodata 256586 256586 0 0.0
.text 4225459 4225459 0 0.0
ota-provider-app debug (read only) 4310161 4310161 0 0.0
(read/write) 194200 194200 0 0.0
.bss 113440 113440 0 0.0
.data 4368 4368 0 0.0
.data.rel.ro 70448 70448 0 0.0
.dynamic 624 624 0 0.0
.got 4536 4536 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 209642 209642 0 0.0
.text 3906035 3906035 0 0.0
ota-requestor-app debug (read only) 4440993 4440993 0 0.0
(read/write) 198568 198568 0 0.0
.bss 114336 114336 0 0.0
.data 4768 4768 0 0.0
.data.rel.ro 73536 73536 0 0.0
.dynamic 624 624 0 0.0
.got 4472 4472 0 0.0
.init 27 27 0 0.0
.init_array 800 800 0 0.0
.rodata 215914 215914 0 0.0
.text 4026051 4026051 0 0.0
shell debug (read only) 2923497 2923497 0 0.0
(read/write) 156880 156880 0 0.0
.bss 62512 62512 0 0.0
.data 1424 1424 0 0.0
.data.rel.ro 87152 87152 0 0.0
.dynamic 592 592 0 0.0
.got 4056 4056 0 0.0
.init 27 27 0 0.0
.init_array 1112 1112 0 0.0
.rodata 187872 187872 0 0.0
.text 2560946 2560946 0 0.0
thermostat-no-ble arm64 (read only) 4429260 4429260 0 0.0
(read/write) 246160 246160 0 0.0
.bss 121976 121976 0 0.0
.data 3392 3392 0 0.0
.data.rel.ro 104296 104296 0 0.0
.dynamic 512 512 0 0.0
.got 8712 8712 0 0.0
.init 24 24 0 0.0
.init_array 448 448 0 0.0
.rodata 160148 160148 0 0.0
.text 3932568 3932568 0 0.0
tv-app debug (read only) 5767065 5767065 0 0.0
(read/write) 353336 353336 0 0.0
.bss 244336 244336 0 0.0
.data 6560 6560 0 0.0
.data.rel.ro 95160 95160 0 0.0
.dynamic 624 624 0 0.0
.got 5464 5464 0 0.0
.init 27 27 0 0.0
.init_array 1184 1184 0 0.0
.rodata 294730 294730 0 0.0
.text 5229011 5229011 0 0.0
tv-casting-app debug (read only) 9897137 9897137 0 0.0
(read/write) 342720 342720 0 0.0
.bss 157976 157976 0 0.0
.data 3008 3008 0 0.0
.data.rel.ro 174848 174848 0 0.0
.dynamic 624 624 0 0.0
.got 5040 5040 0 0.0
.init 27 27 0 0.0
.init_array 1216 1216 0 0.0
.rodata 384472 384472 0 0.0
.text 9045859 9045859 0 0.0
mbed lock-app-release cy8cproto_062_4343w (read only) 6224 6224 0 0.0
(read/write) 2534816 2534816 0 0.0
.bss 220488 220488 0 0.0
.data 5216 5216 0 0.0
.text 1497500 1497500 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1065016 1065016 0 0.0
bss 133107 133107 0 0.0
rodata 103096 103096 0 0.0
text 781600 781600 0 0.0
nrf7002dk_nrf5340_cpuapp (read only) 4 4 0 0.0
(read/write) 1225908 1225908 0 0.0
bss 127171 127171 0 0.0
rodata 151304 151304 0 0.0
text 797400 797400 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1012496 1012496 0 0.0
bss 131965 131965 0 0.0
rodata 90360 90360 0 0.0
text 742968 742968 0 0.0
nxp contact k32w0+release (read only) 575100 575100 0 0.0
(read/write) 80012 80012 0 0.0
.bss 67848 67848 0 0.0
.data 2180 2180 0 0.0
.text 574564 574564 0 0.0
k32w1+release (read only) 1024 1024 0 0.0
(read/write) 702220 702220 0 0.0
.bss 71192 71192 0 0.0
.data 2856 2856 0 0.0
.text 588792 588792 0 0.0
light k32w0+release (read only) 609040 609040 0 0.0
(read/write) 79472 79472 0 0.0
.bss 67288 67288 0 0.0
.data 2200 2200 0 0.0
.text 608504 608504 0 0.0
k32w1+release (read only) 1024 1024 0 0.0
(read/write) 793992 793992 0 0.0
.bss 80736 80736 0 0.0
.data 2056 2056 0 0.0
.text 671832 671832 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 (read only) 832280 832280 0 0.0
(read/write) 1803444 1803444 0 0.0
.bss 198372 198372 0 0.0
.data 2688 2688 0 0.0
.text 1593996 1593996 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 (read only) 835432 835432 0 0.0
(read/write) 1725332 1725332 0 0.0
.bss 195252 195252 0 0.0
.data 2656 2656 0 0.0
.text 1519036 1519036 0 0.0
light cy8ckit_062s2_43012 (read only) 842160 842160 0 0.0
(read/write) 1644060 1644060 0 0.0
.bss 188716 188716 0 0.0
.data 2464 2464 0 0.0
.text 1444492 1444492 0 0.0
lock cy8ckit_062s2_43012 (read only) 815088 815088 0 0.0
(read/write) 1672748 1672748 0 0.0
.bss 215796 215796 0 0.0
.data 2456 2456 0 0.0
.text 1446108 1446108 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1132360 1132360 0 0.0
.bss 102580 102580 0 0.0
.data 844 844 0 0.0
.text 644744 644744 0 0.0
lock-app qpg6105+debug (read/write) 1092360 1092360 0 0.0
.bss 97252 97252 0 0.0
.data 856 856 0 0.0
.text 604740 604740 0 0.0
stm32 light STM32WB5MM-DK (read/write) 603949 603949 0 0.0
.bss 128436 128436 0 0.0
.data 676 676 0 0.0
.rodata 80212 80212 0 0.0
.text 384880 384880 0 0.0
telink air-quality-sensor-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 833042 833042 0 0.0
bss 49844 49844 0 0.0
text 624058 624058 0 0.0
all-clusters-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 1096264 1096264 0 0.0
bss 101528 101528 0 0.0
text 797604 797604 0 0.0
all-clusters-minimal-app tlsr9528a (read only) 47960 47960 0 0.0
(read/write) 1057728 1057728 0 0.0
bss 109976 109976 0 0.0
text 771966 771966 0 0.0
bridge-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 913120 913120 0 0.0
bss 92732 92732 0 0.0
text 655312 655312 0 0.0
contact-sensor-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 835078 835078 0 0.0
bss 49888 49888 0 0.0
text 626164 626164 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a (read only) 51584 51584 0 0.0
(read/write) 935864 935864 0 0.0
bss 77500 77500 0 0.0
text 702830 702830 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d (read only) 29122 29122 0 0.0
(read/write) 1089632 1089632 0 0.0
bss 99824 99824 0 0.0
text 793420 793420 0 0.0
lock-app-dfu tlsr9528a (read only) 51584 51584 0 0.0
(read/write) 910316 910316 0 0.0
bss 69168 69168 0 0.0
text 659696 659696 0 0.0
ota-requestor-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 932900 932900 0 0.0
bss 92436 92436 0 0.0
text 674972 674972 0 0.0
pump-app tlsr9258a (read only) 52490 52490 0 0.0
(read/write) 832724 832724 0 0.0
bss 58132 58132 0 0.0
text 623260 623260 0 0.0
pump-controller-app tlsr9518adk80d (read only) 31872 31872 0 0.0
(read/write) 798852 798852 0 0.0
bss 56060 56060 0 0.0
text 598166 598166 0 0.0
shell tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 676016 676016 0 0.0
bss 73412 73412 0 0.0
text 461764 461764 0 0.0
smoke_co_alarm-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 842810 842810 0 0.0
bss 51516 51516 0 0.0
text 632706 632706 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d (read only) 32220 32220 0 0.0
(read/write) 858565 858565 0 0.0
bss 59684 59684 0 0.0
text 642268 642268 0 0.0
thermostat tlsr9518adk80d (read only) 31872 31872 0 0.0
(read/write) 824400 824400 0 0.0
bss 56392 56392 0 0.0
text 617722 617722 0 0.0
window-covering tlsr9258a (read only) 52490 52490 0 0.0
(read/write) 837516 837516 0 0.0
bss 58348 58348 0 0.0
text 625630 625630 0 0.0

@mergify mergify bot merged commit 84fd7fc into project-chip:master Apr 18, 2024
65 checks passed
@mspang mspang deleted the for-chip/cpp20-fix branch April 29, 2024 18:45
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.

3 participants