Avoid 'register' declarations

gcc 6 with -Wall -Wextra warns:

code/botlib/l_precomp.c: In function ‘PC_NameHash’:
code/botlib/l_precomp.c:551:2: warning: ‘register’ is not at beginning of declaration [-Wold-style-declaration]
  int register hash, i;
  ^~~

Modern compilers either ignore the register storage class when
generating code, or generate better code without it, so just remove
most of them.

The remaining uses are in third-party bundled libraries (libjpeg, zlib),
and in a PowerPC-specific inline function consisting of inline
assembler (because I'm not 100% confident that it doesn't have
some practical use there).
This commit is contained in:
Simon McVittie 2016-09-29 23:37:15 +01:00
parent 863adfcfc2
commit 2ab109b772
6 changed files with 10 additions and 10 deletions

View File

@ -548,7 +548,7 @@ void PC_PrintDefineHashTable(define_t **definehash)
int PC_NameHash(char *name)
{
int register hash, i;
int hash, i;
hash = 0;
for (i = 0; name[i] != '\0'; i++)

View File

@ -53,10 +53,10 @@ static void swapfunc(char *, char *, int, int);
*/
#define swapcode(TYPE, parmi, parmj, n) { \
long i = (n) / sizeof (TYPE); \
register TYPE *pi = (TYPE *) (parmi); \
register TYPE *pj = (TYPE *) (parmj); \
TYPE *pi = (TYPE *) (parmi); \
TYPE *pj = (TYPE *) (parmj); \
do { \
register TYPE t = *pi; \
TYPE t = *pi; \
*pi++ = *pj; \
*pj++ = t; \
} while (--i > 0); \

View File

@ -78,7 +78,7 @@ static void MD5Init(struct MD5Context *ctx)
static void MD5Transform(uint32_t buf[4],
uint32_t const in[16])
{
register uint32_t a, b, c, d;
uint32_t a, b, c, d;
a = buf[0];
b = buf[1];

View File

@ -317,8 +317,8 @@ locals from sp
int VM_CallInterpreted( vm_t *vm, int *args ) {
byte stack[OPSTACK_SIZE + 15];
register int *opStack;
register uint8_t opStackOfs;
int *opStack;
uint8_t opStackOfs;
int programCounter;
int programStack;
int stackOnEntry;

View File

@ -563,8 +563,8 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count)
#if idppc
{
register float half = 0.5;
register float one = 1.0;
float half = 0.5;
float one = 1.0;
float *components = (float *)normals;
// Vanilla PPC code, but since PPC has a reciprocal square root estimate instruction,

View File

@ -4366,7 +4366,7 @@ typedef struct keywordHash_s
} keywordHash_t;
int KeywordHash_Key(char *keyword) {
int register hash, i;
int hash, i;
hash = 0;
for (i = 0; keyword[i] != '\0'; i++) {