OSDN Git Service

* config/alpha/vms.h (INCLUDE_DEFAULTS): Add /gnu/lib/gcc-lib/include.
[pf3gnuchains/gcc-fork.git] / gcc / ch / parse.c
index 96026a1..f8e0e54 100644 (file)
@@ -1,5 +1,6 @@
 /* Parser for GNU CHILL (CCITT High-Level Language)  -*- C -*-
-   Copyright (C) 1992, 1993, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -53,7 +54,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Since parsers are distinct for each language, put the 
    language string definition here.  (fnf) */
-char *language_string = "GNU CHILL";
+const char * const language_string = "GNU CHILL";
 
 /* Common code to be done before expanding any action. */
 #define INIT_ACTION { \
@@ -70,19 +71,30 @@ char *language_string = "GNU CHILL";
 /* Cause the `yydebug' variable to be defined.  */
 #define YYDEBUG 1
 
-extern struct rtx_def* gen_label_rtx         PROTO((void));
-extern void emit_jump                         PROTO((struct rtx_def *));
-extern struct rtx_def* emit_label             PROTO((struct rtx_def *));
+extern struct rtx_def* gen_label_rtx         PARAMS ((void));
+extern void emit_jump                         PARAMS ((struct rtx_def *));
+extern struct rtx_def* emit_label             PARAMS ((struct rtx_def *));
 
 /* This is a hell of a lot easier than getting expr.h included in
    by parse.c.  */
-extern struct rtx_def *expand_expr     PROTO((tree, struct rtx_def *,
+extern struct rtx_def *expand_expr     PARAMS ((tree, struct rtx_def *,
                                               enum machine_mode, int));
 
-static int parse_action                                PROTO((void));
+static int parse_action                                PARAMS ((void));
+static void ch_parse_init                      PARAMS ((void));
+static void check_end_label                    PARAMS ((tree, tree));
+static void end_function                               PARAMS ((void));
+static tree build_prefix_clause                        PARAMS ((tree));
+static enum terminal PEEK_TOKEN                        PARAMS ((void));
+static int peek_token_                         PARAMS ((int));
+static void pushback_token                     PARAMS ((int, tree));
+static void forward_token_                     PARAMS ((void));
+static void require                            PARAMS ((enum terminal));
+static int check_token                         PARAMS ((enum terminal));
+static int expect                              PARAMS ((enum terminal, const char *));
+static void define__PROCNAME__                 PARAMS ((void));
 
 extern int  lineno;
-extern char *input_filename;
 extern tree generic_signal_type_node;
 extern tree signal_code;
 extern int all_static_flag;
@@ -211,7 +223,7 @@ end_function ()
          if (result_never_set
              && TREE_CODE (TREE_TYPE (TREE_TYPE (current_function_decl)))
              != VOID_TYPE)
-           warning ("No RETURN or RESULT in procedure");
+           warning ("no RETURN or RESULT in procedure");
          chill_expand_return (NULL_TREE, 1);
        }
     }
