]> oss.titaniummirror.com Git - msp430-binutils.git/blobdiff - ld/ldlex.l
Merge commit 'upstream/2.20'
[msp430-binutils.git] / ld / ldlex.l
index c7b1cf91cc0dd6e8c7f3829ceaa227849ef6f3e6..ef09eb0412af2ebbe0b9edeac07fcd780c53d0cd 100644 (file)
@@ -1,7 +1,7 @@
 %{
 
 /* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2007
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
@@ -57,7 +57,7 @@ const char *lex_string = NULL;
    Otherwise, stack elements 0 through `include_stack_ptr - 1' are valid.  */
 
 #undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) yy_input (buf, &result, max_size)
+#define YY_INPUT(buf,result,max_size) result = yy_input (buf, max_size)
 
 #define YY_NO_UNPUT
 
@@ -68,7 +68,7 @@ static unsigned int lineno_stack[MAX_INCLUDE_DEPTH];
 static unsigned int include_stack_ptr = 0;
 static int vers_node_nesting = 0;
 
-static void yy_input (char *, int *, int);
+static int yy_input (char *, int);
 static void comment (void);
 static void lex_warn_invalid (char *where, char *what);
 
@@ -239,6 +239,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
 <BOTH,SCRIPT,EXPRESSION,MRI>":"                { RTOKEN(':'); }
 <BOTH,SCRIPT,EXPRESSION,MRI>";"                { RTOKEN(';');}
 <BOTH,SCRIPT>"MEMORY"                  { RTOKEN(MEMORY);}
+<BOTH,SCRIPT>"REGION_ALIAS"            { RTOKEN(REGION_ALIAS);}
 <BOTH,SCRIPT,EXPRESSION>"ORIGIN"       { RTOKEN(ORIGIN);}
 <BOTH,SCRIPT>"VERSION"                 { RTOKEN(VERSIONK);}
 <EXPRESSION,BOTH,SCRIPT>"BLOCK"                { RTOKEN(BLOCK);}
@@ -274,6 +275,9 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
 <BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);}
 <BOTH,SCRIPT>"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);}
 <BOTH,SCRIPT>"SECTIONS"                        { RTOKEN(SECTIONS);}
+<BOTH,SCRIPT>"INSERT"                  { RTOKEN(INSERT_K);}
+<BOTH,SCRIPT>"AFTER"                   { RTOKEN(AFTER);}
+<BOTH,SCRIPT>"BEFORE"                  { RTOKEN(BEFORE);}
 <BOTH,SCRIPT>"FILL"                    { RTOKEN(FILL);}
 <BOTH,SCRIPT>"STARTUP"                 { RTOKEN(STARTUP);}
 <BOTH,SCRIPT>"OUTPUT_FORMAT"           { RTOKEN(OUTPUT_FORMAT);}
@@ -304,7 +308,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
 <BOTH,SCRIPT>"org"                     { RTOKEN(ORIGIN);}
 <BOTH,SCRIPT>"l"                       { RTOKEN( LENGTH);}
 <BOTH,SCRIPT>"len"                     { RTOKEN( LENGTH);}
-<BOTH,SCRIPT>"INCLUDE"                 { RTOKEN(INCLUDE);}
+<EXPRESSION,BOTH,SCRIPT>"INCLUDE"      { RTOKEN(INCLUDE);}
 <BOTH,SCRIPT>"PHDRS"                   { RTOKEN (PHDRS); }
 <EXPRESSION,BOTH,SCRIPT>"AT"           { RTOKEN(AT);}
 <EXPRESSION,BOTH,SCRIPT>"SUBALIGN"     { RTOKEN(SUBALIGN);}
@@ -604,22 +608,23 @@ ldlex_popstate (void)
 }
 \f
 
-/* Place up to MAX_SIZE characters in BUF and return in *RESULT
+/* Place up to MAX_SIZE characters in BUF and return
    either the number of characters read, or 0 to indicate EOF.  */
 
-static void
-yy_input (char *buf, int *result, int max_size)
+static int
+yy_input (char *buf, int max_size)
 {
-  *result = 0;
+  int result = 0;
   if (YY_CURRENT_BUFFER->yy_input_file)
     {
       if (yyin)
        {
-         *result = fread (buf, 1, max_size, yyin);
-         if (*result < max_size && ferror (yyin))
+         result = fread (buf, 1, max_size, yyin);
+         if (result < max_size && ferror (yyin))
            einfo ("%F%P: read in flex scanner failed\n");
        }
     }
+  return result;
 }
 
 /* Eat the rest of a C-style comment.  */