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

Fix callback creation #34147

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Conversation

jlatusek
Copy link
Contributor

@jlatusek jlatusek commented Jul 1, 2024

Problem

There is an error during building unit tests on latest images (61), the error can be found in related PR: #33979

FAILED: obj/src/lib/core/tests/libCoreTests.TestCHIPCallback.cpp.o
clang++ -MMD -MF obj/src/lib/core/tests/libCoreTests.TestCHIPCallback.cpp.o.d -Wconversion -O0 -g2 -fno-common -ffunction-sections -fdata-sections -fno-exceptions -fno-unwin
d-tables -fno-asynchronous-unwind-tables -fPIC -Wall -Werror -Wextra -Wshadow -Wunreachable-code -Wvla -Wformat -Wformat-nonliteral -Wformat-security -Wundef -Wimplicit-fall
through -Wheader-hygiene -Wshorten-64-to-32 -Wformat-type-confusion -Wthread-safety -Wno-deprecated-declarations -Wno-missing-field-initializers -Wno-unknown-warning-option
-Wno-unused-parameter -fdiagnostics-color -fno-strict-aliasing -fmacro-prefix-map=../../= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include
/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -std=gnu++17 -fno-rtti -Wnon-virtual-dtor -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -DCHIP_HAVE_CONFIG_H=1 -DPW
_UNIT_TEST_CONFIG_MEMORY_POOL_SIZE=16384 -DPW_SPAN_ENABLE_ASSERTS=false -I../../src/include -I../../src -Igen/include -I../../config/standalone -I../../zzz_generated/app-com
mon -I../../third_party/nlassert/repo/include -I../../third_party/nlio/repo/include -I../../third_party/nlfaultinjection/include -I../../third_party/inipp/repo/inipp -I../..
/third_party/pigweed/repo/pw_unit_test/public -I../../third_party/pigweed/repo/pw_unit_test/light_public_overrides -I../../third_party/pigweed/repo/pw_unit_test/public_overr
ides -I../../third_party/pigweed/repo/pw_polyfill/public -I../../third_party/pigweed/repo/pw_bytes/public -I../../third_party/pigweed/repo/third_party/fuchsia/repo/sdk/lib/s
tdcompat/include -I../../third_party/pigweed/repo/pw_containers/public -I../../third_party/pigweed/repo/pw_preprocessor/public -I../../third_party/pigweed/repo/pw_span/publi
c -I../../third_party/pigweed/repo/pw_status/public -I../../third_party/pigweed/repo/pw_assert/public -I../../third_party/pigweed/repo/pw_assert/assert_compatibility_public_
overrides -I../../third_party/pigweed/repo/pw_assert_log/check_backend_public_overrides -I../../third_party/pigweed/repo/pw_assert_log/public -I../../third_party/pigweed/rep
o/pw_log/public -I../../third_party/pigweed/repo/pw_log_basic/public_overrides -I../../third_party/pigweed/repo/pw_log_basic/public -I../../third_party/pigweed/repo/pw_strin
g/public -I../../third_party/pigweed/repo/pw_result/public -c ../../src/lib/core/tests/TestCHIPCallback.cpp -o obj/src/lib/core/tests/libCoreTests.TestCHIPCallback.cpp.o
../../src/lib/core/tests/TestCHIPCallback.cpp:204:74: error: reinterpret_cast from 'void *' to 'Cancelable' is not allowed
  204 |     Callback<Notifier::NotifyFn> cancelcb([](void * val, int) { canceler(reinterpret_cast<Cancelable>(val)) }, cb.Cancel());
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Changes

Change creation of Callback, use lambda expression to skip one of required argument of passed callback function. The static void canceler(Cancelable * ca) is also used in other places so I can't change signature of this function.

Copy link

github-actions bot commented Jul 1, 2024

