2010-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
[binutils-gdb.git] / ld / ldlex.l
index 25b4c73a3605a28f622969bb1e69a9600374064f..e52d83b222387f7f97913c0433a06f7aeed3da2c 100644 (file)
@@ -1,3 +1,5 @@
+%option nounput
+
 %{
 
 /* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
@@ -22,7 +24,6 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-#include "sysdep.h"
 #include "bfd.h"
 #include "safe-ctype.h"
 #include "bfdlink.h"
@@ -57,7 +58,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 +69,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);
 
@@ -608,22 +609,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.  */