@@ -226,7 +238,7 @@ build_prefix_clause (id)
   if (!id)
     {
       if (current_module && current_module->name)
-       { char *module_name = IDENTIFIER_POINTER (current_module->name);
+       { const char *module_name = IDENTIFIER_POINTER (current_module->name);
          if (module_name[0] && module_name[0] != '_')
            return current_module->name;
        }
@@ -266,14 +278,15 @@ PEEK_TOKEN()
   return terminal_buffer[0];
 }
 #define PEEK_TREE() val_buffer[0].ttype
-#define PEEK_TOKEN1() peek_token_(1)
-#define PEEK_TOKEN2() peek_token_(2)
+#define PEEK_TOKEN1() peek_token_ (1)
+#define PEEK_TOKEN2() peek_token_ (2)
+
 static int
 peek_token_ (i)
      int i;
 {
   if (i > MAX_LOOK_AHEAD)
-    fatal ("internal error - too much lookahead");
+    abort ();
   if (terminal_buffer[i] == TOKEN_NOT_READ)
     {
       terminal_buffer[i] = yylex();
@@ -289,7 +302,7 @@ pushback_token (code, node)
 {
   int i;
   if (terminal_buffer[MAX_LOOK_AHEAD] != TOKEN_NOT_READ)
-    fatal ("internal error - cannot pushback token");
+    abort ();
   for (i = MAX_LOOK_AHEAD; i > 0; i--)
     { 
       terminal_buffer[i] = terminal_buffer[i - 1]; 
@@ -310,25 +323,21 @@ forward_token_()
     }
   terminal_buffer[MAX_LOOK_AHEAD] = TOKEN_NOT_READ;
 }
-#define FORWARD_TOKEN() forward_token_()
+#define FORWARD_TOKEN() forward_token_ ()
 
 /* Skip the next token.
    if it isn't TOKEN, the parser is broken. */
 
-void
-require(token)
+static void
+require (token)
      enum terminal token;
 {
   if (PEEK_TOKEN() != token)
-    {
-      char buf[80];
-      sprintf (buf, "internal parser error - expected token %d", (int)token);
-      fatal(buf);
-    }
+    internal_error ("internal parser error - expected token %d", (int) token);
   FORWARD_TOKEN();
 }
 
-int
+static int
 check_token (token)
      enum terminal token;
 {
@@ -341,15 +350,15 @@ check_token (token)
 /* return 0 if expected token was not found,
    else return 1.
 */
-int
+static int
 expect(token, message)
      enum terminal token;
-     char *message;
+     const char *message;
 {
   if (PEEK_TOKEN() != token)
     {
       if (pass == 1)
-       error(message ? message : "syntax error");
+       error("%s", message ? message : "syntax error");
       return 0;
     }
   else
@@ -363,7 +372,7 @@ expect(token, message)
 static void
 define__PROCNAME__ ()
 {
-  char *fname;
+  const char *fname;
   tree string;
   tree procname;
 
@@ -378,17 +387,115 @@ define__PROCNAME__ ()
 }
 
 /* Forward declarations. */
-static tree parse_expression ();
-static tree parse_primval ();
-static tree parse_mode PROTO((void));
-static tree parse_opt_mode PROTO((void));
-static tree parse_untyped_expr ();
-static tree parse_opt_untyped_expr ();
-static int parse_definition PROTO((int));
-static void parse_opt_actions ();
-static void parse_body PROTO((void));
-static tree parse_if_expression_body PROTO((void));
-static tree parse_opt_handler PROTO((void));
+static tree parse_expression PARAMS ((void));
+static tree parse_primval PARAMS ((void));
+static tree parse_mode PARAMS ((void));
+static tree parse_opt_mode PARAMS ((void));
+static tree parse_untyped_expr PARAMS ((void));
+static tree parse_opt_untyped_expr PARAMS ((void));
+static int parse_definition PARAMS ((int));
+static void parse_opt_actions PARAMS ((void));
+static void parse_body PARAMS ((void));
+static tree parse_if_expression_body PARAMS ((void));
+static tree parse_opt_handler PARAMS ((void));
+static tree parse_opt_name_string PARAMS ((int));
+static tree parse_simple_name_string PARAMS ((void));
+static tree parse_name_string PARAMS ((void));
+static tree parse_defining_occurrence PARAMS ((void));
+static tree parse_name PARAMS ((void));
+static tree parse_optlabel PARAMS ((void));
+static void parse_opt_end_label_semi_colon PARAMS ((tree));
+static void parse_modulion PARAMS ((tree));
+static void parse_spec_module PARAMS ((tree));
+static void parse_semi_colon PARAMS ((void));
+static tree parse_defining_occurrence_list PARAMS ((void));
+static void parse_mode_definition PARAMS ((int));
+static void parse_mode_definition_statement PARAMS ((int));
+static void parse_synonym_definition PARAMS ((void));
+static void parse_synonym_definition_statement PARAMS ((void));
+static tree parse_on_exception_list PARAMS ((void));
+static void parse_on_alternatives PARAMS ((void));
+static void parse_loc_declaration PARAMS ((int));
+static void parse_declaration_statement PARAMS ((int));
+static tree parse_optforbid PARAMS ((void));
+static tree parse_postfix PARAMS ((enum terminal));
+static tree parse_postfix_list PARAMS ((enum terminal));
+static void parse_rename_clauses PARAMS ((enum terminal));
+static tree parse_opt_prefix_clause PARAMS ((void));
+static void parse_grant_statement PARAMS ((void));
+static void parse_seize_statement PARAMS ((void));
+static tree parse_param_name_list PARAMS ((void));
+static tree parse_param_attr PARAMS ((void));
+static tree parse_formpar PARAMS ((void));
+static tree parse_formparlist PARAMS ((void));
+static tree parse_opt_result_spec PARAMS ((void));
+static tree parse_opt_except PARAMS ((void));
+static tree parse_opt_recursive PARAMS ((void));
+static tree parse_procedureattr PARAMS ((void));
+static void parse_proc_body PARAMS ((tree, tree));
+static void parse_procedure_definition PARAMS ((int));
+static tree parse_processpar PARAMS ((void));
+static tree parse_processparlist PARAMS ((void));
+static void parse_process_definition PARAMS ((int));
+static void parse_signal_definition PARAMS ((void));
+static void parse_signal_definition_statement PARAMS ((void));
+static void parse_then_clause PARAMS ((void));
+static void parse_opt_else_clause PARAMS ((void));
+static tree parse_expr_list PARAMS ((void));
+static tree parse_range_list_clause PARAMS ((void));
+static void pushback_paren_expr PARAMS ((tree));
+static tree parse_case_label PARAMS ((void));
+static tree parse_case_label_list PARAMS ((tree, int));
+static tree parse_case_label_specification PARAMS ((tree));
+static void parse_single_dimension_case_action PARAMS ((tree));
+static void parse_multi_dimension_case_action PARAMS ((tree));
+static void parse_case_action PARAMS ((tree));
+static tree parse_asm_operands PARAMS ((void));
+static tree parse_asm_clobbers PARAMS ((void));
+static void ch_expand_asm_operands PARAMS ((tree, tree, tree, tree,
+                                           int, const char *, int));
+static void parse_asm_action PARAMS ((void));
+static void parse_begin_end_block PARAMS ((tree));
+static void parse_if_action PARAMS ((tree));
+static void parse_iteration PARAMS ((void));
+static tree parse_delay_case_event_list PARAMS ((void));
+static void parse_delay_case_action PARAMS ((tree));
+static void parse_do_action PARAMS ((tree));
+static tree parse_receive_spec PARAMS ((void));
+static void parse_receive_case_action PARAMS ((tree));
+static void parse_send_action PARAMS ((void));
+static void parse_start_action PARAMS ((void));
+static tree parse_call PARAMS ((tree));
+static tree parse_tuple_fieldname_list PARAMS ((void));
+static tree parse_tuple_element PARAMS ((void));
+static tree parse_opt_element_list PARAMS ((void));
+static tree parse_tuple PARAMS ((tree));
+static tree parse_operand6 PARAMS ((void));
+static tree parse_operand5 PARAMS ((void));
+static tree parse_operand4 PARAMS ((void));
+static tree parse_operand3 PARAMS ((void));
+static tree parse_operand2 PARAMS ((void));
+static tree parse_operand1 PARAMS ((void));
+static tree parse_operand0 PARAMS ((void));
+static tree parse_case_expression PARAMS ((void));
+static tree parse_then_alternative PARAMS ((void));
+static tree parse_else_alternative PARAMS ((void));
+static tree parse_if_expression PARAMS ((void));
+static tree parse_index_mode PARAMS ((void));
+static tree parse_set_mode PARAMS ((void));
+static tree parse_pos PARAMS ((void));
+static tree parse_step PARAMS ((void));
+static tree parse_opt_layout PARAMS ((int));
+static tree parse_field_name_list PARAMS ((void));
+static tree parse_fixed_field PARAMS ((void));
+static tree parse_variant_field_list PARAMS ((void));
+static tree parse_variant_alternative PARAMS ((void));
+static tree parse_field PARAMS ((void));
+static tree parse_structure_mode PARAMS ((void));
+static tree parse_opt_queue_size PARAMS ((void));
+static tree parse_procedure_mode PARAMS ((void));
+static void parse_program PARAMS ((void));
+static void parse_pass_1_2 PARAMS ((void));
 
 static tree
 parse_opt_name_string (allow_all)
@@ -622,7 +729,7 @@ parse_mode_definition (is_newmode)
   ignoring = save_ignoring;
 }
 
-void
+static void
 parse_mode_definition_statement (is_newmode)
      int is_newmode;
 {
@@ -854,7 +961,7 @@ parse_loc_declaration (in_spec_module)
       ignoring = save_ignoring;
     }
   if (init_value == NULL_TREE && loc_decl && pass == 1)
-    error ("loc-identity declaration without initialisation");
+    error ("loc-identity declaration without initialization");
   do_decls (names, mode,
            is_static || global_bindings_p ()
            /* the variable becomes STATIC if all_static_flag is set and
@@ -883,7 +990,7 @@ parse_declaration_statement (in_spec_module)
   parse_semi_colon ();
 }
 
-tree
+static tree
 parse_optforbid ()
 {
   if (check_token (FORBID) == 0)
@@ -905,7 +1012,7 @@ parse_optforbid ()
 /* Matches: <grant postfix> or <seize postfix>
    Returns: A (singleton) TREE_LIST. */
 
-tree
+static tree
 parse_postfix (grant_or_seize)
      enum terminal grant_or_seize;
 {
@@ -921,7 +1028,7 @@ parse_postfix (grant_or_seize)
   return build_tree_list (forbid, name);
 }
 
-tree
+static tree
 parse_postfix_list (grant_or_seize)
      enum terminal grant_or_seize;
 {
@@ -931,7 +1038,7 @@ parse_postfix_list (grant_or_seize)
   return list;
 }
 
-void
+static void
 parse_rename_clauses (grant_or_seize)
      enum terminal grant_or_seize;
 {
@@ -972,7 +1079,7 @@ parse_opt_prefix_clause ()
   return build_prefix_clause (parse_opt_name_string (0));
 }
 
-void
+static void
 parse_grant_statement ()
 {
   require (GRANT);
@@ -988,7 +1095,7 @@ parse_grant_statement ()
     }
 }
 
-void
+static void
 parse_seize_statement ()
 {
   require (SEIZE);
@@ -1282,7 +1389,7 @@ parse_process_definition (in_spec_module)
     ignoring = 0;
   require (COLON); require (PROCESS);
   expect (LPRN, "missing '(' after PROCESS");
-  params = parse_processparlist (in_spec_module);
+  params = parse_processparlist ();
   expect (RPRN, "missing ')' in PROCESS");
   ignoring = save_ignoring;
   if (in_spec_module)
@@ -1479,7 +1586,7 @@ parse_range_list_clause ()
     return NULL_TREE;
   while (check_token (COMMA))
     {
-      name = parse_name_string (0);
+      name = parse_name_string ();
     }
   if (check_token (SC))
     {
@@ -1680,7 +1787,7 @@ parse_multi_dimension_case_action (selector)
   tree action_labels = NULL_TREE;
   tree tests = NULL_TREE;
   int  save_lineno = lineno;
-  char *save_filename = input_filename;
+  const char *save_filename = input_filename;
 
   /* We can't compute the range of an (ELSE) label until all of the CASE
      label specifications have been seen, however, the code for the actions
@@ -1899,11 +2006,11 @@ parse_asm_clobbers ()
   return list;
 }
 
-void
+static void
 ch_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
      tree string, outputs, inputs, clobbers;
      int vol;
-     char *filename;
+     const char *filename;
      int line;
 {
   int noutputs = list_length (outputs);
@@ -2278,7 +2385,7 @@ parse_do_action (label)
     {
       push_handler ();
       parse_opt_actions ();
-      expect (OD, "Missing 'OD' after 'DO'");
+      expect (OD, "missing 'OD' after 'DO'");
       parse_opt_handler ();
       parse_opt_end_label_semi_colon (label);
       return;
@@ -2317,7 +2424,7 @@ parse_do_action (label)
   parse_opt_actions ();
   if (! ignoring)
     build_loop_end (); 
-  expect (OD, "Missing 'OD' after 'DO'");
+  expect (OD, "missing 'OD' after 'DO'");
   /* Note that the handler is inside the reach of the DO. */
   parse_opt_handler ();
   end_loop_scope (label);
@@ -2835,7 +2942,7 @@ parse_action ()
 
  no_handler_action:
   if (parse_opt_handler () != NULL_TREE && pass == 1)
-    error ("no handler is permitted on this action.");
+    error ("no handler is permitted on this action");
   parse_semi_colon ();
   return 1;
 
@@ -4166,7 +4273,7 @@ parse_program()
   finish_outer_function ();
 }
 
-void
+static void
 parse_pass_1_2()
 {
   parse_program();
@@ -4219,7 +4326,7 @@ set_yydebug (value)
 #if YYDEBUG != 0
   yydebug = value;
 #else
-  warning ("YYDEBUG not defined.");
+  warning ("YYDEBUG not defined");
 #endif
 }
 #endif