hannestschofenig / mbedtls

An open source, portable, easy to use, readable and flexible SSL library
https://tls.mbed.org
Apache License 2.0
15 stars 8 forks source link

fix Wunused-but-set-variable warning/error #373

Open lhuang04 opened 2 years ago

lhuang04 commented 2 years ago

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:

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:

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

Steps to test or reproduce

Outline the steps to test or reproduce the PR here.