]> granicus.if.org Git - yasm/commitdiff
Warning cleanups.
authorPeter Johnson <peter@tortall.net>
Fri, 16 Aug 2002 05:48:10 +0000 (05:48 -0000)
committerPeter Johnson <peter@tortall.net>
Fri, 16 Aug 2002 05:48:10 +0000 (05:48 -0000)
svn path=/trunk/yasm/; revision=699

tools/re2c/actions.c
tools/re2c/code.c
tools/re2c/dfa.c
tools/re2c/globals.h
tools/re2c/re2c-parser.y
tools/re2c/re2c.c
tools/re2c/scanner.c
tools/re2c/scanner.h
tools/re2c/scanner.re

index 9160e47833e5b4fa64ed77abaabe9453d76b9a05..890422d56ad25f44686b50d439c5b2a340bc1678 100644 (file)
@@ -310,7 +310,7 @@ Range_out(FILE *o, const Range *r)
     Range_out(o, r->next);
 }
 
-Range *doUnion(Range *r1, Range *r2){
+static Range *doUnion(Range *r1, Range *r2){
     Range *r, **rP = &r;
     for(;;){
        Range *s;
@@ -357,7 +357,7 @@ Range *doUnion(Range *r1, Range *r2){
     return r;
 }
 
-Range *doDiff(Range *r1, Range *r2){
+static Range *doDiff(Range *r1, Range *r2){
     Range *r, *s, **rP = &r;
     for(; r1; r1 = r1->next){
        uint lb = r1->lb;
@@ -397,7 +397,7 @@ RegExp *mkDiff(RegExp *e1, RegExp *e2){
     return r? RegExp_new_MatchOp(r) : RegExp_new_NullOp();
 }
 
-RegExp *doAlt(RegExp *e1, RegExp *e2){
+static RegExp *doAlt(RegExp *e1, RegExp *e2){
     if(!e1)
        return e2;
     if(!e2)
@@ -423,7 +423,7 @@ RegExp *mkAlt(RegExp *e1, RegExp *e2){
     return doAlt(merge(m1, m2), doAlt(e1, e2));
 }
 
-uchar unescape(SubStr *s){
+static uchar unescape(SubStr *s){
     uchar c;
     uchar v;
     s->len--;
@@ -456,7 +456,7 @@ uchar unescape(SubStr *s){
     }
 }
 
-Range *getRange(SubStr *s){
+static Range *getRange(SubStr *s){
     uchar lb = unescape(s), ub;
     if(s->len < 2 || *s->str != '-'){
        ub = lb;
@@ -471,7 +471,7 @@ Range *getRange(SubStr *s){
     return Range_new(lb, ub+1);
 }
 
-RegExp *matchChar(uint c){
+static RegExp *matchChar(uint c){
     return RegExp_new_MatchOp(Range_new(c, c+1));
 }
 
@@ -510,9 +510,7 @@ RegExp_new_RuleOp(RegExp *e, RegExp *c, Token *t, uint a)
     return r;
 }
 
-extern void printSpan(FILE *, uint, uint);
-
-void optimize(Ins *i){
+static void optimize(Ins *i){
     while(!isMarked(i)){
        mark(i);
        if(i->i.tag == CHAR){
index c3b5b2d4ca566cec2c4cefc06a9e7c42ac3d2fdf..4dbda04a934bd4396fd2d087fa624948acc05eba 100644 (file)
@@ -46,7 +46,7 @@ void Go_unmap(Go *g, Go *base, State *x){
     g->nSpans = s - g->span;
 }
 
-void doGen(Go *g, State *s, uchar *bm, uchar m){
+static void doGen(Go *g, State *s, uchar *bm, uchar m){
     Span *b = g->span, *e = &b[g->nSpans];
     uint lb = 0;
     for(; b < e; ++b){
@@ -55,8 +55,8 @@ void doGen(Go *g, State *s, uchar *bm, uchar m){
        lb = b->ub;
     }
 }
-
-void prt(FILE *o, Go *g, State *s){
+#if 0
+static void prt(FILE *o, Go *g, State *s){
     Span *b = g->span, *e = &b[g->nSpans];
     uint lb = 0;
     for(; b < e; ++b){
@@ -65,8 +65,8 @@ void prt(FILE *o, Go *g, State *s){
        lb = b->ub;
     }
 }
-
-int matches(Go *g1, State *s1, Go *g2, State *s2){
+#endif
+static int matches(Go *g1, State *s1, Go *g2, State *s2){
     Span *b1 = g1->span, *e1 = &b1[g1->nSpans];
     uint lb1 = 0;
     Span *b2 = g2->span, *e2 = &b2[g2->nSpans];
@@ -165,17 +165,17 @@ void BitMap_stats(void){
 }
 #endif
 
-void genGoTo(FILE *o, State *to){
+static void genGoTo(FILE *o, State *to){
     fprintf(o, "\tgoto yy%u;\n", to->label);
 }
 
-void genIf(FILE *o, const char *cmp, uint v){
+static void genIf(FILE *o, const char *cmp, uint v){
     fprintf(o, "\tif(yych %s '", cmp);
     prtCh(o, v);
     fputs("')", o);
 }
 
-void indent(FILE *o, uint i){
+static void indent(FILE *o, uint i){
     while(i-- > 0)
        fputc('\t', o);
 }
@@ -263,7 +263,7 @@ Action_new_Accept(State *x, uint n, uint *s, State **r)
     return a;
 }
 
-void doLinear(FILE *o, uint i, Span *s, uint n, State *next){
+static void doLinear(FILE *o, uint i, Span *s, uint n, State *next){
     for(;;){
        State *bg = s[0].to;
        while(n >= 3 && s[2].to == bg && (s[1].ub - s[0].ub) == 1){
@@ -295,7 +295,7 @@ Go_genLinear(Go *g, FILE *o, State *next){
     doLinear(o, 0, g->span, g->nSpans, next);
 }
 
-void genCases(FILE *o, uint lb, Span *s){
+static void genCases(FILE *o, uint lb, Span *s){
     if(lb < s->ub){
        for(;;){
            fputs("\tcase '", o); prtCh(o, lb); fputs("':", o);
@@ -346,7 +346,7 @@ Go_genSwitch(Go *g, FILE *o, State *next){
     }
 }
 
-void doBinary(FILE *o, uint i, Span *s, uint n, State *next){
+static void doBinary(FILE *o, uint i, Span *s, uint n, State *next){
     if(n <= 4){
        doLinear(o, i, s, n, next);
     } else {
@@ -524,7 +524,7 @@ static void SCC_traverse(SCC *s, State *x){
        } while(*s->top != x);
 }
 
-uint maxDist(State *s){
+static uint maxDist(State *s){
     uint mm = 0, i;
     for(i = 0; i < s->go.nSpans; ++i){
        State *t = s->go.span[i].to;
@@ -539,7 +539,7 @@ uint maxDist(State *s){
     return mm;
 }
 
-void calcDepth(State *head){
+static void calcDepth(State *head){
     State *t, *s;
     for(s = head; s; s = s->next){
        if(s->link == s){
index f1ffb3d7d0c922da6382beb2ee0dd71adf28e0d9..057ef66116f83a0ba08f7734d8818909825bc0c4 100644 (file)
@@ -146,11 +146,11 @@ DFA_new(Ins *ins, uint ni, uint lb, uint ub, Char *rep)
        s->rule = NULL;
        for(iP = s->kernel; (i = *iP); ++iP){
            if(i->i.tag == CHAR){
-               Ins *j;
-               for(j = i + 1; j < (Ins*) i->i.link; ++j){
-                   if(!(j->c.link = goTo[j->c.value - lb].to))
-                       goTo[nGoTos++].ch = j->c.value;
-                   goTo[j->c.value - lb].to = j;
+               Ins *j2;
+               for(j2 = i + 1; j2 < (Ins*) i->i.link; ++j2){
+                   if(!(j2->c.link = goTo[j2->c.value - lb].to))
+                       goTo[nGoTos++].ch = j2->c.value;
+                   goTo[j2->c.value - lb].to = j2;
                }
            } else if(i->i.tag == TERM){
                if(!s->rule || ((RegExp *)i->i.link)->d.RuleOp.accept < s->rule->d.RuleOp.accept)
index f42735cf9207de939c2ca5436460a98cce13f68c..a9e5eb73cc6962b087b14dba8e576406ecd6515f 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "tools/re2c/basics.h"
 
-extern char *fileName;
+extern const char *fileName;
 extern int sFlag;
 extern int bFlag;
 
index c41170f5da9e42db8ad97abbe7d9ec8cbc3024d4..d2d5406eb40e9c50622f8f6880ad1406db0f331d 100644 (file)
@@ -7,9 +7,10 @@
 #include <stdlib.h>
 #include "tools/re2c/globals.h"
 #include "tools/re2c/parse.h"
-int yyparse();
-int yylex();
-void yyerror(char*);
+int yylex(void);
+void yyerror(const char*);
+
+static char *mystrdup(const char *str);
 
 static uint accept;
 static RegExp *spec;
@@ -120,7 +121,7 @@ primary     :       ID
 
 %%
 
-void yyerror(char* s){
+void yyerror(const char* s){
     Scanner_fatal(in, s);
 }
 
@@ -128,7 +129,7 @@ int yylex(){
     return Scanner_scan(in);
 }
 
-char *
+static char *
 mystrdup(const char *str)
 {
        size_t len;
index 0eece4a7115345df454364eee0f85efdcfb29314..412e59e3ea440f650f3e9815e020dd40e566d534 100644 (file)
@@ -7,7 +7,7 @@
 #include "tools/re2c/parse.h"
 #include "tools/re2c/dfa.h"
 
-char *fileName;
+const char *fileName;
 int sFlag = 0;
 int bFlag = 0;
 
index aeb205f8795cd6e35de9e9779c3947e7025961e6..4f520d6ea925793510eeeb5ebef75f192a33670a 100644 (file)
@@ -1,6 +1,6 @@
-/* Generated by re2c 0.9.1-C on Fri Aug  9 17:42:28 2002
+/* Generated by re2c 0.9.1-C on Thu Aug 15 22:11:10 2002
  */
-#line 1 "scanner.re"
+#line 1 "tools/re2c/scanner.re"
 #include <config.h>
 
 #include <stdlib.h>
@@ -9,8 +9,6 @@
 #include "tools/re2c/parse.h"
 #include "re2c-parser.h"
 
-extern YYSTYPE yylval;
-
 #define        BSIZE   8192
 
 #define        YYCTYPE         uchar
@@ -67,7 +65,7 @@ fill(Scanner *s, uchar *cursor)
     return cursor;
 }
 
-#line 76
+#line 74
 
 
 int
@@ -90,11 +88,11 @@ yy0:
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych == '*') goto yy7;
 yy3:
-#line 92
+#line 90
        { goto echo; }
 yy4:   yych = *++YYCURSOR;
 
-#line 88
+#line 86
        { if(cursor == s->eof) RETURN(0);
                                  fwrite(s->tok, 1, cursor - s->tok, out);
                                  s->tok = s->pos = cursor; s->cline++;
@@ -117,12 +115,12 @@ yy9:      yych = *++YYCURSOR;
        if(yych != 'c') goto yy8;
        yych = *++YYCURSOR;
 
-#line 85
+#line 83
        { fwrite(s->tok, 1, &cursor[-7] - s->tok, out);
                                  s->tok = cursor;
                                  RETURN(1); }
 }
-#line 93
+#line 91
 
 }
 
@@ -192,32 +190,32 @@ yy15:
        }
 yy17:  yych = *++YYCURSOR;
 
-#line 108
+#line 106
        { depth = 1;
                                  goto code;
                                }
 yy19:  yych = *++YYCURSOR;
        if(yych == '*') goto yy54;
 yy20:
-#line 127
+#line 125
        { RETURN(*s->tok); }
 yy21:  yych = *++YYCURSOR;
        if(yych == '/') goto yy52;
 yy22:
-#line 129
+#line 127
        { yylval.op = *s->tok;
                                  RETURN(CLOSE); }
 yy23:  yyaccept = 0;
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych != '\n')        goto yy48;
 yy24:
-#line 120
+#line 118
        { Scanner_fatal(s, "bad string"); }
 yy25:  yyaccept = 1;
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych != '\n')        goto yy42;
 yy26:
-#line 125
+#line 123
        { Scanner_fatal(s, "bad character constant"); }
 yy27:  yych = *++YYCURSOR;
        goto yy20;
@@ -226,7 +224,7 @@ yy28:       yych = *++YYCURSOR;
 yy29:  yych = *++YYCURSOR;
        goto yy40;
 yy30:
-#line 132
+#line 130
        { SubStr substr;
                                  s->cur = cursor;
                                  substr = Scanner_token(s);
@@ -235,18 +233,18 @@ yy30:
 yy31:  yych = *++YYCURSOR;
        goto yy38;
 yy32:
-#line 138
+#line 136
        { goto scan; }
 yy33:  yych = *++YYCURSOR;
 
-#line 140
+#line 138
        { if(cursor == s->eof) RETURN(0);
                                  s->pos = cursor; s->cline++;
                                  goto scan;
                                }
 yy35:  yych = *++YYCURSOR;
 
-#line 145
+#line 143
        { fprintf(stderr, "unexpected character: '%c'\n", *s->tok);
                                  goto scan;
                                }
@@ -291,7 +289,7 @@ yy44:       ++YYCURSOR;
        goto yy41;
 yy45:  yych = *++YYCURSOR;
 
-#line 122
+#line 120
        { s->cur = cursor;
                                  yylval.regexp = ranToRE(Scanner_token(s));
                                  return RANGE; }
@@ -312,22 +310,22 @@ yy48:     if(yych <= '!'){
        goto yy47;
 yy50:  yych = *++YYCURSOR;
 
-#line 117
+#line 115
        { s->cur = cursor;
                                  yylval.regexp = strToRE(Scanner_token(s));
                                  return STRING; }
 yy52:  yych = *++YYCURSOR;
 
-#line 114
+#line 112
        { s->tok = cursor;
                                  RETURN(0); }
 yy54:  yych = *++YYCURSOR;
 
-#line 111
+#line 109
        { depth = 1;
                                  goto comment; }
 }
-#line 148
+#line 146
 
 
 code:
@@ -358,7 +356,7 @@ yy56:
        }
        yych = *++YYCURSOR;
 
-#line 152
+#line 150
        { if(--depth == 0){
                                        s->cur = cursor;
                                        yylval.token = Token_new(Scanner_token(s), s->tline);
@@ -367,19 +365,19 @@ yy56:
                                  goto code; }
 yy60:  yych = *++YYCURSOR;
 
-#line 158
+#line 156
        { ++depth;
                                  goto code; }
 yy62:  yych = *++YYCURSOR;
 
-#line 160
+#line 158
        { if(cursor == s->eof) Scanner_fatal(s, "missing '}'");
                                  s->pos = cursor; s->cline++;
                                  goto code;
                                }
 yy64:  yych = *++YYCURSOR;
 yy65:
-#line 164
+#line 162
        { goto code; }
 yy66:  yyaccept = 0;
        yych = *(YYMARKER = ++YYCURSOR);
@@ -424,7 +422,7 @@ yy73:       if(yych <= '!'){
        if(yych == '\n')        goto yy70;
        goto yy72;
 }
-#line 165
+#line 163
 
 
 comment:
@@ -447,14 +445,14 @@ yy75:
 yy77:  yych = *++YYCURSOR;
        if(yych == '/') goto yy85;
 yy78:
-#line 179
+#line 177
        { goto comment; }
 yy79:  yych = *++YYCURSOR;
        if(yych == '*') goto yy83;
        goto yy78;
 yy80:  yych = *++YYCURSOR;
 
-#line 175
+#line 173
        { if(cursor == s->eof) RETURN(0);
                                  s->tok = s->pos = cursor; s->cline++;
                                  goto comment;
@@ -463,23 +461,23 @@ yy82:     yych = *++YYCURSOR;
        goto yy78;
 yy83:  yych = *++YYCURSOR;
 
-#line 173
+#line 171
        { ++depth;
                                  goto comment; }
 yy85:  yych = *++YYCURSOR;
 
-#line 169
+#line 167
        { if(--depth == 0)
                                        goto scan;
                                    else
                                        goto comment; }
 }
-#line 180
+#line 178
 
 }
 
 void
-Scanner_fatal(Scanner *s, char *msg)
+Scanner_fatal(Scanner *s, const char *msg)
 {
     fprintf(stderr, "line %d, column %d: %s\n", s->tline, s->tchar + 1, msg);
     exit(1);
index a76c4dd44fe50628ec36463b36b2af4b1bd0c5bc..2c2d0200b7f2d8fec60c32a99c6d87f6518494dc 100644 (file)
@@ -15,7 +15,7 @@ static inline Scanner *Scanner_new(FILE *);
 
 int Scanner_echo(Scanner*, FILE *);
 int Scanner_scan(Scanner*);
-void Scanner_fatal(Scanner*, char*);
+void Scanner_fatal(Scanner*, const char*);
 static inline SubStr Scanner_token(Scanner*);
 static inline uint Scanner_line(Scanner*);
 
index a058fe7651ced03b46e574322731b845f37bd14c..4b94ed47a9681f2430c3247ec2d00fc18c4c7929 100644 (file)
@@ -6,8 +6,6 @@
 #include "tools/re2c/parse.h"
 #include "re2c-parser.h"
 
-extern YYSTYPE yylval;
-
 #define        BSIZE   8192
 
 #define        YYCTYPE         uchar
@@ -181,7 +179,7 @@ comment:
 }
 
 void
-Scanner_fatal(Scanner *s, char *msg)
+Scanner_fatal(Scanner *s, const char *msg)
 {
     fprintf(stderr, "line %d, column %d: %s\n", s->tline, s->tchar + 1, msg);
     exit(1);