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

Modernize use nullptr #17113

Merged
merged 4 commits into from
Apr 6, 2022
Merged

Conversation

andy31415
Copy link
Contributor

Problem

Using nullptr makes it clear that we use pointers not integers. Generally less ambigous code and friedlier to generic programming.

Change overview

Enable clang-tidy check, update a bunch of code.

Testing

Automated change. I did run unit tests again to confirm that code compiles and tests pass.

Ran clang-tidy and updated like:

```
./scripts/run-clang-tidy-on-compile-commands.py --compile-database
out/linux-x64-tests/compile_commands.json fix
```

May need more passes for darwin if CI on darwin fails.
@github-actions
Copy link

github-actions bot commented Apr 6, 2022

PR #17113: Size comparison from 56f738f to 96222cd

Full report (19 builds for cc13x2_26x2, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 56f738f 96222cda change % change
cc13x2_26x2 lock-ftd LP_CC2652R7 (read only) 674307 674307 0 0.0
(read/write) 177204 177204 0 0.0
.bss 81552 81552 0 0.0
.data 3168 3168 0 0.0
.rodata 80579 80579 0 0.0
.text 593248 593248 0 0.0
lock-mtd LP_CC2652R7 (read only) 623443 623443 0 0.0
(read/write) 154304 154304 0 0.0
.bss 77280 77280 0 0.0
.data 3168 3168 0 0.0
.rodata 80467 80467 0 0.0
.text 542488 542488 0 0.0
pump-app LP_CC2652R7 (read only) 691607 691607 0 0.0
(read/write) 161064 161064 0 0.0
.bss 81944 81944 0 0.0
.data 3200 3200 0 0.0
.rodata 82511 82511 0 0.0
.text 608612 608612 0 0.0
pump-controller-app LP_CC2652R7 (read only) 675979 675979 0 0.0
(read/write) 176436 176436 0 0.0
.bss 81688 81688 0 0.0
.data 3164 3164 0 0.0
.rodata 79011 79011 0 0.0
.text 596484 596484 0 0.0
efr32 lighting-app BRD4161A (read only) 923476 923476 0 0.0
(read/write) 129580 129580 0 0.0
.bss 127584 127584 0 0.0
.data 1996 1996 0 0.0
.text 923468 923468 0 0.0
BRD4161A+rpc (read only) 951364 951364 0 0.0
(read/write) 145528 145528 0 0.0
.bss 143352 143352 0 0.0
.data 2176 2176 0 0.0
.text 951356 951356 0 0.0
window-app BRD4161A (read only) 860796 860796 0 0.0
(read/write) 127640 127640 0 0.0
.bss 125760 125760 0 0.0
.data 1880 1880 0 0.0
.text 860788 860788 0 0.0
esp32 all-clusters-app c3devkit (read only) 991668 991668 0 0.0
(read/write) 1461530 1461530 0 0.0
.dram0.bss 63000 63000 0 0.0
.dram0.data 14260 14260 0 0.0
.flash.rodata 198784 198784 0 0.0
.flash.text 991668 991668 0 0.0
.iram0.text 62572 62572 0 0.0
m5stack (read only) 1043503 1043503 0 0.0
(read/write) 462488 462488 0 0.0
.dram0.bss 68528 68528 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 227752 227752 0 0.0
.flash.text 1038119 1038119 0 0.0
.iram0.text 123415 123415 0 0.0
k32w light k32w061+release (read/write) 684828 684828 0 0.0
.bss 78240 78240 0 0.0
.data 1988 1988 0 0.0
.text 598800 598800 0 0.0
lock k32w061+release (read/write) 689668 689668 0 0.0
.bss 78816 78816 0 0.0
.data 1948 1948 0 0.0
.text 603104 603104 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 10278220 10278220 0 0.0
(read/write) 492033 492033 0 0.0
.bss 41041 41041 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 388704 388704 0 0.0
.dynamic 560 560 0 0.0
.got 57360 57360 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 512396 512396 0 0.0
.text 8663044 8663044 0 0.0
thermostat-no-ble arm64 (read only) 2344188 2344188 0 0.0
(read/write) 150257 150257 0 0.0
.bss 63169 63169 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 78184 78184 0 0.0
.dynamic 560 560 0 0.0
.got 4752 4752 0 0.0
.init 24 24 0 0.0
.init_array 368 368 0 0.0
.rodata 144364 144364 0 0.0
.text 1972672 1972672 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2366580 2366580 0 0.0
.bss 185092 185092 0 0.0
.data 5792 5792 0 0.0
.text 1329180 1329180 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1152967 1152967 0 0.0
bss 135604 135604 0 0.0
rodata 145632 145632 0 0.0
text 793156 793156 0 0.0
p6 all-clusters-app default (read/write) 2511992 2511992 0 0.0
.bss 118528 118528 0 0.0
.data 2672 2672 0 0.0
.text 1470256 1470256 0 0.0
light-app default (read/write) 2413168 2413168 0 0.0
.bss 111992 111992 0 0.0
.data 2528 2528 0 0.0
.text 1371432 1371432 0 0.0
lock-app default (read/write) 2376848 2376848 0 0.0
.bss 111736 111736 0 0.0
.data 2488 2488 0 0.0
.text 1335112 1335112 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 798836 798836 0 0.0
bss 70096 70096 0 0.0
noinit 40416 40416 0 0.0
text 567918 567918 0 0.0

@boring-cyborg boring-cyborg bot added the darwin label Apr 6, 2022
@github-actions
Copy link

github-actions bot commented Apr 6, 2022

PR #17113: Size comparison from 56f738f to bc7952b

Full report (12 builds for cc13x2_26x2, linux, mbed, nrfconnect, p6, telink)
platform target config section 56f738f bc7952b change % change
cc13x2_26x2 lock-ftd LP_CC2652R7 (read only) 674307 674307 0 0.0
(read/write) 177204 177204 0 0.0
.bss 81552 81552 0 0.0
.data 3168 3168 0 0.0
.rodata 80579 80579 0 0.0
.text 593248 593248 0 0.0
lock-mtd LP_CC2652R7 (read only) 623443 623443 0 0.0
(read/write) 154304 154304 0 0.0
.bss 77280 77280 0 0.0
.data 3168 3168 0 0.0
.rodata 80467 80467 0 0.0
.text 542488 542488 0 0.0
pump-app LP_CC2652R7 (read only) 691607 691607 0 0.0
(read/write) 161064 161064 0 0.0
.bss 81944 81944 0 0.0
.data 3200 3200 0 0.0
.rodata 82511 82511 0 0.0
.text 608612 608612 0 0.0
pump-controller-app LP_CC2652R7 (read only) 675979 675979 0 0.0
(read/write) 176436 176436 0 0.0
.bss 81688 81688 0 0.0
.data 3164 3164 0 0.0
.rodata 79011 79011 0 0.0
.text 596484 596484 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 10278220 10278220 0 0.0
(read/write) 492033 492033 0 0.0
.bss 41041 41041 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 388704 388704 0 0.0
.dynamic 560 560 0 0.0
.got 57360 57360 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 512396 512396 0 0.0
.text 8663044 8663044 0 0.0
thermostat-no-ble arm64 (read only) 2344188 2344188 0 0.0
(read/write) 150257 150257 0 0.0
.bss 63169 63169 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 78184 78184 0 0.0
.dynamic 560 560 0 0.0
.got 4752 4752 0 0.0
.init 24 24 0 0.0
.init_array 368 368 0 0.0
.rodata 144364 144364 0 0.0
.text 1972672 1972672 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2366580 2366580 0 0.0
.bss 185092 185092 0 0.0
.data 5792 5792 0 0.0
.text 1329180 1329180 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1152967 1152967 0 0.0
bss 135604 135604 0 0.0
rodata 145632 145632 0 0.0
text 793156 793156 0 0.0
p6 all-clusters-app default (read/write) 2511992 2511992 0 0.0
.bss 118528 118528 0 0.0
.data 2672 2672 0 0.0
.text 1470256 1470256 0 0.0
light-app default (read/write) 2413168 2413168 0 0.0
.bss 111992 111992 0 0.0
.data 2528 2528 0 0.0
.text 1371432 1371432 0 0.0
lock-app default (read/write) 2376848 2376848 0 0.0
.bss 111736 111736 0 0.0
.data 2488 2488 0 0.0
.text 1335112 1335112 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 798836 798836 0 0.0
bss 70096 70096 0 0.0
noinit 40416 40416 0 0.0
text 567918 567918 0 0.0

@github-actions
Copy link

github-actions bot commented Apr 6, 2022

PR #17113: Size comparison from 56f738f to 652c3fd

Increases above 0.2%:

platform target config section 56f738f 652c3fd change % change
efr32 lighting-app BRD4161A (read/write) 129580 133144 3564 2.8
.bss 127584 131152 3568 2.8
BRD4161A+rpc (read/write) 145528 149092 3564 2.4
.bss 143352 146920 3568 2.5
window-app BRD4161A (read/write) 127640 131204 3564 2.8
.bss 125760 129328 3568 2.8
Increases (3 builds for efr32)
platform target config section 56f738f 652c3fd change % change
efr32 lighting-app BRD4161A (read/write) 129580 133144 3564 2.8
.bss 127584 131152 3568 2.8
BRD4161A+rpc (read/write) 145528 149092 3564 2.4
.bss 143352 146920 3568 2.5
window-app BRD4161A (read/write) 127640 131204 3564 2.8
.bss 125760 129328 3568 2.8
Decreases (3 builds for efr32)
platform target config section 56f738f 652c3fd change % change
efr32 lighting-app BRD4161A (read only) 923476 904532 -18944 -2.1
.data 1996 1992 -4 -0.2
.text 923468 904524 -18944 -2.1
BRD4161A+rpc (read only) 951364 932420 -18944 -2.0
.data 2176 2172 -4 -0.2
.text 951356 932412 -18944 -2.0
window-app BRD4161A (read only) 860796 841868 -18928 -2.2
.data 1880 1876 -4 -0.2
.text 860788 841860 -18928 -2.2
Full report (19 builds for cc13x2_26x2, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 56f738f 652c3fd change % change
cc13x2_26x2 lock-ftd LP_CC2652R7 (read only) 674307 674307 0 0.0
(read/write) 177204 177204 0 0.0
.bss 81552 81552 0 0.0
.data 3168 3168 0 0.0
.rodata 80579 80579 0 0.0
.text 593248 593248 0 0.0
lock-mtd LP_CC2652R7 (read only) 623443 623443 0 0.0
(read/write) 154304 154304 0 0.0
.bss 77280 77280 0 0.0
.data 3168 3168 0 0.0
.rodata 80467 80467 0 0.0
.text 542488 542488 0 0.0
pump-app LP_CC2652R7 (read only) 691607 691607 0 0.0
(read/write) 161064 161064 0 0.0
.bss 81944 81944 0 0.0
.data 3200 3200 0 0.0
.rodata 82511 82511 0 0.0
.text 608612 608612 0 0.0
pump-controller-app LP_CC2652R7 (read only) 675979 675979 0 0.0
(read/write) 176436 176436 0 0.0
.bss 81688 81688 0 0.0
.data 3164 3164 0 0.0
.rodata 79011 79011 0 0.0
.text 596484 596484 0 0.0
efr32 lighting-app BRD4161A (read only) 923476 904532 -18944 -2.1
(read/write) 129580 133144 3564 2.8
.bss 127584 131152 3568 2.8
.data 1996 1992 -4 -0.2
.text 923468 904524 -18944 -2.1
BRD4161A+rpc (read only) 951364 932420 -18944 -2.0
(read/write) 145528 149092 3564 2.4
.bss 143352 146920 3568 2.5
.data 2176 2172 -4 -0.2
.text 951356 932412 -18944 -2.0
window-app BRD4161A (read only) 860796 841868 -18928 -2.2
(read/write) 127640 131204 3564 2.8
.bss 125760 129328 3568 2.8
.data 1880 1876 -4 -0.2
.text 860788 841860 -18928 -2.2
esp32 all-clusters-app c3devkit (read only) 991668 991668 0 0.0
(read/write) 1461530 1461530 0 0.0
.dram0.bss 63000 63000 0 0.0
.dram0.data 14260 14260 0 0.0
.flash.rodata 198784 198784 0 0.0
.flash.text 991668 991668 0 0.0
.iram0.text 62572 62572 0 0.0
m5stack (read only) 1043503 1043503 0 0.0
(read/write) 462488 462488 0 0.0
.dram0.bss 68528 68528 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 227752 227752 0 0.0
.flash.text 1038119 1038119 0 0.0
.iram0.text 123415 123415 0 0.0
k32w light k32w061+release (read/write) 684828 684828 0 0.0
.bss 78240 78240 0 0.0
.data 1988 1988 0 0.0
.text 598800 598800 0 0.0
lock k32w061+release (read/write) 689668 689668 0 0.0
.bss 78816 78816 0 0.0
.data 1948 1948 0 0.0
.text 603104 603104 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 10278220 10278220 0 0.0
(read/write) 492033 492033 0 0.0
.bss 41041 41041 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 388704 388704 0 0.0
.dynamic 560 560 0 0.0
.got 57360 57360 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 512396 512396 0 0.0
.text 8663044 8663044 0 0.0
thermostat-no-ble arm64 (read only) 2344188 2344188 0 0.0
(read/write) 150257 150257 0 0.0
.bss 63169 63169 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 78184 78184 0 0.0
.dynamic 560 560 0 0.0
.got 4752 4752 0 0.0
.init 24 24 0 0.0
.init_array 368 368 0 0.0
.rodata 144364 144364 0 0.0
.text 1972672 1972672 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2366580 2366580 0 0.0
.bss 185092 185092 0 0.0
.data 5792 5792 0 0.0
.text 1329180 1329180 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1152967 1152967 0 0.0
bss 135604 135604 0 0.0
rodata 145632 145632 0 0.0
text 793156 793156 0 0.0
p6 all-clusters-app default (read/write) 2511992 2511992 0 0.0
.bss 118528 118528 0 0.0
.data 2672 2672 0 0.0
.text 1470256 1470256 0 0.0
light-app default (read/write) 2413168 2413168 0 0.0
.bss 111992 111992 0 0.0
.data 2528 2528 0 0.0
.text 1371432 1371432 0 0.0
lock-app default (read/write) 2376848 2376848 0 0.0
.bss 111736 111736 0 0.0
.data 2488 2488 0 0.0
.text 1335112 1335112 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 798836 798836 0 0.0
bss 70096 70096 0 0.0
noinit 40416 40416 0 0.0
text 567918 567918 0 0.0

@andy31415 andy31415 merged commit 697b155 into project-chip:master Apr 6, 2022
andrei-menzopol pushed a commit to andrei-menzopol/connectedhomeip that referenced this pull request Apr 14, 2022
* Enable modernize-use-nullptr clang-tidy.

Ran clang-tidy and updated like:

```
./scripts/run-clang-tidy-on-compile-commands.py --compile-database
out/linux-x64-tests/compile_commands.json fix
```

May need more passes for darwin if CI on darwin fails.

* Restyle

* More nullptr fixes

* Update zap template from NULL to nullptr
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.

4 participants