top level:
authorZack Weinberg <zack@wolery.cumb.org>
Tue, 9 May 2000 19:56:01 +0000 (19:56 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Tue, 9 May 2000 19:56:01 +0000 (19:56 +0000)
* Makefile.in (WARN_CFLAGS): Add -Wwrite-strings.
(tree.o): Depend on output.h.

* c-decl.c (pending_invalid_xref_file,
current_function_prototype_file): Constify.
(pushdecl): Constify a local char *.
(define_label): Constify filename parameter.
* c-lex.c (init_parse): Constify parameter and return value.
* c-typeck.c (c_expand_asm_operands): Constify filename parameter.
* c-tree.h: Update prototypes.
* c-parse.in: Constify filename member of %union, and if_stmt_file.
* c-parse.y, c-parse.c, c-parse.h, objc/objc-parse.y,
objc/objc-parse.c: Regenerate.

* dwarfout.c (dwarfout_init): Constify main_input_filename parameter.
* dwarfout.h: Update prototypes.
* expr.c (expand_expr): Constify a local char *.
* flags.h: Constify main_input_filename.
* function.c (expand_function_end): Constify filename parameter.
* genrecog.c (make_insn_sequence): Use a character array for
c_test_pos.
(main): Remove unused variables.
* input.h: Constify input_filename, main_input_filename, and
file_stack.name.  Update prototypes.
* output.h: Declare first_global_object_name and
weak_global_object_name here, as const char *.
* stmt.c (expand_asm_operands): Constify filename parameter.
* toplev.c (compile_file, push_srcloc, debug_start_source_file):
Constify filename parameter.
(input_filename, main_input_filename): Constify.
* toplev.h: Update prototypes.
* tree.c: Include output.h.  Don't declare
first_global_object_name or weak_global_object_name.  Clean up string
bashing in get_file_function_name_long.
* tree.h (struct tree_decl): Constify filename member.
(input_filename): Constify.
Update prototypes.
* varasm.c (first_global_object_name, weak_global_object_name):
Constify.
(assemble_start_function, assemble_variable): Clean up string bashing.

* gcc.c: Constify all spec-related strings initialized,
transitively, from string constants.  Constify all strings
and string variables related to multilibs.
(set_spec, read_specs): Cast argument to free to PTR.
(used_arg): Do not modify multilib_matches.  Use strncmp plus
length comparison to compare multilib switches.
* genmultilib: Constify everything declared in multilib.h.

ch:
* ch-tree.h: Update prototypes.  Remove prototypes for
functions declared elsewhere.
* decl.c (define_label): Constify filename parameter.
* grant.c (globalize_decl, set_default_grant_file): Constify
local char * variables.  Don't declare
first_global_object_name or asm_out_file.
* lang.c (chill_real_input_filename): Constify.
* lex.c (init_parse): Constify parameter and return value.
* parse.c: Don't declare input_filename.
(ch_expand_asm_operands): Constify filename parameter.
(parse_multi_dimension_case_action): Constify local char *.
* satisfy.c (safe_satisfy_decl): Constify local char *.

cp:
* cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
and pending_inline.filename.  Update prototypes.
* decl.c (define_label): Constify filename parameter.
* decl2.c (warn_if_unknown_interface): Constify local char *.
* input.c Constify input_source.filename. Don't declare
input_filename or lineno.  Constify filename parameter to feed_input.
* lex.c (init_parse): Constify parameter and return value.
(cp_pragma_interface, cp_pragma_implementation): Constify
filename argument.
(reinit_parse_for_method, reinit_parse_for_block,
reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
Constify local char *.
* pt.c: Don't declare lineno or input_filename.
(print_template_context, tsubst_friend_function, tsubst_decl,
tsubst, instantiate_decl): Constify local char *.
* semantics.c (expand_body): Constify local char *.
* tree.c (build_srcloc): Constify filename parameter.
* typeck.c (c_expand_asm_operands): Constify filename
parameter.

f:
* com.c (ffecom_subscript_check_): Constify array_name
parameter. Clean up string bashing.
(ffecom_arrayref_, ffecom_char_args_x_): Constify array_name
parameter.
(ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_,
ffecom_sym_transform_, ffecom_sym_transform_assign_): Constify
local char *.
(init_parse): Constify parameter and return value.
* lex.c: Include dwarfout.h instead of prototyping dwarfout_*
functions here.
(ffelex_file_pop_, ffelex_file_push_): Constify filename parameter.
(ffelex_hash_, ffelex_include_): Constify local char *.
* std.c (ffestd_exec_end): Constify local char *.
* where.c (ffewhere_file_new): Constify filename parameter.
* where.h: Update prototypes.

java:
* check_init.c (check_init): Constify local char *.
* class.c (push_class): Constify local char *.
* java_tree.h: Update prototypes.
* jcf-io.c (open_class): Constify filename parameter and
return value.
(find_class): Remove redundant string copy.  Cast return from
open_class.
* jcf-parse.c (read_class, parse_class_file, yyparse):
Constify local char *.
* jcf-write.c (generate_bytecode_insns, generate_classfile):
Constify local char *.
* jcf.h (JCF): Constify filename and classname.
(JCF_FINISH): Cast args to FREE to char * when appropriate.
* lang.c (init_parse): Constify parameter and return value.
* lex.c (java_get_line_col): Constify filename parameter.
* parse.h: Constify parser_ctxt.filename.  Update prototypes.
* parse.y (java_parser_context_suspend,
issue_warning_error_from_context, safe_layout_class): Constify
local char *.
* parse.c: Regenerate.

From-SVN: r33804

65 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-decl.c
gcc/c-lex.c
gcc/c-parse.c
gcc/c-parse.h
gcc/c-parse.in
gcc/c-parse.y
gcc/c-tree.h
gcc/c-typeck.c
gcc/ch/ChangeLog
gcc/ch/ch-tree.h
gcc/ch/decl.c
gcc/ch/grant.c
gcc/ch/lang.c
gcc/ch/lex.c
gcc/ch/parse.c
gcc/ch/satisfy.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/input.c
gcc/cp/lex.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/dwarfout.c
gcc/dwarfout.h
gcc/expr.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/f/lex.c
gcc/f/std.c
gcc/f/where.c
gcc/f/where.h
gcc/flags.h
gcc/function.c
gcc/gcc.c
gcc/genmultilib
gcc/genrecog.c
gcc/input.h
gcc/java/ChangeLog
gcc/java/check-init.c
gcc/java/class.c
gcc/java/java-tree.h
gcc/java/jcf-io.c
gcc/java/jcf-parse.c
gcc/java/jcf-write.c
gcc/java/jcf.h
gcc/java/lang.c
gcc/java/lex.c
gcc/java/parse.c
gcc/java/parse.h
gcc/java/parse.y
gcc/objc/objc-parse.c
gcc/objc/objc-parse.y
gcc/output.h
gcc/stmt.c
gcc/toplev.c
gcc/toplev.h
gcc/tree.c
gcc/tree.h
gcc/varasm.c

index a6d17cb..e0d227c 100644 (file)
@@ -1,3 +1,54 @@
+2000-05-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * Makefile.in (WARN_CFLAGS): Add -Wwrite-strings.
+       (tree.o): Depend on output.h.
+
+       * c-decl.c (pending_invalid_xref_file,
+       current_function_prototype_file): Constify.
+       (pushdecl): Constify a local char *.
+       (define_label): Constify filename parameter.
+       * c-lex.c (init_parse): Constify parameter and return value.
+       * c-typeck.c (c_expand_asm_operands): Constify filename parameter.
+       * c-tree.h: Update prototypes.
+       * c-parse.in: Constify filename member of %union, and if_stmt_file.
+       * c-parse.y, c-parse.c, c-parse.h, objc/objc-parse.y,
+       objc/objc-parse.c: Regenerate.
+
+       * dwarfout.c (dwarfout_init): Constify main_input_filename parameter.
+       * dwarfout.h: Update prototypes.
+       * expr.c (expand_expr): Constify a local char *.
+       * flags.h: Constify main_input_filename.
+       * function.c (expand_function_end): Constify filename parameter.
+       * genrecog.c (make_insn_sequence): Use a character array for
+       c_test_pos.
+       (main): Remove unused variables.
+       * input.h: Constify input_filename, main_input_filename, and
+       file_stack.name.  Update prototypes.
+       * output.h: Declare first_global_object_name and
+       weak_global_object_name here, as const char *.
+       * stmt.c (expand_asm_operands): Constify filename parameter.
+       * toplev.c (compile_file, push_srcloc, debug_start_source_file):
+       Constify filename parameter.
+       (input_filename, main_input_filename): Constify.
+       * toplev.h: Update prototypes.
+       * tree.c: Include output.h.  Don't declare
+       first_global_object_name or weak_global_object_name.  Clean up string
+       bashing in get_file_function_name_long.
+       * tree.h (struct tree_decl): Constify filename member.
+       (input_filename): Constify.
+       Update prototypes.
+       * varasm.c (first_global_object_name, weak_global_object_name):
+       Constify.
+       (assemble_start_function, assemble_variable): Clean up string bashing.
+
+       * gcc.c: Constify all spec-related strings initialized,
+       transitively, from string constants.  Constify all strings
+       and string variables related to multilibs.
+       (set_spec, read_specs): Cast argument to free to PTR.
+       (used_arg): Do not modify multilib_matches.  Use strncmp plus
+       length comparison to compare multilib switches.
+       * genmultilib: Constify everything declared in multilib.h.
+
 Tue May  9 22:28:03 2000  Denis Chertykov  <denisc@overta.ru>
 
        * flow.c (flow_delete_insn): Use INSN_DELETED_P for marking insn
index cdd3ee5..449ee48 100644 (file)
@@ -76,7 +76,7 @@ XCFLAGS =
 TCFLAGS =
 CFLAGS = -g @stage1_warn_cflags@
 BOOT_CFLAGS = -O2 $(CFLAGS)
-WARN_CFLAGS = -W -Wall -Wtraditional -pedantic -Wno-long-long
+WARN_CFLAGS = -W -Wall -Wtraditional -pedantic -Wno-long-long -Wwrite-strings
 LOOSE_CFLAGS = `echo $(CFLAGS)|sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'`
 # These exists to be overridden by the x-* and t-* files, respectively.
 X_CFLAGS =
@@ -1223,7 +1223,7 @@ prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h
 convert.o: convert.c $(CONFIG_H) system.h $(TREE_H) flags.h convert.h toplev.h
 
 tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h \
-   $(GGC_H) $(HASHTAB_H)
+   $(GGC_H) $(HASHTAB_H) output.h
 print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H) $(GGC_H)
 stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
    function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H)
index fcf8a7d..301a322 100644 (file)
@@ -80,7 +80,7 @@ int ggc_p = 1;
 
 tree pending_invalid_xref;
 /* File and line to appear in the eventual error message.  */
-char *pending_invalid_xref_file;
+const char *pending_invalid_xref_file;
 int pending_invalid_xref_line;
 
 /* While defining an enum type, this is 1 plus the last enumerator
@@ -116,7 +116,7 @@ static tree current_function_parm_tags;
 
 /* Similar, for the file and line that the prototype came from if this is
    an old-style definition.  */
-static char *current_function_prototype_file;
+static const char *current_function_prototype_file;
 static int current_function_prototype_line;
 
 /* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
@@ -2019,7 +2019,7 @@ pushdecl (x)
 
   if (name)
     {
-      char *file;
+      const char *file;
       int line;
       int different_binding_level = 0;
 
@@ -2674,7 +2674,7 @@ shadow_label (name)
 
 tree
 define_label (filename, line, name)
-     char *filename;
+     const char *filename;
      int line;
      tree name;
 {
index 8498e5f..3ca8264 100644 (file)
@@ -222,9 +222,9 @@ remember_protocol_qualifiers ()
       wordlist[i].name = "oneway";
 }
 \f
-char *
+const char *
 init_parse (filename)
-     char *filename;
+     const char *filename;
 {
 #if !USE_CPPLIB
   /* Open input file.  */
