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 warnings with -Wall -Wextra enabled #41

Merged
merged 6 commits into from
May 16, 2024

Conversation

tony-josi-aws
Copy link
Member

Issue #, if available:

When library is compiled with -Wextra on ARM GCC compiler (arm-none-eabi-gcc) the following warnings are emitted:

(base) [δ:0s T:15:39:04]ubuntu@ip-172-31-69-236:~/Projects/Fleet-Provisioning-for-AWS-IoT-embedded-sdk$ arm-none-eabi-gcc -std=gnu99 -ggdb -DNDEBUG -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 source/fleet_provisioning.c -c -I source/include -DFLEET_PROVISIONING_DO_NOT_USE_CUSTOM_CONFIG -Wall -Wextra
source/fleet_provisioning.c: In function 'GetRegisterThingTopicCheckParams':
source/fleet_provisioning.c:289:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  289 |         ( format < FleetProvisioningJson ) ||
      |                  ^
source/fleet_provisioning.c:291:17: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  291 |         ( topic < FleetProvisioningPublish ) ||
      |                 ^

Description of changes:

This PR fixes that by removing the ( format < FleetProvisioningJson ) and ( topic < FleetProvisioningPublish ) checks as they are always false. format and topic are of the type FleetProvisioningFormat_t and FleetProvisioningApiTopics_t, thus wont be less than the minimum values FleetProvisioningJson and FleetProvisioningPublish respectively.

  • I have tested my changes. No regression in existing tests.
  • [ ] I have modified and/or added unit-tests to cover the code changes in this Pull Request.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

archigup
archigup previously approved these changes May 15, 2024
aggarg
aggarg previously approved these changes May 16, 2024
aggarg
aggarg previously approved these changes May 16, 2024
@tony-josi-aws tony-josi-aws merged commit 348b19b into aws:main May 16, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants