Applied patch from bug 737905 (renamed yylineo to mylineno)
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 May 2003 06:44:44 +0000 (06:44 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 May 2003 06:44:44 +0000 (06:44 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2633 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCC.lex
src/SDCCast.c
src/SDCCglobl.h
src/SDCCsymt.c
src/SDCCval.c
src/altlex.c

index ef2a8fa360597e0f26cea57bfe8a69cdcac07ec2..ae51cf56b8057b89d80d09f1680d16fdc57d7d7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-05-19  Bernhard Held <bernhard@bernhardheld.de>
+
+       Applied patch from bug 737905 (renamed yylineo to mylineno):
+       * src/altlex.c
+       * src/SDCCast.c
+       * src/SDCglobl.h
+       * src/SDCC.lex
+       * src/SDCCsymt.c
+       * src/SDCCval.c 
+
 2003-05-19  Scott Dattalo  <scott@dattalo.com>
 
        * src/pic16/pcode.c: Cleaned warnings
index 87d26948fdf1574858ccc215282e721e941f7861..d88529d2740cb8bf624f6d00824c22927051ae23 100644 (file)
@@ -22,6 +22,8 @@
    what you give them.   Help stamp out software-hoarding!  
 -------------------------------------------------------------------------*/
 
+%option noyywrap
+
 D        [0-9]
 L        [a-zA-Z_]
 H        [a-fA-F0-9]
@@ -42,15 +44,33 @@ char *currFname;
 
 extern int lineno, column;
 extern char *filename ;
-int   yylineno = 1               ;
+int   mylineno = 1               ;
 void count()                     ;
 int process_pragma(char *);
 #undef yywrap
 
+#ifndef YYPROTO
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+#endif
+
 int yywrap YY_PROTO((void))
 {
    return(1);
 }
+
+static void yyunput (int, char *);
+
+static void my_unput(char c)
+{
+  yyunput(c, (yytext_ptr));
+}
+
 #define TKEYWORD(token) return (isTargetKeyword(yytext) ? token :\
                                check_type(yytext))
 char *asmbuff=NULL;
@@ -64,6 +84,7 @@ extern int printListing               (int   );
 struct optimize save_optimize ;
 struct options  save_options  ;
 %}
+
 %x asm
 %%
 "_asm"         {  
@@ -224,7 +245,7 @@ struct options  save_options  ;
   if (ch!='\n') {
     // that could have been removed by the preprocessor anyway
     werror (W_STRAY_BACKSLASH, column);
-    unput(ch);
+    my_unput(ch);
   }
 }
 .                         { count()    ; }
@@ -257,7 +278,7 @@ int checkCurrFile ( char *s)
     /* set the current line number to   */
     /* line number if printFlag is on   */
     if (!*s) {         
-      lineno = yylineno = lNum ;
+      lineno = mylineno = lNum ;
       return 0;
     }
     
@@ -269,7 +290,7 @@ int checkCurrFile ( char *s)
     /* in c1mode fullSrcFileName is NULL */
     if ( fullSrcFileName &&
          strncmp(s,fullSrcFileName,strlen(fullSrcFileName)) == 0) {
-      lineno = yylineno = lNum;                                        
+      lineno = mylineno = lNum;                                        
       currFname = fullSrcFileName ;
     }  else {
        char *sb = s;
@@ -277,7 +298,7 @@ int checkCurrFile ( char *s)
        while (*s != '"') s++;
        *s = '\0';
        currFname = strdup (sb);
-       lineno = yylineno = lNum;
+       lineno = mylineno = lNum;
     }
     filename = currFname ;
     return 0;
@@ -292,7 +313,7 @@ void count()
   for (i = 0; yytext[i] != '\0'; i++)   {                              
     if (yytext[i] == '\n')      {         
       column = 0;
-      lineno = ++yylineno ;
+      lineno = ++mylineno ;
     }
     else 
       if (yytext[i] == '\t')
@@ -344,7 +365,7 @@ char *stringLiteral()
       ch = input();
       if (ch == '\n') {
         /* \<newline> is a continuator */
-        lineno = ++yylineno;
+        lineno = ++mylineno;
         column = 0;
       }
       else {
@@ -358,7 +379,7 @@ char *stringLiteral()
       /* if new line we have a new line break, which is illegal */
       werror(W_NEWLINE_IN_STRING);
       dbuf_append(&dbuf, "\n", 1);
-      lineno = ++yylineno;
+      lineno = ++mylineno;
       column = 0;
       break;
 
@@ -372,16 +393,16 @@ char *stringLiteral()
         case '\\':
           if ((ch = input()) != '\n') {
             werror(W_STRAY_BACKSLASH, column);
-            unput(ch);
+            my_unput(ch);
           }
           else {
-            lineno = ++yylineno;
+            lineno = ++mylineno;
             column = 0;
           }
           break;
 
         case '\n':
-          yylineno++;
+          mylineno++;
           break;
         }
       }