index a00ba33..aff33d8 100644 (file)
@@ -1,7 +1,6 @@
 
 /*  A Bison parser, made from c-parse.y
- by  GNU Bison version 1.27
-  */
+    by GNU Bison version 1.28  */
 
 #define YYBISON 1  /* Identify Bison output.  */
 
@@ -101,7 +100,7 @@ const char * const language_string = "GNU C";
 
 #line 65 "c-parse.y"
 typedef union {long itype; tree ttype; enum tree_code code;
-       char *filename; int lineno; int ends_in_label; } YYSTYPE;
+       const char *filename; int lineno; int ends_in_label; } YYSTYPE;
 #line 186 "c-parse.y"
 
 /* Number of statements (loosely speaking) and compound statements 
@@ -111,7 +110,7 @@ static int compstmt_count;
   
 /* Input file and line number of the end of the body of last simple_if;
    used by the stmt-rule immediately after simple_if returns.  */
-static char *if_stmt_file;
+static const char *if_stmt_file;
 static int if_stmt_line;
 
 /* List of types and structure classes of the current declaration.  */
@@ -1275,8 +1274,8 @@ static const short yycheck[] = {    38,
     48,    49,    50,    51,    52,    53,    54,    55,    56,    57
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/lib/bison.simple"
-/* This file comes from bison-1.27.  */
+#line 3 "/usr/share/misc/bison.simple"
+/* This file comes from bison-1.28.  */
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -1489,7 +1488,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
 #endif
 #endif
 \f
-#line 216 "/usr/lib/bison.simple"
+#line 217 "/usr/share/misc/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -3836,7 +3835,7 @@ case 407:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 542 "/usr/lib/bison.simple"
+#line 543 "/usr/share/misc/bison.simple"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
index 29eff12..f93aef0 100644 (file)
@@ -1,5 +1,5 @@
 typedef union {long itype; tree ttype; enum tree_code code;
-       char *filename; int lineno; int ends_in_label; } YYSTYPE;
+       const char *filename; int lineno; int ends_in_label; } YYSTYPE;
 #define        IDENTIFIER      257
 #define        TYPENAME        258
 #define        SCSPEC  259
index deea8e9..adc247a 100644 (file)
@@ -75,7 +75,7 @@ end ifc
 %start program
 
 %union {long itype; tree ttype; enum tree_code code;
-       char *filename; int lineno; int ends_in_label; }
+       const char *filename; int lineno; int ends_in_label; }
 
 /* All identifiers that are not reserved words
    and are not declared typedefs in the current block */
@@ -216,7 +216,7 @@ static int compstmt_count;
   
 /* Input file and line number of the end of the body of last simple_if;
    used by the stmt-rule immediately after simple_if returns.  */
-static char *if_stmt_file;
+static const char *if_stmt_file;
 static int if_stmt_line;
 
 /* List of types and structure classes of the current declaration.  */
index 99998fc..c228e6e 100644 (file)
@@ -63,7 +63,7 @@ const char * const language_string = "GNU C";
 %start program
 
 %union {long itype; tree ttype; enum tree_code code;
-       char *filename; int lineno; int ends_in_label; }
+       const char *filename; int lineno; int ends_in_label; }
 
 /* All identifiers that are not reserved words
    and are not declared typedefs in the current block */
@@ -191,7 +191,7 @@ static int compstmt_count;
   
 /* Input file and line number of the end of the body of last simple_if;
    used by the stmt-rule immediately after simple_if returns.  */
-static char *if_stmt_file;
+static const char *if_stmt_file;
 static int if_stmt_line;
 
 /* List of types and structure classes of the current declaration.  */
index 32e802e..68e6f47 100644 (file)
@@ -191,7 +191,8 @@ extern void clear_parm_order                    PARAMS ((void));
 extern tree combine_parm_decls                  PARAMS ((tree, tree, int));
 extern int  complete_array_type                 PARAMS ((tree, tree, int));
 extern void declare_parm_level                  PARAMS ((int));
-extern tree define_label                        PARAMS ((char *, int, tree));
+extern tree define_label                        PARAMS ((const char *, int,
+                                                        tree));
 extern void delete_block                        PARAMS ((tree));
 extern void finish_decl                         PARAMS ((tree, tree, tree));
 extern void finish_decl_top_level               PARAMS ((tree, tree, tree));
@@ -290,8 +291,8 @@ extern void set_init_index                  PARAMS ((tree, tree));
 extern void set_init_label                     PARAMS ((tree));
 extern void process_init_element               PARAMS ((tree));
 extern void c_expand_asm_operands              PARAMS ((tree, tree, tree,
-                                                        tree, int, char *,
-                                                        int));
+                                                        tree, int,
+                                                        const char *, int));
 extern void c_expand_return                    PARAMS ((tree));
 extern tree c_expand_start_case                 PARAMS ((tree));
 
index efc38a8..25c19e2 100644 (file)
@@ -6435,7 +6435,7 @@ void
 c_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);
index fe84211..45262b3 100644 (file)
@@ -1,3 +1,18 @@
+2000-05-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * ch-tree.h: Update prototypes.  Remove prototypes for
+       functions declared elsewhere.
+       * decl.c (define_label): Constify filename parameter.
+       * grant.c (globalize_decl, set_default_grant_file): Constify
+       local char * variables.  Don't declare
+       first_global_object_name or asm_out_file.
+       * lang.c (chill_real_input_filename): Constify.
+       * lex.c (init_parse): Constify parameter and return value.
+       * parse.c: Don't declare input_filename.
+       (ch_expand_asm_operands): Constify filename parameter.
+       (parse_multi_dimension_case_action): Constify local char *.
+       * satisfy.c (safe_satisfy_decl): Constify local char *.
+
 2000-05-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * ch-tree.h (init_function_start): Constify.
index 953a1dc..5547107 100644 (file)
@@ -672,7 +672,7 @@ extern void clear_parm_order                    PARAMS ((void));
 extern tree combine_parm_decls                  PARAMS ((tree, tree, int));
 extern int  complete_array_type                 PARAMS ((tree, tree, int));
 extern void declare_parm_level                  PARAMS ((int));
-extern tree define_label                        PARAMS ((char *, int, tree));
+extern tree define_label                        PARAMS ((const char *, int, tree));
 extern void delete_block                        PARAMS ((tree));
 extern void finish_decl                         PARAMS ((tree));
 extern tree finish_enum                         PARAMS ((tree, tree));
@@ -1110,16 +1110,6 @@ extern tree type_for_size                       PARAMS ((unsigned, int));
 extern int  valid_array_index                   PARAMS ((tree, tree));
 extern void validate_varying_array_ref          PARAMS ((tree, tree));
 
-/* in function.c */
-extern void expand_function_end                 PARAMS ((char *, int, int));
-extern void expand_function_start               PARAMS ((tree, int));
-extern void init_function_start                 PARAMS ((tree, const char *, int));
-extern void pop_function_context                PARAMS ((void));
-extern void push_function_context               PARAMS ((void));
-
-/* in integrate.c */
-extern void output_inline_function              PARAMS ((tree));
-
 /* in toplev.c */
 extern void announce_function                   PARAMS ((tree));
 extern int  floor_log2_wide                     PARAMS ((unsigned HOST_WIDE_INT));
@@ -1132,10 +1122,6 @@ extern void make_function_rtl                   PARAMS ((tree));
 extern void init_iterators                      PARAMS ((void));
 extern int  mark_addressable                   PARAMS ((tree));
 extern tree chill_result_decl;
-#ifdef RTX_CODE
-extern rtx label_rtx                            PARAMS ((tree));
-#endif
-extern void permanent_allocation                PARAMS ((int));
 
 #ifndef SET_WORD_SIZE
 #define SET_WORD_SIZE BITS_PER_WORD
index 83caf0b..9d5fd0d 100644 (file)
@@ -3151,7 +3151,7 @@ pushdecl_top_level (x)
 
 tree
 define_label (filename, line, name)
-     char *filename;
+     const char *filename;
      int line;
      tree name;
 {
index ddd8f93..42328c1 100644 (file)
@@ -2544,9 +2544,7 @@ globalize_decl (decl)
   if (!TREE_PUBLIC (decl) && DECL_NAME (decl) &&
       (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL))
     {
-      extern   FILE    *asm_out_file;
-      extern   char    *first_global_object_name;
-      const char       *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+      const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
        
       if (!first_global_object_name)
        first_global_object_name = name + (name[0] == '*');
@@ -2686,7 +2684,8 @@ write_grant_file ()
 void
 set_default_grant_file ()
 {
-    char       *p, *tmp, *fname;
+    char       *p, *tmp;
+    const char *fname;
 
     if (dump_base_name)
       fname = dump_base_name; /* Probably invoked via gcc */
@@ -2993,18 +2992,18 @@ chill_finish_compile ()
         Perhaps rewrite this so nothing is done in pass 1. */
       if (pass == 1)
        {
-         extern char *first_global_object_name;
          /* If we don't do this spoof, we get the name of the first
             tasking_code variable, and not the file name. */
-         char *tmp = first_global_object_name;
-
+         char *q;
+         const char *tmp = first_global_object_name;
          first_global_object_name = NULL;
          chill_init_name = get_file_function_name ('I');
          first_global_object_name = tmp;
+
          /* strip off the file's extension, if any. */
-         tmp = strrchr (IDENTIFIER_POINTER (chill_init_name), '.');
-         if (tmp)
-           *tmp = '\0';
+         q = strrchr (IDENTIFIER_POINTER (chill_init_name), '.');
+         if (q)
+           *q = '\0';
        }
 
       start_chill_function (chill_init_name, void_type_node, NULL_TREE,
index 42470cf..9a2f822 100644 (file)
@@ -47,7 +47,7 @@ int ignore_case = 1;
 int special_UC = 0;
 
 /* The actual name of the input file, regardless of any #line directives */
-char* chill_real_input_filename;
+const char* chill_real_input_filename;
 extern FILE* finput;
 
 static int deep_const_expr                     PARAMS ((tree));
index 5f0eb52..cd433ca 100644 (file)
@@ -197,9 +197,9 @@ ch_lex_init ()
 }
 
 
-char *
+const char *
 init_parse (filename)
-     char *filename;
+     const char *filename;
 {
   int lowercase_standard_names = ignore_case || ! special_UC;
 
index 92ca55b..f2513ff 100644 (file)
@@ -94,7 +94,6 @@ 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;
@@ -451,7 +450,8 @@ 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, char *, int));
+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));
@@ -1785,7 +1785,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
@@ -2008,7 +2008,7 @@ 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);
index fa30030..8fa46de 100644 (file)
@@ -67,7 +67,7 @@ safe_satisfy_decl (decl, prev_chain)
   struct decl_chain new_link;
   struct decl_chain *link;
   struct decl_chain *chain = prev_chain;
-  char *save_filename = input_filename;
+  const char *save_filename = input_filename;
   int save_lineno = lineno;
   tree result = decl;
   
