Address some -Wold-style-declaration warnings
authorBenjamin Kaduk <bkaduk@akamai.com>
Fri, 14 Apr 2017 16:53:04 +0000 (11:53 -0500)
committerRich Salz <rsalz@openssl.org>
Mon, 1 May 2017 18:23:28 +0000 (14:23 -0400)
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 <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3239)

crypto/cast/c_enc.c
crypto/ec/ecp_nistz256.c
crypto/include/internal/bn_dh.h
crypto/o_str.c
test/chacha_internal_test.c
test/wpackettest.c

index 9a858125919c092f88054f9554e431e0d166c302..700b6d162a9fbcd36c92fe66f34d21a34ca4b542 100644 (file)
@@ -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];
index 5c8affa4c70ba12aca6d67e46a1d9e59b38a9461..665ca35673921c6f4c8311d5703e4ea09dc5c071 100644 (file)
@@ -767,12 +767,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)
 };
index b4bca40c58a3db54704d749386ddfa9285c208db..f49f039835b3da1aa64f0486ee04ee172d34ae60 100644 (file)
@@ -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)
index d8516c27bbbede979a5d428fca1ec8be63765ed6..528655aa8ce8a8529819ee3080387104cf852f92 100644 (file)
@@ -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;
index de8e4b2d8b79ef0e92ffe48bed1456bb5091f574..e3d1c4997bd7773b0ef9d2be3525264232f772a7 100644 (file)
 #include "testutil.h"
 #include "internal/chacha.h"
 
-const static unsigned int key[] = {
+static const unsigned int key[] = {
     0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c,
     0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c
 };
 
-const static unsigned int ivp[] = {
+static const unsigned int ivp[] = {
     0x00000000, 0x00000000, 0x03020100, 0x07060504
 };
 
-const static unsigned char ref[] = {
+static const unsigned char ref[] = {
     0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69,
     0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75,
     0x7f, 0x57, 0x9d, 0xa3, 0x16, 0x02, 0xfc, 0x93,
index a0872c5724e174c9d94daf215d9c429fa6156853..5c7ea10165dcee8eea0c3bceb46e4e15023337bf 100644 (file)
 
 #include "testutil.h"
 
-const static unsigned char simple1[] = { 0xff };
-const static unsigned char simple2[] = { 0x01, 0xff };
-const static unsigned char simple3[] = { 0x00, 0x00, 0x00, 0x01, 0xff };
-const static unsigned char nestedsub[] = { 0x03, 0xff, 0x01, 0xff };
-const static unsigned char seqsub[] = { 0x01, 0xff, 0x01, 0xff };
-const static unsigned char empty[] = { 0x00 };
-const static unsigned char alloc[] = { 0x02, 0xfe, 0xff };
-const static unsigned char submem[] = { 0x03, 0x02, 0xfe, 0xff };
-const static unsigned char fixed[] = { 0xff, 0xff, 0xff };
+static const unsigned char simple1[] = { 0xff };
+static const unsigned char simple2[] = { 0x01, 0xff };
+static const unsigned char simple3[] = { 0x00, 0x00, 0x00, 0x01, 0xff };
+static const unsigned char nestedsub[] = { 0x03, 0xff, 0x01, 0xff };
+static const unsigned char seqsub[] = { 0x01, 0xff, 0x01, 0xff };
+static const unsigned char empty[] = { 0x00 };
+static const unsigned char alloc[] = { 0x02, 0xfe, 0xff };
+static const unsigned char submem[] = { 0x03, 0x02, 0xfe, 0xff };
+static const unsigned char fixed[] = { 0xff, 0xff, 0xff };
 
 static BUF_MEM *buf;