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 PC_NameHash(char *name)
{ {
int register hash, i; int hash, i;
hash = 0; hash = 0;
for (i = 0; name[i] != '\0'; i++) 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) { \ #define swapcode(TYPE, parmi, parmj, n) { \
long i = (n) / sizeof (TYPE); \ long i = (n) / sizeof (TYPE); \
register TYPE *pi = (TYPE *) (parmi); \ TYPE *pi = (TYPE *) (parmi); \
register TYPE *pj = (TYPE *) (parmj); \ TYPE *pj = (TYPE *) (parmj); \
do { \ do { \
register TYPE t = *pi; \ TYPE t = *pi; \
*pi++ = *pj; \ *pi++ = *pj; \
*pj++ = t; \ *pj++ = t; \
} while (--i > 0); \ } while (--i > 0); \

View file

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

View file

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

View file

@ -563,8 +563,8 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count)
#if idppc #if idppc
{ {
register float half = 0.5; float half = 0.5;
register float one = 1.0; float one = 1.0;
float *components = (float *)normals; float *components = (float *)normals;
// Vanilla PPC code, but since PPC has a reciprocal square root estimate instruction, // 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; } keywordHash_t;
int KeywordHash_Key(char *keyword) { int KeywordHash_Key(char *keyword) {
int register hash, i; int hash, i;
hash = 0; hash = 0;
for (i = 0; keyword[i] != '\0'; i++) { for (i = 0; keyword[i] != '\0'; i++) {