-
Notifications
You must be signed in to change notification settings - Fork 847
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 shadow global declaration on old versions of gcc #8519
Conversation
Old versions of gcc (4.3.3 at least) complain on local variables shadowing global names. Some of them are well-known unix function names like 'send' and 'dup'. Others are simply local collisions. Simply rename the local variables to avoid the clash.
Can one of the admins verify this patch? |
Hi @ribes96 , Thank you for this pull request. This issue with shadow variable names comes up peridically. It reminds me that we need a build test case for this. Can you tell us more about your project and use case for wolfSSL? In order to accept third-party code/PR's we need to get you setup as a contributor. Please email support at wolfssl dot com and reference this PR. Please include your contact information including your location. Thanks, |
Hi @ribes96 -- thanks for the contribution! Upon further investigation of the issue, we're inclined to recommend addressing this problem by passing If |
Passing |
@ribes96 note that I have a PR in process that addresses all of the name conflicts you identified, except for the |
At line 326 of file static unsigned int cipherType(const WOLFSSL_EVP_CIPHER *cipher); The definition is at line 1850 static unsigned int cipherType(const WOLFSSL_EVP_CIPHER *cipher)
{
if (cipher == NULL) return 0; /* dummy for #ifdef */
#ifndef NO_DES3
else if (EVP_CIPHER_TYPE_MATCHES(cipher, EVP_DES_CBC))
return WC_DES_CBC_TYPE;
else if (EVP_CIPHER_TYPE_MATCHES(cipher, EVP_DES_EDE3_CBC))
return WC_DES_EDE3_CBC_TYPE;
#if !defined(NO_DES3)
else if (EVP_CIPHER_TYPE_MATCHES(cipher, EVP_DES_ECB))
return WC_DES_ECB_TYPE;
else if (EVP_CIPHER_TYPE_MATCHES(cipher, EVP_DES_EDE3_ECB))
return WC_DES_EDE3_ECB_TYPE;
#endif /* NO_DES3 && HAVE_AES_ECB */
#endif Then at line 8262 there is a local variable also named static int IsCipherTypeAEAD(unsigned char cipherType)
{
switch (cipherType) {
case WC_AES_128_GCM_TYPE:
case WC_AES_192_GCM_TYPE:
case WC_AES_256_GCM_TYPE:
case WC_AES_128_CCM_TYPE:
case WC_AES_192_CCM_TYPE:
case WC_AES_256_CCM_TYPE:
case WC_ARIA_128_GCM_TYPE:
case WC_ARIA_192_GCM_TYPE:
case WC_ARIA_256_GCM_TYPE:
case WC_SM4_GCM_TYPE:
case WC_SM4_CCM_TYPE:
return 1;
default:
return 0;
}
} |
@ribes96 Ah, well this will not do -- an |
Do you consider the fact that autotools overrides CFLAGS with options at the end a bug? Should I fill a bug report? Specially considering that shadowed variables could creep in again in the future... I was unable to find a way to tell autotools to place my |
Old versions of gcc (4.3.3 at least) complain on local variables shadowing global names. Some of them are well-known unix function names like 'send' and 'dup'. Others are simply local collisions.
Simply rename the local variables to avoid the clash.
Description
Please describe the scope of the fix or feature addition.
Simply rename of variables to avoid name collision
Fixes zd#
Testing
How did you test?
Checklist