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

Add -Wconversion to various things in src/app #7902

Merged
merged 2 commits into from
Jun 25, 2021

Conversation

bzbarsky-apple
Copy link
Contributor

Problem

We are not using -Wconversion to build things in src/app, so we won't catch problems as we start changing the sizes of things like cluster/endpoint/attribute ids.

Change overview

Add -Wconversion to some of the relevant .gn/.gni files, fix resulting problems.

Testing

Compiled the code on esp32, Mac, nrfconnect.

@github-actions
Copy link

Size increase report for "nrfconnect-example-build" from 336533f

File Section File VM
chip-lock.elf device_handles -4 -4
chip-lock.elf text -12 -12
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

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

sections,vmsize,filesize

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

sections,vmsize,filesize
.debug_info,0,281
.debug_str,0,65
.strtab,0,42
.debug_line,0,36
.symtab,0,32
.debug_frame,0,16
.debug_abbrev,0,15
.debug_aranges,0,8
.debug_ranges,0,8
.shstrtab,0,-2
device_handles,-4,-4
text,-12,-12
.debug_loc,0,-333


@@ -176,13 +176,15 @@ uint8_t emberAfGetDynamicIndexFromEndpoint(EndpointId id)
EmberAfStatus emberAfSetDynamicEndpoint(uint8_t index, EndpointId id, EmberAfEndpointType * ep, uint16_t deviceId,
uint8_t deviceVersion)
{
index += FIXED_ENDPOINT_COUNT;
auto realIndex = index + FIXED_ENDPOINT_COUNT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto -> int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do that, but the point is we don't really care what this gets promoted to by C's rules. We just check that it's in-range and then cast it to the type we really want... So I was pretty carefully avoiding using int there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that we care or don't care. It's that the type is clear and it's "int". It isn't going to change and there aren't any other promotion rules like that. Why obfuscate?

@github-actions
Copy link

Size increase report for "esp32-example-build" from 336533f

File Section File VM
chip-all-clusters-app.elf .flash.rodata 24 24
chip-all-clusters-app.elf .flash.text -24 -24
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,122
.debug_ranges,0,104
.debug_str,0,68
.strtab,0,42
.debug_frame,0,24
.flash.rodata,24,24
.symtab,0,16
.debug_aranges,0,8
.shstrtab,0,-2
.flash.text,-24,-24
[Unmapped],0,-24
.debug_abbrev,0,-63
.debug_line,0,-212
.debug_loc,0,-467

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

sections,vmsize,filesize


@github-actions
Copy link

Size increase report for "gn_qpg6100-example-build" from 336533f

File Section File VM
chip-qpg6100-lighting-example.out .text -8 -8
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-qpg6100-lighting-example.out and ./pull_artifact/chip-qpg6100-lighting-example.out:

sections,vmsize,filesize
.debug_info,0,191
.debug_str,0,75
.strtab,0,42
.debug_abbrev,0,41
.symtab,0,32
.debug_aranges,0,8
[Unmapped],0,8
.debug_frame,0,4
.shstrtab,0,-2
.text,-8,-8
.debug_ranges,0,-32
.debug_line,0,-78
.debug_loc,0,-737

Comparing ./master_artifact/chip-qpg6100-lighting-example.out.map and ./pull_artifact/chip-qpg6100-lighting-example.out.map:

BLOAT EXECUTION FAILED WITH CODE 1:
bloaty: unknown file type for file './pull_artifact/chip-qpg6100-lighting-example.out.map'


@bzbarsky-apple
Copy link
Contributor Author

@Damian-Nordic @jmartinez-silabs Please take a look?

@woody-apple woody-apple merged commit 2f1c2d1 into project-chip:master Jun 25, 2021
@bzbarsky-apple bzbarsky-apple deleted the add-wconversion-app branch June 25, 2021 19:41
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
* Add -Wconversion to various things in src/app.

* Regenerate generated files
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