egcs, warning patch for ch/ dir, part 3/3

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Fri Sep 18 14:28:00 GMT 1998


	This is part 3/3.  Okay to install?

Fri Sep 18 14:59:26 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* parse.c: Include system.h and toplev.h.  Remove redundant
	prototypes.
	(quasi_signal): Hide.
	(PEEK_TOKEN): Change return type to `enum terminal'.
	(parse_mode_definition_statement): Remove unused variable `names'.
	(parse_formpar): Remove unused parameter `in_spec_module'.  All
	callers changed.
	(parse_formparlist): Likewise.
	(parse_processpar): Remove unused variable `parms'.
	(parse_definition): Add explicit braces to avoid ambiguous `else'.
	(parse_multi_dimension_case_action): Initialize variable
	`begin_test_label'.  Remove unused variable `new_test'.
	(parse_case_action): Remove unused variable `caseaction_flag'.
	(parse_asm_clobbers): Remove unused variable `expr'.
	(parse_delay_case_action): Initialize variable `label_cnt'.
	(parse_action): Make function static.
	(parse_tuple_element): Remove unused variable `list'.
	(parse_primval): Add default case in switch.
	(parse_variant_alternative): Remove unused variables `x' and
	`variant_fields'.

	* satisfy.c: Include system.h and toplev.h.  Remove redundant
	prototypes.

	* tasking.c Include system.h and toplev.h.  Remove redundant
	prototypes.
	(data_name): Hide.
	(get_struct_variable_name): Likewise.
	(validate_process_parameters): Mark parameter `parms' with
	ATTRIBUTE_UNUSED.
	(build_start_process): Initialize variable `tuple'.
	(build_receive_buffer_case_end): Remove unused variable `buffer_ptr'.

	* timing.c: Include system.h and toplev.h.
	(build_after_timeout_start): Remove unused variable `goto_where'.

	* tree.c: Include system.h and toplev.h.  Remove redundant
	prototypes.

	* typeck.c: Include system.h and toplev.h.  Remove redundant
	prototypes.
	(extract_constant_from_buffer): Make function static.  Add
 	explicit braces to avoid ambiguous `else'.
	(expand_constant_to_buffer): Likewise.
	(build_chill_slice): remove unused variable `is_static'.
	(chill_compatible): Add explicit braces to avoid ambiguous `else'. 
	(apply_chill_array_layout): Remove unused variable `offset'.
	(smash_dummy_type): Remove unused variable `save_lang_specific'.
	(initializer_constant_valid_p): Add default case in switch.


diff -rup orig/egcs-CVS19980918/gcc/ch/parse.c egcs-CVS19980918/gcc/ch/parse.c
--- orig/egcs-CVS19980918/gcc/ch/parse.c	Fri Sep 18 16:40:43 1998
+++ egcs-CVS19980918/gcc/ch/parse.c	Fri Sep 18 17:07:50 1998
@@ -40,14 +40,15 @@ the Free Software Foundation, 675 Mass A
  * Then code is generated.
  */
 
-#include <stdio.h>
 #include "config.h"
+#include "system.h"
 #include "tree.h"
 #include "ch-tree.h"
 #include "lex.h"
 #include "actions.h"
 #include "tasking.h"
 #include "parse.h"
+#include "toplev.h"
 
 /* Since parsers are distinct for each language, put the 
    language string definition here.  (fnf) */
@@ -68,26 +69,11 @@ char *language_string = "GNU CHILL";
 /* Cause the `yydebug' variable to be defined.  */
 #define YYDEBUG 1
 
-extern void assemble_external                 PROTO((tree));
-extern void chill_check_no_handlers           PROTO((void));
-extern void chill_finish_on                   PROTO((void));
-extern void chill_handle_case_default         PROTO((void));
-extern void chill_handle_on_labels            PROTO((tree));
-extern tree chill_initializer_constant_valid_p PROTO((tree, tree));
-extern void chill_start_default_handler       PROTO((void));
-extern void chill_start_on                    PROTO((void));
-extern struct rtx_def* emit_line_note         PROTO((char *, int));
 extern struct rtx_def* gen_label_rtx	      PROTO((void));
 extern void emit_jump                         PROTO((struct rtx_def *));
 extern void emit_label                        PROTO((struct rtx_def *));