@@ -390,7 +411,7 @@ char *stringLiteral()
         goto out;
 
       if (ch != '\"') {
-        unput(ch) ;
+        my_unput(ch) ;
         goto out;
       }
       break;
@@ -607,9 +628,9 @@ int yyerror(char *s)
 {
    fflush(stdout);
 
-   if (yylineno && filename) {
+   if (mylineno && filename) {
      fprintf(stdout,"\n%s:%d: %s: token -> '%s' ; column %d\n",
-            filename,yylineno,
+            filename,mylineno,
             s,yytext,column);
      fatalError++;
    } else {
index 5fd567323c44e56ee27c456b757f2b77786108d6..1399fbd8b2ffa2fbcafed208873de860c078ef59 100644 (file)
@@ -78,7 +78,7 @@ newAst_ (unsigned type)
   ex = Safe_alloc ( sizeof (ast));
 
   ex->type = type;
-  ex->lineno = (noLineno ? oldLineno : yylineno);
+  ex->lineno = (noLineno ? oldLineno : mylineno);
   ex->filename = currFname;
   ex->level = NestLevel;
   ex->block = currBlockno;
@@ -4314,7 +4314,7 @@ createFunction (symbol * name, ast * body)
       addSymChain (name);
       allocVariables (name);
     }
-  name->lastLine = yylineno;
+  name->lastLine = mylineno;
   currFunc = name;
 
   /* set the stack pointer */
index 44a8d3ef31f9722ce6452a7cd197b6cc32550b3f..3fff1577fd01101f4efed16e1dc381c36b299843 100644 (file)
@@ -253,7 +253,7 @@ extern char *dstPath;               /* path for the output files; */
 extern char *moduleName;       /* module name is source file without path and extension */
                                /* can be NULL while linking without compiling */
 extern int currLineno;         /* current line number    */
-extern int yylineno;           /* line number of the current file SDCC.lex */
+extern int mylineno;           /* line number of the current file SDCC.lex */
 extern FILE *yyin;             /* */
 extern FILE *asmFile;          /* assembly output file */
 extern FILE *cdbFile;          /* debugger symbol file */
index be673e50622ad7175195b49ae8ee69e8d6115727..1e21ade18bd7d4e3b97ace4db3df750c9c069263 100644 (file)
@@ -290,7 +290,7 @@ newSymbol (char *name, int scope)
   strncpyz (sym->name, name, sizeof(sym->name));       /* copy the name */
   sym->level = scope;          /* set the level    */
   sym->block = currBlockno;
-  sym->lineDef = yylineno;     /* set the line number */
+  sym->lineDef = mylineno;     /* set the line number */
   return sym;
 }
 
index d944b5c8cd38ec6fed8f35ac4946bc1250d6854b..edd9c25b82ee14dc58df776f56013e9341f10713 100644 (file)
@@ -56,7 +56,7 @@ newiList (int type, void *ilist)
   nilist = Safe_alloc (sizeof (initList));
 
   nilist->type = type;
-  nilist->lineno = yylineno;
+  nilist->lineno = mylineno;
 
   switch (type)
     {
index 5de195461cc1f424ddec2d0c42eba71a9ca918fe..a7115d6f4262c0f687ac2ffbfae13c980029edd3 100644 (file)
@@ -47,7 +47,7 @@ extern char *filename;
 
 FILE *yyin;
 
-int yylineno;
+int mylineno;
 char *currFname;
 char *yytext;
 
@@ -292,8 +292,8 @@ handle_line (void)
   if (line[0] == '\0')
     error ("Error in number in #line");
   /* This is weird but cpp seems to add an extra three to the line no */
-  yylineno = atoi (line) - 3;
-  lineno = yylineno;
+  mylineno = atoi (line) - 3;
+  lineno = mylineno;
   /* Fetch the filename if there is one */
   while (c == '\t' || c == ' ')
     c = GETC ();
@@ -325,8 +325,8 @@ static INLINE int
 check_newline (void)
 {
   int c;
-  yylineno++;
-  lineno = yylineno;
+  mylineno++;
+  lineno = mylineno;
 
   /* Skip any leading white space */
   c = GETC ();