PR #34147: Size comparison from d033f8b to 6a225df

Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section d033f8b 6a225df change % change
bl602 lighting-app bl602 FLASH 1270846 1270846 0 0.0
RAM 95328 95328 0 0.0
bl602+mfd FLASH 1285104 1285104 0 0.0
RAM 95472 95472 0 0.0
bl602+rpc FLASH 1310062 1310062 0 0.0
RAM 103752 103752 0 0.0
bl702 lighting-app bl702 FLASH 1091992 1091992 0 0.0
RAM 15161 15161 0 0.0
bl702+mfd FLASH 1102686 1102686 0 0.0
RAM 15313 15313 0 0.0
bl702+rpc FLASH 1181802 1181802 0 0.0
RAM 24181 24181 0 0.0
bl706-eth FLASH 875086 875086 0 0.0
RAM 27272 27272 0 0.0
bl706-wifi FLASH 1127428 1127428 0 0.0
RAM 14605 14605 0 0.0
bl702l lighting-app bl702l FLASH 1078878 1078878 0 0.0
RAM 21732 21732 0 0.0
bl702l+mfd FLASH 1090140 1090140 0 0.0
RAM 21892 21892 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 798480 798480 0 0.0
RAM 103096 103096 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 814236 814236 0 0.0
RAM 113568 113568 0 0.0
lock-mtd LP_EM_CC1354P10_6 FLASH 803752 803752 0 0.0
RAM 107696 107696 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 756544 756544 0 0.0
RAM 101788 101788 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 742224 742224 0 0.0
RAM 102036 102036 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 606042 606042 0 0.0
RAM 204508 204508 0 0.0
lock CC3235SF_LAUNCHXL FLASH 651078 651078 0 0.0
RAM 204780 204780 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 666249 666249 0 0.0
RAM 75100 75100 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 686093 686093 0 0.0
RAM 77732 77732 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 686093 686093 0 0.0
RAM 77732 77732 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 643037 643037 0 0.0
RAM 70168 70168 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 608793 608793 0 0.0
RAM 70804 70804 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 628437 628437 0 0.0
RAM 73356 73356 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 628437 628437 0 0.0
RAM 73356 73356 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 624297 624297 0 0.0
RAM 73820 73820 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 644021 644021 0 0.0
RAM 76372 76372 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 644021 644021 0 0.0
RAM 76372 76372 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 592861 592861 0 0.0
RAM 67788 67788 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 612713 612713 0 0.0
RAM 70420 70420 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 612713 612713 0 0.0
RAM 70420 70420 0 0.0
efr32 lighting-app BRD4187C FLASH 923428 923428 0 0.0
RAM 134996 134996 0 0.0
lock-app BRD4338a FLASH 762340 762340 0 0.0
RAM 174552 174552 0 0.0
window-app BRD4187C FLASH 1012216 1012216 0 0.0
RAM 129616 129616 0 0.0
esp32 all-clusters-app c3devkit DRAM 88396 88396 0 0.0
FLASH 1467758 1467758 0 0.0
IRAM 75570 75570 0 0.0
m5stack DRAM 114868 114868 0 0.0
FLASH 1537019 1537019 0 0.0
IRAM 125403 125403 0 0.0
linux air-purifier-app debug unknown 4592 4592 0 0.0
FLASH 2529680 2529680 0 0.0
RAM 125112 125112 0 0.0
all-clusters-app debug unknown 5368 5368 0 0.0
FLASH 5581742 5581742 0 0.0
RAM 487512 487512 0 0.0
all-clusters-minimal-app debug unknown 5288 5288 0 0.0
FLASH 5051864 5051864 0 0.0
RAM 232936 232936 0 0.0
bridge-app debug unknown 5256 5256 0 0.0
FLASH 4477896 4477896 0 0.0
RAM 212832 212832 0 0.0
chip-tool debug unknown 5728 5728 0 0.0
FLASH 11693351 11693351 0 0.0
RAM 542146 542146 0 0.0
chip-tool-ipv6only arm64 unknown 19992 19992 0 0.0
FLASH 10811708 10811708 0 0.0
RAM 591072 591072 0 0.0
fabric-admin debug unknown 5592 5592 0 0.0
FLASH 10657831 10657831 0 0.0
RAM 535786 535786 0 0.0
fabric-bridge-app debug unknown 5264 5264 0 0.0
FLASH 4348440 4348440 0 0.0
RAM 204960 204960 0 0.0
lighting-app debug+rpc+ui unknown 5936 5936 0 0.0
FLASH 5373522 5373522 0 0.0
RAM 221640 221640 0 0.0
lock-app debug unknown 5192 5192 0 0.0
FLASH 4541480 4541480 0 0.0
RAM 200248 200248 0 0.0
ota-provider-app debug unknown 4576 4576 0 0.0
FLASH 4197336 4197336 0 0.0
RAM 194544 194544 0 0.0
ota-requestor-app debug unknown 4512 4512 0 0.0
FLASH 4322696 4322696 0 0.0
RAM 199168 199168 0 0.0
shell debug unknown 4112 4112 0 0.0
FLASH 2794957 2794957 0 0.0
RAM 150480 150480 0 0.0
thermostat-no-ble arm64 unknown 9184 9184 0 0.0
FLASH 4167964 4167964 0 0.0
RAM 235864 235864 0 0.0
tv-app debug unknown 5472 5472 0 0.0
FLASH 5605144 5605144 0 0.0
RAM 341800 341800 0 0.0
tv-casting-app debug unknown 5096 5096 0 0.0
FLASH 9862542 9862542 0 0.0
RAM 400024 400024 0 0.0
mbed lock-app-release cy8cproto_062_4343w FLASH 1502292 1502292 0 0.0
RAM 226656 226656 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 881272 881272 0 0.0
RAM 139693 139693 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 951804 951804 0 0.0
RAM 138121 138121 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 826824 826824 0 0.0
RAM 138591 138591 0 0.0
nxp contact k32w0+release FLASH 575996 575996 0 0.0
RAM 70024 70024 0 0.0
k32w1+release FLASH 591160 591160 0 0.0
RAM 74056 74056 0 0.0
light k32w0+release FLASH 610104 610104 0 0.0
RAM 69500 69500 0 0.0
k32w1+release FLASH 674720 674720 0 0.0
RAM 82816 82816 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1613628 1613628 0 0.0
RAM 207148 207148 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1534396 1534396 0 0.0
RAM 204052 204052 0 0.0
light cy8ckit_062s2_43012 FLASH 1461268 1461268 0 0.0
RAM 197332 197332 0 0.0
lock cy8ckit_062s2_43012 FLASH 1463124 1463124 0 0.0
RAM 224396 224396 0 0.0
qpg lighting-app qpg6105+debug FLASH 651052 651052 0 0.0
RAM 104564 104564 0 0.0
lock-app qpg6105+debug FLASH 611184 611184 0 0.0
RAM 99240 99240 0 0.0
stm32 light STM32WB5MM-DK FLASH 472456 472456 0 0.0
RAM 141652 141652 0 0.0
telink air-quality-sensor-app tlsr9528a_retention FLASH 632508 632508 0 0.0
RAM 50528 50528 0 0.0
all-clusters-app tlsr9118bdk40d FLASH 657190 657190 0 0.0
RAM 145872 145872 0 0.0
all-clusters-minimal-app tlsr9528a FLASH 777484 777484 0 0.0
RAM 110684 110684 0 0.0
bridge-app tlsr9258a FLASH 675502 675502 0 0.0
RAM 95304 95304 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 634092 634092 0 0.0
RAM 50572 50572 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 719896 719896 0 0.0
RAM 77148 77148 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 612324 612324 0 0.0
RAM 142104 142104 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 800104 800104 0 0.0
RAM 100508 100508 0 0.0
lock-app-dfu tlsr9528a FLASH 665666 665666 0 0.0
RAM 69860 69860 0 0.0
ota-requestor-app tlsr9258a FLASH 694832 694832 0 0.0
RAM 95028 95028 0 0.0
pump-app tlsr9518adk80d FLASH 616366 616366 0 0.0
RAM 56952 56952 0 0.0
pump-controller-app tlsr9518adk80d FLASH 606750 606750 0 0.0
RAM 56752 56752 0 0.0
shell tlsr9518adk80d FLASH 466192 466192 0 0.0
RAM 72484 72484 0 0.0
smoke_co_alarm-app tlsr9528a_retention FLASH 640706 640706 0 0.0
RAM 52200 52200 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d FLASH 650576 650576 0 0.0
RAM 60388 60388 0 0.0
thermostat tlsr9518adk80d FLASH 625640 625640 0 0.0
RAM 57084 57084 0 0.0
window-covering tlsr9118bdk40d FLASH 518872 518872 0 0.0
RAM 97800 97800 0 0.0
tizen all-clusters-app arm unknown 1584 1584 0 0.0
FLASH 1633672 1633672 0 0.0
RAM 46012 46012 0 0.0
chip-tool-ubsan arm unknown 2384 2384 0 0.0
FLASH 16119802 16119802 0 0.0
RAM 7084788 7084788 0 0.0

@mergify mergify bot merged commit 005f1b4 into project-chip:master Jul 2, 2024
68 checks passed
@arkq arkq deleted the unit_test_allback_fix branch July 2, 2024 18:12
austina-csa pushed a commit to austina-csa/connectedhomeip that referenced this pull request Jul 10, 2024
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