Fix warnings emitted when compiling for mbedTLS and ESP_PLATFORM=1
#213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix warnings emitted when compiling c-core for our ESP-IDF v5.4 project
Warnings
pubnub_sync_subloop_define: GCC maintainers discourage the use of incomplete and unnamed struct initializers through the warning-Wmissing-field-initializers. As the use of a function in a struct initializer is not C89 compliant, I've fixed this by skipping the initialization of the struct and instead assigning it's values on subsequent lines.pbpal_resolv_and_connect: There was an implicit cast in the arguments ofconnectand explicit cast was impossible due to the#defineinpubnub_internal.hovershadowing the symbol. I've fixed this by removing the#defineand being explicit in the case ofESP_PLATFORM == 1.pubnub_assert_handler_abort: The pubnub_assert conventions heavily imply that abort functions should never return, but the compiler cannot assumepubnub_assert_handler_abortis__noreturn__due to the volatile loop condition. I've removed this feature under the assumption that the debugging use case is niche.pbntf_setup: The forward declaration did not match the actual function.Other Feedback
CONTRIBUTING.mdinstructs to Pull Request into thedevelopbranch, but that branch appears abandonedI noticed
for(;;) continue;is used in a few places in your code with the intention of aborting program execution. This is inadvisable as it is the compiler's discretion as to whether it omits a loop whose body has no observable effect as explained by Section5.1.2.3 Program executionof the C99 specification:This is not a problem on Xtensa GCC, but it may impact portability to other embedded architectures.