From: Kaveh R. Ghazi Date: Sat, 7 Aug 1999 22:28:52 +0000 (+0000) Subject: class.c (count_fields, [...]): Add static prototype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c0758dde6fff7bf6350eedda3dd9db427a44fcb;p=gcc.git class.c (count_fields, [...]): Add static prototype. * class.c (count_fields, add_fields_to_vec): Add static prototype. * cp-tree.h (opname_tab, assignop_tab, operator_name_string, get_id_2, composite_pointer_type, dump_node_to_file): Constify a char*. * decl.c (named_label_list, cp_finish_decl, grokdeclarator): Constify a char*. * decl2.c (finish_static_data_member_decl, grokfield): Constify a char*. * dump.c (queue_and_dump_index, dump_int, dump_string, dump_string_field, dequeue_and_dump, dump_node_to_file): Constify a char*. (dump_stmt): Add static prototype. * errfn.c (cp_thing): Constify a char*. * error.c (dump_unary_op, dump_binary_op, aggr_variety, dump_aggr_type, dump_global_iord, dump_decl, dump_function_name, dump_expr): Constify a char*. * lex.c (extend_token_buffer_to, pragma_getc, pragma_ungetc, read_line_number): Add static prototype. (opname_tab, assignop_tab, operator_name_string): Constify a char*. (real_yylex): Move label `letter' into the scope where it is used. * method.c (build_mangled_template_parm_index, build_overload_int, build_decl_overload_real, get_id_2): Constify a char*. * search.c (check_final_overrider): Make static. * typeck.c (composite_pointer_type): Constify a char*. From-SVN: r28588 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2840d962155..0e0b5a57ea9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,40 @@ +1999-08-07 Kaveh R. Ghazi + + * class.c (count_fields, add_fields_to_vec): Add static prototype. + + * cp-tree.h (opname_tab, assignop_tab, operator_name_string, + get_id_2, composite_pointer_type, dump_node_to_file): Constify a + char*. + + * decl.c (named_label_list, cp_finish_decl, grokdeclarator): + Constify a char*. + + * decl2.c (finish_static_data_member_decl, grokfield): Constify a + char*. + + * dump.c (queue_and_dump_index, dump_int, dump_string, + dump_string_field, dequeue_and_dump, dump_node_to_file): Constify + a char*. + (dump_stmt): Add static prototype. + + * errfn.c (cp_thing): Constify a char*. + + * error.c (dump_unary_op, dump_binary_op, aggr_variety, + dump_aggr_type, dump_global_iord, dump_decl, dump_function_name, + dump_expr): Constify a char*. + + * lex.c (extend_token_buffer_to, pragma_getc, pragma_ungetc, + read_line_number): Add static prototype. + (opname_tab, assignop_tab, operator_name_string): Constify a char*. + (real_yylex): Move label `letter' into the scope where it is used. + + * method.c (build_mangled_template_parm_index, build_overload_int, + build_decl_overload_real, get_id_2): Constify a char*. + + * search.c (check_final_overrider): Make static. + + * typeck.c (composite_pointer_type): Constify a char*. + 1999-08-06 Jason Merrill * decl.c (bad_specifiers): It's OK to have an EH spec on a function diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4f7172bc2be..28ef03fda77 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -139,6 +139,8 @@ static tree resolve_address_of_overloaded_function PROTO((tree, tree, int, static void build_vtable_entry_ref PROTO((tree, tree, tree)); static tree build_vtable_entry_for_fn PROTO((tree, tree)); static tree build_vtbl_initializer PROTO((tree)); +static int count_fields PROTO((tree)); +static int add_fields_to_vec PROTO((tree, tree, int)); /* Way of stacking language names. */ tree *current_lang_base, *current_lang_stack; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cc076a0f17b..3d38152dde5 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2801,7 +2801,7 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */ /* Indexed by TREE_CODE, these tables give C-looking names to operators represented by TREE_CODES. For example, opname_tab[(int) MINUS_EXPR] == "-". */ -extern char **opname_tab, **assignop_tab; +extern const char **opname_tab, **assignop_tab; /* in call.c */ extern int check_dtor_name PROTO((tree, tree)); @@ -3171,7 +3171,7 @@ extern tree make_pointer_declarator PROTO((tree, tree)); extern tree make_reference_declarator PROTO((tree, tree)); extern tree make_call_declarator PROTO((tree, tree, tree, tree)); extern void set_quals_and_spec PROTO((tree, tree, tree)); -extern char *operator_name_string PROTO((tree)); +extern const char *operator_name_string PROTO((tree)); extern void lang_init PROTO((void)); extern void lang_finish PROTO((void)); #if 0 @@ -3234,7 +3234,7 @@ extern tree hack_identifier PROTO((tree, tree)); extern tree make_thunk PROTO((tree, int)); extern void emit_thunk PROTO((tree)); extern void synthesize_method PROTO((tree)); -extern tree get_id_2 PROTO((char *, tree)); +extern tree get_id_2 PROTO((const char *, tree)); /* in pt.c */ extern void check_template_shadow PROTO ((tree)); @@ -3599,7 +3599,8 @@ extern void expand_ptrmemfunc_cst PROTO((tree, tree *, tree *, tre extern tree delta2_from_ptrmemfunc PROTO((tree)); extern tree pfn_from_ptrmemfunc PROTO((tree)); extern tree type_after_usual_arithmetic_conversions PROTO((tree, tree)); -extern tree composite_pointer_type PROTO((tree, tree, tree, tree, char*)); +extern tree composite_pointer_type PROTO((tree, tree, tree, tree, + const char*)); /* in typeck2.c */ extern tree error_not_base_type PROTO((tree, tree)); @@ -3637,7 +3638,7 @@ extern void GNU_xref_hier PROTO((tree, tree, int, int, int)); extern void GNU_xref_member PROTO((tree, tree)); /* in dump.c */ -extern void dump_node_to_file PROTO ((tree, char *)); +extern void dump_node_to_file PROTO ((tree, const char *)); /* -- end of C++ */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b3f534bb06f..83e408e9d96 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -344,7 +344,7 @@ struct named_label_list struct binding_level *binding_level; tree names_in_scope; tree label_decl; - char *filename_o_goto; + const char *filename_o_goto; int lineno_o_goto; struct named_label_list *next; }; @@ -7375,7 +7375,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) tree cleanup = NULL_TREE, ttype = NULL_TREE; int was_incomplete; int temporary = allocation_temporary_p (); - char *asmspec = NULL; + const char *asmspec = NULL; int was_readonly = 0; int already_used = 0; tree core_type; @@ -8950,7 +8950,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) int defaulted_int = 0; int opaque_typedef = 0; tree typedef_decl = NULL_TREE; - char *name; + const char *name; tree typedef_type = NULL_TREE; int funcdef_flag = 0; enum tree_code innermost_code = ERROR_MARK; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c16f1fdd059..04d6f22fa2a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1505,7 +1505,7 @@ finish_static_data_member_decl (decl, init, asmspec_tree, need_pop, flags) int need_pop; int flags; { - char* asmspec = 0; + const char *asmspec = 0; if (asmspec_tree) asmspec = TREE_STRING_POINTER (asmspec_tree); @@ -1581,7 +1581,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist) tree declarator, declspecs, init, asmspec_tree, attrlist; { register tree value; - char *asmspec = 0; + const char *asmspec = 0; int flags = LOOKUP_ONLYCONVERTING; /* Convert () initializers to = initializers. */ diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index b22565cc7ba..9519e997e49 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -80,15 +80,16 @@ typedef struct dump_info static unsigned int queue PROTO ((dump_info_p, tree, int)); static void dump_index PROTO ((dump_info_p, unsigned int)); -static void queue_and_dump_index PROTO ((dump_info_p, char *, tree, int)); +static void queue_and_dump_index PROTO ((dump_info_p, const char *, tree, int)); static void queue_and_dump_type PROTO ((dump_info_p, tree, int)); static void dequeue_and_dump PROTO ((dump_info_p)); static void dump_new_line PROTO ((dump_info_p)); static void dump_maybe_newline PROTO ((dump_info_p)); -static void dump_int PROTO ((dump_info_p, char *, int)); -static void dump_string PROTO ((dump_info_p, char *)); -static void dump_string_field PROTO ((dump_info_p, char *, char *)); +static void dump_int PROTO ((dump_info_p, const char *, int)); +static void dump_string PROTO ((dump_info_p, const char *)); +static void dump_string_field PROTO ((dump_info_p, const char *, const char *)); static void dump_node PROTO ((tree, FILE *)); +static void dump_stmt PROTO ((dump_info_p, tree)); /* Add T to the end of the queue of nodes to dump. If DUMP_CHILDREN_P is non-zero, then its children should be dumped as well. Returns @@ -152,7 +153,7 @@ dump_index (di, index) static void queue_and_dump_index (di, field, t, flags) dump_info_p di; - char *field; + const char *field; tree t; int flags; { @@ -223,7 +224,7 @@ dump_maybe_newline (di) static void dump_int (di, field, i) dump_info_p di; - char *field; + const char *field; int i; { dump_maybe_newline (di); @@ -236,7 +237,7 @@ dump_int (di, field, i) static void dump_string (di, string) dump_info_p di; - char *string; + const char *string; { dump_maybe_newline (di); fprintf (di->stream, "%-13s ", string); @@ -251,8 +252,8 @@ dump_string (di, string) static void dump_string_field (di, field, string) dump_info_p di; - char *field; - char *string; + const char *field; + const char *string; { dump_maybe_newline (di); fprintf (di->stream, "%-4s: %-7s ", field, string); @@ -382,7 +383,7 @@ dequeue_and_dump (di) /* And a source position. */ if (DECL_SOURCE_FILE (t)) { - char *filename = rindex (DECL_SOURCE_FILE (t), '/'); + const char *filename = rindex (DECL_SOURCE_FILE (t), '/'); if (!filename) filename = DECL_SOURCE_FILE (t); else @@ -846,7 +847,7 @@ dump_node (t, stream) void dump_node_to_file (t, file) tree t; - char *file; + const char *file; { FILE *f; diff --git a/gcc/cp/errfn.c b/gcc/cp/errfn.c index b5d3eeccd5a..a03aacc7bff 100644 --- a/gcc/cp/errfn.c +++ b/gcc/cp/errfn.c @@ -106,7 +106,7 @@ cp_thing (errfn, atarg1, format, ap) if (function || *f == 's') { - char *p; + const char *p; int plen; if (*f == 's') @@ -180,7 +180,7 @@ cp_thing (errfn, atarg1, format, ap) if (atarg) { - char *file = cp_file_of (atarg); + const char *file = cp_file_of (atarg); int line = cp_line_of (atarg); (*errfn) (file, line, "%s", buf); } diff --git a/gcc/cp/error.c b/gcc/cp/error.c index c455e812367..0279701ca21 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -101,8 +101,8 @@ static void dump_simple_decl PROTO((tree, tree, int)); static void dump_decl PROTO((tree, int)); static void dump_function_decl PROTO((tree, int)); static void dump_expr PROTO((tree, int)); -static void dump_unary_op PROTO((char *, tree, int)); -static void dump_binary_op PROTO((char *, tree)); +static void dump_unary_op PROTO((const char *, tree, int)); +static void dump_binary_op PROTO((const char *, tree)); static void dump_aggr_type PROTO((tree, int, int)); static void dump_type_prefix PROTO((tree, int, int)); static void dump_type_suffix PROTO((tree, int, int)); @@ -113,7 +113,7 @@ static void dump_qualifiers PROTO((tree, enum pad)); static void dump_char PROTO((int)); static void dump_parameters PROTO((tree, int, int)); static void dump_exception_spec PROTO((tree, int)); -static char *aggr_variety PROTO((tree)); +static const char *aggr_variety PROTO((tree)); static tree ident_fndecl PROTO((tree)); static int interesting_scope_p PROTO((tree)); @@ -346,7 +346,7 @@ dump_type_real (t, v, canonical_name) } } -static char * +static const char * aggr_variety (t) tree t; { @@ -379,7 +379,7 @@ dump_aggr_type (t, v, canonical_name) int canonical_name; { tree name; - char *variety = aggr_variety (t); + const char *variety = aggr_variety (t); dump_qualifiers (t, after); @@ -659,7 +659,7 @@ static void dump_global_iord (t) tree t; { - char *name = IDENTIFIER_POINTER (t); + const char *name = IDENTIFIER_POINTER (t); OB_PUTS ("(static "); if (name [sizeof (GLOBAL_THING) - 1] == 'I') @@ -807,7 +807,7 @@ dump_decl (t, v) } else if (IDENTIFIER_OPNAME_P (t)) { - char *name_string = operator_name_string (t); + const char *name_string = operator_name_string (t); OB_PUTS ("operator "); OB_PUTCP (name_string); } @@ -1135,7 +1135,7 @@ dump_function_name (t) } else if (IDENTIFIER_OPNAME_P (name)) { - char *name_string = operator_name_string (name); + const char *name_string = operator_name_string (name); OB_PUTS ("operator "); OB_PUTCP (name_string); } @@ -1303,7 +1303,7 @@ dump_expr (t, nop) /* If it's an enum, output its tag, rather than its value. */ if (TREE_CODE (type) == ENUMERAL_TYPE) { - char *p = enum_name_string (t, type); + const char *p = enum_name_string (t, type); OB_PUTCP (p); } else if (type == boolean_type_node) @@ -1352,7 +1352,7 @@ dump_expr (t, nop) sprintf (digit_buffer, "%g", TREE_REAL_CST (t)); #else { - unsigned char *p = (unsigned char *) &TREE_REAL_CST (t); + const unsigned char *p = (const unsigned char *) &TREE_REAL_CST (t); size_t i; strcpy (digit_buffer, "0x"); for (i = 0; i < sizeof TREE_REAL_CST (t); i++) @@ -1371,7 +1371,7 @@ dump_expr (t, nop) case STRING_CST: { - char *p = TREE_STRING_POINTER (t); + const char *p = TREE_STRING_POINTER (t); int len = TREE_STRING_LENGTH (t) - 1; int i; @@ -1842,7 +1842,7 @@ dump_expr (t, nop) static void dump_binary_op (opstring, t) - char *opstring; + const char *opstring; tree t; { OB_PUTC ('('); @@ -1859,7 +1859,7 @@ dump_binary_op (opstring, t) static void dump_unary_op (opstring, t, nop) - char *opstring; + const char *opstring; tree t; int nop; { diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index e4236522096..d0c62b4ec87 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -85,6 +85,12 @@ static void begin_definition_of_inclass_inline PROTO((struct pending_inline*)); static void parse_float PROTO((PTR)); static int is_global PROTO((tree)); static void init_filename_times PROTO((void)); +static void extend_token_buffer_to PROTO((int)); +#ifdef HANDLE_PRAGMA +static int pragma_getc PROTO((void)); +static void pragma_ungetc PROTO((int)); +#endif +static int read_line_number PROTO((int *)); /* Given a file name X, return the nondirectory portion. Keep in mind that X can be computed more than once. */ @@ -134,8 +140,8 @@ extern struct obstack token_obstack; /* Holds translations from TREE_CODEs to operator name strings, i.e., opname_tab[PLUS_EXPR] == "+". */ -char **opname_tab; -char **assignop_tab; +const char **opname_tab; +const char **assignop_tab; extern int yychar; /* the lookahead symbol */ extern YYSTYPE yylval; /* the semantic value of the */ @@ -240,7 +246,7 @@ set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification) tree ansi_opname[LAST_CPLUS_TREE_CODE]; tree ansi_assopname[LAST_CPLUS_TREE_CODE]; -char * +const char * operator_name_string (name) tree name; { @@ -530,9 +536,9 @@ init_parse (filename) (char *)(tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE), (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *)); - opname_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *)); + opname_tab = (const char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *)); bzero ((char *)opname_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *)); - assignop_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *)); + assignop_tab = (const char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *)); bzero ((char *)assignop_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *)); ansi_opname[0] = get_identifier (""); @@ -3606,8 +3612,8 @@ real_yylex () case 'z': case '_': case '$': - letter: #if USE_CPPLIB + letter: if (cpp_token == CPP_NAME) { /* Note that one character has already been read from diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 33a036c20a6..39f6dcebb1e 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -79,7 +79,7 @@ static void end_squangling PROTO((void)); static int check_ktype PROTO((tree, int)); static int issue_ktype PROTO((tree)); static void build_overload_scope_ref PROTO((tree)); -static void build_mangled_template_parm_index PROTO((char *, tree)); +static void build_mangled_template_parm_index PROTO((const char *, tree)); #if HOST_BITS_PER_WIDE_INT >= 64 static void build_mangled_C9x_name PROTO((int)); #endif @@ -574,7 +574,7 @@ build_overload_int (value, in_template) int i; int operands = tree_code_length[(int) TREE_CODE (value)]; tree id; - char* name; + const char *name; id = ansi_opname [(int) TREE_CODE (value)]; my_friendly_assert (id != NULL_TREE, 0); @@ -657,7 +657,7 @@ build_overload_int (value, in_template) static void build_mangled_template_parm_index (s, index) - char* s; + const char *s; tree index; { OB_PUTCP (s); @@ -1591,7 +1591,7 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs, tree targs; int for_method; { - char *name = IDENTIFIER_POINTER (dname); + const char *name = IDENTIFIER_POINTER (dname); /* member operators new and delete look like methods at this point. */ if (! for_method && parms != NULL_TREE && TREE_CODE (parms) == TREE_LIST @@ -1798,7 +1798,7 @@ build_overload_with_type (name, type) tree get_id_2 (name, name2) - char *name; + const char *name; tree name2; { OB_INIT (); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index dc898cd3429..7592df65042 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1888,7 +1888,7 @@ covariant_return_p (brettype, drettype) /* Check that virtual overrider OVERRIDER is acceptable for base function BASEFN. Issue diagnostic, and return zero, if unacceptable. */ -int +static int check_final_overrider (overrider, basefn) tree overrider, basefn; { diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fd17b115867..991234c5678 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -520,7 +520,7 @@ composite_pointer_type (t1, t2, arg1, arg2, location) tree t2; tree arg1; tree arg2; - char* location; + const char* location; { tree result_type;