mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

fix Wunused-but-set-variable warning/error

Open lhuang04 opened this issue 3 years ago • 0 comments

Summary: When the MBEDTLS_DEBUG_C is undefined, we saw the following compiler warnining/error.

/upstream/library/ssl_tls13_keys.c: In function
‘mbedtls_ssl_tls1_3_generate_resumption_master_secret’:
/upstream/library/ssl_tls13_keys.c:890:12: error: variable
‘md_size’ set but not used [-Werror=unused-but-set-variable]
     size_t md_size;
/upstream/library/ssl_tls13_server.c: In function
‘ssl_parse_key_shares_ext’:
/upstream/library/ssl_tls13_server.c:366:39: error:
variable ‘their_curve_info’ set but not used
[-Werror=unused-but-set-variable]
         mbedtls_ecp_curve_info const *their_curve_info;

Test Plan:

rm -rf build/; mkdir build; cd build; CFLAGS="-std=c99 -g
-Wunused-but-set-variable -Wno-unused-parameter" cmake ..; make -j

Reviewers:

Subscribers:

Tasks:

Tags:

Notes:

  • Pull requests cannot be accepted until the PR follows the contributing guidelines. In particular, each commit must have at least one Signed-off-by: line from the committer to certify that the contribution is made under the terms of the Developer Certificate of Origin.
  • This is just a template, so feel free to use/remove the unnecessary things

Description

A few sentences describing the overall goals of the pull request's commits.

Status

READY/IN DEVELOPMENT/HOLD

Requires Backporting

When there is a bug fix, it should be backported to all maintained and supported branches. Changes do not have to be backported if:

  • This PR is a new feature\enhancement
  • This PR contains changes in the API. If this is true, and there is a need for the fix to be backported, the fix should be handled differently in the legacy branch

Yes | NO
Which branch?

Migrations

If there is any API change, what's the incentive and logic for it.

YES | NO

Additional comments

Any additional information that could be of interest

Todos

  • [ ] Tests
  • [ ] Documentation
  • [ ] Changelog updated
  • [ ] Backported

Steps to test or reproduce

Outline the steps to test or reproduce the PR here.

lhuang04 avatar Sep 09 '21 13:09 lhuang04