2010-08-07  Diego Novillo  <dnovillo@google.com>

	* lto/lto.c (gimple_parse_expect_token,
	gimple_parse_expect_subcode, gimple_parse_expect_lhs,
	gimple_parse_expect_rhs1, gimple_parse_expect_rhs2,
	gimple_parse_assign_stmt, gimple parse_expect_op1,
	gimple_parse_expect_op2, gimple_parse_expect_true_label,
	gimple_parse_expect_false_label, gimple_parse_cond_stmt,
	gimple_parse_goto_stmt, gimple_parse_label_stmt,
	gimple_parse_return_stmt, gimple_parse_stmt): Make
	static.
	(gimple_parse_stmt): Fix call to strcasecmp.
	(gimple_parse_expect_subcode): Likewise.

diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 6f12c5f..f5fba73 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1995,10 +1995,11 @@ lto_eh_personality (void)
 /* Consumes a token if the EXPECTED_TOKEN_TYPE is exactly the one we 
    are looking for. The token is obtained by reading it from the reader P.  */
  
-void 
+static const cpp_token * 
 gimple_parse_expect_token (cpp_reader *p, int expected_token_type)
 {
   const cpp_token *next_token;
+
   next_token = cpp_peek_token (p, 0);
 
   /* If the token type does not match then we must report an error,
@@ -2008,17 +2009,21 @@ gimple_parse_expect_token (cpp_reader *p, int expected_token_type)
      diagnostics similar to that reported by other front ends in
      the same case.  */
 
-  if(next_token->type != expected_token_type)
-    error ("Mismatch in expected token type");
+  if (next_token->type != expected_token_type)
+    error ("expected token type %s instead of %s",
+	    cpp_type2name (expected_token_type, 0),
+	    cpp_type2name (next_token->type, 0));
   else
-    next_token = cpp_get_token (p);     
+    next_token = cpp_get_token_with_location (p, &input_location);
+
+  return next_token;
 }
 
 /* Helper for gimple_parse_assign_stmt and gimple_parse_cond_stmt.
    Peeks a token by reading from reader P and looks it up to match 
    against the tree codes.  */
 
