From bd97dde41e96193aa076260fb0057e9ce0f6861b Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Fri, 14 Apr 2017 11:53:04 -0500 Subject: [PATCH] Address some -Wold-style-declaration warnings gcc's -Wextra pulls in -Wold-style-declaration, which triggers when a declaration has a storage-class specifier as a non-initial qualifier. The ISO C formal grammar requires the storage-class to be the first component of the declaration, if present. Seeint as the register storage-class specifier does not really have any effect anymore with modern compilers, remove it entirely while we're here, instead of fixing up the order. Interestingly, the gcc devteam warnings do not pull in -Wextra, though the clang ones do. [extended tests] Reviewed-by: Andy Polyakov Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3239) (cherry picked from commit f44903a428cc63ce88bfba26e8e4e2e9b21f058d) --- crypto/cast/c_enc.c | 8 ++++---- crypto/ec/ecp_nistz256.c | 4 ++-- crypto/include/internal/bn_dh.h | 6 +++--- crypto/o_str.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crypto/cast/c_enc.c b/crypto/cast/c_enc.c index 9a85812591..700b6d162a 100644 --- a/crypto/cast/c_enc.c +++ b/crypto/cast/c_enc.c @@ -12,8 +12,8 @@ void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) { - register CAST_LONG l, r, t; - const register CAST_LONG *k; + CAST_LONG l, r, t; + const CAST_LONG *k; k = &(key->data[0]); l = data[0]; @@ -44,8 +44,8 @@ void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key) { - register CAST_LONG l, r, t; - const register CAST_LONG *k; + CAST_LONG l, r, t; + const CAST_LONG *k; k = &(key->data[0]); l = data[0]; diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c index dca3a2dde5..246189833e 100644 --- a/crypto/ec/ecp_nistz256.c +++ b/crypto/ec/ecp_nistz256.c @@ -757,12 +757,12 @@ __owur static int ecp_nistz256_windowed_mul(const EC_GROUP *group, } /* Coordinates of G, for which we have precomputed tables */ -const static BN_ULONG def_xG[P256_LIMBS] = { +static const BN_ULONG def_xG[P256_LIMBS] = { TOBN(0x79e730d4, 0x18a9143c), TOBN(0x75ba95fc, 0x5fedb601), TOBN(0x79fb732b, 0x77622510), TOBN(0x18905f76, 0xa53755c6) }; -const static BN_ULONG def_yG[P256_LIMBS] = { +static const BN_ULONG def_yG[P256_LIMBS] = { TOBN(0xddf25357, 0xce95560a), TOBN(0x8b4ab8e4, 0xba19e45c), TOBN(0xd2e88688, 0xdd21f325), TOBN(0x8571ff18, 0x25885d85) }; diff --git a/crypto/include/internal/bn_dh.h b/crypto/include/internal/bn_dh.h index b4bca40c58..f49f039835 100644 --- a/crypto/include/internal/bn_dh.h +++ b/crypto/include/internal/bn_dh.h @@ -8,9 +8,9 @@ */ #define declare_dh_bn(x) \ - const extern BIGNUM _bignum_dh##x##_p; \ - const extern BIGNUM _bignum_dh##x##_g; \ - const extern BIGNUM _bignum_dh##x##_q; + extern const BIGNUM _bignum_dh##x##_p; \ + extern const BIGNUM _bignum_dh##x##_g; \ + extern const BIGNUM _bignum_dh##x##_q; declare_dh_bn(1024_160) declare_dh_bn(2048_224) diff --git a/crypto/o_str.c b/crypto/o_str.c index d8516c27bb..528655aa8c 100644 --- a/crypto/o_str.c +++ b/crypto/o_str.c @@ -193,7 +193,7 @@ unsigned char *OPENSSL_hexstr2buf(const char *str, long *len) */ char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len) { - const static char hexdig[] = "0123456789ABCDEF"; + static const char hexdig[] = "0123456789ABCDEF"; char *tmp, *q; const unsigned char *p; int i; -- 2.25.1