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

Use to_underlying instead of manually writing it out or static asserts. #8278

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

Cleans up some code now that we don't have to choose between
cumbersome template bits with decltype and std::underlying_type_t and
cassting to a fixed type which might be wrong.

Problem

Code is uglier than it has to be.

Change overview

Use our shiny new to_underlying to make it less ugly.

Testing

Should be no behavior changes. Normal CI tests for that.

Cleans up some code now that we don't have to choose between
cumbersome template bits with decltype and std::underlying_type_t and
cassting to a fixed type which might be wrong.
@github-actions
Copy link

Size increase report for "esp32-example-build" from 0e19e0d

File Section File VM
chip-all-clusters-app.elf .flash.text -24 -24
chip-lock-app.elf .flash.text 64 64
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-all-clusters-app.elf and ./pull_artifact/chip-all-clusters-app.elf:

sections,vmsize,filesize
.debug_info,0,3122
.debug_str,0,1745
.debug_line,0,311
.xt.prop._ZN4chip6System5Mutex6UnlockEv,0,108
.debug_abbrev,0,107
.xt.lit._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE14_LockChipStackEv,0,48
.xt.lit._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE15_StartChipTimerEj,0,48
.xt.lit._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE16_UnlockChipStackEv,0,48
[Unmapped],0,24
.xt.prop._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE14_LockChipStackEv,0,12
.xt.prop._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE15_StartChipTimerEj,0,12
.xt.prop._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE16_UnlockChipStackEv,0,12
.debug_loc,0,-5
.flash.text,-24,-24
.xt.prop._ZN4chip11DeviceLayer8Internal26GenericPlatformManagerImplINS0_19PlatformManagerImplEE14_InitChipStackEv,0,-40
.xt.lit._ZN4chip11DeviceLayer8Internal35GenericPlatformManagerImpl_FreeRTOSINS0_19PlatformManagerImplEE10_PostEventEPKNS0_15ChipDeviceEventE,0,-80
.xt.lit._ZN4chip6System5Mutex6UnlockEv,0,-128

Comparing ./master_artifact/chip-lock-app.elf and ./pull_artifact/chip-lock-app.elf:

sections,vmsize,filesize
.debug_info,0,2122
.debug_str,0,889
.debug_line,0,231
.flash.text,64,64
.debug_abbrev,0,43
.debug_loc,0,11
[Unmapped],0,-64

Comparing ./master_artifact/chip-temperature-measurement-app.elf and ./pull_artifact/chip-temperature-measurement-app.elf:

sections,vmsize,filesize
.debug_info,0,2226
.debug_str,0,889
.debug_line,0,247
.debug_abbrev,0,65
.debug_loc,0,5

Comparing ./master_artifact/chip-shell.elf and ./pull_artifact/chip-shell.elf:

sections,vmsize,filesize
.debug_info,0,657
.debug_str,0,543
.debug_line,0,97
.debug_abbrev,0,18
.debug_loc,0,5

Comparing ./master_artifact/chip-pigweed-app.elf and ./pull_artifact/chip-pigweed-app.elf:

sections,vmsize,filesize

Comparing ./master_artifact/chip-persistent-storage.elf and ./pull_artifact/chip-persistent-storage.elf:

sections,vmsize,filesize


@bzbarsky-apple
Copy link
Contributor Author

@bzbarsky-apple bzbarsky-apple merged commit 6fa975e into project-chip:master Jul 13, 2021
@bzbarsky-apple bzbarsky-apple deleted the use-to-underlying branch July 13, 2021 20:22
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
…s. (project-chip#8278)

Cleans up some code now that we don't have to choose between
cumbersome template bits with decltype and std::underlying_type_t and
cassting to a fixed type which might be wrong.
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.

5 participants