From d8e178a02b6adccbbbef668c0374a95b466d11b0 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Fri, 26 Mar 1999 07:45:00 +0000 Subject: Warning fixes: * call.c (op_error): Const-ify a char*. (add_candidate, source_type, add_warning): Add static prototype. (print_z_candidates): Const-ify a char*. * class.c (resolve_address_of_overloaded_function, fixed_type_or_null, build_vtable_entry_ref): Add static prototype. (get_vtable_name, finish_struct_1): Const-ify a char*. * cvt.c (convert_to_reference): Likewise. * decl.c (redeclaration_error_message, record_builtin_type, record_unknown_type, member_function_or_else, bad_specifiers): Likewise. (find_binding, select_decl, unqualified_namespace_lookup, lookup_flags, qualify_lookup, record_builtin_java_type, tag_name): Add static prototype. (warn_extern_redeclared_static, duplicate_decls, pushdecl, implicitly_declare, record_builtin_java_type, define_function, grok_op_properties, tag_name): Const-ify a char*. * cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const. (define_function, finish_builtin_type): Const-ify a char*. (cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn, cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args. (file_name_nondirectory): Const-ify a char*. (init_filename_times): Don't prototype. (compiler_error): Prototype. (yyerror, init_repo): Const-ify a char*. (build_srcloc): Don't prototype. (build_x_indirect_ref, build_indirect_ref, build_component_addr): Const-ify a char*. (warn_for_assignment): Don't prototype. (convert_for_initialization, readonly_error, check_for_new_type, GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call): Const-ify a char*. * decl2.c (acceptable_java_type, output_vtable_inherit, setup_initp, start_objects, finish_objects, do_dtors, do_ctors, merge_functions, decl_namespace, validate_nonmember_using_decl, do_nonmember_using_decl): Add static prototype. (lang_f_options): Const-ify a char*. (finish_builtin_type): Likewise. (add_function, arg_assoc_namespace, arg_assoc_class): Add static prototype. * errfn.c: Include cp-tree.h. (cp_thing): Add static prototype. (compiler_error): Don't protoptype. (cp_compiler_error): Cast `compiler_error' to `errorfn' before passing it to `cp_thing'. * error.c (interesting_scope_p): Add static prototype. * except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify a char*. * init.c (compiler_error): Don't prototype. (member_init_ok_or_else): Const-ify a char*. (build_java_class_ref): Add static prototype. * lex.c (compiler_error): Don't prototype. (get_time_identifier, interface_strcmp, extend_token_buffer, handle_cp_pragma): Const-ify a char*. (is_global, init_filename_times): Add static prototype. (file_name_nondirectory, cplus_tree_code_name): Const-ify a char*. (compiler_error): Change from fixed args to variable args. (yyerror): Const-ify a char*. * parse.y (cond_stmt_keyword): Const-ify a char*. (parse_decl): Add static prototype. * pt.c (template_args_equal, print_template_context): Likewise. (print_candidates, check_default_tmpl_args): Const-ify a char*. (instantiate_class_template): Likewise. * repo.c (get_base_filename, open_repo_file, init_repo): Likewise. * rtti.c (call_void_fn, expand_generic_desc, expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise. * search.c (lookup_field_info, lookup_member): Likewise. (lookup_member): Cast the first argument of `bzero' to a PTR. * sig.c (compiler_error): Don't prototype. (build_signature_pointer_or_reference_nam): Const-ify a char*. (get_sigtable_name, build_member_function_pointer): Likewise. * tree.c (compiler_error): Don't prototype. (no_linkage_helper, build_srcloc): Add static prototype. (build_vbase_pointer_fields): Const-ify a char*. (__eprintf): Don't unnecessarily handle `const' when !__STDC__. * typeck.c (compiler_error): Don't prototype. (convert_for_assignment): Const-ify a char*. (comp_cv_target_types): Add static prototype. (build_x_indirect_ref, build_indirect_ref, convert_arguments, build_component_addr, build_unary_op, convert_for_initialization): Const-ify a char*. * typeck2.c (ack): Add static prototype and change from fixed args to variable args. (readonly_error, check_for_new_type): Const-ify a char*. * xref.c (_XREF_FILE, find_file, filename, fctname, declname, fixname, open_xref_file, classname, GNU_xref_begin): Likewise. (GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'. (GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call, gen_assign, GNU_xref_member): Const-ify a char*. From-SVN: r25994 --- gcc/cp/cp-tree.h | 63 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'gcc/cp/cp-tree.h') diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 307df1d..4e6c024 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2451,10 +2451,11 @@ extern int current_function_parms_stored; #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ /* Store the vbase pointer field name for type TYPE into pointer BUF. */ -#define FORMAT_VBASE_NAME(BUF,TYPE) do { \ - BUF = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \ +#define FORMAT_VBASE_NAME(BUF,TYPE) do { \ + char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \ + sizeof (VBASE_NAME) + 1); \ - sprintf (BUF, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \ + sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \ + (BUF) = wbuf; \ } while (0) /* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is @@ -2861,8 +2862,8 @@ extern tree auto_function PROTO((tree, tree, enum built_in_function)); extern void init_decl_processing PROTO((void)); extern int init_type_desc PROTO((void)); extern tree define_function - PROTO((char *, tree, enum built_in_function, - void (*) (tree), char *)); + PROTO((const char *, tree, enum built_in_function, + void (*) (tree), const char *)); extern tree check_tag_decl PROTO((tree)); extern void shadow_tag PROTO((tree)); extern tree groktypename PROTO((tree)); @@ -2940,7 +2941,8 @@ extern tree get_temp_name PROTO((tree, int)); extern tree get_temp_regvar PROTO((tree, tree)); extern void finish_anon_union PROTO((tree)); extern tree finish_table PROTO((tree, tree, tree, int)); -extern void finish_builtin_type PROTO((tree, char *, tree *, int, tree)); +extern void finish_builtin_type PROTO((tree, const char *, + tree *, int, tree)); extern tree coerce_new_type PROTO((tree)); extern tree coerce_delete_type PROTO((tree)); extern void comdat_linkage PROTO((tree)); @@ -2976,14 +2978,15 @@ extern tree handle_class_head PROTO((tree, tree, tree)); extern tree lookup_arg_dependent PROTO((tree, tree, tree)); /* in errfn.c */ -extern void cp_error (); -extern void cp_error_at (); -extern void cp_warning (); -extern void cp_warning_at (); -extern void cp_pedwarn (); -extern void cp_pedwarn_at (); -extern void cp_compiler_error (); -extern void cp_sprintf (); +/* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */ +extern void cp_error PVPROTO((const char *, ...)); +extern void cp_error_at PVPROTO((const char *, ...)); +extern void cp_warning PVPROTO((const char *, ...)); +extern void cp_warning_at PVPROTO((const char *, ...)); +extern void cp_pedwarn PVPROTO((const char *, ...)); +extern void cp_pedwarn_at PVPROTO((const char *, ...)); +extern void cp_compiler_error PVPROTO((const char *, ...)); +extern void cp_sprintf PVPROTO((const char *, ...)); /* in error.c */ extern void init_error PROTO((void)); @@ -3053,7 +3056,7 @@ extern tree build_vec_delete PROTO((tree, tree, tree, tree, int)); /* in input.c */ /* in lex.c */ -extern char *file_name_nondirectory PROTO((char *)); +extern char *file_name_nondirectory PROTO((const char *)); 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)); @@ -3061,7 +3064,6 @@ extern void set_quals_and_spec PROTO((tree, tree, tree)); extern char *operator_name_string PROTO((tree)); extern void lang_init PROTO((void)); extern void lang_finish PROTO((void)); -extern void init_filename_times PROTO((void)); #if 0 extern void reinit_lang_specific PROTO((void)); #endif @@ -3093,8 +3095,9 @@ extern tree build_lang_field_decl PROTO((enum tree_code, tree, tree)); extern void copy_lang_decl PROTO((tree)); extern tree make_lang_type PROTO((enum tree_code)); extern void dump_time_statistics PROTO((void)); -/* extern void compiler_error PROTO((char *, HOST_WIDE_INT, HOST_WIDE_INT)); */ -extern void yyerror PROTO((char *)); +extern void compiler_error PVPROTO((const char *, ...)) + ATTRIBUTE_PRINTF_1; +extern void yyerror PROTO((const char *)); extern void clear_inline_text_obstack PROTO((void)); extern void maybe_snarf_defarg PROTO((void)); extern tree snarf_defarg PROTO((void)); @@ -3188,7 +3191,7 @@ extern int processing_template_parmlist; /* in repo.c */ extern void repo_template_used PROTO((tree)); extern void repo_template_instantiated PROTO((tree, int)); -extern void init_repo PROTO((char*)); +extern void init_repo PROTO((const char *)); extern void finish_repo PROTO((void)); /* in rtti.c */ @@ -3384,7 +3387,6 @@ extern tree make_temp_vec PROTO((int)); extern tree build_ptr_wrapper PROTO((void *)); extern tree build_expr_ptr_wrapper PROTO((void *)); extern tree build_int_wrapper PROTO((int)); -extern tree build_srcloc PROTO((char *, int)); extern tree build_srcloc_here PROTO((void)); extern int varargs_function_p PROTO((tree)); extern int really_overloaded_fn PROTO((tree)); @@ -3441,8 +3443,8 @@ extern tree build_object_ref PROTO((tree, tree, tree)); extern tree build_component_ref_1 PROTO((tree, tree, int)); extern tree build_component_ref PROTO((tree, tree, tree, int)); extern tree build_x_component_ref PROTO((tree, tree, tree, int)); -extern tree build_x_indirect_ref PROTO((tree, char *)); -extern tree build_indirect_ref PROTO((tree, char *)); +extern tree build_x_indirect_ref PROTO((tree, const char *)); +extern tree build_indirect_ref PROTO((tree, const char *)); extern tree build_array_ref PROTO((tree, tree)); extern tree build_x_function_call PROTO((tree, tree, tree)); extern tree get_member_function_from_ptrfunc PROTO((tree *, tree)); @@ -3453,7 +3455,7 @@ extern tree convert_arguments PROTO((tree, tree, tree, int)); extern tree build_x_binary_op PROTO((enum tree_code, tree, tree)); extern tree build_binary_op PROTO((enum tree_code, tree, tree, int)); extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code)); -extern tree build_component_addr PROTO((tree, tree, char *)); +extern tree build_component_addr PROTO((tree, tree, const char *)); extern tree build_x_unary_op PROTO((enum tree_code, tree)); extern tree build_unary_op PROTO((enum tree_code, tree, int)); extern tree unary_complex_lvalue PROTO((enum tree_code, tree)); @@ -3468,8 +3470,7 @@ extern tree build_const_cast PROTO((tree, tree)); extern tree build_c_cast PROTO((tree, tree)); extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree)); extern tree build_modify_expr PROTO((tree, enum tree_code, tree)); -extern void warn_for_assignment PROTO((char *, char *, char *, tree, int, int)); -extern tree convert_for_initialization PROTO((tree, tree, tree, int, char *, tree, int)); +extern tree convert_for_initialization PROTO((tree, tree, tree, int, const char *, tree, int)); extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int)); extern void c_expand_return PROTO((tree)); extern tree c_expand_start_case PROTO((tree)); @@ -3488,7 +3489,7 @@ extern tree pfn_from_ptrmemfunc PROTO((tree)); /* in typeck2.c */ extern tree error_not_base_type PROTO((tree, tree)); extern tree binfo_or_else PROTO((tree, tree)); -extern void readonly_error PROTO((tree, char *, int)); +extern void readonly_error PROTO((tree, const char *, int)); extern void abstract_virtuals_error PROTO((tree, tree)); extern void signature_error PROTO((tree, tree)); extern void incomplete_type_error PROTO((tree, tree)); @@ -3503,18 +3504,18 @@ extern tree build_m_component_ref PROTO((tree, tree)); extern tree build_functional_cast PROTO((tree, tree)); extern char *enum_name_string PROTO((tree, tree)); extern void report_case_error PROTO((int, tree, tree, tree)); -extern void check_for_new_type PROTO((char *,flagged_type_tree)); +extern void check_for_new_type PROTO((const char *, flagged_type_tree)); extern tree initializer_constant_valid_p PROTO((tree, tree)); /* in xref.c */ -extern void GNU_xref_begin PROTO((char *)); +extern void GNU_xref_begin PROTO((const char *)); extern void GNU_xref_end PROTO((int)); -extern void GNU_xref_file PROTO((char *)); +extern void GNU_xref_file PROTO((const char *)); extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT)); extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int)); -extern void GNU_xref_ref PROTO((tree, char *)); +extern void GNU_xref_ref PROTO((tree, const char *)); extern void GNU_xref_decl PROTO((tree, tree)); -extern void GNU_xref_call PROTO((tree, char *)); +extern void GNU_xref_call PROTO((tree, const char *)); extern void GNU_xref_function PROTO((tree, tree)); extern void GNU_xref_assign PROTO((tree)); extern void GNU_xref_hier PROTO((tree, tree, int, int, int)); -- cgit v1.1