From 2ab109b7729774cdfb791c80e855dea61c7b4d2f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 29 Sep 2016 23:37:15 +0100 Subject: [PATCH] Avoid 'register' declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- code/botlib/l_precomp.c | 2 +- code/game/bg_lib.c | 6 +++--- code/qcommon/md5.c | 2 +- code/qcommon/vm_interpreted.c | 4 ++-- code/renderergl1/tr_surface.c | 4 ++-- code/ui/ui_shared.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/botlib/l_precomp.c b/code/botlib/l_precomp.c index 4414f4c1..89f4a05a 100644 --- a/code/botlib/l_precomp.c +++ b/code/botlib/l_precomp.c @@ -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++) diff --git a/code/game/bg_lib.c b/code/game/bg_lib.c index ff023219..f893f442 100644 --- a/code/game/bg_lib.c +++ b/code/game/bg_lib.c @@ -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); \ diff --git a/code/qcommon/md5.c b/code/qcommon/md5.c index 994083fc..d47560e4 100644 --- a/code/qcommon/md5.c +++ b/code/qcommon/md5.c @@ -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]; diff --git a/code/qcommon/vm_interpreted.c b/code/qcommon/vm_interpreted.c index aa45fde6..f630d053 100644 --- a/code/qcommon/vm_interpreted.c +++ b/code/qcommon/vm_interpreted.c @@ -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; diff --git a/code/renderergl1/tr_surface.c b/code/renderergl1/tr_surface.c index c4a1b2d9..9aadf95f 100644 --- a/code/renderergl1/tr_surface.c +++ b/code/renderergl1/tr_surface.c @@ -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, diff --git a/code/ui/ui_shared.c b/code/ui/ui_shared.c index c95d386f..afef613d 100644 --- a/code/ui/ui_shared.c +++ b/code/ui/ui_shared.c @@ -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++) {