aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
AgeCommit message (Collapse)AuthorFilesLines
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
2000-11-24Overhaul sequence point warnings (again)Bernd Schmidt1-204/+354
From-SVN: r37706
2000-11-21c-common.c (c_unsafe_for_reeval): New function.Richard Henderson1-0/+15
* c-common.c (c_unsafe_for_reeval): New function. (add_c_tree_codes): Register it. * c-common.h: Declare it. * tree.c (lang_unsafe_for_reeval): New hook. (unsafe_for_reeval): Call it. * tree.h: Declare it. From-SVN: r37623
2000-11-17stringpool.c: New file.Zack Weinberg1-4/+2
* stringpool.c: New file. * ggc-common.c (ggc_mark_string_ptr, ggc_add_string_root): Delete. (ggc_alloc_string): Now in stringpool.o. * ggc-page.c, ggc-simple.c: Do not define or allocate empty_string. * ggc.h: Delete prototype of ggc_add_string_root. #define ggc_add_string_root and ggc_mark_string to nothing. Prototype init_stringpool and stringpool_statistics. (ggc_alloc_string): Returns a const char *. * tree.c (hash_table, do_identifier_warnings): Delete. (init_obstacks): Don't initialize the identifier hash table. (get_identifier, maybe_get_identifier, start_identifier_warnings, set_identifier_size): Now in stringpool.c. * tree.h (struct tree_string): Constify pointer field. (approx_sqrt): Prototype. * Makefile.in (stringpool.o): Add rule, mention in OBJS. * toplev.c (approx_sqrt): New function. (compile_file): Call stringpool_statistics if mem_report is on. (main): Call init_stringpool. * builtins.c (c_strlen), c-decl.c (finish_decl), c-lex.c (process_directive), c-typeck.c (constructor_asmspec, struct initializer_stack, start_init), except.c (create_rethrow_ref), stmt.c (digit_strings), toplev.c (decode_f_option), tree.c (built_in_filename), varasm,c (in_named_name, assemble_static_space, struct constant_descriptor, struct deferred_string, struct pool_constant, force_const_mem), i386.c (pic_label_name, global_offset_table_name), rs6000.c (rs6000_emit_prologue, rs6000_emit_epilogue) : Constify a char *. * c-common.c (combine_strings): Combine strings in scratch buffer, then pass to build_string. * optabs.c (init_libfuncs), profile.c (init_edge_profiler, output_func_start_profiler), stmt.c (init_stmt), alpha.c (alpha_need_linkage), arm.c (arm_encode_call_attribute), i386.c (load_pic_register), ia64.c (ia64_encode_section_info), rs6000.c (rs6000_encode_section_info): Create string in scratch buffer, then pass to ggc_alloc_string. * stmt.c (expand_asm_operands): If we must adjust the constraint strings, do so by creating a new one, not by modifying the old one in place. Constify some char *s. * config/pa/pa.c (hppa_encode_label): Drop unnecessary second argument. Create string in scratch buffer, then pass to ggc_alloc_string. * config/pa/pa-protos.h: Update prototype. * config/pa/elf.h, config/pa/pa.h, config/pa/som.h: hppa_encode_label takes only one argument. * c-parse.in (if_prefix): Find the filename and line number at $-2 and $-1 respectively. * diagnostic.c (error_recursion): Add missing newline, use fputs, translate string. cp: * lex.c (struct impl_files, internal_filename): Constify a char *. java: * jcf-parse.c (get_constant), parse.y (do_merge_string_cste): Create string in scratch buffer, then pass to build_string. From-SVN: r37514
2000-11-15tree.c (build_type_no_quals): New function.Andrew Haley1-3/+1
2000-11-13 Andrew Haley <aph@redhat.com> * tree.c (build_type_no_quals): New function. * tree.h (build_type_no_quals): Declare. * c-common.c (c_get_alias_set): When considering type compatibility for pointer types, ignore cv-qualifiers anywhere in a pointer chain. From-SVN: r37479
2000-11-13c-common.c (boolean_increment): New function.Joseph Myers1-0/+41
* c-common.c (boolean_increment): New function. * c-common.h (enum c_tree_index): Add CTI_C_BOOL_TYPE, CTI_C_BOOL_TRUE and CTI_C_BOOL_FALSE. (c_bool_type_node, c_bool_true_node, c_bool_false_node): Define. (boolean_increment): Declare. * c-convert.c (convert): Allow for BOOLEAN_TYPE. * c-decl.c (init_decl_processing): Create boolean nodes. (finish_struct): Allow for _Bool bitfields. * c-parse.in (reswords): Add _Bool. (rid_to_yy): Allow for RID_BOOL. * c-typeck.c (default_conversion): Make booleans promote to int. (convert_arguments, build_unary_op, build_modify_expr, convert_for_assignment): Allow for booleans. * ginclude/stdbool.h: Make conforming to C99. cp: * typeck.c (build_unary_op): Use boolean_increment from c-common.c, moving the relevant code there. testsuite: * gcc.dg/c99-bool-1.c: New test. From-SVN: r37428
2000-11-13builtins.c (expand_builtin): Handle BUILT_IN_INDEX and BUILT_IN_RINDEX.Kaveh R. Ghazi1-0/+10
* builtins.c (expand_builtin): Handle BUILT_IN_INDEX and BUILT_IN_RINDEX. Add missing checks for BUILT_IN_STRCHR and BUILT_IN_STRRCHR. * builtins.def (BUILT_IN_INDEX, BUILT_IN_RINDEX): New entries. * c-common.c (c_common_nodes_and_builtins): Declare index and rindex when nonansi builtins are allowed. * extend.texi (index, rindex): Document new builtins. testsuite: * gcc.c-torture/execute/string-opt-3.c: Also test builtin rindex. * gcc.c-torture/execute/string-opt-4.c: Also test builtin index. From-SVN: r37416
2000-11-10Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o.Mark Mitchell1-0/+18
* Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o. (c-dump.o): New target. * c-common.h (flag_dump_translation_unit): New variable. (C_TYPE_QUALS): New macro. (strip_array_types): New function. (DECL_C_BIT_FIELD): New macro. (SET_DECL_C_BIT_FIELD): Likewise. (CLEAR_DECL_C_BIT_FIELD): Likewise. (dump_info_p): New typedef. (dump_tree_fn): Likewise. (lang_dump_tree): New variable. (dump_node_to_file): New function. * c-common.c (flag_dump_translation_unit): Define it. (strip_array_types): New function. * c-decl.c (c_decode_option): Handle -fdump-translation-unit. * c-lang.c (finish_file): Call dump_node_to_file if flag_dump_translation_unit. * c-semantics.c (mark_rtl_for_local_static): Fix typo in comment. * c-tree.h (DECL_C_BIT_FIELD): Remove declaration. * c-dump.c: New file. * Make-lang.in (CXX_C_OBJS): Add c-dump.o. (dump.o): Update dependency list. * cp-tree.h (DECL_MAYBE_TEMPLATE): Remove. (flag_dump_translation_unit): Likewise. (CP_TYPE_QUALS): Adjust definition. (DECL_C_BIT_FIELD): Remove. (SET_DECL_C_BIT_FIELD): Likewise. (CLEAR_DECL_C_BIT_FIELD): Likewise. (add_maybe_template): Likewise. (strip_array_types): Likewise. (dump_node_to_file): Likewise. (cp_dump_tree): New function. * decl.c (init_decl_processing): Set lang_dump_tree. * decl2.c (flag_dump_translation_unit): Remove. * dump.c: Move most of it to ../c-dump.c. (cp_dump_tree): New function. * pt.c (add_maybe_template): Remove. * typeck.c (strip_array_types): Likewise. From-SVN: r37358
2000-11-09builtins.c (c_strlen): Use TREE_STRING_LENGTH - 1 for max.Jakub Jelinek1-0/+6
* builtins.c (c_strlen): Use TREE_STRING_LENGTH - 1 for max. (c_getstr): New function. (expand_builtin_strstr): Do nothing if -fcheck-memory-usage. If both arguments are constant string, optimize out. (expand_builtin_strchr, expand_builtin_strrchr): New functions. (expand_builtin_strpbrk): Use c_getstr, do nothing if -fcheck-memory-usage. (expand_builtin_fputs): Likewise. (expand_builtin_strcmp): Add MODE argument. Use even if !HAVE_cmpstrsi. Optimize the case when both arguments are constant strings. (expand_builtin): Adjust expand_builtin_strcmp caller. Call expand_builtin_strchr and expand_builtin_strrchr. * c-common.c (c_common_nodes_and_builtins): Add strchr and strrchr builtins. * builtins.def (BUILT_IN_STRRCHR): Add. * gcc.c-torture/execute/string-opt-1.c: Add test for strstr with both arguments constant strings. * gcc.c-torture/execute/string-opt-3.c: New test. * gcc.c-torture/execute/string-opt-4.c: New test. * gcc.c-torture/execute/string-opt-5.c: New test. From-SVN: r37338
2000-11-07* c-common.c (combine_strings): Only warn about long strings for C.Kaveh R. Ghazi1-1/+1
From-SVN: r37297
2000-11-07builtins.c (expand_builtin_strpbrk): New function.Kaveh R. Ghazi1-1/+5
* builtins.c (expand_builtin_strpbrk): New function. (expand_builtin): Handle BUILT_IN_STRPBRK. * builtins.def (BUILT_IN_STRPBRK): New entry. * c-common.c (c_common_nodes_and_builtins): Declare builtin strpbrk. testsuite: * gcc.c-torture/execute/string-opt-2.c: New test. From-SVN: r37291
2000-11-02c-common.c (get_flag_spec, [...]): Use strchr () instead of index ().Joseph Myers1-21/+22
* c-common.c (get_flag_spec, check_format_info_main, check_format_types): Use strchr () instead of index (). Compare against error_mark_node instead of comparing the TREE_CODE against ERROR_MARK. From-SVN: r37205
2000-11-01builtins.c (expand_builtin_strstr): New function.Kaveh R. Ghazi1-0/+24
* builtins.c (expand_builtin_strstr): New function. (expand_builtin): Handle BUILT_IN_STRSTR and BUILT_IN_STRCHR. * builtins.def (BUILT_IN_STRSTR, BUILT_IN_STRCHR): New entries. * c-common.c (c_common_nodes_and_builtins): Declare builtin strstr and builtin strchr. From-SVN: r37181
2000-10-20c-common.c (check_format_info_recurse): Extract string constant initializers ↵Joseph Myers1-0/+27
from non-volatile constant arrays and... * c-common.c (check_format_info_recurse): Extract string constant initializers from non-volatile constant arrays and check them as formats. * c-typeck.c (decl_constant_value): Don't check pedantic or check for DECL_MODE (decl) != BLKmode. (decl_constant_value_for_broken_optimization): New function which includes these checks. (default_conversion, convert_for_assignment, digest_init): Use decl_constant_value_for_broken_optimization instead of decl_constant_value. testsuite: * gcc.dg/format-array-1.c: New test. From-SVN: r36965
2000-10-18c-common.h (flag_no_builtin): Declare.Mark Mitchell1-27/+25
* c-common.h (flag_no_builtin): Declare. (flag_no_nonansi_builtin): Likewise. (c_common_nodes_and_builtins): Change prototype. * c-common.c (flag_no_builtin): New variable. (flag_no_nonansi_builtin): Likewise. (c_common_nodes_and_builtins): Remove parameters. Adjust accordingly. * c-decl.c (flag_no_builtin): Remove. (flag_no_nonansi_builtin): Likewise. (init_decl_processing): Adjust call to c_common_nodes_and_builtins. * cp-tree.h (cp_tree_index): Add CPTI_FAKE_STD. (fake_std_node): New macro. * decl.c (in_std): Rename to ... (in_fake_std): ... this. (flag_no_builtin): Remove. (flag_no_nonansi_builtin): Likewise. (walk_namespaces_r): Use fake_std_node. (push_namespace): Use std_identifier. (pop_namespace): Use in_fake_std. (lookup_name_real): Use fake_std_node. (init_decl_processing): When -fhonor-std, create the `std' namespace. Don't create a dummy fake_std_node in that case. Adjust call to c_common_nodes_and_builtins. Use std_identifier. (builtin_function): Put builtins whose names don't begin with `_' in the std namespace. * decl2.c (flag_no_builtin): Remove. (flag_no_nonansi_builtin): Likewise. (set_decl_namespace): Use fake_std_node. (validate_nonmember_using_decl): Likewise. (do_using_directive): Likewise. (handle_class_head): Likewise. * dump.c (dequeue_and_dump): Likewise. * except.c (init_exception_processing): Use std_identifier. * init.c (build_member_call): Use fake_std_node. * rtti.c (init_rtti_processing): Use std_identifier. From-SVN: r36940
2000-10-18c-common.c (check_format_types): Check for writing through a NULL pointer ↵Joseph Myers1-0/+9
argument. * c-common.c (check_format_types): Check for writing through a NULL pointer argument. testsuite: * gcc.dg/c90-printf-1.c, gcc.dg/c90-scanf-1.c: Add tests for writing through null pointers; remove comment about testing unterminated strings. From-SVN: r36936
2000-10-18c-common.c (CPLUSPLUS_STD_VER, [...]): Define.Joseph Myers1-36/+38
* c-common.c (CPLUSPLUS_STD_VER, C_STD_VER, C_STD_NAME): Define. (maybe_read_dollar_number, check_format_info_main): Use them for pedantic warning messages. From-SVN: r36931
2000-10-18c-common.c (check_format_info_main): Minor cleanup...Joseph Myers1-36/+30
* c-common.c (check_format_info_main): Minor cleanup: move variables into inner scopes; initialize declarations where appropriate; don't hardcode "scanf" name on warning for zero width. From-SVN: r36929
2000-10-18c-common.c (back_end_hook): New variable.Mark Mitchell1-0/+4
* c-common.c (back_end_hook): New variable. * c-common.h (back_end_hook): Declare it. * c-lang.c (finish_file): Use it. * emit-rtl.c (init_emit_once): Initialize the const_int_htab earlier. * cp-tree.h (back_end_hook): Remove declaration. * decl2.c (back_end_hook): Remove definition. * dump.c (dequeue_and_dump): Dump TREE_USED. From-SVN: r36928
2000-10-17c-common.c (FMT_FLAG_DOLLAR_MULTIPLE): Define.Joseph Myers1-8/+23
* c-common.c (FMT_FLAG_DOLLAR_MULTIPLE): Define. (format_types): Use it for printf. (maybe_read_dollar_number): Add parameter for the kind of format involved. Warn for multiple use for arguments if this is inappropriate for the kind of format involved. (check_format_info_main): Update calls to maybe_read_dollar_number. testsuite: * gcc.dg/format-xopen-1.c: Update comments; adjust for checking for multiple use of arguments with scanf formats; add tests for multiple use of arguments. From-SVN: r36905