index fa1c7f1..bd7f0ea 100644 (file)
@@ -1,3 +1,25 @@
+2000-05-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
+       and pending_inline.filename.  Update prototypes.
+       * decl.c (define_label): Constify filename parameter.
+       * decl2.c (warn_if_unknown_interface): Constify local char *.
+       * input.c Constify input_source.filename. Don't declare
+       input_filename or lineno.  Constify filename parameter to feed_input.
+       * lex.c (init_parse): Constify parameter and return value.
+       (cp_pragma_interface, cp_pragma_implementation): Constify
+       filename argument.
+       (reinit_parse_for_method, reinit_parse_for_block,
+       reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
+       Constify local char *.
+       * pt.c: Don't declare lineno or input_filename.
+       (print_template_context, tsubst_friend_function, tsubst_decl,
+       tsubst, instantiate_decl): Constify local char *.
+       * semantics.c (expand_body): Constify local char *.
+       * tree.c (build_srcloc): Constify filename parameter.
+       * typeck.c (c_expand_asm_operands): Constify filename
+       parameter.
+
 2000-05-08  Nathan Sidwell  <nathan@codesourcery.com>
 
        * tinfo.cc (__dynamic_cast): Use a reinterpret_cast. Fix
index cb46967..c7c0933 100644 (file)
@@ -399,7 +399,7 @@ struct tree_wrapper
 struct tree_srcloc
 {
   char common[sizeof (struct tree_common)];
-  char *filename;
+  const char *filename;
   int linenum;
 };
 
@@ -3338,7 +3338,7 @@ struct tinst_level
 {
   tree decl;
   int line;
-  char *file;
+  const char *file;
   struct tinst_level *next;
 };
 
@@ -3533,7 +3533,7 @@ struct pending_inline
 {
   struct pending_inline *next; /* pointer to next in chain */
   int lineno;                  /* line number we got the text from */
-  char *filename;              /* name of file we were processing */
+  const char *filename;                /* name of file we were processing */
   tree fndecl;                 /* FUNCTION_DECL that brought us here */
   int token;                   /* token we were scanning */
   int token_value;             /* value of token we were scanning (YYSTYPE) */
@@ -3910,7 +3910,7 @@ extern void push_class_level_binding              PARAMS ((tree, tree));
 extern tree implicitly_declare                 PARAMS ((tree));
 extern tree lookup_label                       PARAMS ((tree));
 extern tree declare_local_label                 PARAMS ((tree));
-extern tree define_label                       PARAMS ((char *, int, tree));
+extern tree define_label                       PARAMS ((const char *, int, tree));
 extern void push_switch                                PARAMS ((void));
 extern void pop_switch                         PARAMS ((void));
 extern void define_case_label                  PARAMS ((void));
@@ -4593,7 +4593,7 @@ extern tree build_x_modify_expr                   PARAMS ((tree, enum tree_code, tree));
 extern tree build_modify_expr                  PARAMS ((tree, enum tree_code, tree));
 extern tree dubious_conversion_warnings         PARAMS ((tree, tree, const char *, tree, int));
 extern tree convert_for_initialization         PARAMS ((tree, tree, tree, int, const char *, tree, int));
-extern void c_expand_asm_operands              PARAMS ((tree, tree, tree, tree, int, char *, int));
+extern void c_expand_asm_operands              PARAMS ((tree, tree, tree, tree, int, const char *, int));
 extern void c_expand_return                    PARAMS ((tree));
 extern tree c_expand_start_case                        PARAMS ((tree));
 extern int comp_ptr_ttypes                     PARAMS ((tree, tree));
index 81203b4..b951773 100644 (file)
@@ -4794,7 +4794,7 @@ declare_local_label (id)
 
 tree
 define_label (filename, line, name)
-     char *filename;
+     const char *filename;
      int line;
      tree name;
 {
index 85bc908..ca660e0 100644 (file)
@@ -867,7 +867,7 @@ warn_if_unknown_interface (decl)
     {
       struct tinst_level *til = tinst_for_decl ();
       int sl = lineno;
-      char *sf = input_filename;
+      const char *sf = input_filename;
 
       if (til)
        {
index 3236158..8c96c37 100644 (file)
@@ -54,7 +54,7 @@ struct input_source {
   /* values to restore after reading all of current string */
   struct pending_input *input;
 #if !USE_CPPLIB
-  char *filename;
+  const char *filename;
   int lineno;
   struct putback_buffer putback;
 #endif
@@ -62,15 +62,12 @@ struct input_source {
 
 static struct input_source *input, *free_inputs;
 
-extern char *input_filename;
-extern int lineno;
-
 #if USE_CPPLIB
 extern unsigned char *yy_cur, *yy_lim;
 extern int yy_get_token ();
 #endif
 
-extern void feed_input PARAMS ((char *, int, char *, int));
+extern void feed_input PARAMS ((char *, int, const char *, int));
 extern void put_input PARAMS ((int));
 extern void put_back PARAMS ((int));
 extern int getch PARAMS ((void));
@@ -114,7 +111,7 @@ void
 feed_input (str, len, file, line)
      char *str;
      int len;
-     char *file;
+     const char *file;
      int line;
 {
   struct input_source *inp = allocate_input ();
index ba32971..34fea7e 100644 (file)
@@ -65,8 +65,8 @@ static void feed_defarg PARAMS ((tree, tree));
 static void store_pending_inline PARAMS ((tree, struct pending_inline *));
 static void reinit_parse_for_expr PARAMS ((struct obstack *));
 static int *init_cpp_parse PARAMS ((void));
-static void cp_pragma_interface PARAMS ((char *));
-static void cp_pragma_implementation PARAMS ((char *));
+static void cp_pragma_interface PARAMS ((const char *));
+static void cp_pragma_implementation PARAMS ((const char *));
 static int handle_cp_pragma PARAMS ((const char *));
 #ifdef HANDLE_GENERIC_PRAGMAS
 static int handle_generic_pragma PARAMS ((int));
@@ -510,9 +510,9 @@ init_cpp_parse ()
   return token_count;
 }
 
-char *
+const char *
 init_parse (filename)
-     char *filename;
+     const char *filename;
 {
   extern int flag_no_gnu_keywords;
   extern int flag_operator_names;
@@ -1188,7 +1188,7 @@ interface_strcmp (s)
 
 static void
 cp_pragma_interface (main_filename)
-     char *main_filename;
+     const char *main_filename;
 {
   tree fileinfo 
     = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename));
@@ -1235,7 +1235,7 @@ cp_pragma_interface (main_filename)
 
 static void
 cp_pragma_implementation (main_filename)
-     char *main_filename;
+     const char *main_filename;
 {
   struct impl_files *ifiles = impl_file_chain;
   for (; ifiles; ifiles = ifiles->next)
@@ -1514,7 +1514,7 @@ reinit_parse_for_method (yychar, decl)
 {
   int len;
   int starting_lineno = lineno;
-  char *starting_filename = input_filename;
+  const char *starting_filename = input_filename;
 
   reinit_parse_for_block (yychar, &inline_text_obstack);
 
@@ -1562,7 +1562,7 @@ reinit_parse_for_block (pyychar, obstackp)
   register int c;
   int blev = 1;
   int starting_lineno = lineno;
-  char *starting_filename = input_filename;
+  const char *starting_filename = input_filename;
   int len;
   int look_for_semicolon = 0;
   int look_for_lbrac = 0;
@@ -1728,7 +1728,7 @@ reinit_parse_for_expr (obstackp)
 {
   register int c;
   int starting_lineno = lineno;
-  char *starting_filename = input_filename;
+  const char *starting_filename = input_filename;
   int len;
   int plev = 0;
 
@@ -1868,7 +1868,7 @@ feed_defarg (f, p)
      tree f, p;
 {
   tree d = TREE_PURPOSE (p);
-  char *file;
+  const char *file;
   int line;
   if (TREE_CODE (f) == FUNCTION_DECL)
     {
@@ -2589,7 +2589,7 @@ handle_cp_pragma (pname)
     }
   else if (! strcmp (pname, "interface"))
     {
-      char *main_filename = input_filename;
+      const char *main_filename = input_filename;
 
       main_filename = file_name_nondirectory (main_filename);
 
@@ -2616,7 +2616,7 @@ handle_cp_pragma (pname)
     }
   else if (! strcmp (pname, "implementation"))
     {
-      char *main_filename = main_input_filename ? main_input_filename : input_filename;
+      const char *main_filename = main_input_filename ? main_input_filename : input_filename;
 
       main_filename = file_name_nondirectory (main_filename);
 
index 2e077c9..3b3f786 100644 (file)
@@ -51,9 +51,6 @@ typedef int (*tree_fn_t) PARAMS ((tree, void*));
 
 extern struct obstack permanent_obstack;
 
-extern int lineno;
-extern char *input_filename;
-
 /* The PENDING_TEMPLATES is a TREE_LIST of templates whose
    instantiations have been deferred, either because their definitions
    were not yet available, or because we were putting off doing the
@@ -4240,7 +4237,7 @@ print_template_context (err)
 {
   struct tinst_level *p = current_tinst_level;
   int line = lineno;
-  char *file = input_filename;
+  const char *file = input_filename;
 
   if (err && p)
     {
@@ -4375,7 +4372,7 @@ tsubst_friend_function (decl, args)
 {
   tree new_friend;
   int line = lineno;
-  char *file = input_filename;
+  const char *file = input_filename;
 
   lineno = DECL_SOURCE_LINE (decl);
   input_filename = DECL_SOURCE_FILE (decl);
@@ -5389,7 +5386,7 @@ tsubst_decl (t, args, type, in_decl)
      tree in_decl;
 {
   int saved_lineno;
-  char* saved_filename;
+  const char *saved_filename;
   tree r = NULL_TREE;
 
   /* Set the filename and linenumber to improve error-reporting.  */
@@ -6454,7 +6451,7 @@ tsubst (t, args, complain, in_decl)
            || (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
          {
            static int   last_line = 0;
-           static char* last_file = 0;
+           static const char* last_file = 0;
 
            /* We keep track of the last time we issued this error
               message to avoid spewing a ton of messages during a
@@ -9434,7 +9431,7 @@ instantiate_decl (d, defer_ok)
   tree gen_tmpl;
   int pattern_defined;
   int line = lineno;
-  char *file = input_filename;
+  const char *file = input_filename;
 
   /* This function should only be used to instantiate templates for
      functions and static member variables.  */
index d6d493f..afa9ff2 100644 (file)
@@ -2694,7 +2694,7 @@ expand_body (fn)
      tree fn;
 {
   int saved_lineno;
-  char *saved_input_filename;
+  const char *saved_input_filename;
 
   /* When the parser calls us after finishing the body of a template
      function, we don't really want to expand the body.  When we're
index 712e40d..078558e 100644 (file)
@@ -40,7 +40,7 @@ static int list_hash PARAMS ((tree, tree, tree));
 static tree list_hash_lookup PARAMS ((int, tree, tree, tree));
 static cp_lvalue_kind lvalue_p_1 PARAMS ((tree, int));
 static tree no_linkage_helper PARAMS ((tree *, int *, void *));
-static tree build_srcloc PARAMS ((char *, int));
+static tree build_srcloc PARAMS ((const char *, int));
 static void mark_list_hash PARAMS ((void *));
 static int statement_code_p PARAMS ((enum tree_code));
 static tree mark_local_for_remap_r PARAMS ((tree *, int *, void *));
@@ -1989,7 +1989,7 @@ build_int_wrapper (i)
 
 static tree
 build_srcloc (file, line)
-     char *file;
+     const char *file;
      int line;
 {
   tree t;
index 7d75d6f..671a666 100644 (file)
@@ -6638,7 +6638,7 @@ void
 c_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);
index a8b2a4a..c9a9d4f 100644 (file)
@@ -5690,7 +5690,7 @@ dwarfout_undef (lineno, buffer)
 void
 dwarfout_init (asm_out_file, main_input_filename)
      register FILE *asm_out_file;
-     register char *main_input_filename;
+     register const char *main_input_filename;
 {
   /* Remember the name of the primary input file.  */
 
index c09469a..e0b9e2c 100644 (file)
@@ -18,8 +18,7 @@ along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-extern void dwarfout_init              PARAMS ((FILE *asm_out_file, 
-                                               char *main_input_filename));
+extern void dwarfout_init              PARAMS ((FILE *, const char *));
 extern void dwarfout_finish            PARAMS ((void));
 
 extern void dwarfout_define            PARAMS ((unsigned, const char *));
index 287cd28..5dace5b 100644 (file)
@@ -6077,7 +6077,7 @@ expand_expr (exp, target, tmode, modifier)
     case EXPR_WITH_FILE_LOCATION:
       {
        rtx to_return;
-       char *saved_input_filename = input_filename;
+       const char *saved_input_filename = input_filename;
        int saved_lineno = lineno;
        input_filename = EXPR_WFL_FILENAME (exp);
        lineno = EXPR_WFL_LINENO (exp);
index 5c95ba1..c33a790 100644 (file)
@@ -1,3 +1,21 @@
+2000-05-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * com.c (ffecom_subscript_check_): Constify array_name
+       parameter. Clean up string bashing.
+       (ffecom_arrayref_, ffecom_char_args_x_): Constify array_name
+       parameter.
+       (ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_,
+       ffecom_sym_transform_, ffecom_sym_transform_assign_): Constify
+       local char *.
+       (init_parse): Constify parameter and return value.
+       * lex.c: Include dwarfout.h instead of prototyping dwarfout_*
+       functions here.
+       (ffelex_file_pop_, ffelex_file_push_): Constify filename parameter.
+       (ffelex_hash_, ffelex_include_): Constify local char *.
+       * std.c (ffestd_exec_end): Constify local char *.
+       * where.c (ffewhere_file_new): Constify filename parameter.
+       * where.h: Update prototypes.
+
 2000-05-06  Zack Weinberg  <zack@wolery.cumb.org>
 
        * com.c (ffecom_overlap_): Set source_offset to
index d1ddd62..c533330 100644 (file)
@@ -712,7 +712,7 @@ static tree shadowed_labels;
 
 static tree
 ffecom_subscript_check_ (tree array, tree element, int dim, int total_dims,
-                        char *array_name)
+                        const char *array_name)
 {
   tree low = TYPE_MIN_VALUE (TYPE_DOMAIN (array));
   tree high = TYPE_MAX_VALUE (TYPE_DOMAIN (array));
@@ -762,31 +762,30 @@ ffecom_subscript_check_ (tree array, tree element, int dim, int total_dims,
       {
       case 0:
        var = xmalloc (strlen (array_name) + 20);
-       sprintf (&var[0], "%s[%s-substring]",
+       sprintf (var, "%s[%s-substring]",
                 array_name,
                 dim ? "end" : "start");
        len = strlen (var) + 1;
+       arg1 = build_string (len, var);
+       free (var);
        break;
 
       case 1:
        len = strlen (array_name) + 1;
-       var = array_name;
+       arg1 = build_string (len, array_name);
        break;
 
       default:
        var = xmalloc (strlen (array_name) + 40);
-       sprintf (&var[0], "%s[subscript-%d-of-%d]",
+       sprintf (var, "%s[subscript-%d-of-%d]",
                 array_name,
                 dim + 1, total_dims);
        len = strlen (var) + 1;
+       arg1 = build_string (len, var);
+       free (var);
        break;
       }
 
-    arg1 = build_string (len, var);
-
-    if (total_dims != 1)
-      free (var);
-
     TREE_TYPE (arg1)
       = build_type_variant (build_array_type (char_type_node,
                                              build_range_type
@@ -877,7 +876,7 @@ ffecom_arrayref_ (tree item, ffebld expr, int want_ptr)
   tree element;
   tree tree_type;
   tree tree_type_x;
-  char *array_name;
+  const char *array_name;
   ffetype type;
   ffebld list;
 
@@ -2072,7 +2071,7 @@ ffecom_char_args_x_ (tree *xitem, tree *length, ffebld expr, bool with_null)
        ffebld thing = ffebld_right (expr);
        tree start_tree;
        tree end_tree;
-       char *char_name;
+       const char *char_name;
        ffebld left_symter;
        tree array;
 
@@ -2678,7 +2677,7 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum)
   bool altreturning = FALSE;   /* This entry point has alternate returns. */
   int yes;
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
 
   input_filename = ffesymbol_where_filename (fn);
   lineno = ffesymbol_where_filelinenum (fn);
@@ -6262,7 +6261,7 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt)
   static bool recurse = FALSE;
   int yes;
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
 
   ffecom_nested_entry_ = s;
 
@@ -7292,7 +7291,7 @@ ffecom_start_progunit_ ()
   && (ffecom_master_bt_ == FFEINFO_basictypeNONE);
   bool main_program = FALSE;
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
   int yes;
 
   assert (fn != NULL);
@@ -7528,7 +7527,7 @@ ffecom_sym_transform_ (ffesymbol s)
   ffeglobal g;
   int yes;
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
 
   /* Must ensure special ASSIGN variables are declared at top of outermost
      block, else they'll end up in the innermost block when their first
@@ -8575,7 +8574,7 @@ ffecom_sym_transform_assign_ (ffesymbol s)
   tree t;                      /* Transformed thingy. */
   int yes;
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
 
   if (ffesymbol_sfdummyparent (s) == NULL)
     {
@@ -14770,9 +14769,9 @@ init_decl_processing ()
   ffe_init_0 ();
 }
 
-char *
+const char *
 init_parse (filename)
-     char *filename;
+     const char *filename;
 {
   /* Open input file.  */
   if (filename == 0 || !strcmp (filename, "-"))
index a79bab3..0370637 100644 (file)
@@ -36,11 +36,8 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #endif
 
 #ifdef DWARF_DEBUGGING_INFO
-void dwarfout_resume_previous_source_file (register unsigned);
-void dwarfout_start_new_source_file (register char *);
-void dwarfout_define (register unsigned, register char *);
-void dwarfout_undef (register unsigned, register char *);
-#endif DWARF_DEBUGGING_INFO
+#include "dwarfout.h"
+#endif
 
 static void ffelex_append_to_token_ (char c);
 static int ffelex_backslash_ (int c, ffewhereColumnNumber col);
@@ -856,7 +853,7 @@ ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c)
 
 #if FFECOM_targetCURRENT == FFECOM_targetGCC
 static void
-ffelex_file_pop_ (char *input_filename)
+ffelex_file_pop_ (const char *input_filename)
 {
   if (input_file_stack->next)
     {
@@ -882,7 +879,7 @@ ffelex_file_pop_ (char *input_filename)
 #endif
 #if FFECOM_targetCURRENT == FFECOM_targetGCC
 static void
-ffelex_file_push_ (int old_lineno, char *input_filename)
+ffelex_file_push_ (int old_lineno, const char *input_filename)
 {
   struct file_stack *p
     = (struct file_stack *) xmalloc (sizeof (struct file_stack));
@@ -1282,7 +1279,7 @@ ffelex_hash_ (FILE *finput)
       && (ffelex_token_type (token) == FFELEX_typeNUMBER))
     {
       int old_lineno = lineno;
-      char *old_input_filename = input_filename;
+      const char *old_input_filename = input_filename;
       ffewhereFile wf;
 
       /* subtract one, because it is the following line that
@@ -1554,7 +1551,7 @@ ffelex_include_ ()
     = ffewhere_line_filelinenum (current_wl);
 #if FFECOM_targetCURRENT == FFECOM_targetGCC
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
 #endif
 
   if (card_length != 0)
index 5811803..8610b9c 100644 (file)
@@ -1500,7 +1500,7 @@ ffestd_exec_end ()
 {
 #if FFECOM_targetCURRENT == FFECOM_targetGCC
   int old_lineno = lineno;
-  char *old_input_filename = input_filename;
+  const char *old_input_filename = input_filename;
 #endif
 
   ffecom_end_transition ();
index 931191a..0fafa75 100644 (file)
@@ -161,7 +161,7 @@ ffewhere_file_kill (ffewhereFile wf)
 /* Create file object.  */
 
 ffewhereFile
-ffewhere_file_new (char *name, size_t length)
+ffewhere_file_new (const char *name, size_t length)
 {
   ffewhereFile wf;
   int filepos;
index 32b3d4b..efda13a 100644 (file)
@@ -89,7 +89,7 @@ extern struct _ffewhere_line_ ffewhere_unknown_line_;
 /* Declare functions with prototypes. */
 
 void ffewhere_file_kill (ffewhereFile wf);
-ffewhereFile ffewhere_file_new (char *name, size_t length);
+ffewhereFile ffewhere_file_new (const char *name, size_t length);
 void ffewhere_file_set (ffewhereFile wf, bool have_num, ffewhereLineNumber ln);
 void ffewhere_init_1 (void);
 char *ffewhere_line_content (ffewhereLine l);
index 3ed4a31..9ca120c 100644 (file)
@@ -20,7 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 /* Name of the input .c file being compiled.  */
-extern char *main_input_filename;
+extern const char *main_input_filename;
 
 enum debug_info_type
 {
index a0038d1..9fd40cc 100644 (file)
@@ -6391,7 +6391,7 @@ use_return_register ()
 
 void
 expand_function_end (filename, line, end_bindings)
-     char *filename;
+     const char *filename;
      int line;
      int end_bindings;
 {
index e3952ff..270e4ed 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -146,11 +146,11 @@ static int save_temps_flag;
 
 /* The compiler version.  */
 
-static char *compiler_version;
+static const char *compiler_version;
 
 /* The target version specified with -V */
 
-static char *spec_version = DEFAULT_TARGET_VERSION;
+static const char *spec_version = DEFAULT_TARGET_VERSION;
 
 /* The target machine specified with -b.  */
 
@@ -160,9 +160,9 @@ static const char *spec_machine = DEFAULT_TARGET_MACHINE;
    When -b is used, the value comes from the `specs' file.  */
 
 #ifdef CROSS_COMPILE
-static char *cross_compile = "1";
+static const char *cross_compile = "1";
 #else
-static char *cross_compile = "0";
+static const char *cross_compile = "0";
 #endif
 
 /* The number of errors that have occurred; the link phase will not be
@@ -493,29 +493,29 @@ proper position among the other output files.  */
 #define LINKER_NAME "collect2"
 #endif
 
-static char *cpp_spec = CPP_SPEC;
-static char *cpp_predefines = CPP_PREDEFINES;
-static char *cc1_spec = CC1_SPEC;
-static char *cc1plus_spec = CC1PLUS_SPEC;
-static char *signed_char_spec = SIGNED_CHAR_SPEC;
-static char *asm_spec = ASM_SPEC;
-static char *asm_final_spec = ASM_FINAL_SPEC;
-static char *link_spec = LINK_SPEC;
-static char *lib_spec = LIB_SPEC;
-static char *libgcc_spec = LIBGCC_SPEC;
-static char *endfile_spec = ENDFILE_SPEC;
-static char *startfile_spec = STARTFILE_SPEC;
-static char *switches_need_spaces = SWITCHES_NEED_SPACES;
-static char *linker_name_spec = LINKER_NAME;
+static const char *cpp_spec = CPP_SPEC;
+static const char *cpp_predefines = CPP_PREDEFINES;
+static const char *cc1_spec = CC1_SPEC;
+static const char *cc1plus_spec = CC1PLUS_SPEC;
+static const char *signed_char_spec = SIGNED_CHAR_SPEC;
+static const char *asm_spec = ASM_SPEC;
+static const char *asm_final_spec = ASM_FINAL_SPEC;
+static const char *link_spec = LINK_SPEC;
+static const char *lib_spec = LIB_SPEC;
+static const char *libgcc_spec = LIBGCC_SPEC;
+static const char *endfile_spec = ENDFILE_SPEC;
+static const char *startfile_spec = STARTFILE_SPEC;
+static const char *switches_need_spaces = SWITCHES_NEED_SPACES;
+static const char *linker_name_spec = LINKER_NAME;
 
 /* Some compilers have limits on line lengths, and the multilib_select
    and/or multilib_matches strings can be very long, so we build them at
    run time.  */
 static struct obstack multilib_obstack;
-static char *multilib_select;
-static char *multilib_matches;
-static char *multilib_defaults;
-static char *multilib_exclusions;
+static const char *multilib_select;
+static const char *multilib_matches;
+static const char *multilib_defaults;
+static const char *multilib_exclusions;
 #include "multilib.h"
 
 /* Check whether a particular argument is a default argument.  */
@@ -1119,12 +1119,12 @@ struct spec_list
 {
                                /* The following 2 fields must be first */
                                /* to allow EXTRA_SPECS to be initialized */
-  char *name;                  /* name of the spec.  */
-  char *ptr;                   /* available ptr if no static pointer */
+  const char *name;            /* name of the spec.  */
+  const char *ptr;             /* available ptr if no static pointer */
 
                                /* The following fields are not initialized */
                                /* by EXTRA_SPECS */
-  char **ptr_spec;             /* pointer to the spec itself.  */
+  const char **ptr_spec;       /* pointer to the spec itself.  */
   struct spec_list *next;      /* Next spec in linked list.  */
   int name_len;                        /* length of the name */
   int alloc_p;                 /* whether string was allocated */
@@ -1164,8 +1164,8 @@ static struct spec_list static_specs[] =
    That is all that the EXTRA_SPECS macro gives us.  */
 struct spec_list_1
 {
-  char *name;
-  char *ptr;
+  const char *name;
+  const char *ptr;
 };
 
 static struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS };
@@ -1230,7 +1230,7 @@ set_spec (name, spec)
      const char *spec;
 {
   struct spec_list *sl;
-  char *old_spec;
+  const char *old_spec;
   int name_len = strlen (name);
   int i;
 
@@ -1278,7 +1278,7 @@ set_spec (name, spec)
 
   /* Free the old spec.  */
   if (old_spec && sl->alloc_p)
-    free (old_spec);
+    free ((PTR) old_spec);
 
   sl->alloc_p = 1;
 }
@@ -1413,7 +1413,7 @@ static const char *tooldir_prefix;
 #ifndef STANDARD_BINDIR_PREFIX
 #define STANDARD_BINDIR_PREFIX "/usr/local/bin"
 #endif
-static char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
+static const char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
 
 /* Subdirectory to use for locating libraries.  Set by
    set_multilib_dir based on the compilation options.  */
@@ -1657,7 +1657,7 @@ read_specs (filename, main_p)
 
              set_spec (p2, *(sl->ptr_spec));
              if (sl->alloc_p)
-               free (*(sl->ptr_spec));
+               free ((PTR) *(sl->ptr_spec));
 
              *(sl->ptr_spec) = "";
              sl->alloc_p = 0;
@@ -4291,7 +4291,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
            {
              char *x = (char *) alloca (strlen (cpp_predefines) + 1);
              char *buf = x;
-             char *y;
+             const char *y;
 
              /* Copy all of the -D options in CPP_PREDEFINES into BUF.  */
              y = cpp_predefines;
@@ -4321,7 +4321,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
            {
              char *x = (char *) alloca (strlen (cpp_predefines) * 4 + 1);
              char *buf = x;
-             char *y;
+             const char *y;
 
              /* Copy all of CPP_PREDEFINES into BUF,
                 but force them all into the reserved name space if they
@@ -4567,8 +4567,8 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          case 'v':
            {
              int c1 = *p++;  /* Select first or second version number.  */
-             char *v = compiler_version;
-             char *q;
+             const char *v = compiler_version;
+             const char *q;
              static const char zeroc = '0';
 
              /* The format of the version string is
@@ -5172,7 +5172,7 @@ main (argc, argv)
   /* Build multilib_select, et. al from the separate lines that make up each
      multilib selection.  */
   {
-    char **q = multilib_raw;
+    const char *const *q = multilib_raw;
     int need_space;
 
     obstack_init (&multilib_obstack);
@@ -5948,8 +5948,8 @@ used_arg (p, len)
 {
   struct mswitchstr
   {
-    char *str;
-    char *replace;
+    const char *str;
+    const char *replace;
     int len;
     int rep_len;
   };
@@ -5961,7 +5961,7 @@ used_arg (p, len)
   if (!mswitches)
     {
       struct mswitchstr *matches;
-      char *q;
+      const char *q;
       int cnt = 0;
 
       /* Break multilib_matches into the component strings of string and replacement
@@ -5982,7 +5982,6 @@ used_arg (p, len)
                abort ();
              q++;
            }
-         *q = '\0';
          matches[i].len = q - matches[i].str;
 
          matches[i].replace = ++q;
@@ -5994,9 +5993,7 @@ used_arg (p, len)
            }
          matches[i].rep_len = q - matches[i].replace;
          i++;
-         if (*q == ';')
-           *q++ = '\0';
-         else
+         if (*q != ';')
            break;
        }
 
@@ -6011,7 +6008,8 @@ used_arg (p, len)
        {
          int xlen = strlen (switches[i].part1);
          for (j = 0; j < cnt; j++)
-           if (xlen == matches[j].len && ! strcmp (switches[i].part1, matches[j].str))
+           if (xlen == matches[j].len
+               && ! strncmp (switches[i].part1, matches[j].str, xlen))
              {
                mswitches[n_mswitches].str = matches[j].replace;
                mswitches[n_mswitches].len = matches[j].rep_len;
@@ -6035,7 +6033,7 @@ default_arg (p, len)
      const char *p;
      int len;
 {
-  char *start, *end;
+  const char *start, *end;
 
   for (start = multilib_defaults; *start != '\0'; start = end+1)
     {
@@ -6072,9 +6070,9 @@ default_arg (p, len)
 static void
 set_multilib_dir ()
 {
-  char *p;
+  const char *p;
   unsigned int this_path_len;
-  char *this_path, *this_arg;
+  const char *this_path, *this_arg;
   int not_arg;
   int ok;
 
@@ -6229,8 +6227,8 @@ set_multilib_dir ()
 static void
 print_multilib_info ()
 {
-  char *p = multilib_select;
-  char *last_path = 0, *this_path;
+  const char *p = multilib_select;
+  const char *last_path = 0, *this_path;
   int skip;
   unsigned int last_path_len = 0;
 
@@ -6257,8 +6255,8 @@ print_multilib_info ()
          with the '!' in either list. If any of the exclusion rules match
          all of its options with the select rule, we skip it.  */
         {
-          char *e = multilib_exclusions;
-         char *this_arg;
+          const char *e = multilib_exclusions;
+         const char *this_arg;
 
          while (*e != '\0')
            {
@@ -6273,7 +6271,7 @@ print_multilib_info ()
              /* Check the arguments.  */
              while (*e != ';')
                {
-                 char *q;
+                 const char *q;
                  int mp = 0;
 
                  if (*e == '\0')
@@ -6297,7 +6295,7 @@ print_multilib_info ()
                  q = p + 1;
                  while (*q != ';')
                    {
-                     char *arg;
+                     const char *arg;
                      int len = e - this_arg;
 
                      if (*q == '\0')
@@ -6356,12 +6354,12 @@ print_multilib_info ()
         this one which does not require that default argument.  */
       if (! skip)
        {
-         char *q;
+         const char *q;
 
          q = p + 1;
          while (*q != ';')
            {
-             char *arg;
+             const char *arg;
 
              if (*q == '\0')
                abort ();
@@ -6392,7 +6390,7 @@ print_multilib_info ()
 
       if (! skip)
        {
-         char *p1;
+         const char *p1;
 
          for (p1 = last_path; p1 < p; p1++)
            putchar (*p1);
@@ -6437,7 +6435,7 @@ print_multilib_info ()
          if (multilib_extra && *multilib_extra)
            {
              int print_at = TRUE;
-             char *q;
+             const char *q;
 
              for (q = multilib_extra; *q != '\0'; q++)
                {
index 6610b7b..4ff64bb 100644 (file)
@@ -107,7 +107,7 @@ exceptions=$4
 extra=$5
 exclusions=$6
 
-echo "static char *multilib_raw[] = {"
+echo "static const char *const multilib_raw[] = {"
 
 # What we want to do is select all combinations of the sets in
 # options.  Each combination which includes a set of mutually
@@ -285,7 +285,7 @@ echo "};"
 # Note, the format of the matches is reversed compared
 # to what we want, so switch them around.
 echo ""
-echo "static char *multilib_matches_raw[] = {"
+echo "static const char *const multilib_matches_raw[] = {"
 for match in ${matches}; do
   l=`echo ${match} | sed -e 's/=.*$//' -e 's/?/=/g'`
   r=`echo ${match} | sed -e 's/^.*=//' -e 's/?/=/g'`
@@ -301,11 +301,11 @@ echo "};"
 
 # Output the default options now
 echo ""
-echo "static char *multilib_extra = \"${extra}\";"
+echo "static const char *multilib_extra = \"${extra}\";"
 
 # Output the exclusion rules now
 echo ""
-echo "static char *multilib_exclusions_raw[] = {"
+echo "static const char *const multilib_exclusions_raw[] = {"
 for rule in ${exclusions}; do
   s=`echo ${rule} | sed -e 's,/, ,g'`
   echo "\"${s};\","
index 3cc438c..5d8bb59 100644 (file)
@@ -2281,10 +2281,11 @@ make_insn_sequence (insn, type)
   struct decision *last;
   struct decision_test *test, **place;
   struct decision_head head;
-  char *c_test_pos = "";
+  char c_test_pos[2];
 
   record_insn_name (next_insn_code, (type == RECOG ? XSTR (insn, 0) : NULL));
 
+  c_test_pos[0] = '\0';
   if (type == PEEPHOLE2)
     {
       int i, j;
@@ -2307,7 +2308,6 @@ make_insn_sequence (insn, type)
        }
       XVECLEN (x, 0) = j;
 
-      c_test_pos = alloca (2);
       c_test_pos[0] = 'A' + j - 1;
       c_test_pos[1] = '\0';
     }
@@ -2473,8 +2473,6 @@ main (argc, argv)
 {
   rtx desc;
   struct decision_head recog_tree, split_tree, peephole2_tree, h;
-  FILE *infile;
-  register int c;
 
   progname = "genrecog";
 
index 3aee605..32d49b9 100644 (file)
@@ -20,10 +20,10 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 /* Source file current line is coming from.  */
-extern char *input_filename;
+extern const char *input_filename;
 
 /* Top-level source file.  */
-extern char *main_input_filename;
+extern const char *main_input_filename;
 
 /* Line number in current source file.  */
 extern int lineno;
@@ -33,7 +33,7 @@ extern FILE *finput;
 
 struct file_stack
   {
-    char *name;
+    const char *name;
     struct file_stack *next;
     int line;
     int indent_level;
@@ -46,5 +46,5 @@ extern struct file_stack *input_file_stack;
 /* Incremented on each change to input_file_stack.  */
 extern int input_file_stack_tick;
 
-extern void push_srcloc PARAMS ((char *name, int line));
+extern void push_srcloc PARAMS ((const char *name, int line));
 extern void pop_srcloc PARAMS ((void));
index 0fc8b70..2f7aff9 100644 (file)
@@ -1,3 +1,26 @@
+2000-05-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * check_init.c (check_init): Constify local char *.
+       * class.c (push_class): Constify local char *.
+       * java_tree.h: Update prototypes.
+       * jcf-io.c (open_class): Constify filename parameter and
+       return value.
+       (find_class): Remove redundant string copy.  Cast return from
+       open_class.
+       * jcf-parse.c (read_class, parse_class_file, yyparse):
+       Constify local char *.
+       * jcf-write.c (generate_bytecode_insns, generate_classfile):
+       Constify local char *.
+       * jcf.h (JCF): Constify filename and classname.
+       (JCF_FINISH): Cast args to FREE to char * when appropriate.
+       * lang.c (init_parse): Constify parameter and return value.
+       * lex.c (java_get_line_col): Constify filename parameter.
+       * parse.h: Constify parser_ctxt.filename.  Update prototypes.
+       * parse.y (java_parser_context_suspend,
+       issue_warning_error_from_context, safe_layout_class): Constify
+       local char *.
+       * parse.c: Regenerate.
+
 2000-05-08  Tom Tromey  <tromey@cygnus.com>
 
        * expr.c (build_jni_stub): Cache the result of
index fed19a7..24be236 100644 (file)
@@ -711,7 +711,7 @@ check_init (exp, before)
 
     case EXPR_WITH_FILE_LOCATION:
       {
-       char *saved_input_filename = input_filename;
+       const char *saved_input_filename = input_filename;
        tree saved_wfl = wfl;
        tree body = EXPR_WFL_NODE (exp);
        int saved_lineno = lineno;
index ca29eb9..21232e7 100644 (file)
@@ -320,7 +320,7 @@ push_class (class_type, class_name)
      tree class_type, class_name;
 {
   tree decl, signature;
-  char *save_input_filename = input_filename;
+  const char *save_input_filename = input_filename;
   int save_lineno = lineno;
   tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
   push_obstacks (&permanent_obstack, &permanent_obstack);
index 2820f5d..e0b594e 100644 (file)
@@ -758,9 +758,11 @@ extern void jcf_print_char PARAMS ((FILE *, int));
 extern void jcf_print_utf8_replace PARAMS ((FILE *, const unsigned char *,
                                           int, int, int));
 # if JCF_USE_STDIO
-extern char* open_class PARAMS ((char *, struct JCF *, FILE *, const char *));
+extern const char* open_class PARAMS ((const char *, struct JCF *,
+                                      FILE *, const char *));
 # else
-extern char* open_class PARAMS ((char *, struct JCF *, int, const char *));
+extern const char* open_class PARAMS ((const char *, struct JCF *,
+                                      int, const char *));
 # endif /* JCF_USE_STDIO */
 #endif
 void java_debug_context PARAMS ((void));
index 38ed908..b4f4e2e 100644 (file)
@@ -183,9 +183,10 @@ DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system),
 }
 
 #if JCF_USE_STDIO
-char*
+const char *
 DEFUN(open_class, (filename, jcf, stream, dep_name),
-      char *filename AND JCF *jcf AND FILE* stream AND const char *dep_name)
+      const char *filename AND JCF *jcf AND FILE* stream
+      AND const char *dep_name)
 {
   if (jcf)
     {
@@ -204,9 +205,9 @@ DEFUN(open_class, (filename, jcf, stream, dep_name),
   return filename;
 }
 #else
-char*
+const char *
 DEFUN(open_class, (filename, jcf, fd, dep_name),
-      char *filename AND JCF *jcf AND int fd AND const char *dep_name)
+      const char *filename AND JCF *jcf AND int fd AND const char *dep_name)
 {
   if (jcf)
     {
@@ -441,9 +442,7 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
       close (fd);              /* We use STDIO for source file */
     }
   else
-    buffer = open_class (buffer, jcf, fd, dep_file);
-  jcf->classname = (char *) ALLOC (classname_length + 1);
-  strncpy (jcf->classname, classname, classname_length + 1);
+    buffer = (char *) open_class (buffer, jcf, fd, dep_file);
   jcf->classname = xstrdup (classname);
   return buffer;
 #endif
index 6d4f246..cd0f283 100644 (file)
@@ -481,7 +481,7 @@ read_class (name)
 {
   JCF this_jcf, *jcf;
   tree save_current_class = current_class;
-  char *save_input_filename = input_filename;
+  const char *save_input_filename = input_filename;
   JCF *save_current_jcf = current_jcf;
   long saved_pos = 0;
   if (current_jcf->read_state)
@@ -665,7 +665,7 @@ static void
 parse_class_file ()
 {
   tree method;
-  char *save_input_filename = input_filename;
+  const char *save_input_filename = input_filename;
   int save_lineno = lineno;
 
   java_layout_seen_class_methods ();
@@ -841,7 +841,7 @@ yyparse ()
 
          if (twice)
            {
-             char *saved_input_filename = input_filename;
+             const char *saved_input_filename = input_filename;
              input_filename = value;
              warning ("source file seen twice on command line and will be compiled only once.");
              input_filename = saved_input_filename;
index 61ff0fd..3b93e51 100644 (file)
@@ -1479,7 +1479,7 @@ generate_bytecode_insns (exp, target, state)
       break;
     case EXPR_WITH_FILE_LOCATION:
       {
-       char *saved_input_filename = input_filename;
+       const char *saved_input_filename = input_filename;
        tree body = EXPR_WFL_NODE (exp);
        int saved_lineno = lineno;
        if (body == empty_stmt_node)
@@ -2796,7 +2796,7 @@ generate_classfile (clas, state)
      struct jcf_partial *state;
 {
   struct chunk *cpool_chunk;
-  char *source_file;
+  const char *source_file, *s;
   char *ptr;
   int i;
   char *fields_count_ptr;
@@ -3064,13 +3064,13 @@ generate_classfile (clas, state)
   ptr = methods_count_ptr;  UNSAFE_PUT2 (methods_count);
 
   source_file = DECL_SOURCE_FILE (TYPE_NAME (clas));
-  for (ptr = source_file;  ;  ptr++)
+  for (s = source_file; ; s++)
     {
       char ch = *ptr;
       if (ch == '\0')
        break;
       if (ch == '/' || ch == '\\')
-       source_file = ptr+1;
+       source_file = s+1;
     }
   ptr = append_chunk (NULL, 10, state);
 
index 9bd8a7c..0fe4814 100644 (file)
@@ -95,8 +95,8 @@ typedef struct JCF {
   long zip_offset;    
   jcf_filbuf_t filbuf;
   void *read_state;
-  char *filename;
-  char *classname;
+  const char *filename;
+  const char *classname;
   void *zipd;                  /* Directory entry where it was found */
   JCF_u2 access_flags, this_class, super_class;
   CPool cpool;
@@ -144,8 +144,8 @@ typedef struct JCF {
 #define JCF_FINISH(JCF) { \
   CPOOL_FINISH(&(JCF)->cpool); \
   if ((JCF)->buffer) FREE ((JCF)->buffer); \
-  if ((JCF)->filename) FREE ((JCF)->filename); \
-  if ((JCF)->classname) FREE ((JCF)->classname); }
+  if ((JCF)->filename) FREE ((char *) (JCF)->filename); \
+  if ((JCF)->classname) FREE ((char *) (JCF)->classname); }
   
 #define CPOOL_INIT(CPOOL) \
   ((CPOOL)->capacity = 0, (CPOOL)->count = 0, (CPOOL)->tags = 0, (CPOOL)->data = 0)
index f8c37f2..4bef553 100644 (file)
@@ -303,9 +303,9 @@ lang_decode_option (argc, argv)
 }
 
 FILE *finput;
-char *
+const char *
 init_parse (filename)
-     char *filename;
+     const char *filename;
 {
   /* Open input file.  */
 
index c5de7ed..c1d4c03 100644 (file)
@@ -1363,7 +1363,7 @@ java_is_eol (fp, c)
 
 char *
 java_get_line_col (filename, line, col)
-     char *filename ATTRIBUTE_UNUSED;
+     const char *filename ATTRIBUTE_UNUSED;
      int line ATTRIBUTE_UNUSED, col ATTRIBUTE_UNUSED;
 {
 #ifdef JC1_LITE
index a362a5d..fc7a153 100644 (file)
@@ -1,7 +1,6 @@
 
 /*  A Bison parser, made from ./parse.y
- by  GNU Bison version 1.25
-  */
+    by GNU Bison version 1.28  */
 
 #define YYBISON 1  /* Identify Bison output.  */
 
 #define yychar java_char
 #define yydebug java_debug
 #define yynerrs java_nerrs
-#define        PLUS_TK 258
-#define        MINUS_TK        259
-#define        MULT_TK 260
-#define        DIV_TK  261
-#define        REM_TK  262
-#define        LS_TK   263
-#define        SRS_TK  264
-#define        ZRS_TK  265
-#define        AND_TK  266
-#define        XOR_TK  267
-#define        OR_TK   268
-#define        BOOL_AND_TK     269
-#define        BOOL_OR_TK      270
-#define        EQ_TK   271
-#define        NEQ_TK  272
-#define        GT_TK   273
-#define        GTE_TK  274
-#define        LT_TK   275
-#define        LTE_TK  276
-#define        PLUS_ASSIGN_TK  277
-#define        MINUS_ASSIGN_TK 278
-#define        MULT_ASSIGN_TK  279
-#define        DIV_ASSIGN_TK   280
-#define        REM_ASSIGN_TK   281
-#define        LS_ASSIGN_TK    282
-#define        SRS_ASSIGN_TK   283
-#define        ZRS_ASSIGN_TK   284
-#define        AND_ASSIGN_TK   285
-#define        XOR_ASSIGN_TK   286
-#define        OR_ASSIGN_TK    287
-#define        PUBLIC_TK       288
-#define        PRIVATE_TK      289
-#define        PROTECTED_TK    290
-#define        STATIC_TK       291
-#define        FINAL_TK        292
-#define        SYNCHRONIZED_TK 293
-#define        VOLATILE_TK     294
-#define        TRANSIENT_TK    295
-#define        NATIVE_TK       296
-#define        PAD_TK  297
-#define        ABSTRACT_TK     298
-#define        MODIFIER_TK     299
-#define        DECR_TK 300
-#define        INCR_TK 301
-#define        DEFAULT_TK      302
-#define        IF_TK   303
-#define        THROW_TK        304
-#define        BOOLEAN_TK      305
-#define        DO_TK   306
-#define        IMPLEMENTS_TK   307
-#define        THROWS_TK       308
-#define        BREAK_TK        309
-#define        IMPORT_TK       310
-#define        ELSE_TK 311
-#define        INSTANCEOF_TK   312
-#define        RETURN_TK       313
-#define        VOID_TK 314
-#define        CATCH_TK        315
-#define        INTERFACE_TK    316
-#define        CASE_TK 317
-#define        EXTENDS_TK      318
-#define        FINALLY_TK      319
-#define        SUPER_TK        320
-#define        WHILE_TK        321
-#define        CLASS_TK        322
-#define        SWITCH_TK       323
-#define        CONST_TK        324
-#define        TRY_TK  325
-#define        FOR_TK  326
-#define        NEW_TK  327
-#define        CONTINUE_TK     328
-#define        GOTO_TK 329
-#define        PACKAGE_TK      330
-#define        THIS_TK 331
-#define        BYTE_TK 332
-#define        SHORT_TK        333
-#define        INT_TK  334
-#define        LONG_TK 335
-#define        CHAR_TK 336
-#define        INTEGRAL_TK     337
-#define        FLOAT_TK        338
-#define        DOUBLE_TK       339
-#define        FP_TK   340
-#define        ID_TK   341
-#define        REL_QM_TK       342
-#define        REL_CL_TK       343
-#define        NOT_TK  344
-#define        NEG_TK  345
-#define        ASSIGN_ANY_TK   346
-#define        ASSIGN_TK       347
-#define        OP_TK   348
-#define        CP_TK   349
-#define        OCB_TK  350
-#define        CCB_TK  351
-#define        OSB_TK  352
-#define        CSB_TK  353
-#define        SC_TK   354
-#define        C_TK    355
-#define        DOT_TK  356
-#define        STRING_LIT_TK   357
-#define        CHAR_LIT_TK     358
-#define        INT_LIT_TK      359
-#define        FP_LIT_TK       360
-#define        TRUE_TK 361
-#define        FALSE_TK        362
-#define        BOOL_LIT_TK     363
-#define        NULL_TK 364
+#define        PLUS_TK 257
+#define        MINUS_TK        258
+#define        MULT_TK 259
+#define        DIV_TK  260
+#define        REM_TK  261
+#define        LS_TK   262
+#define        SRS_TK  263
+#define        ZRS_TK  264
+#define        AND_TK  265
+#define        XOR_TK  266
+#define        OR_TK   267
+#define        BOOL_AND_TK     268
+#define        BOOL_OR_TK      269
+#define        EQ_TK   270
+#define        NEQ_TK  271
+#define        GT_TK   272
+#define        GTE_TK  273
+#define        LT_TK   274
+#define        LTE_TK  275
+#define        PLUS_ASSIGN_TK  276
+#define        MINUS_ASSIGN_TK 277
+#define        MULT_ASSIGN_TK  278
+#define        DIV_ASSIGN_TK   279
+#define        REM_ASSIGN_TK   280
+#define        LS_ASSIGN_TK    281
+#define        SRS_ASSIGN_TK   282
+#define        ZRS_ASSIGN_TK   283
+#define        AND_ASSIGN_TK   284
+#define        XOR_ASSIGN_TK   285
+#define        OR_ASSIGN_TK    286
+#define        PUBLIC_TK       287
+#define        PRIVATE_TK      288
+#define        PROTECTED_TK    289
+#define        STATIC_TK       290
+#define        FINAL_TK        291
+#define        SYNCHRONIZED_TK 292
+#define        VOLATILE_TK     293
+#define        TRANSIENT_TK    294
+#define        NATIVE_TK       295
+#define        PAD_TK  296
+#define        ABSTRACT_TK     297
+#define        MODIFIER_TK     298
+#define        DECR_TK 299
+#define        INCR_TK 300
+#define        DEFAULT_TK      301
+#define        IF_TK   302
+#define        THROW_TK        303
+#define        BOOLEAN_TK      304
+#define        DO_TK   305
+#define        IMPLEMENTS_TK   306
+#define        THROWS_TK       307
+#define        BREAK_TK        308
+#define        IMPORT_TK       309
+#define        ELSE_TK 310
+#define        INSTANCEOF_TK   311
+#define        RETURN_TK       312
+#define        VOID_TK 313
+#define        CATCH_TK        314
+#define        INTERFACE_TK    315
+#define        CASE_TK 316
+#define        EXTENDS_TK      317
+#define        FINALLY_TK      318
+#define        SUPER_TK        319
+#define        WHILE_TK        320
+#define        CLASS_TK        321
+#define        SWITCH_TK       322
+#define        CONST_TK        323
+#define        TRY_TK  324
+#define        FOR_TK  325
+#define        NEW_TK  326
+#define        CONTINUE_TK     327
+#define        GOTO_TK 328
+#define        PACKAGE_TK      329
+#define        THIS_TK 330
+#define        BYTE_TK 331
+#define        SHORT_TK        332
+#define        INT_TK  333
+#define        LONG_TK 334
+#define        CHAR_TK 335
+#define        INTEGRAL_TK     336
+#define        FLOAT_TK        337
+#define        DOUBLE_TK       338
+#define        FP_TK   339
+#define        ID_TK   340
+#define        REL_QM_TK       341
+#define        REL_CL_TK       342
+#define        NOT_TK  343
+#define        NEG_TK  344
+#define        ASSIGN_ANY_TK   345
+#define        ASSIGN_TK       346
+#define        OP_TK   347
+#define        CP_TK   348
+#define        OCB_TK  349
+#define        CCB_TK  350
+#define        OSB_TK  351
+#define        CSB_TK  352
+#define        SC_TK   353
+#define        C_TK    354
+#define        DOT_TK  355
+#define        STRING_LIT_TK   356
+#define        CHAR_LIT_TK     357
+#define        INT_LIT_TK      358
+#define        FP_LIT_TK       359
+#define        TRUE_TK 360
+#define        FALSE_TK        361
+#define        BOOL_LIT_TK     362
+#define        NULL_TK 363
 
 #line 48 "./parse.y"
 
@@ -517,7 +516,7 @@ typedef union {
 #define        YYFLAG          -32768
 #define        YYNTBASE        110
 
-#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 272)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 272)
 
 static const char yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -545,18 +544,18 @@ static const char yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
-     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
-    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
-    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
-    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
-    96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
-   106,   107,   108,   109
+     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
+     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
+    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
+    47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
+    57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
+    67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
+    77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
+    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+    97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
+   107,   108,   109
 };
 
 #if YYDEBUG != 0
@@ -2388,6 +2387,7 @@ static const short yycheck[] = {     3,
 
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #line 3 "/usr/share/misc/bison.simple"
+/* This file comes from bison-1.28.  */
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2404,46 +2404,66 @@ static const short yycheck[] = {     3,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
    This special exception was added by the Free Software Foundation
    in version 1.24 of Bison.  */
 
-#ifndef alloca
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
+
+#ifndef YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
 #ifdef __GNUC__
+#define YYSTACK_USE_ALLOCA
 #define alloca __builtin_alloca
 #else /* not GNU C.  */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define YYSTACK_USE_ALLOCA
 #include <alloca.h>
 #else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
+/* We think this test detects Watcom and Microsoft C.  */
+/* This used to test MSDOS, but that is a bad idea
+   since that symbol is in the user namespace.  */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+        instead, just don't use alloca.  */
 #include <malloc.h>
+#endif
 #else /* not MSDOS, or __TURBOC__ */
 #if defined(_AIX)
-#include <malloc.h>
+/* I don't know what this was needed for, but it pollutes the namespace.
+   So I turned it off.   rms, 2 May 1997.  */
+/* #include <malloc.h>  */
  #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
+#define YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+                and on HPUX 10.  Eventually we can turn this on.  */
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
 #endif /* __hpux */
+#endif
 #endif /* not _AIX */
 #endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc.  */
-#endif /* not GNU C.  */
-#endif /* alloca not defined.  */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* YYSTACK_USE_ALLOCA not defined */
 
-/* This is the parser code that is written into each bison parser
-  when the %semantic_parser declaration is not specified in the grammar.
-  It was written by Richard Stallman by simplifying the hairy parser
-  used when %semantic_parser is specified.  */
+#ifdef YYSTACK_USE_ALLOCA
+#define YYSTACK_ALLOC alloca
+#else
+#define YYSTACK_ALLOC malloc
+#endif
 
 /* Note: there must be only one dollar sign in this file.
    It is replaced by the list of actions, each action
@@ -2453,8 +2473,8 @@ void *alloca ();
 #define yyclearin      (yychar = YYEMPTY)
 #define YYEMPTY                -2
 #define YYEOF          0
-#define YYACCEPT       return(0)
-#define YYABORT        return(1)
+#define YYACCEPT       goto yyacceptlab
+#define YYABORT        goto yyabortlab
 #define YYERROR                goto yyerrlab1
 /* Like YYERROR except do call yyerror.
    This remains here temporarily to ease the
@@ -2535,14 +2555,12 @@ int yydebug;                    /*  nonzero means print parse trace     */
 #ifndef YYMAXDEPTH
 #define YYMAXDEPTH 10000
 #endif
-
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-#ifndef YYPARSE_PARAM
-int yyparse (void);
-#endif
-#endif
 \f
+/* Define __yy_memcpy.  Note that the size argument
+   should be passed with type unsigned int, because that is what the non-GCC
+   definitions require.  With GCC, __builtin_memcpy takes an arg
+   of type size_t, but it can handle unsigned int.  */
+
 #if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
 #define __yy_memcpy(TO,FROM,COUNT)     __builtin_memcpy(TO,FROM,COUNT)
 #else                          /* not GNU C or C++ */
@@ -2554,7 +2572,7 @@ static void
 __yy_memcpy (to, from, count)
      char *to;
      char *from;
-     int count;
+     unsigned int count;
 {
   register char *f = from;
   register char *t = to;
@@ -2569,10 +2587,10 @@ __yy_memcpy (to, from, count)
 /* This is the most reliable way to avoid incompatibilities
    in available built-in functions on various systems.  */
 static void
-__yy_memcpy (char *to, char *from, int count)
+__yy_memcpy (char *to, char *from, unsigned int count)
 {
-  register char *f = from;
   register char *t = to;
+  register char *f = from;
   register int i = count;
 
   while (i-- > 0)
@@ -2582,7 +2600,7 @@ __yy_memcpy (char *to, char *from, int count)
 #endif
 #endif
 \f
-#line 196 "/usr/share/misc/bison.simple"
+#line 217 "/usr/share/misc/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -2603,6 +2621,15 @@ __yy_memcpy (char *to, char *from, int count)
 #define YYPARSE_PARAM_DECL
 #endif /* not YYPARSE_PARAM */
 
+/* Prevent warning if -Wstrict-prototypes.  */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int yyparse (void *);
+#else
+int yyparse (void);
+#endif
+#endif
+
 int
 yyparse(YYPARSE_PARAM_ARG)
      YYPARSE_PARAM_DECL
@@ -2631,6 +2658,7 @@ yyparse(YYPARSE_PARAM_ARG)
 #endif
 
   int yystacksize = YYINITDEPTH;
+  int yyfree_stacks = 0;
 
 #ifdef YYPURE
   int yychar;
@@ -2715,18 +2743,32 @@ yynewstate:
       if (yystacksize >= YYMAXDEPTH)
        {
          yyerror("parser stack overflow");
+         if (yyfree_stacks)
+           {
+             free (yyss);
+             free (yyvs);
+#ifdef YYLSP_NEEDED
+             free (yyls);
+#endif
+           }
          return 2;
        }
       yystacksize *= 2;
       if (yystacksize > YYMAXDEPTH)
        yystacksize = YYMAXDEPTH;
-      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
-      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
-      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
-      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
+#ifndef YYSTACK_USE_ALLOCA
+      yyfree_stacks = 1;
+#endif
+      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
+      __yy_memcpy ((char *)yyss, (char *)yyss1,
+                  size * (unsigned int) sizeof (*yyssp));
+      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
+      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
+                  size * (unsigned int) sizeof (*yyvsp));
 #ifdef YYLSP_NEEDED
-      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
-      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
+      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
+      __yy_memcpy ((char *)yyls, (char *)yyls1,
+                  size * (unsigned int) sizeof (*yylsp));
 #endif
 #endif /* no yyoverflow */
 
@@ -4978,7 +5020,7 @@ case 503:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/share/misc/bison.simple"
+#line 543 "/usr/share/misc/bison.simple"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -5173,6 +5215,30 @@ yyerrhandle:
 
   yystate = yyn;
   goto yynewstate;
+
+ yyacceptlab:
+  /* YYACCEPT comes here.  */
+  if (yyfree_stacks)
+    {
+      free (yyss);
+      free (yyvs);
+#ifdef YYLSP_NEEDED
+      free (yyls);
+#endif
+    }
+  return 0;
+
+ yyabortlab:
+  /* YYABORT comes here.  */
+  if (yyfree_stacks)
+    {
+      free (yyss);
+      free (yyvs);
+#ifdef YYLSP_NEEDED
+      free (yyls);
+#endif
+    }
+  return 1;
 }
 #line 2546 "./parse.y"
 
@@ -5310,7 +5376,7 @@ static void
 java_parser_context_suspend ()
 {
   /* This makes debugging through java_debug_context easier */
-  static char *name = "<inner buffer context>";
+  static const char *name = "<inner buffer context>";
 
   /* Duplicate the previous context, use it to save the globals we're
      interested in */
@@ -5597,7 +5663,7 @@ issue_warning_error_from_context (cl, msg, ap)
      const char *msg;
      va_list ap;
 {
-  char *saved, *saved_input_filename;
+  const char *saved, *saved_input_filename;
   char buffer [4096];
   vsprintf (buffer, msg, ap);
   force_error = 1;
@@ -7791,7 +7857,7 @@ safe_layout_class (class)
      tree class;
 {
   tree save_current_class = current_class;
-  char *save_input_filename = input_filename;
+  const char *save_input_filename = input_filename;
   int save_lineno = lineno;
 
   push_obstacks (&permanent_obstack, &permanent_obstack);
index a9617b3..4ffee79 100644 (file)
@@ -705,7 +705,7 @@ typedef struct _jdeplist {
 /* Parser context data structure. */
 struct parser_ctxt {
 
-  char *filename;                  /* Current filename */
+  const char *filename;                    /* Current filename */
   FILE *finput;                            /* Current file input stream */
   struct parser_ctxt *next;
 
@@ -898,7 +898,7 @@ void java_expand_switch PARAMS ((tree));
 int java_report_errors PARAMS ((void));
 extern tree do_resolve_class PARAMS ((tree, tree, tree, tree));
 #endif
-char *java_get_line_col PARAMS ((char *, int, int));
+char *java_get_line_col PARAMS ((const char *, int, int));
 extern void reset_report PARAMS ((void));
 
 /* Always in use, no matter what you compile */
index 3f5d7ce..08e1a0e 100644 (file)
@@ -2678,7 +2678,7 @@ static void
 java_parser_context_suspend ()
 {
   /* This makes debugging through java_debug_context easier */
-  static char *name = "<inner buffer context>";
+  static const char *name = "<inner buffer context>";
 
   /* Duplicate the previous context, use it to save the globals we're
      interested in */
@@ -2965,7 +2965,7 @@ issue_warning_error_from_context (cl, msg, ap)
      const char *msg;
      va_list ap;
 {
-  char *saved, *saved_input_filename;
+  const char *saved, *saved_input_filename;
   char buffer [4096];
   vsprintf (buffer, msg, ap);
   force_error = 1;
@@ -5159,7 +5159,7 @@ safe_layout_class (class)
      tree class;
 {
   tree save_current_class = current_class;
-  char *save_input_filename = input_filename;
+  const char *save_input_filename = input_filename;
   int save_lineno = lineno;
 
   push_obstacks (&permanent_obstack, &permanent_obstack);
index 2ad6d3f..5407d32 100644 (file)
@@ -1,7 +1,6 @@
 
 /*  A Bison parser, made from objc-parse.y
- by  GNU Bison version 1.27
-  */
+    by GNU Bison version 1.28  */
 
 #define YYBISON 1  /* Identify Bison output.  */
 
@@ -102,7 +101,7 @@ const char * const language_string = "GNU Obj-C";
 
 #line 66 "objc-parse.y"
 typedef union {long itype; tree ttype; enum tree_code code;
-       char *filename; int lineno; int ends_in_label; } YYSTYPE;
+       const char *filename; int lineno; int ends_in_label; } YYSTYPE;
 #line 198 "objc-parse.y"
 
 /* Number of statements (loosely speaking) and compound statements 
@@ -112,7 +111,7 @@ static int compstmt_count;
   
 /* Input file and line number of the end of the body of last simple_if;
    used by the stmt-rule immediately after simple_if returns.  */
-static char *if_stmt_file;
+static const char *if_stmt_file;
 static int if_stmt_line;
 
 /* List of types and structure classes of the current declaration.  */
@@ -1759,8 +1758,8 @@ static const short yycheck[] = {    56,
     50,    51,    52,    53,    54,    55,    56,    57
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/lib/bison.simple"
-/* This file comes from bison-1.27.  */
+#line 3 "/usr/share/misc/bison.simple"
+/* This file comes from bison-1.28.  */
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -1973,7 +1972,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
 #endif
 #endif
 \f
-#line 216 "/usr/lib/bison.simple"
+#line 217 "/usr/share/misc/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -5096,7 +5095,7 @@ case 570:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 542 "/usr/lib/bison.simple"
+#line 543 "/usr/share/misc/bison.simple"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
index 1a45295..10e135f 100644 (file)
@@ -64,7 +64,7 @@ const char * const language_string = "GNU Obj-C";
 %start program
 
 %union {long itype; tree ttype; enum tree_code code;
-       char *filename; int lineno; int ends_in_label; }
+       const char *filename; int lineno; int ends_in_label; }
 
 /* All identifiers that are not reserved words
    and are not declared typedefs in the current block */
@@ -203,7 +203,7 @@ static int compstmt_count;
   
 /* Input file and line number of the end of the body of last simple_if;
    used by the stmt-rule immediately after simple_if returns.  */
-static char *if_stmt_file;
+static const char *if_stmt_file;
 static int if_stmt_line;
 
 /* List of types and structure classes of the current declaration.  */
index 48d5a73..279a25b 100644 (file)
@@ -403,6 +403,13 @@ extern int sdb_begin_function_line;
 #ifdef BUFSIZ
 extern FILE *asm_out_file;
 #endif
+
+/* The first global object in the file.  */
+extern const char *first_global_object_name;
+
+/* The first weak object in the file.  */
+extern const char *weak_global_object_name;
+
 /* Nonzero if function being compiled doesn't contain any calls
    (ignoring the prologue and epilogue).  This is set prior to
    local register allocation and is valid for the remaining
index 88538e0..0626e2c 100644 (file)
@@ -1311,7 +1311,7 @@ void
 expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
      tree string, outputs, inputs, clobbers;
      int vol;
-     char *filename;
+     const char *filename;
      int line;
 {
   rtvec argvec, constraints;
index e780587..165073f 100644 (file)
@@ -163,7 +163,7 @@ static void pipe_closed PARAMS ((int)) ATTRIBUTE_NORETURN;
 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
 static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED;
 #endif
-static void compile_file PARAMS ((char *));
+static void compile_file PARAMS ((const char *));
 static void display_help PARAMS ((void));
 static void mark_file_stack PARAMS ((void *));
 
@@ -195,13 +195,13 @@ char **save_argv;
 /* Name of current original source file (what was input to cpp).
    This comes from each #-command in the actual input.  */
 
-char *input_filename;
+const char *input_filename;
 
 /* Name of top-level original source file (what was input to cpp).
    This comes from the #-command at the beginning of the actual input.
    If there isn't any there, then this is the cc1 input file name.  */
 
-char *main_input_filename;
+const char *main_input_filename;
 
 /* Current line number in real source file.  */
 
@@ -1992,7 +1992,7 @@ check_global_declarations (vec, len)
 
 void
 push_srcloc (file, line)
-     char *file;
+     const char *file;
      int line;
 {
   struct file_stack *fs;
@@ -2037,7 +2037,7 @@ pop_srcloc ()
 
 static void
 compile_file (name)
-     char *name;
+     const char *name;
 {
   tree globals;
 
@@ -4826,7 +4826,7 @@ print_switch_values (file, pos, max, indent, sep, term)
 
 void
 debug_start_source_file (filename)
-     register char *filename ATTRIBUTE_UNUSED;
+     register const char *filename ATTRIBUTE_UNUSED;
 {
 #ifdef DBX_DEBUGGING_INFO
   if (write_symbols == DBX_DEBUG)
index 8379532..9f7ed84 100644 (file)
@@ -31,7 +31,7 @@ extern int read_integral_parameter    PARAMS ((const char *, const char *,
 extern int count_error                 PARAMS ((int));
 extern void strip_off_ending           PARAMS ((char *, int));
 extern void print_time                 PARAMS ((const char *, long));
-extern void debug_start_source_file    PARAMS ((char *));
+extern void debug_start_source_file    PARAMS ((const char *));
 extern void debug_end_source_file      PARAMS ((unsigned));
 extern void debug_define               PARAMS ((unsigned, char *));
 extern void debug_undef                        PARAMS ((unsigned, char *));
index 9f68e60..2a0ed56 100644 (file)
@@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "ggc.h"
 #include "hashtab.h"
+#include "output.h"
 
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
@@ -5359,9 +5360,6 @@ dump_tree_statistics ()
 #endif /* NO_DOT_IN_LABEL */
 #endif /* NO_DOLLAR_IN_LABEL */
 
-extern char *first_global_object_name;
-extern char *weak_global_object_name;
-
 /* Appends 6 random characters to TEMPLATE to (hopefully) avoid name
    clashes in cases where we can't reliably choose a unique name.
 
@@ -5417,7 +5415,8 @@ get_file_function_name_long (type)
      const char *type;
 {
   char *buf;
-  register char *p;
+  const char *p;
+  char *q;
 
   if (first_global_object_name)
     p = first_global_object_name;
@@ -5434,10 +5433,11 @@ get_file_function_name_long (type)
       if (! file)
        file = input_filename;
 
-      p = (char *) alloca (7 + strlen (name) + strlen (file));
+      q = (char *) alloca (7 + strlen (name) + strlen (file));
 
-      sprintf (p, "%s%s", name, file);
-      append_random_chars (p);
+      sprintf (q, "%s%s", name, file);
+      append_random_chars (q);
+      p = q;
     }
 
   buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p)
@@ -5452,22 +5452,17 @@ get_file_function_name_long (type)
   /* Don't need to pull weird characters out of global names.  */
   if (p != first_global_object_name)
     {
-      for (p = buf+11; *p; p++)
-       if (! ( ISDIGIT(*p)
-#if 0 /* we always want labels, which are valid C++ identifiers (+ `$') */
-#ifndef ASM_IDENTIFY_GCC       /* this is required if `.' is invalid -- k. raeburn */
-              || *p == '.'
-#endif
-#endif
+      for (q = buf+11; *q; q++)
+       if (! ( ISDIGIT(*q)
 #ifndef NO_DOLLAR_IN_LABEL     /* this for `$'; unlikely, but... -- kr */
-              || *p == '$'
+              || *q == '$'
 #endif
 #ifndef NO_DOT_IN_LABEL                /* this for `.'; unlikely, but...  */
-              || *p == '.'
+              || *q == '.'
 #endif
-              || ISUPPER(*p)
-              || ISLOWER(*p)))
-         *p = '_';
+              || ISUPPER(*q)
+              || ISLOWER(*q)))
+         *q = '_';
     }
 
   return get_identifier (buf);
index 0bbf784..ccbb9c3 100644 (file)
@@ -1541,7 +1541,7 @@ struct tree_type
 struct tree_decl
 {
   char common[sizeof (struct tree_common)];
-  char *filename;
+  const char *filename;
   int linenum;
   unsigned int uid;
   union tree_node *size;
@@ -2309,7 +2309,7 @@ extern int real_zerop PARAMS ((tree));
 
 /* Points to the name of the input file from which the current input
    being parsed originally came (before it went into cpp).  */
-extern char *input_filename;
+extern const char *input_filename;
 
 /* Current line number in input file.  */
 extern int lineno;
@@ -2354,7 +2354,7 @@ extern const char *(*decl_printable_name) PARAMS ((tree, int));
 
 extern void (*incomplete_decl_finalize_hook)   PARAMS ((tree));
 
-extern char *init_parse                                PARAMS ((char *));
+extern const char *init_parse                  PARAMS ((const char *));
 extern void finish_parse                       PARAMS ((void));
 
 extern const char * const language_string;
@@ -2656,7 +2656,7 @@ extern void print_obstack_statistics      PARAMS ((const char *,
 #ifdef BUFSIZ
 extern void print_obstack_name         PARAMS ((char *, FILE *, const char *));
 #endif
-extern void expand_function_end                PARAMS ((char *, int, int));
+extern void expand_function_end                PARAMS ((const char *, int, int));
 extern void expand_function_start      PARAMS ((tree, int));
 extern int real_onep                   PARAMS ((tree));
 extern int real_twop                   PARAMS ((tree));
@@ -2790,7 +2790,7 @@ extern void emit_nop                      PARAMS ((void));
 extern void expand_computed_goto       PARAMS ((tree));
 extern struct rtx_def *label_rtx       PARAMS ((tree));
 extern void expand_asm_operands                PARAMS ((tree, tree, tree, tree, int,
-                                               char *, int));
+                                                const char *, int));
 extern int any_pending_cleanups                PARAMS ((int));
 extern void init_stmt                  PARAMS ((void));
 extern void init_stmt_for_function     PARAMS ((void));
index 3b5c314..633688e 100644 (file)
@@ -77,8 +77,8 @@ Boston, MA 02111-1307, USA.  */
 extern FILE *asm_out_file;
 
 /* The (assembler) name of the first globally-visible object output.  */
-char *first_global_object_name;
-char *weak_global_object_name;
+const char *first_global_object_name;
+const char *weak_global_object_name;
 
 extern struct obstack *current_obstack;
 extern struct obstack *saveable_obstack;
@@ -1061,16 +1061,16 @@ assemble_start_function (decl, fnname)
       if (! first_global_object_name)
        {
          const char *p;
-         char **name;
+         char *name;
+
+         STRIP_NAME_ENCODING (p, fnname);
+         name = permalloc (strlen (p) + 1);
+         strcpy (name, p);
 
          if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
-           name = &first_global_object_name;
+           first_global_object_name = name;
          else
-           name = &weak_global_object_name;
-
-         STRIP_NAME_ENCODING (p, fnname);
-         *name = permalloc (strlen (p) + 1);
-         strcpy (*name, p);
+           weak_global_object_name = name;
        }
 
 #ifdef ASM_WEAKEN_LABEL
@@ -1438,10 +1438,12 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
       && ! DECL_ONE_ONLY (decl))
     {
       const char *p;
+      char *xname;
 
       STRIP_NAME_ENCODING (p, name);
-      first_global_object_name = permalloc (strlen (p) + 1);
-      strcpy (first_global_object_name, p);
+      xname = permalloc (strlen (p) + 1);
+      strcpy (xname, p);
+      first_global_object_name = xname;
     }
 
   /* Compute the alignment of this data.  */