aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
AgeCommit message (Collapse)AuthorFilesLines
2001-07-10target.h (struct gcc_target): New fields init_builtins and expand_builtin.Stan Shebs1-1/+1
* target.h (struct gcc_target): New fields init_builtins and expand_builtin. * target-def.h (TARGET_INIT_BUILTINS): New macro. (TARGET_EXPAND_BUILTIN): New macro. (TARGET_INITIALIZER): Add them. * builtins.c: Include target.h. (expand_builtin): Use targetm.expand_builtin. (default_init_builtins): New function. (default_expand_builtin): New function. * expr.h (default_init_builtins): Declare. (default_expand_builtin): Declare. * c-common.c (c_common_nodes_and_builtins): Use targetm.init_builtins. * defaults.h (MD_INIT_BUILTINS): Remove. * Makefile.in (builtins.o): Depend on target.h. * config/arm/arm.c (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. * config/arm/arm.h (MD_INIT_BUILTINS): Remove. (MD_EXPAND_BUILTIN): Remove. * config/c4x/c4x.c (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. (c4x_init_builtins): Make endlink arg a local. (c4x_print_operand): Fix typos in adjust_address usages. * config/c4x/c4x-protos.h (c4x_init_builtins): Update decl. * config/c4x/c4x.h (MD_INIT_BUILTINS): Remove. (MD_EXPAND_BUILTIN): Remove. * config/i386/i386.c (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. (ix86_init_mmx_sse_builtins): New function, was ix86_init_builtins. (ix86_init_builtins): Call new function only if TARGET_MMX. * config/i386/i386-protos.h (ix86_init_mmx_sse_builtins): Declare. * config/i386/i386.h (MD_INIT_BUILTINS): Remove. (MD_EXPAND_BUILTIN): Remove. * config/ia64/ia64.c (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. * config/ia64/ia64.h (MD_INIT_BUILTINS): Remove. (MD_EXPAND_BUILTIN): Remove. * doc/tm.texi: Document these changes. From-SVN: r43888
2001-07-08target.h (struct gcc_target): Add insert_attributes.Joseph Myers1-11/+2
* target.h (struct gcc_target): Add insert_attributes. * target-def.h (TARGET_INSERT_ATTRIBUTES): Define. (TARGET_INITIALIZER): Update. * tree.c, tree.h (default_insert_attributes): New function. Update comments on other default functions to refer to targetm, not target. * doc/tm.texi (INSERT_ATTRIBUTES): Update to document TARGET_INSERT_ATTRIBUTES. (SET_DEFAULT_DECL_ATTRIBUTES): Remove. * c-common.c (decl_attributes): Use targetm.insert_attributes. Don't use PRAGMA_INSERT_ATTRIBUTES. * Makefile.in (c-common.o): Depend on $(TARGET_H). * c-decl.c (start_decl, start_function): Don't call SET_DEFAULT_DECL_ATTRIBUTES. * config/c4x/c4x.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define. * config/c4x/c4x-protos.h (c4x_set_default_attributes): Don't declare. * config/c4x/c4x.c (TARGET_INSERT_ATTRIBUTES): Define. (c4x_check_attribute): Avoid modifying attribute list itself. (c4x_set_default_attributes): Rename to c4x_insert_attributes. Make static. * config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Don't define. * config/sh/sh-protos.h (sh_pragma_insert_attributes): Don't declare. * config/sh/sh.c (TARGET_INSERT_ATTRIBUTES): Define. (sh_pragma_insert_attributes): Rename to sh_insert_attributes. Make static. * config/v850/v850.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define. * config/v850/v850-protos.h (v850_set_default_decl_attr): Don't declare. * config/v850/v850.c (TARGET_INSERT_ATTRIBUTES): Define. (v850_set_default_decl_attr): Rename to v850_insert_attributes. Adjust parameters. Make static. cp: * decl.c (start_decl): Don't call SET_DEFAULT_DECL_ATTRIBUTES. (start_function): Don't call SET_DEFAULT_DECL_ATTRIBUTES. Call cplus_decl_attributes even if attrs is NULL. * friend.c (do_friend): Don't call SET_DEFAULT_DECL_ATTRIBUTES. From-SVN: r43851
2001-07-08c-common.c (decl_attributes): Only take a single attributes parameter.Joseph Myers1-10/+6
* c-common.c (decl_attributes): Only take a single attributes parameter. * c-common.h (decl_attributes): Update prototype. * c-decl.c (start_decl, start_function): Only take a single attributes parameter. Update calls to decl_attributes. (finish_struct, finish_enum): Update calls to decl_attributes. (push_parm_decl): Expect unified list of attributes. Update call to decl_attributes. * c-parse.in (fndef, initdcl, notype_initdcl, nested_function, notype_nested_function, component_declarator, component_notype_declarator, label): Update calls to decl_attributes. (absdcl_maybe_attribute, parm, firstparm, myparm): Unify attribute lists that are passed to push_parm_decl. * c-tree.h (start_function, start_decl): Update prototypes. * config/sh/sh-protos.h, config/sh/sh.c (sh_pragma_insert_attributes): Only take a single attributes parameter. * config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Likewise. * doc/tm.texi (INSERT_ATTRIBUTES): Update. * objc/objc-act.c (define_decl, generate_objc_symtab_decl, build_module_descriptor, generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_protocols, generate_ivars_list, generate_dispatch_table, generate_protocol_list, generate_category, generate_shared_structures, really_start_method, add_objc_decls, generate_classref_translation_entry): Update calls to start_decl and start_function. (build_tmp_function_decl, start_method_def): Unify attribute lists that are passed to push_parm_decl. cp: * decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update calls to decl_attributes. testsuite: * gcc.c-torture/compile/20010701-1.c, g++.old-deja/g++.ext/attrib6.C: New tests. From-SVN: r43850
2001-07-01c-common.c (decl_attributes, [...]): Don't call layout_decl for FIELD_DECL.Richard Kenner1-1/+2
* c-common.c (decl_attributes, case A_MODE): Don't call layout_decl for FIELD_DECL. From-SVN: r43682
2001-06-22re PR c/3259 (({ }) and -Wall)Joseph Myers1-0/+5
* c-common.c (verify_tree): Check for x being NULL. * doc/c-tree.texi: Document COMPOUND_BODY of an empty COMPOUND_STMT. Fixes PR c/3259. testsuite: * gcc.dg/20010622-1.c: New test. From-SVN: r43508
2001-06-05c-common.h (flag_dump_translation_unit): Remove.Nathan Sidwell1-5/+0
* c-common.h (flag_dump_translation_unit): Remove. (enum tree_dump_index): Define. (TDF_ADDRESS, TDF_SLIM): New #defines. (dump_node_to_file): Remove. (dump_node): Make extern. Add flags. (dump_flag, dump_enabled_p, dump_begin, dump_end, dump_switch_p): Prototype. * c-common.c (flag_dump_translation_unit): Remove. * c-decl.c (c_decode_option): Remove -fdump-translation-unit logic. Use dump_switch_p. * c-dump.h (struct dump_info): Add node and user fields. (dump_pointer): Declare. * c-dump.c (dump_node): Make extern. Add flags. (SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines. (dump_new_line, dump_maybe_newline): Use them. (dump_pointer): New function. (dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's chain or function's body. Dump address, if TDF_ADDRESS set. (dump_flag): Define. (dump_node_to_file): Remove. (struct dump_file_info): New struct. (dump_files): New array. (dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define. * c-lang.c (finish_file): Adjust dumping. * toplev.h (dump_base_name): Make extern. * invoke.texi: Document new flags. cp: * class.c (maybe_indent_hierarchy): New function. (dump_class_hierarchy_r): Add flags. Dump extra binfo information, if enabled. Use maybe_indent_hierarchy. Adjust output format. (dump_class_hierarchy): Adjust prototype. Adjust output format. (dump_array, dump_vtable, dump_vtt): New functions. (finish_struct_1): Adjust hierarchy dumping. (initialize_vtable): Call dump_vtable. (build_vtt): Call dump_vtt. (build_ctor_vtbl_group): Call dump_vtable. * decl2.c (flag_dump_class_layout): Remove. (cxx_decode_option): Remove dump translation unit and dump class hierarchy check. Call dump_switch_p. (finish_file): Adjust dumping. (dump.c): Only dump base classes if not TDF_SLIM. Only dump namespace members if not TDF_SLIM. * optimize.c (dump_function): New function. (optimize_function): Call dump_function. * semantics.c (expand_body): Use dump_enabled_p. From-SVN: r42896
2001-05-25builtins.def: Encode additional information, such as names and types, here.Mark Mitchell1-571/+169
* builtins.def: Encode additional information, such as names and types, here. * builtin-types.def: New file. * builtins.c (built_in_names): Adjust use of DEF_BUILTIN. (built_in_decls): Likewise. Don't explicitly initialize global data to NULL. (expand_builtin_mathfn): Handle float and long double variants of math builtins. (expand_builtin): Likewise. * c-common.c (c_common_nodes_and_builtins): Make it table-driven. (expand_tree_builtin): Handle long, long long, float, and long double variants of math functions. * c-common.h (c_tree_index): Remove some unused nodes. (void_ftype): Remove. (void_type_ptr): Likewise. (int_ftype_int): Likewise. (ptr_ftype_sizetype): Likewise. * c-decl.c (init_decl_processing): Remove creation of DWARF builtins. * defaults.h (MD_INIT_BUILTINS): Provide default definition. * tree.h (built_in_function): Adjust definition of DEF_BUILTIN. * Makefile.in (c-common.o): Depend on builtin-types.def. * decl.c (init_decl_processing): Tweak. From-SVN: r42583
2001-05-21fix commentJason Merrill1-1/+1
From-SVN: r42396
2001-05-11c-common.c (finish_label_expr): New function, lifted from from cp/semantics.c.Neil Booth1-0/+33
* c-common.c (finish_label_expr): New function, lifted from from cp/semantics.c. * c-common.h (finish_label_expr, lookup_label): New prototypes. * c-parse.in: Move 3 blocks of parser code into new functions. * c-typeck.c (simple_asm_stmt, c_cast_expr): New functions. * c-tree.h (simple_asm_stmt, c_cast_expr): New prototypes. (lookup_label): Remove. From-SVN: r41959
2001-05-10c-common.c (combine_strings): Widen strings in a host-endian-independent way.DJ Delorie1-5/+12
* c-common.c (combine_strings): Widen strings in a host-endian-independent way. From-SVN: r41941
2001-05-01bitmap.c: Change NULL_PTR to NULL or "(rtx*)0".Kaveh R. Ghazi1-45/+45
* bitmap.c: Change NULL_PTR to NULL or "(rtx*)0". * c-common.c: Likewise. * c-decl.c: Likewise. * combine.c: Likewise. * rs6000.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * integrate.c: Likewise. * loop.c: Likewise. * objc/objc-act.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * varasm.c: Likewise. From-SVN: r41722
2001-04-30c-common.c (c_promoting_integer_type_p): New function, from the corpse of ↵Richard Henderson1-2/+32
old macro. * c-common.c (c_promoting_integer_type_p): New function, from the corpse of old macro. Properly promote too-small enumerations and booleans. Adjust all callers. * c-common.h (C_PROMOTING_INTEGER_TYPE_P): Remove. (c_promoting_integer_type_p): Declare. * c-decl.c: Adjust C_PROMOTING_INTEGER_TYPE_P invocations. * c-typeck.c: Likewise. (default_conversion): Remove now redundant boolean check. * cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations. * decl.c: Likewise. From-SVN: r41709
2001-04-24Lazy __FUNCTION__ generation.Nathan Sidwell1-23/+173
gcc: Lazy __FUNCTION__ generation. * c-common.h (RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME): New _RIDs. (CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, CTI_FUNC_ID): Remove. (CTI_FUNCTION_NAME_DECL, CTI_PRETTY_FUNCTION_NAME_DECL, CTI_C99_FUNCTION_NAME_DECL, CTI_SAVED_FUNCTION_NAME_DECLS): New global tree slots. (function_id_node, pretty_function_id_node, func_id_node): Remove. (c99_function_name_decl_node, function_name_decl_node, pretty_function_name_decl_node, saved_function_name_decls): Declare. (struct language_function): Remove x_function_name_declared_p. (make_fname_decl): Remove a parameter. (declare_function_names): Remove prototype. (start_fname_decls, finish_fname_decls): Prototype. (fname_as_string): Likewise. (fname_string, fname_decl): Likewise. * c-common.c (make_fname_decl): Adjust. (struct fname_var_t): New struct. (fname_vars): New static array. (declare_function_name): Remove. (start_fname_decls, finish_fname_decls): New functions. (fname_as_string): New function from remnants of declare_function_name. (fname_string, fname_decl): New functions. * c-decl.c (c_function_name_declared_p): Remove. (init_decl_processing): Don't generate __FUNCTION__ et al ids, don't call declare_function_name. Call start_fname_decls. (c_make_fname_decl): Adjust parameters. Generate the name. Don't clobber the line number. Call finish_decl. (start_function): Call start_fname_decls. (finish_function): Call finish_fname_decls. Remove c_function_name_declared_p. (push_c_function_context): Don't push c_function_name_declared_p. (pop_c_function_context): Don't pop c_function_name_declared_p. (c_begin_compound_stmt): Don't check c_function_name_declared_p. * c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): New tokens. (program): Call finish_fname_decls for C. (primary): Add VAR_FUNC_NAME. (reswords): Add slots for __FUNCTION__ et al. (rid_to_yy): Add mappings for __FUNCTION__ et al. (yylexname): If it's a STRING_FUNC_NAME generate the function name now. Don't look for VAR_DECLs containing __FUNCTION__ et al. * c-semantics.c (prune_unused_decls): Remove. (finish_stmt_tree): Don't call prune_unused_decls. (genrtl_decl_stmt): Don't prune unused decls here. cp: Lazy __FUNCTION__ generation. * cp-tree.def (FUNCTION_NAME): Remove. * cp-tree.h (function_name_declared_p): Remove. (cp_fname_init): Prototype. * decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids, don't call declare_function_name. Call start_fname_decls. (cp_make_fname_decl): Adjust parameters. Generate the name. Don't clobber the line number. (cp_fname_init): New function. (start_function): Call start_fname_decls. (finish_function): Call finish_fname_decls. * lex.c (reswords): Add slots for __FUNCTION__ et al. (rid_to_yy): Add mappings for __FUNCTION__ et al. * optimize.c (maybe_clone_body): Remove function_name_declared_p. * parse.y (VAR_FUNC_NAME): New token. (primary): Add VAR_FUNC_NAME. * pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's generation. (tsubst, FUNCTION_NAME case): Remove. (tsubst_copy, FUNCTION_NAME case): Remove. (tsubst_expr, DECL_STMT case): Be careful with a DECL_PRETTY_FUNCTION_P. (instantiate_decl): Remove function_name_declared_p. * semantics.c (begin_compound_statement): Don't call declare_function_name here. (setup_vtbl_ptr). Don't save & restore function_name_declared_p. (finish_translation_unit): Call finish_fname_decls. (expand_body): Remove function_name_declared_p. * typeck2.c (digest_init): Allow any ERROR_MARK. testsuite: * gcc.dg/c99-func-2.c: Remove xfail. * gcc.dg/c99-func-3.c: Remove xfail. * gcc.dg/c99-func-4.c: Remove xfail. From-SVN: r41520
2001-03-28IA-64 ABI Exception Handling.Richard Henderson1-0/+5
From-SVN: r40924
2001-02-27c-common.c (walk_stmt_tree): Visit the chain of the current tree even if ↵Diego Novillo1-13/+13
walk_subtrees is 0. 2001-02-27 Diego Novillo <dnovillo@redhat.com> * c-common.c (walk_stmt_tree): Visit the chain of the current tree even if walk_subtrees is 0. * c-semantics.c (prune_unused_decls): Return a non-null value to stop traversing the tree chain. From-SVN: r40106
2001-02-16fix comment typoJason Merrill1-1/+1
From-SVN: r39764
2001-02-12c-common.c (constant_fits_type_p): New function.Jakub Jelinek1-1/+16
* c-common.c (constant_fits_type_p): New function. (convert_and_check): Use it. * gcc.c-torture/compile/20010209-1.c: New test. From-SVN: r39596
2001-02-10Doc and warning fixes.Anthony Green1-1/+1
From-SVN: r39580
2001-01-28configure.in: Arrange to include defaults.h in [ht]config.h/tm.h.Kaveh R. Ghazi1-1/+0
* configure.in: Arrange to include defaults.h in [ht]config.h/tm.h. * Makefile.in: Remove all dependencies on defaults.h. * builtins.c: Don't include defaults.h. * c-common.c: Likewise. * c-decl.c: Likewise. * c-pragma.c: Likewise. * c-typeck.c: Likewise. * combine.c: Likewise. * i386.c: Likewise. * frame-ia64.c: Likewise. * cppexp.c: Likewise. * crtstuff.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * dwarfout.c: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * frame-dwarf2.c: Likewise. * libgcc2.c: Likewise. * optabs.c: Likewise. * profile.c: Likewise. * sdbout.c: Likewise. * toplev.c: Likewise. * tradcif.y: Likewise. * tree.c: Likewise. * varasm.c: Likewise. ch: * Makefile.in: Remove all dependencies on defaults.h. * decl.c: Don't include defaults.h. * timing.c: Likewise. cp: * Make-lang.in: Remove all dependencies on defaults.h. * call.c: Don't include defaults.h. * decl.c: Likewise. * decl2.c: Likewise. * except.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. f: * Make-lang.in: Remove all dependencies on defaults.h. * com.c: Don't include defaults.h. java: * Make-lang.in: Remove all dependencies on defaults.h. * decl.c: Don't include defaults.h. * expr.c: Likewise. * parse.y: Likewise. From-SVN: r39308
2001-01-13c-common.c: Move format checking code to ...Joseph Myers1-2453/+4
* c-common.c: Move format checking code to ... * c-format.c: ... here. New file. Reorder some functions and declarations. (decl_handle_format_attribute, decl_handle_format_arg_attribute): New functions. * c-common.h (decl_handle_format_attribute, decl_handle_format_arg_attribute): Declare. * Makefile.in (C_AND_OBJC_OBJS): Add c-format.o. (c-common.o): Adjust dependencies. (c-format.o): New list of dependencies. cp: * Make-lang.in (CXX_C_OBJS): Add c-format.o. From-SVN: r38998
2001-01-09c-common.c (enum format_type): Add format_type_error.Joseph Myers1-13/+34
* c-common.c (enum format_type): Add format_type_error. (decode_format_type): New function. (decl_attributes): Use it. (format_kind_info): Adjust comment. From-SVN: r38843
2001-01-07builtins.def (BUILT_IN_FPRINTF): New entry.Kaveh R. Ghazi1-1/+103
* builtins.def (BUILT_IN_FPRINTF): New entry. * c-common.c (c_expand_builtin_fprintf): New function. (init_function_format_info): Handle __builtin_fprintf. (c_common_nodes_and_builtins): Declare fprintf/__builtin_fprintf. (c_expand_builtin): Handle BUILT_IN_FPRINTF. * c-decl.c (duplicate_decls): Adjust comment. * extend.texi (fprintf): Document new builtin. testsuite: * gcc.c-torture/execute/stdio-opt-3.c: New test. From-SVN: r38788
2001-01-07c-common.c (c_common_nodes_and_builtins): Add _Exit builtin.Joseph Myers1-1/+3
* c-common.c (c_common_nodes_and_builtins): Add _Exit builtin. * extend.texi: Document _Exit builtin. testsuite: * gcc.c-torture/execute/builtin-noret-1.c: New test. From-SVN: r38771
2001-01-05builtins.def (BUILT_IN_CONJ, [...]): Define.Joseph Myers1-0/+73
* builtins.def (BUILT_IN_CONJ, BUILT_IN_CREAL, BUILT_IN_CIMAG): Define. * builtins.c (expand_builtin): Abort on BUILT_IN_CONJ, BUILT_IN_CREAL and BUILT_IN_CIMAG. * c-common.c (c_common_nodes_and_builtins): Create builtin conjf, conj, conjl, crealf, creal, creall, cimagf, cimag and cimagl. (expand_tree_builtin): Handle BUILT_IN_CONJ, BUILT_IN_CREAL and BUILT_IN_CIMAG. * extend.texi: Document these builtins. testsuite: * gcc.c-torture/execute/builtin-complex-1.c: New test. From-SVN: r38716
2001-01-05VECTOR_TYPE fixes for aliasing, and dwarf2 output.Daniel Berlin1-1/+5
From-SVN: r38715
2001-01-04c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.Joseph Myers1-0/+158
* c-common.c (SIZE_TYPE, WCHAR_TYPE): Define. (flag_short_double, flag_short_wchar): Define. (c_common_nodes_and_builtins): Create many tree nodes shared between C and C++ here instead of in cp/decl.c and ... * c-decl.c (init_decl_processing): ... here. (SIZE_TYPE, WCHAR_TYPE): Don't define. (flag_short_double, flag_short_wchar): Don't define. (record_builtin_type): New function. (build_void_list_node): New function. * c-common.h (flag_short_double, flag_short_wchar, record_builtin_type, build_void_list_node): Declare. cp: * decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define. (record_builtin_type): Make non-static. (flag_short_double): Don't declare. (init_decl_processing): Remove the creation of many tree nodes now in c_common_nodes_and_builtins. (build_void_list_node): New function. * decl2.c (flag_short_double, flag_short_wchar): Don't define. * cp-tree.h (flag_short_wchar): Don't declare. From-SVN: r38695
2001-01-03c-common.c (c_common_lang_init): New function.Joseph Myers1-0/+23
* c-common.c (c_common_lang_init): New function. Warn if format warning options which only have effects when used with -Wformat are used without -Wformat. * c-common.h (c_common_lang_init): Declare. * c-lang.c (lang_init): Call c_common_lang_init. * objc/objc-act.c (lang_init): Call c_common_lang_init. cp: * lex.c (lang_init): Call c_common_lang_init. From-SVN: r38672
2001-01-02update copyrightsKaveh Ghazi1-1/+1
From-SVN: r38606
2001-01-02c-common.c (c_common_nodes_and_builtins): Set prototype parameters for ↵Kaveh R. Ghazi1-12/+34
__builtin_fputs, __builtin_fputc and __builtin_fwrite. * c-common.c (c_common_nodes_and_builtins): Set prototype parameters for __builtin_fputs, __builtin_fputc and __builtin_fwrite. Don't declare plain fputc as a builtin. testsuite: * gcc.c-torture/execute/stdio-opt-1.c: Also test __builtin_fputc and __builtin_fwrite. From-SVN: r38605
2000-12-28c-common.c (enum format_type): Add strfmon_format_type.Joseph Myers1-49/+137
* c-common.c (enum format_type): Add strfmon_format_type. (decl_attributes): Handle format attributes strfmon and __strfmon__. (FMT_FLAG_USE_DOLLAR, FMT_FLAG_ZERO_WIDTH_BAD, FMT_FLAG_EMPTY_PREC_OK): Define. (format_char_info): Update comment for flag_chars. (format_flag_spec): Add skip_next_char. (format_kind_info): Add left_precision_char. (printf_flag_specs, scanf_flag_specs, strftime_flag_specs, format_types): Update for these new structure members and flags. (time_char_table): Make const. (strfmon_length_specs, strfmon_flag_specs, strfmon_flag_pairs, monetary_char_table): New. (format_types): Add details of strfmon formats. (init_function_format_info): Create default attribute for strfmon. (check_format_info_main): Check the new flags. Handle skip_next_char and left precision. * toplev.c (documented_lang_options): Update description of -Wformat. * extend.texi: Document strfmon format attributes. Document attribute forms such as __printf__. Clarify format_arg attribute documentation. * invoke.texi (-Wformat): Update for strfmon formats. testsuite: * gcc.dg/format-strfmon-1.c: New test. From-SVN: r38512
2000-12-23builtins.def (BUILT_IN_LABS, [...]): Don't define.Joseph Myers1-6/+3
* builtins.def (BUILT_IN_LABS, BUILT_IN_LLABS, BUILT_IN_IMAXABS): Don't define. * builtins.c (expand_builtin): Don't handle BUILT_IN_LABS, BUILT_IN_LLABS and BUILT_IN_IMAXABS. * c-common.c (c_common_nodes_and_builtins): Use BUILT_IN_ABS for builtin labs, llabs and imaxabs. (expand_tree_builtin): Don't handle BUILT_IN_LABS, BUILT_IN_LLABS and BUILT_IN_IMAXABS. From-SVN: r38475
2000-12-23c-common.c (builtin_function_2): New function.Joseph Myers1-213/+208
* c-common.c (builtin_function_2): New function. (c_common_nodes_and_builtins): Use it to define each pair (foo, __builtin_foo) of builtins in one place. From-SVN: r38474
2000-12-20c-typeck.c (build_asm_stmt): New, broken out from ...Richard Henderson1-2/+2
* c-typeck.c (build_asm_stmt): New, broken out from ... (c_expand_asm_operands): ... here. Just do rtl expansion. (c_expand_return): Return the new stmt node. (c_start_case, do_case): Likewise. * c-common.c (c_expand_expr_stmt): Likewise. * c-common.h: Update declarations. * c-tree.h: Likewise. * c-semantics.c (build_stmt): Use STMT_LINENO not TREE_COMPLEXITY. * c-parse.in (fndef): Set DECL_SOURCE_LINE to the open brace. (nested_function, notype_nested_function): Likewise. (compstmt): Return the compound statement not the binding level. (lineno_labeled_stmt): Simplify. (lineno_stmt, lineno_label): Set STMT_LINENO. (stmt, label): Return the new stmt node. From-SVN: r38402
2000-12-18c-common.c (STD_C9L, ADJ_STD): Define.Joseph Myers1-20/+26
* c-common.c (STD_C9L, ADJ_STD): Define. (printf_length_specs, scanf_length_specs): Mark "ll" as standard STD_C9L. (T99_LL): Rename to T9L_LL. (T99_ULL): Rename to T9L_ULL. (print_char_table, scan_char_table): Use T9L_LL and T9L_ULL instead of T99_LL and T99_ULL. (check_format_info_main): Use ADJ_STD on all format standard versions being compared. * c-common.h: Declare warn_long_long. * c-tree.h: Don't declare warn_long_long. cp: * cp-tree.h: Don't declare warn_long_long. testsuite: * gcc.dg/format-warnll-1.c: New test. From-SVN: r38369
2000-12-17c-common.c (c_common_nodes_and_builtins): Create a cstring_endlink, use it.Kaveh R. Ghazi1-58/+36
* c-common.c (c_common_nodes_and_builtins): Create a cstring_endlink, use it. Rename int_ftype_string_string to int_ftype_cstring_cstring, string_ftype_string_int to string_ftype_cstring_int, and string_ftype_string_string to string_ftype_cstring_cstring. Prefer sizetype_endlink and int_endlink to manually recreating them. Fix the prototype set for __builtin_strspn/__builtin_strcspn. From-SVN: r38329
2000-12-09c-common.c (check_function_format): Don't suggest adding format attributes ↵Joseph Myers1-2/+19
to functions with no parameter to which... * c-common.c (check_function_format): Don't suggest adding format attributes to functions with no parameter to which to add them. testsuite: * gcc.dg/format-miss-2.c: New test. From-SVN: r38163
2000-12-07c-common.c (warn_format_security): New variable.Joseph Myers1-2/+9
* c-common.c (warn_format_security): New variable. (check_format_info): Warn about non-literal formats with no format arguments if either -Wformat-nonliteral or -Wformat-security is specified. (set_Wformat): Set warn_format_security for settings other than 1. * c-common.h (warn_format_security): Declare. * c-decl.c (c_decode_option): Decode -Wformat-security and -Wno-format-security. * invoke.texi: Document -Wformat-security. * toplev.c (documented_lang_options): Include -Wformat-security and -Wno-format-security. cp: * decl2.c (lang_decode_option): Handle -Wformat-security. testsuite: * format-sec-1.c: New test. From-SVN: r38106
2000-12-07c-common.c (check_format_info): Warn for non-constant format strings with ↵Joseph Myers1-2/+23
strftime formats if -Wformat-nonliteral. * c-common.c (check_format_info): Warn for non-constant format strings with strftime formats if -Wformat-nonliteral. Where the format can convert arguments, if the format is not a string literal and there are no arguments to the format, give a different warning message from the general non-string-literal case. testsuite: * gcc.dg/format-nonlit-3.c: New test. From-SVN: r38105
2000-12-07c-common.c (format_wanted_type): Add reading_from_flag.Joseph Myers1-15/+38
* c-common.c (format_wanted_type): Add reading_from_flag. (print_char_table): Mark %s and %S formats with flag "R". (check_format_info_main): Set up reading_from_flag appropriately. If aflag, always set writing_in_flag rather than relying on the format used being a scanf format and so having it set. (check_format_types): Check for formats reading through null pointers. testsuite: * gcc.dg/c90-printf-1.c: Add test for printf formats reading through a null pointer. From-SVN: r38104
2000-12-07c-common.c (parse_in): Make a cpp_reader *.Neil Booth1-1/+1
* c-common.c (parse_in): Make a cpp_reader *. * cppfiles.c (_cpp_fake_include): Remove. * cpphash.h: Similarly. * cpplib.c (do_line): Don't call _cpp_fake_include. A valid #line always creates a callback; FC_RENAME if there are no #line flags. * fix-header.c (read_scan_file): cpp_push_buffer cannot fail. The first EOF must be our get_char buffer. From-SVN: r38101
2000-12-03builtins.c (expand_builtin_strcat, [...]): New functions.Kaveh R. Ghazi1-9/+35
* builtins.c (expand_builtin_strcat, expand_builtin_strncat, expand_builtin_strspn, expand_builtin_strcspn): New functions. (expand_builtin): Handle BUILT_IN_STRCAT, BUILT_IN_STRNCAT, BUILT_IN_STRSPN and BUILT_IN_STRCSPN. * builtins.def (BUILT_IN_STRCAT, BUILT_IN_STRNCAT, BUILT_IN_STRSPN, BUILT_IN_STRCSPN): New entries. * c-common.c (c_common_nodes_and_builtins): Declare builtin strcat, strncat, strspn and strcspn. (string_ftype_string_cstring): Renamed from `string_ftype_ptr_ptr'. * extend.texi (strcat, strcspn, strncat, strspn): Document new builtins. testsuite: * gcc.c-torture/execute/string-opt-9.c: New test. * gcc.c-torture/execute/string-opt-10.c: Likewise. * gcc.c-torture/execute/string-opt-11.c: Likewise. * gcc.c-torture/execute/string-opt-12.c: Likewise. From-SVN: r37964
2000-12-02c-common.c (combine_strings): When the ISO C standard specifies the maximum ↵Geoffrey Keating1-2/+2
length of a string... * c-common.c (combine_strings): When the ISO C standard specifies the maximum length of a string, it doesn't include the trailing zero byte. * gcc.dg/cpp/if-6.c: New testcase. From-SVN: r37961
2000-12-02Make alpha build again.Bernd Schmidt1-0/+4
From-SVN: r37950
2000-12-01c-common.c (warn_format, [...]): Define.Joseph Myers1-18/+48
* c-common.c (warn_format, warn_format_y2k, warn_format_extra_args, warn_format_nonliteral): Define. (check_format_info): Check warn_format_nonliteral and warn_format_extra_args. (check_format_info_main): Check warn_format_y2k. (set_Wformat): New function. * c-common.h (warn_format_y2k, warn_format_extra_args, warn_format_nonliteral, set_Wformat): Declare. * c-decl.c (warn_format): Remove definition. (c_decode_option): Handle -Wformat-nonliteral, -Wno-format-extra-args and -Wno-format-y2k, and negated versions. Use set_Wformat. * invoke.texi: Document these new options and -Wformat=2. * toplev.c (documented_lang_options): Add these new options. cp: * decl2.c (warn_format): Remove definition. (lang_decode_option): Handle -Wformat-nonliteral, -Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat. testsuite: * gcc.dg/format-no-exargs-1.c, gcc.dg/format-no-y2k-1.c, gcc.dg/format-nonlit-1.c, gcc.dg/format-nonlit-2.c: New tests. From-SVN: r37933
2000-12-01builtins.def (BUILT_IN_IMAXABS): Add.Joseph Myers1-2/+15
* builtins.def (BUILT_IN_IMAXABS): Add. * builtins.c (expand_builtin): Also abort on BUILT_IN_IMAXABS. * c-common.c (c_common_nodes_and_builtins): Create builtin functions __builtin_imaxabs, and plain imaxabs unless flag_no_nonansi_builtin outside C99 mode. (expand_tree_builtin): Handle BUILT_IN_IMAXABS. * extend.texi: Document builtin imaxabs. From-SVN: r37932
2000-12-01c-common.c: Include "defaults.h".Joseph Myers1-0/+38
* c-common.c: Include "defaults.h". (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Define. (c_common_nodes_and_builtins): Create string_type_node, const_string_type_node, wint_type_node, intmax_type_node, uintmax_type_node, default_function_type, ptrdiff_type_node and unsigned_ptrdiff_type_node. * c-common.h (identifier_global_value): Declare. * c-decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define. (init_decl_processing): Don't create string_type_node, const_string_type_node, wint_type_node, intmax_type_node, uintmax_type_node, default_function_type, ptrdiff_type_node and unsigned_ptrdiff_type_node. (identifier_global_value): New function. cp: * decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define. (init_decl_processing): Don't create string_type_node, const_string_type_node, wint_type_node, intmax_type_node, uintmax_type_node, default_function_type, ptrdiff_type_node and unsigned_ptrdiff_type_node. Adjust position of call to c_common_nodes_and_builtins. (identifier_global_value): New function. From-SVN: r37931
2000-11-30* c-common.c (status_warning) [! ANSI_PROTOTYPES]: Load statusAlexandre Oliva1-9/+9
from va_list before using it. From-SVN: r37900
2000-11-27builtins.c (expand_builtin_strncmp, [...]): New functions.Kaveh R. Ghazi1-2/+28
* builtins.c (expand_builtin_strncmp, expand_builtin_strncpy): New functions. (expand_builtin): Handle BUILT_IN_STRNCPY and BUILT_IN_STRNCMP. * builtins.def (BUILT_IN_STRNCPY, BUILT_IN_STRNCMP): New entries. * c-common.c (c_common_nodes_and_builtins): Declare builtin strncpy and strncmp. * extend.texi (strncmp, strncpy): Document new builtins. testsuite: * gcc.c-torture/execute/string-opt-7.c: New test. * gcc.c-torture/execute/string-opt-8.c: Likewise. From-SVN: r37777
2000-11-25c-common.c: Remove USE_CPPLIB conditional inclusions.Neil Booth1-88/+0
* c-common.c: Remove USE_CPPLIB conditional inclusions. * c-common.h: Similarly. * c-decl.c: Similarly. * c-lang.c: Similarly. * c-lex.c: Similarly. * c-parse.in: Similarly. * c-pragma.c: Similarly. * c-pragma.h: Similarly. * gcc.c: Similarly. * toplev.c: Similarly. * cp/cp-tree.h: Similarly. * cp/decl2.c: Similarly. * cp/lang-specs.h: Similarly. * cp/lex.c: Similarly. * cp/lex.h: Similarly. * cp/spew.c: Similarly. * java/lang-options.h: Similarly. * objc/lang-specs.h: Similarly. * objc/objc-act.c: Similarly. * configure.in: Remove configure option. * config.in: Regenerate. * configure: Regenerate. From-SVN: r37742
2000-11-24Fix bug in previous change.Bernd Schmidt1-0/+3
From-SVN: r37707