-void
+static void
 gimple_parse_expect_subcode (cpp_reader *p)
 {
   const cpp_token *next_token;
@@ -2032,7 +2037,7 @@ gimple_parse_expect_subcode (cpp_reader *p)
   next_token = cpp_peek_token (p, 0);
   text = (const char *) cpp_token_as_text (p, next_token);
   for (i = ERROR_MARK; i < LAST_AND_UNUSED_TREE_CODE; i++)
-    if (strcasecmp (text, tree_code_name[i]) != NULL)
+    if (strcasecmp (text, tree_code_name[i]) == 0)
       break;
 
   /* If none of the tree codes match, then report an error. Otherwise
@@ -2051,7 +2056,7 @@ gimple_parse_expect_subcode (cpp_reader *p)
 /* Helper for gimple_parse_assign_stmt. The token read from reader P should 
    be the lhs of the tuple.  */
 
-void 
+static void 
 gimple_parse_expect_lhs (cpp_reader *p)
 {  
   const cpp_token *next_token;
@@ -2070,7 +2075,7 @@ gimple_parse_expect_lhs (cpp_reader *p)
 /* Helper for gimple_parse_assign_stmt. The token read from reader P should 
    be the first operand in rhs of the tuple.  */
 
-void 
+static void 
 gimple_parse_expect_rhs1 (cpp_reader *p)
 {
   const cpp_token *next_token;
@@ -2103,7 +2108,7 @@ gimple_parse_expect_rhs1 (cpp_reader *p)
 /* Helper for gimple_parse_assign_stmt. The token read from reader P should 
    be the second operand in rhs of the tuple.  */
 
-void 
+static void 
 gimple_parse_expect_rhs2 (cpp_reader *p)
 {
   const cpp_token *next_token;
@@ -2131,7 +2136,7 @@ gimple_parse_expect_rhs2 (cpp_reader *p)
 /* Parse a gimple_assign tuple that is read from the reader P. For now we 
    only recognize the tuple. Refer gimple.def for the format of this tuple.  */
 
-void 
+static void 
 gimple_parse_assign_stmt (cpp_reader *p)
 {
   gimple_parse_expect_subcode (p);
@@ -2142,7 +2147,7 @@ gimple_parse_assign_stmt (cpp_reader *p)
 
 /* Helper for gimple_parse_cond_stmt. The token read from reader P should
    be the first operand in the tuple.  */
-void
+static void
 gimple_parse_expect_op1 (cpp_reader *p)
 {
   const cpp_token *next_token;
@@ -2159,7 +2164,7 @@ gimple_parse_expect_op1 (cpp_reader *p)
 /* Helper for gimple_parse_cond_stmt. The token read from reader P should
    be the second operand in the tuple.  */
 
-void
+static void
 gimple_parse_expect_op2 (cpp_reader *p)
 {
   const cpp_token *next_token;
@@ -2184,7 +2189,7 @@ gimple_parse_expect_op2 (cpp_reader *p)
    be the true label in the tuple that means the label where the control
    jumps if the condition evaluates to true.  */
 
-void
+static void
 gimple_parse_expect_true_label (cpp_reader *p)
 {
   gimple_parse_expect_token (p, CPP_LESS);
@@ -2197,7 +2202,7 @@ gimple_parse_expect_true_label (cpp_reader *p)
    be the false label in the tuple that means the label where the control
    jumps if the condition evaluates to false.  */
 
-void
+static void
 gimple_parse_expect_false_label (cpp_reader *p)
 {
   gimple_parse_expect_token (p, CPP_LESS);
@@ -2208,7 +2213,7 @@ gimple_parse_expect_false_label (cpp_reader *p)
 /* Parse a gimple_cond tuple that is read from the reader P. For now we only 
    recognize the tuple. Refer gimple.def for the format of this tuple.  */
 
-void
+static void
 gimple_parse_cond_stmt (cpp_reader *p)
 {
   gimple_parse_expect_subcode (p);
@@ -2221,7 +2226,7 @@ gimple_parse_cond_stmt (cpp_reader *p)
 /* Parse a gimple_goto tuple that is read from the reader P. For now we only 
    recognize the tuple. Refer gimple.def for the format of this tuple.  */
 
-void
+static void
 gimple_parse_goto_stmt (cpp_reader *p)
 {
   gimple_parse_expect_token (p, CPP_LSHIFT);
@@ -2232,7 +2237,7 @@ gimple_parse_goto_stmt (cpp_reader *p)
 /* Parse a gimple_label tuple that is read from the reader P. For now we only 
    recognize the tuple. Refer gimple.def for the format of this tuple.  */
 
-void
+static void
 gimple_parse_label_stmt (cpp_reader *p)
 {
   gimple_parse_expect_token (p, CPP_LSHIFT);
@@ -2243,7 +2248,7 @@ gimple_parse_label_stmt (cpp_reader *p)
 /* Parse a gimple_return tuple that is read from the reader P. For now we only 
    recognize the tuple. Refer gimple.def for the format of this tuple.  */
 
-void
+static void
 gimple_parse_return_stmt (cpp_reader *p)
 {
   gimple_parse_expect_token (p, CPP_LESS);
@@ -2254,17 +2259,17 @@ gimple_parse_return_stmt (cpp_reader *p)
 /* The TOK read from the reader P is looked up for a match. Calls the 
    corresponding function to do the parsing for the match.  */
 
-void 
+static void 
 gimple_parse_stmt (cpp_reader *p, const cpp_token *tok)
 {
   const char *text;
   int i;
   text = (const char *) cpp_token_as_text (p, tok);
   for (i = GIMPLE_ERROR_MARK; i < LAST_AND_UNUSED_GIMPLE_CODE; i++)
-    if (strcasecmp (text, gimple_code_name[i]) != NULL)
+    if (strcasecmp (text, gimple_code_name[i]) == 0)
       break;
 
-  if(i == LAST_AND_UNUSED_GIMPLE_CODE)
+  if (i == LAST_AND_UNUSED_GIMPLE_CODE)
     error ("Invalid gimple code used"); 
   else
     {
@@ -2340,7 +2345,7 @@ lto_main (int debug_p ATTRIBUTE_UNUSED)
               tok = cpp_get_token (p);
               while (tok->type != CPP_EOF)
                 {
-                  gimple_parse_stmt (p,tok);
+                  gimple_parse_stmt (p, tok);
                   tok = cpp_get_token (p);
                 }
             }
diff --git a/gcc/lto/lto.h b/gcc/lto/lto.h
index 36ab64b..d340d05 100644
--- a/gcc/lto/lto.h
+++ b/gcc/lto/lto.h
@@ -40,21 +40,6 @@ extern const char *resolution_file_name;
 extern tree lto_eh_personality (void);
 extern void lto_main (int);
 extern void lto_read_all_file_options (void);
-extern void gimple_parse_stmt (cpp_reader *p, const cpp_token *tok);
-extern void gimple_parse_expect_subcode (cpp_reader *p);
-extern void gimple_parse_expect_lhs (cpp_reader *p);
-extern void gimple_parse_expect_rhs1 (cpp_reader *p);
-extern void gimple_parse_expect_rhs2 (cpp_reader *p);
-extern void gimple_parse_assign_stmt (cpp_reader *p);
-extern void gimple_parse_expect_op1 (cpp_reader *p);
-extern void gimple_parse_expect_op2 (cpp_reader *p);
-extern void gimple_parse_expect_true_label (cpp_reader *p);
-extern void gimple_parse_expect_false_label (cpp_reader *p);
-extern void gimple_parse_cond_stmt (cpp_reader *p);
-extern void gimple_parse_label_stmt (cpp_reader *p);
-extern void gimple_parse_goto_stmt (cpp_reader *p);
-extern void gimple_parse_return_stmt (cpp_reader *p);
-extern void gimple_parse_expect_token (cpp_reader *p, int expected_token_type);
  
 /* In lto-elf.c or lto-coff.c  */
 extern lto_file *lto_obj_file_open (const char *filename, bool writable);
diff --git a/gcc/tags b/gcc/tags
index 63b1d3d..e7a6af9 100644
--- a/gcc/tags
+++ b/gcc/tags
@@ -38424,10 +38424,19 @@ gimple_p	vecir.h	/^DEF_VEC_P(gimple_p);$/;"	v
 gimple_p	vecir.h	/^typedef gimple *gimple_p;$/;"	t
 gimple_parse_assign_stmt	lto/lto.c	/^gimple_parse_assign_stmt (cpp_reader *p)$/;"	f
 gimple_parse_cond_stmt	lto/lto.c	/^gimple_parse_cond_stmt (cpp_reader *p)$/;"	f
-gimple_parse_expect_token	lto/lto.c	/^gimple_parse_expect_token (cpp_reader *p,int expected_token_type)$/;"	f
+gimple_parse_expect_false_label	lto/lto.c	/^gimple_parse_expect_false_label (cpp_reader *p)$/;"	f
+gimple_parse_expect_lhs	lto/lto.c	/^gimple_parse_expect_lhs (cpp_reader *p)$/;"	f
+gimple_parse_expect_op1	lto/lto.c	/^gimple_parse_expect_op1 (cpp_reader *p)$/;"	f
+gimple_parse_expect_op2	lto/lto.c	/^gimple_parse_expect_op2 (cpp_reader *p)$/;"	f
+gimple_parse_expect_rhs1	lto/lto.c	/^gimple_parse_expect_rhs1 (cpp_reader *p)$/;"	f
+gimple_parse_expect_rhs2	lto/lto.c	/^gimple_parse_expect_rhs2 (cpp_reader *p)$/;"	f
+gimple_parse_expect_subcode	lto/lto.c	/^gimple_parse_expect_subcode (cpp_reader *p)$/;"	f
+gimple_parse_expect_token	lto/lto.c	/^gimple_parse_expect_token (cpp_reader *p, int expected_token_type)$/;"	f
+gimple_parse_expect_true_label	lto/lto.c	/^gimple_parse_expect_true_label (cpp_reader *p)$/;"	f
 gimple_parse_goto_stmt	lto/lto.c	/^gimple_parse_goto_stmt (cpp_reader *p)$/;"	f
-gimple_parse_label_stmt	lto/lto.c	/^void gimple_parse_label_stmt (cpp_reader *p)$/;"	f
-gimple_parse_stmt	lto/lto.c	/^gimple_parse_stmt (cpp_reader *p,const cpp_token *tok)$/;"	f
+gimple_parse_label_stmt	lto/lto.c	/^gimple_parse_label_stmt (cpp_reader *p)$/;"	f
+gimple_parse_return_stmt	lto/lto.c	/^gimple_parse_return_stmt (cpp_reader *p)$/;"	f
+gimple_parse_stmt	lto/lto.c	/^gimple_parse_stmt (cpp_reader *p, const cpp_token *tok)$/;"	f
 gimple_phi_arg	gimple.h	/^gimple_phi_arg (gimple gs, unsigned index)$/;"	f
 gimple_phi_arg_def	tree-flow-inline.h	/^gimple_phi_arg_def (gimple gs, size_t index)$/;"	f
 gimple_phi_arg_def_ptr	tree-flow-inline.h	/^gimple_phi_arg_def_ptr (gimple gs, size_t index)$/;"	f