-extern void error                             PROTO((char *, ...));
-extern int  expand_exit_labelled              PROTO((tree));
-extern void lookup_and_expand_goto            PROTO((tree));
-extern void lookup_and_handle_exit            PROTO((tree));
-
-extern void push_granted                      PROTO((tree, tree));
-extern void sorry                             PROTO((char *, ...));
-extern void warning                           PROTO((char *, ...));
+
+static int parse_action				PROTO((void));
 
 extern int  lineno;
 extern char *input_filename;
@@ -96,7 +82,9 @@ extern tree signal_code;
 extern int all_static_flag;
 extern int ignore_case;
      
+#if 0
 static int  quasi_signal = 0;  /* 1 if processing a quasi signal decl */
+#endif
 
 int parsing_newmode;                       /* 0 while parsing SYNMODE; 
 					      1 while parsing NEWMODE. */
@@ -261,7 +249,7 @@ static YYSTYPE val_buffer[MAX_LOOK_AHEAD
 #ifdef __GNUC__
 __inline__
 #endif
-static int
+static enum terminal
 PEEK_TOKEN()
 {
   if (terminal_buffer[0] == TOKEN_NOT_READ)
@@ -533,8 +521,6 @@ parse_opt_end_label_semi_colon (start_la
   parse_semi_colon ();
 }
 
-extern tree set_module_name ();
-
 static void
 parse_modulion (label)
      tree label;
@@ -633,7 +619,6 @@ void
 parse_mode_definition_statement (is_newmode)
      int is_newmode;
 {
-  tree names;
   FORWARD_TOKEN (); /* skip SYNMODE or NEWMODE */
   parse_mode_definition (is_newmode);
   while (PEEK_TOKEN () == COMMA)
@@ -1077,8 +1062,7 @@ parse_param_attr ()
 /* In pass 1, returns list of types; in pass 2: chain of PARM_DECLs. */
    
 static tree
-parse_formpar (in_spec_module)
-     int in_spec_module;
+parse_formpar ()
 {
   tree names = parse_param_name_list ();
   tree mode = parse_mode ();
@@ -1093,15 +1077,14 @@ parse_formpar (in_spec_module)
  * also need change.  Push_extern_process is affected as well.
  */
 static tree
-parse_formparlist (in_spec_module)
-     int in_spec_module;
+parse_formparlist ()
 {
   tree list = NULL_TREE;
   if (PEEK_TOKEN() == RPRN)
     return NULL_TREE;
   for (;;)
     {
-      list = chainon (list, parse_formpar (in_spec_module));
+      list = chainon (list, parse_formpar ());
       if (! check_token (COMMA))
 	break;
     }
@@ -1233,7 +1216,7 @@ parse_procedure_definition (in_spec_modu
     ignoring = pass == 2;
   require (COLON); require (PROC);
   expect (LPRN, "missing '(' after PROC");
-  params = parse_formparlist (in_spec_module);
+  params = parse_formparlist ();
   expect (RPRN, "missing ')' in PROC");
   result = parse_opt_result_spec ();
   exceptlist = parse_opt_except ();
@@ -1259,7 +1242,7 @@ parse_processpar ()
   tree names = parse_defining_occurrence_list ();
   tree mode = parse_mode ();
   tree paramattr = parse_param_attr ();
-  tree parms = NULL_TREE;
+
   if (names && TREE_CODE (names) == IDENTIFIER_NODE)
     names = build_tree_list (NULL_TREE, names);
   return tree_cons (tree_cons (paramattr, mode, NULL_TREE), names, NULL_TREE);
@@ -1395,16 +1378,18 @@ parse_definition (in_spec_module)
     {
     case NAME:
       if (PEEK_TOKEN1() == COLON)
-	if (PEEK_TOKEN2() == PROC)
-	  {
-	    parse_procedure_definition (in_spec_module);
-	    return 1;
-	  }
-	else if (PEEK_TOKEN2() == PROCESS)
-	  {
-	    parse_process_definition (in_spec_module);
-	    return 1;
-	  }
+	{
+	  if (PEEK_TOKEN2() == PROC)
+	    {
+	      parse_procedure_definition (in_spec_module);
+	      return 1;
+	    }
+	  else if (PEEK_TOKEN2() == PROCESS)
+	    {
+	      parse_process_definition (in_spec_module);
+	      return 1;
+	    }
+	}
       return 0;
     case DCL:
       parse_declaration_statement(in_spec_module);
@@ -1684,10 +1669,9 @@ static void
 parse_multi_dimension_case_action (selector)
      tree selector;
 {
-  struct rtx_def *begin_test_label, *end_case_label, *new_label;
+  struct rtx_def *begin_test_label = 0, *end_case_label, *new_label;
   tree action_labels = NULL_TREE;
   tree tests = NULL_TREE;
-  tree new_test;
   int  save_lineno = lineno;
   char *save_filename = input_filename;
 
@@ -1816,10 +1800,6 @@ parse_case_action (label)
   tree selector;
   int  multi_dimension_case = 0;
 
-/* The case label/action toggle.  It is 0 initially, and when an action
-   was last seen.  It is 1 integer_zero_node when a label was last seen. */
-  int caseaction_flag = 0;
-
   require (CASE);
   selector = parse_expr_list ();
   selector = nreverse (selector);
@@ -1897,7 +1877,7 @@ parse_asm_clobbers ()
   tree list = NULL_TREE;
   for (;;)
     {
-      tree string, expr;
+      tree string;
       if (PEEK_TOKEN () != STRING)
 	{
 	  error ("bad ASM operand");
@@ -2176,7 +2156,7 @@ static void
 parse_delay_case_action (label)
      tree label;
 {
-  tree label_cnt, set_location, priority;
+  tree label_cnt = NULL_TREE, set_location, priority;
   tree combined_event_list = NULL_TREE;
   require (DELAY);
   require (CASE);
@@ -2577,7 +2557,7 @@ parse_opt_actions ()
   while (parse_action ()) ;
 }
 
-int
+static int
 parse_action ()
 {
   tree label = NULL_TREE;
@@ -2962,7 +2942,7 @@ parse_tuple_element ()
 {
   /* The tupleelement chain is built in reverse order,
      and put in forward order when the list is used.  */
-  tree value, list, label;
+  tree value, label;
   if (PEEK_TOKEN () == DOT)
     {
       /* Parse a labelled structure tuple. */
@@ -3152,6 +3132,8 @@ parse_primval ()
 	  args = parse_primval ();
 	  val = ignoring ? val : build_generalized_call (val, args);
 	  continue;
+	default:
+	  break;
 	}
       break;
     }
@@ -3755,8 +3737,8 @@ parse_variant_field_list ()
 static tree
 parse_variant_alternative ()
 {
-  tree labels, x;
-  tree variant_fields = NULL_TREE;
+  tree labels;
+
   if (PEEK_TOKEN () == LPRN)
     labels = parse_case_label_specification (NULL_TREE);
   else
diff -rup orig/egcs-CVS19980918/gcc/ch/satisfy.c egcs-CVS19980918/gcc/ch/satisfy.c
--- orig/egcs-CVS19980918/gcc/ch/satisfy.c	Fri Sep 18 16:40:43 1998
+++ egcs-CVS19980918/gcc/ch/satisfy.c	Fri Sep 18 17:07:50 1998
@@ -17,19 +17,15 @@ You should have received a copy of the G
 along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <stdio.h>
 #include "config.h"
+#include "system.h"
 #include "tree.h"
 #include "flags.h"
 #include "ch-tree.h"
 #include "lex.h"
+#include "toplev.h"
 
 #define SATISFY(ARG) ((ARG) = satisfy(ARG, chain))
-
-extern void error           PROTO((char *, ...));
-extern void error_with_decl PROTO((tree, char *, ...));
-extern void expand_decl     PROTO((tree));
-extern void layout_enum     PROTO((tree));
 
 struct decl_chain
 {
diff -rup orig/egcs-CVS19980918/gcc/ch/tasking.c egcs-CVS19980918/gcc/ch/tasking.c
--- orig/egcs-CVS19980918/gcc/ch/tasking.c	Fri Sep 18 16:40:43 1998
+++ egcs-CVS19980918/gcc/ch/tasking.c	Fri Sep 18 17:07:50 1998
@@ -17,10 +17,8 @@ You should have received a copy of the G
 along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
 #include "config.h"
+#include "system.h"
 #include "tree.h"
 #include "rtl.h"
 #include "ch-tree.h"
@@ -30,13 +28,7 @@ the Free Software Foundation, 675 Mass A
 #include "assert.h"
 #include "tasking.h"
 #include "lex.h"
-
-/* external functions */
-extern void emit_jump       PROTO((rtx));
-extern void error           PROTO((char *, ...));
-extern void error_with_decl PVPROTO ((tree, char *, ...));
-extern void push_obstacks   PROTO((struct obstack *, struct obstack *));
-extern void warning         PROTO((char *, ...));
+#include "toplev.h"
 
 /* from ch-lex.l, from compiler directives */
 extern tree process_type;
@@ -70,8 +62,10 @@ static char * struct_name = "__tmp_%s_ar
 /* name template for process arguments for debugging type */
 static char * struct_debug_name = "__tmp_%s_debug_type";
 
+#if 0
 /* name template for process argument variable */
 static char * data_name = "__tmp_%s_arg_variable";
+#endif
 
 /* name template for process wrapper */
 static char * wrapper_name = "__tmp_%s_wrapper";
@@ -117,7 +111,7 @@ get_tasking_code_name (name)
   return get_identifier (tmpname);
 }
 
-
+#if 0
 static tree
 get_struct_variable_name (name)
      tree name;
@@ -128,6 +122,7 @@ get_struct_variable_name (name)
   sprintf (tmpname, data_name, idp);
   return get_identifier (tmpname);
 }
+#endif
 
 static tree
 get_process_wrapper_name (name)
@@ -498,7 +493,7 @@ build_process_wrapper (plabel, processda
 
 void
 validate_process_parameters (parms)
-     tree parms;
+     tree parms ATTRIBUTE_UNUSED;
 {
 }
 
@@ -522,7 +517,7 @@ build_start_process (process_name, copyn
   tree process_decl, struct_type_node;
   tree result;
   tree valtail, typetail;
-  tree tuple, actuallist = NULL_TREE;
+  tree tuple = NULL_TREE, actuallist = NULL_TREE;
   tree typelist;
   int  parmno = 2;
   tree args;
@@ -2111,7 +2106,6 @@ build_receive_buffer_case_end (label_cnt
       tree buffer_descr;
       tree buffer_descr_init;
       tree buffer_length;
-      tree buffer_ptr;
       tree field;
       char fldname[20];
 
diff -rup orig/egcs-CVS19980918/gcc/ch/timing.c egcs-CVS19980918/gcc/ch/timing.c
--- orig/egcs-CVS19980918/gcc/ch/timing.c	Fri Sep 18 16:40:44 1998
+++ egcs-CVS19980918/gcc/ch/timing.c	Fri Sep 18 17:07:50 1998
@@ -17,10 +17,8 @@ You should have received a copy of the G
 along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
 #include "config.h"
+#include "system.h"
 #include "tree.h"
 #include "rtl.h"
 #include "ch-tree.h"
@@ -28,6 +26,7 @@ the Free Software Foundation, 675 Mass A
 #include "input.h"
 #include "obstack.h"
 #include "lex.h"
+#include "toplev.h"
 
 #ifndef LONG_TYPE_SIZE
 #define LONG_TYPE_SIZE BITS_PER_WORD
@@ -394,7 +393,7 @@ build_after_start (duration, delay_flag)
 void
 build_after_timeout_start ()
 {
-  tree label_name, goto_where;
+  tree label_name;
   
   if (! ignoring)
     {
diff -rup orig/egcs-CVS19980918/gcc/ch/tree.c egcs-CVS19980918/gcc/ch/tree.c
--- orig/egcs-CVS19980918/gcc/ch/tree.c	Fri Sep 18 16:40:44 1998
+++ egcs-CVS19980918/gcc/ch/tree.c	Fri Sep 18 17:07:50 1998
@@ -18,16 +18,15 @@ along with GNU CC; see the file COPYING.
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "config.h"
+#include "system.h"
 #include "obstack.h"
 #include "tree.h"
 #include "ch-tree.h"
+#include "toplev.h"
 
 /* Here is how primitive or already-canonicalized types' 
    hash codes are made.  */
 #define TYPE_HASH(TYPE) ((HOST_WIDE_INT) (TYPE) & 0777777)
-
-extern void error PROTO((char *, ...));
-extern int  get_type_precision PROTO((tree, tree));
 
 extern struct obstack permanent_obstack;
 /* This is special sentinel used to communicate from build_string_type
diff -rup orig/egcs-CVS19980918/gcc/ch/typeck.c egcs-CVS19980918/gcc/ch/typeck.c
--- orig/egcs-CVS19980918/gcc/ch/typeck.c	Fri Sep 18 16:40:44 1998
+++ egcs-CVS19980918/gcc/ch/typeck.c	Fri Sep 18 17:07:50 1998
@@ -28,27 +28,14 @@ the Free Software Foundation, 675 Mass A
    like a strange sort of assignment).  */
 
 #include "config.h"
-#include <stdio.h>
+#include "system.h"
 #include "tree.h"
 #include "ch-tree.h"
 #include "flags.h"
 #include "rtl.h"
 #include "expr.h"
 #include "lex.h"
-
-extern tree build_chill_compound_expr PROTO((tree));
-extern tree build_component_ref       PROTO((tree, tree));
-extern void c_expand_return           PROTO((tree));
-extern int  ch_singleton_set          PROTO((tree));
-extern void error                     PROTO((char *, ...));
-extern void error_with_decl           PROTO((tree, char *, ...));
-extern int  mark_addressable          PROTO((tree));
-extern void pedwarn                   PROTO((char *, ...));
-extern void pedwarn_with_decl         PROTO((tree, char *, ...));
-extern tree require_complete_type     PROTO((tree));
-extern void sorry                     PROTO((char *, ...));
-extern void warning                   PROTO((char *, ...));
-extern int  get_type_precision        PROTO((tree, tree));
+#include "toplev.h"
 
 extern tree intQI_type_node;
 extern tree intHI_type_node;
@@ -63,9 +50,9 @@ extern tree unsigned_intDI_type_node;
 extern tree unsigned_intTI_type_node;
 
 /* forward declarations */
-tree chill_expand_tuple PROTO((tree, tree));
 static int chill_l_equivalent PROTO((tree, tree, struct mode_chain*));
-extern tree extract_constant_from_buffer();
+static tree extract_constant_from_buffer PROTO((tree, unsigned char *, int));
+static int expand_constant_to_buffer PROTO((tree, unsigned char *, int));
 
 /*
  * This function checks an array access.
@@ -249,7 +236,6 @@ build_chill_slice (array, min_value, len
       tree element_type = TREE_TYPE (array_type);
       tree slice_type = build_simple_array_type (element_type, index_type, NULL_TREE);
       tree slice_pointer_type;
-      int is_static;
       tree max_size;
 
       if (CH_CHARS_TYPE_P (array_type))
@@ -729,7 +715,7 @@ convert_to_discrete (exp)
    Returns 1 on success, or 0 on failure. (Either the VALUE was
    not constant, or we don't know how to do the conversion.) */
 
-int
+static int
 expand_constant_to_buffer (value, buffer, buf_size)
      tree value;
      unsigned char *buffer; 
@@ -782,10 +768,12 @@ expand_constant_to_buffer (value, buffer
 	    {
 	      tree min_val = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
 	      if (min_val)
-		if (TREE_CODE (min_val) != INTEGER_CST)
-		  return 0;
-		else
-		  min_index = TREE_INT_CST_LOW (min_val);
+		{
+		  if (TREE_CODE (min_val) != INTEGER_CST)
+		    return 0;
+		  else
+		    min_index = TREE_INT_CST_LOW (min_val);
+		}
 	    }
 
 	  next_index = min_index;
@@ -858,7 +846,7 @@ expand_constant_to_buffer (value, buffer
    Returns NULL_TREE on failure. (E.g. the TYPE might be variable size,
    or perhaps we don't know how to do the conversion.) */
 
-tree
+static tree
 extract_constant_from_buffer (type, buffer, buf_size)
      tree type;
      unsigned char *buffer;
@@ -912,10 +900,12 @@ extract_constant_from_buffer (type, buff
 	  return 0;
 	value = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
 	if (value)
-	  if (TREE_CODE (value) != INTEGER_CST)
-	    return 0;
-	  else
-	    min_index = TREE_INT_CST_LOW (value);
+	  {
+	    if (TREE_CODE (value) != INTEGER_CST)
+	      return 0;
+	    else
+	      min_index = TREE_INT_CST_LOW (value);
+	  }
 	value = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
 	if (value == NULL_TREE || TREE_CODE (value) != INTEGER_CST)
 	  return 0;
@@ -1845,12 +1835,14 @@ chill_compatible (expr, mode)
     mode = TREE_TYPE (mode);
 
   if (TREE_TYPE (expr) == NULL_TREE)
-    if (TREE_CODE (expr) == CONSTRUCTOR)
-      return TREE_CODE (mode) == RECORD_TYPE
-	|| ((TREE_CODE (mode) == SET_TYPE || TREE_CODE (mode) == ARRAY_TYPE)
-	    && ! TYPE_STRING_FLAG (mode));
-    else
-      return TREE_CODE (expr) == CASE_EXPR || TREE_CODE (expr) == COND_EXPR;
+    {
+      if (TREE_CODE (expr) == CONSTRUCTOR)
+	return TREE_CODE (mode) == RECORD_TYPE
+	  || ((TREE_CODE (mode) == SET_TYPE || TREE_CODE (mode) == ARRAY_TYPE)
+	      && ! TYPE_STRING_FLAG (mode));
+      else
+	return TREE_CODE (expr) == CASE_EXPR || TREE_CODE (expr) == COND_EXPR;
+    }
 
   class = chill_expr_class (expr);
   switch (class.kind)
@@ -2733,7 +2725,7 @@ apply_chill_array_layout (array_type)
      tree array_type;
 {
   tree layout, temp, what, element_type;
-  int stepsize, word, start_bit, offset, length, natural_length;
+  int stepsize, word, start_bit, length, natural_length;
   int stepsize_specified;
   int start_bit_error = 0;
   int length_error = 0;
@@ -3351,7 +3343,6 @@ smash_dummy_type (type)
   int  save_readonly = TYPE_READONLY (type);
   tree  save_novelty = CH_NOVELTY (type);
   tree save_domain = TYPE_DOMAIN (type);
-  struct lang_type *save_lang_specific = TYPE_LANG_SPECIFIC (type);
 
   if (origin == NULL_TREE)
     abort ();
@@ -3795,9 +3786,9 @@ initializer_constant_valid_p (value, end
 	  return null_pointer_node;
 	return 0;
       }
+    default:
+      return 0;
     }
-
-  return 0;
 }
 
 /* Return an integer type with BITS bits of precision,



More information about the Gcc-patches mailing list