diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2011-10-08 16:39:13 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2011-10-08 16:43:23 +0300 |
commit | 88b265f102939bbc5b51653eb656d6e16b5cff07 (patch) | |
tree | 91cebab163b0db24aa215569235a0ccedc480d7b /rsc | |
parent | 51798a4ecf01aa225875e8582787323b1092b2dd (diff) |
Revert "cppcheck reduce scope of var in rsc/...cpp3.c/cpp4.c/cpp6.c"
As long as we want to be buildable with MSVC 2008, we can't use C99
features in our C source files. (Yeah, horrible, M$ suxors, etc,
complain to your mother.) Please relax the cppcheck enthusiasm, or at
least, tune cppcheck to follow C89 for C files.
This reverts commit 0921457488898b43152e33d1184929f7436aeeb4.
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/source/rscpp/cpp3.c | 7 | ||||
-rw-r--r-- | rsc/source/rscpp/cpp4.c | 11 | ||||
-rw-r--r-- | rsc/source/rscpp/cpp6.c | 3 |
3 files changed, 11 insertions, 10 deletions
diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c index b9ed7a9e1af1..7f9c8adbaf8d 100644 --- a/rsc/source/rscpp/cpp3.c +++ b/rsc/source/rscpp/cpp3.c @@ -449,6 +449,7 @@ void initdefines() register char **pp; register char *tp; register DEFBUF *dp; + int i; time_t tvec; #if !defined( WNT ) && !defined(G3) @@ -475,10 +476,8 @@ void initdefines() * notices this and calls the appropriate routine. * DEF_NOARGS is one greater than the first "magic" definition. */ - if (nflag < 2) - { - int i = DEF_NOARGS; - for (pp = magic; *pp != NULL; pp++) { + if (nflag < 2) { + for (pp = magic, i = DEF_NOARGS; *pp != NULL; pp++) { dp = defendel(*pp, FALSE); dp->nargs = --i; } diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c index af8995be4524..3f5e03a0b5b7 100644 --- a/rsc/source/rscpp/cpp4.c +++ b/rsc/source/rscpp/cpp4.c @@ -554,9 +554,12 @@ void expstuff(DEFBUF* tokenp) * Stuff the macro body, replacing formal parameters by actual parameters. */ { + register int c; /* Current character */ register char *inp; /* -> repl string */ register char *defp; /* -> macro output buff */ + int size; /* Actual parm. size */ char *defend; /* -> output buff end */ + int string_magic; /* String formal hack */ FILEINFO *file; /* Funny #include */ extern FILEINFO *getfile(); @@ -565,7 +568,6 @@ void expstuff(DEFBUF* tokenp) defp = file->buffer; /* -> output buffer */ defend = defp + (NBUFF - 1); /* Note its end */ if (inp != NULL) { - register int c; /* Current character */ while ((c = (*inp++ & 0xFF)) != EOS) { #ifdef SOLAR if (c == DEL) { @@ -573,15 +575,14 @@ void expstuff(DEFBUF* tokenp) #else if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) { #endif - int string_magic = (c == (MAC_PARM + PAR_MAC)); + string_magic = (c == (MAC_PARM + PAR_MAC)); if (string_magic) c = (*inp++ & 0xFF); /* * Replace formal parameter by actual parameter string. */ - if ((c -= MAC_PARM) < nargs) - { - int size = strlen(parlist[c]); + if ((c -= MAC_PARM) < nargs) { + size = strlen(parlist[c]); if ((defp + size) >= defend) goto nospace; /* diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c index 6c021fb823c5..cb628ba4c04d 100644 --- a/rsc/source/rscpp/cpp6.c +++ b/rsc/source/rscpp/cpp6.c @@ -278,6 +278,7 @@ catenate() * and return FALSE. */ { + register int c; register char *token1; #if OK_CONCAT @@ -287,7 +288,7 @@ catenate() } else { token1 = savestring(token); /* Save first token */ - register int c = macroid(get()); /* Scan next token */ + c = macroid(get()); /* Scan next token */ switch(type[c]) { /* What was it? */ case LET: /* An identifier, ... */ if (strlen(token1) + strlen(token) >= NWORK) |