aboutsummaryrefslogtreecommitdiff
path: root/libcpp/init.c
AgeCommit message (Collapse)AuthorFilesLines
2011-10-31re PR libstdc++/1773 (__cplusplus defined to 1, should be 199711L)Jason Merrill1-1/+7
PR libstdc++/1773 * init.c (cpp_init_builtins): Set __cplusplus for C++11. From-SVN: r180708
2011-10-31re PR c++/50920 (add a -std=c++11 option to the driver)Jason Merrill1-4/+4
PR c++/50920 gcc/c-family * c-common.h (cxx_dialect): Add cxx11 and cxx03. * c.opt: Add -std=c++11, -std=gnu++11, -std=gnu++03, and -Wc++11-compat. * c-opts.c (set_std_cxx11): Rename from set_std_cxx0x. gcc/cp * class.c (check_field_decl): Change c++0x in diags to c++11. * error.c (maybe_warn_cpp0x): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. * pt.c (check_default_tmpl_args): Likewise. libcpp * include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11, CLK_GNUCXX0X to CLK_GNUCXX11. libstdc++-v3 * include/bits/c++0x_warning.h: Change -std=c++0x to -std=c++11. From-SVN: r180707
2011-10-26Implement C++11 user-defined literals.Ed Smith-Rowland1-13/+15
libcpp/ * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix, cpp_userdef_string_remove_type, cpp_userdef_string_add_type, cpp_userdef_char_remove_type, cpp_userdef_char_add_type, cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New. (cpp_classify_number): Classify unrecognized tokens as user-defined literals. * include/cpplib.h: Add new tokens for user-defined literals. * init.c: Add new preprocessor flag (cxx11). * lex.c: (lex_string, lex_raw_string): Handle user-defined literals including concatenation and promotion with suffixes. c-family/ * c-common.c (build_userdef_literal): New. * c-common.def: New tree code. * c-common.h (tree_userdef_literal): New tree struct and accessors. * c-lex.c (interpret_float): Add suffix parm. (c_lex_with_flags): Build literal tokens. cp/ * cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree. * cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator name tools. New tree code for user-defined literals. * cxx-pretty-print.h: (pp_cxx_userdef_literal) New. * cxx-pretty-print.c: (pp_cxx_userdef_literal) New. (pp_cxx_primary_expression, pp_cxx_expression): Use it. * decl.c: (cp_tree_node_structure): Return new tree code. (duplicate_decls): Check for raw vs. template operator conflicts. (grokfndecl, grokdeclarator): New checks for literal operators. * error.c: (dump_expr): Warn about user-defined literals in C++98 mode. (dump_function_name): Pretty printing. * mangle.c: (write_literal_operator_name): New. (write_unqualified_id, write_unqualified_name): Use it. * parser.c: (cp_parser_operator): Handle operator"". (cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal): New. (cp_parser_primary_expression): Handle new user-defined literal tokens with new functions. * semantics.c: (potential_constant_expression_1): Add user-defined literals. * typeck.c (check_raw_literal_operator, check_literal_operator_args): New. From-SVN: r180536
2011-10-17Generate virtual locations for tokensTom Tromey1-1/+2
This second instalment uses the infrastructure of the previous patch to allocate a macro map for each macro expansion and assign a virtual location to each token resulting from the expansion. To date when cpp_get_token comes across a token that happens to be a macro, the macro expander kicks in, expands the macro, pushes the resulting tokens onto a "token context" and returns a dummy padding token. The next call to cpp_get_token goes look into the token context for the next token [which is going to result from the previous macro expansion] and returns it. If the token is a macro, the macro expander kicks in and you know the story. This patch piggy-backs on that macro expansion process, so to speak. First it modifies the macro expander to make it create a macro map for each macro expansion. It then allocates a virtual location for each resulting token. Virtual locations of tokens resulting from macro expansions are then stored on a special kind of context called an "expanded tokens context". In other words, in an expanded tokens context, there are tokens resulting from macro expansion and their associated virtual locations. cpp_get_token_with_location is modified to return the virtual location of tokens resulting from macro expansion. Note that once all tokens from an expanded token context have been consumed and the context and is freed, the memory used to store the virtual locations of the tokens held in that context is freed as well. This helps reducing the overall peak memory consumption. The client code that was getting macro expansion point location from cpp_get_token_with_location now gets virtual location from it. Those virtual locations can in turn be resolved into the different interesting physical locations thanks to the linemap API exposed by the previous patch. Expensive progress. Possibly. So this whole virtual location allocation business is switched off by default. So by default no extended token is created. No extended token context is created either. One has to use -ftrack-macro-expansion to switch this on. This complicates the code but I believe it can be useful as some of our friends found out at http://llvm.org/bugs/show_bug.cgi?id=5610 The patch tries to reduce the memory consumption by freeing some token context memory that was being reused before. I didn't notice any compilation slow down due to this immediate freeing on my GNU/Linux system. As no client code tries to resolve virtual locations to anything but what was being done before, no new test case has been added. Co-Authored-By: Dodji Seketeli <dodji@redhat.com> From-SVN: r180082
2011-10-17Linemap infrastructure for virtual locationsTom Tromey1-1/+3
This is the first instalment of a set which goal is to track locations of tokens across macro expansions. Tom Tromey did the original work and attached the patch to PR preprocessor/7263. This opus is a derivative of that original work. This patch modifies the linemap module of libcpp to add virtual locations support. A virtual location is a mapped location that can resolve to several different physical locations. It can always resolve to the spelling location of a token. For tokens resulting from macro expansion it can resolve to: - either the location of the expansion point of the macro. - or the location of the token in the definition of the macro - or, if the token is an argument of a function-like macro, the location of the use of the matching macro parameter in the definition of the macro The patch creates a new type of line map called a macro map. For every single macro expansion, there is a macro map that generates a virtual location for every single resulting token of the expansion. The good old type of line map we all know is now called an ordinary map. That one still encodes spelling locations as it has always had. As a result linemap_lookup as been extended to return a macro map when given a virtual location resulting from a macro expansion. The layout of structs line_map has changed to support this new type of map. So did the layout of struct line_maps. Accessor macros have been introduced to avoid messing with the implementation details of these datastructures directly. This helped already as we have been testing different ways of arranging these datastructure. Having to constantly adjust client code that is too tied with the internals of line_map and line_maps would have been even more painful. Of course, many new public functions have been added to the linemap module to handle the resolution of virtual locations. This patch introduces the infrastructure but no part of the compiler uses virtual locations yet. However the client code of the linemap data structures has been adjusted as per the changes. E.g, it's not anymore reliable for a client code to manipulate struct line_map directly if it just wants to deal with spelling locations, because struct line_map can now represent a macro map as well. In that case, it's better to use the convenient API to resolve the initial (possibly virtual) location to a spelling location (or to an ordinary map) and use that. This is the reason why the patch adjusts the Java, Ada and Fortran front ends. Also, note that virtual locations are not supposed to be ordered for relations '<' and '>' anymore. To test if a virtual location appears "before" another one, one has to use a new operator exposed by the line map interface. The patch updates the only spot (in the diagnostics module) I have found that was making the assumption that locations were ordered for these relations. This is the only change that introduces a use of the new line map API in this patch, so I am adding a regression test for it only. From-SVN: r180081
2011-08-22Add ability to force lexed tokens' source_locations.Gabriel Charette1-0/+3
Use it to force BUILTINS_LOCATION when declaring builtins instead of creating a <built-in> entry in the line_table which is wrong. * c-opts.c (c_finish_options): Force BUILTINS_LOCATION for tokens defined in cpp_init_builtins and c_cpp_builtins. gcc/fortran/ChangeLog * cpp.c (gfc_cpp_init): Force BUILTINS_LOCATION for tokens defined in cpp_define_builtins. libcpp/ChangeLog * init.c (cpp_create_reader): Inititalize forced_token_location_p. * internal.h (struct cpp_reader): Add field forced_token_location_p. * lex.c (_cpp_lex_direct): Use forced_token_location_p. (cpp_force_token_locations): New. (cpp_stop_forcing_token_locations): New. From-SVN: r177973
2011-08-18Properly define __cplusplus (PR libstdc++-v3/1773)Rainer Orth1-1/+1
PR libstdc++/1773 * init.c (cpp_init_builtins): Define __cplusplus 19971L. From-SVN: r177877
2011-08-18c1x-uni-string-1.c, [...]: New tests.Joseph Myers1-14/+23
gcc/testsuite: * gcc.dg/c1x-uni-string-1.c, gcc.dg/c1x-uni-string-2.c: New tests. libcpp: * include/cpplib.h (struct cpp_options): Add rliterals. * init.c (struct lang_flags, lang_defaults): Add rliterals. (cpp_set_lang): Set rliterals option. (cpp_init_builtins): Define __STDC_UTF_16__ and __STDC_UTF_32__. * lex.c (_cpp_lex_direct): Only accept raw strings if rliterals. From-SVN: r177868
2011-04-20remove useless if-before-free testsJim Meyering1-2/+1
Change "if (E) free (E);" to "free (E);" everywhere except in the libgo/, intl/, zlib/ and classpath/ directories. Also transform equivalent variants like "if (E != NULL) free (E);" and allow an extra cast on the argument to free. Otherwise, the tested and freed "E" expressions must be identical, modulo white space. From-SVN: r172785
2011-03-25files.c (file_hash_eq): Use filename_cmp instead of strcmp.Kai Tietz1-2/+3
2011-03-25 Kai Tietz <ktietz@redhat.com> * files.c (file_hash_eq): Use filename_cmp instead of strcmp. (nonexistent_file_hash_eq): Likewise. (remap_filename): Likewise. Handle absolute DOS-path, (append_file_to_dir): Check for IS_DIR_SEPARATOR instead of slash. (read_name_map): Likewise. * linemap.c (linemap_add): Use filename_cmp instead of strcmp. * mkdeps.c (apply_vpath): Use filename_ncmp instead of strncmp. (deps_restore): Use filename_cmp instead of strcmp. * init.c (read_original_directory): Use IS_DIR_SEPARATOR instead of checking for slash. From-SVN: r171521
2010-09-29optc-gen.awk: Generate global_options initializer instead of individual ↵Joseph Myers1-3/+3
variables. gcc: * optc-gen.awk: Generate global_options initializer instead of individual variables. Add x_ prefix to names of structure members. * opth-gen.awk: Generate gcc_options structure. Add x_ prefix to names of structure members. * doc/tm.texi.in (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Document. * doc/tm.texi: Regenerate. * alias.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * builtins.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER. * c-parser.c (disable_extension_diagnostics, restore_extension_diagnostics): Update names of cpp_options members. * combine.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * common.opt (fcompare-debug-second): Don't use Var. * config/alpha/alpha.h (target_flags): Remove. * config/arm/arm.h (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Define. * config/bfin/bfin.h (target_flags): Remove. * config/cris/cris.h (target_flags): Remove. * config/i386/i386-c.c (ix86_pragma_target_parse): Update names of cl_target_option members. * config/i386/i386.c (ix86_force_align_arg_pointer): Remove. (ix86_function_specific_print, ix86_valid_target_attribute_tree, ix86_can_inline_p): Update names of cl_target_option members. * config/i386/i386.h (ix86_isa_flags): Remove. * config/lm32/lm32.h (target_flags): Remove. * config/mcore/mcore.h (mcore_stack_increment): Remove. * config/mcore/mcore.md (addsi3): Remove extern declaration of flag_omit_frame_pointer. * config/mep/mep.h (target_flags): Remove. * config/mips/mips.h (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Define. * config/mmix/mmix.h (target_flags): Remove. * config/rs6000/rs6000.h (rs6000_xilinx_fpu, flag_pic, flag_expensive_optimizations): Remove. * config/s390/s390.h (flag_pic): Remove. * config/score/score-conv.h (target_flags): Remove. * config/sh/sh.h (sh_fixed_range_str): Remove. * config/spu/spu.h (target_flags, spu_fixed_range_string): Remove. * dbxout.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER * df-scan.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * diagnostic.c (diagnostic_initialize): Update names of diagnostic_context members. * diagnostic.h (diagnostic_context): Rename inhibit_warnings and warn_system_headers. (diagnostic_report_warnings_p): Update for new names. * dwarf2out.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER * emit-rtl.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER and HARD_FRAME_POINTER_IS_ARG_POINTER. * flags.h (flag_compare_debug): Declare. * ira.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * opts.c (flag_compare_debug): Define. (common_handle_option): Update names of diagnostic_context members. Handle -fcompare-debug-second. (fast_math_flags_struct_set_p): Update names of cl_optimization members. * reginfo.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * regrename.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * reload.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * reload1.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * resource.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER. * rtl.h (HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_IS_ARG_POINTER): Define and use. * sel-sched.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * stmt.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER. gcc/c-family: * c-common.c (c_cpp_error): Update names of diagnostic_context members. * c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Update names of cl_optimization members. * c-opts.c (warning_as_error_callback, c_common_handle_option, sanitize_cpp_opts, finish_options): Update names of cpp_options members. gcc/fortran: * cpp.c (cpp_define_builtins): Update names of gfc_option_t members. (gfc_cpp_post_options): Update names of cpp_options members. (cb_cpp_error): Update names of diagnostic_context members. * f95-lang.c (gfc_init_builtin_functions): Update names of gfc_option_t members. * gfortran.h (gfc_option_t): Rename warn_conversion and flag_openmp. * intrinsic.c (gfc_convert_type_warn): Update names of gfc_option_t members. * options.c (gfc_init_options, gfc_post_options, set_Wall, gfc_handle_option): Update names of gfc_option_t members. * parse.c (next_free, next_fixed): Update names of gfc_option_t members. * scanner.c (pedantic): Remove extern declaration. (skip_free_comments, skip_fixed_comments, include_line): Update names of gfc_option_t members. * trans-decl.c (gfc_generate_function_code): Update names of gfc_option_t members. gcc/java: * java-tree.h (flag_filelist_file, flag_assert, flag_jni, flag_force_classes_archive_check, flag_redundant, flag_newer, flag_use_divide_subroutine, flag_use_atomic_builtins, flag_use_boehm_gc, flag_hash_synchronization, flag_check_references, flag_optimize_sci, flag_indirect_classes, flag_indirect_dispatch, flag_store_check, flag_reduced_reflection): Remove. * jcf-dump.c (flag_newer): Remove. * jcf.h (quiet_flag): Remove. * parse.h (quiet_flag): Remove. libcpp: * include/cpplib.h (cpp_options): Rename warn_deprecated, warn_traditional, warn_long_long and pedantic. * directives.c (directive_diagnostics, _cpp_handle_directive): Update names of cpp_options members. * expr.c (cpp_classify_number, eval_token): Update names of cpp_options members. * init.c (cpp_create_reader, post_options): Update names of cpp_options members. * internal.h (CPP_PEDANTIC, CPP_WTRADITIONAL): Update names of cpp_options members. * macro.c (parse_params): Update names of cpp_options members. From-SVN: r164723
2010-09-15* init.c: Fix type name in comment.Ian Lance Taylor1-1/+1
From-SVN: r164306
2010-06-10common.opt (fshow-column): Don't mark as C ObjC C++ ObjC++.Joseph Myers1-3/+0
gcc: * common.opt (fshow-column): Don't mark as C ObjC C++ ObjC++. gcc/c-family: * c-opts.c (c_common_handle_option): Don't handle OPT_fshow_column. libcpp: * include/cpplib.h (struct cpp_options): Remove show_column. * init.c (cpp_create_reader, post_options): Don't set show_column. From-SVN: r160553
2010-04-25c-common.c (flag_isoc1x): New.Joseph Myers1-0/+5
gcc: * c-common.c (flag_isoc1x): New. (flag_isoc99): Update comment. * c-common.h (flag_isoc1x): New. (flag_isoc99): Update comment. * c-cppbuiltin.c (builtin_define_float_constants): Also define __<type>_DECIMAL_DIG__. * c-opts.c (set_std_c1x): New. (c_common_handle_option): Handle -std=c1x and -std=gnu1x. (set_std_c89, set_std_c99): Also set flag_isoc1x to 0. * c.opt (-std=c1x, -std=gnu1x): New options. * doc/cpp.texi: Mention -std=c1x. * doc/cppopts.texi (-std=c1x, -std=gnu1x): Document. * doc/extend.texi: Mention -std=c1x and -std=gnu1x. * doc/invoke.texi (-std=c1x, -std=gnu1x): Document. * doc/standards.texi: Mention C1X. * ginclude/float.h (FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG, FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, LDBL_HAS_SUBNORM, FLT_TRUE_MIN, DBL_TRUE_MIN, LDBL_TRUE_MIN): Define for C1X. gcc/testsuite: * gcc.dg/c90-float-1.c: Also test that C1X macros are not defined. * gcc.dg/c99-float-1.c: Also test that C1X macros are not defined. * gcc.dg/c1x-float-1.c: New test. libcpp: * include/cpplib.h (enum c_lang): Add CLK_GNUC1X and CLK_STDC1X. * init.c (lang_defaults): Add entries for new language variants. (cpp_init_builtins): Define __STDC_VERSION__ to 201000L for C1X variants. From-SVN: r158711
2010-02-11init.c (read_original_filename): Don't call read_original_directory if ↵Jakub Jelinek1-3/+3
_cpp_handle_directive returns 0. * init.c (read_original_filename): Don't call read_original_directory if _cpp_handle_directive returns 0. From-SVN: r156720
2009-11-11ChangeLog for libcppKai Tietz1-0/+15
2009-11-11 Kai Tietz <kai.tietz@onevision.com> * directives.c (do_pragma_push_macro): New pragma handler. (do_pragma_pop_macro): Likewise. (_cpp_init_internal_pragmas): Add push_macro and pop_macro handler to internal pragmas. (lex_macro_node_from_str): Removed. (cpp_push_definition): Replace lex_macro_node_from_str by _cpp_lex_identifier. (cpp_pop_definition): Likewise. * internal.h (_cpp_lex_identifier): New prototype. (def_pragma_macro): New structure. (cpp_reader): New member pushed_macros. * lex.c (_cpp_lex_identifier): New function. (lex_identifier_intern): New function. * init.c (cpp_create_reader): Initialize pushed_macros member. (cpp_destroy): Free elements in pushed_macros member. * pch.c (_cpp_save_pushed_macros): New function. (_cpp_restore_pushed_macros): Likewise. (_cpp_restore_pushed_macros): Use _cpp_save_pushed_macros. (cpp_read_state): Use _cpp_restore_pushed_macros. ChangeLog for gcc 2009-11-11 Kai Tietz <kai.tietz@onevision.com> * config/i386/cygming.h (HANDLE_PRAGMA_PUSH_POP_MACRO): Removed. * c-pragma.c (def_pragma_macro_value): Likewise. (def_pragma_macro): Likewise. (pushed_macro_table): Likewise. (HANDLE_PRAGMA_PUSH_POP_MACRO): Remove guarded code. * doc/tm.texi (HANDLE_PRAGMA_PUSH_POP_MACRO): Removed. ChangeLog for gcc/testsuite 2009-11-11 Kai Tietz <kai.tietz@onevision.com> * g++.dg/torture/pushpop_macro.C: New testcase. * gcc.c-torture/execute/pushpop_macro.c: New testcase. * gcc.dg/cpp/pragma-pop_macro-1.c: Allow test for all targets. From-SVN: r154098
2009-06-12cpplib.h (struct cpp_options): Add warn_cxx_operator_names field.Ian Lance Taylor1-4/+11
libcpp/: * include/cpplib.h (struct cpp_options): Add warn_cxx_operator_names field. (NODE_WARN_OPERATOR): Define. (struct cpp_hashnode): Increase flags field to 10 bits, decrease type to 6 bits. * init.c (mark_named_operators): Add flags parameter. (cpp_post_options): Pick flags value to pass to mark_named_operators. * lex.c (lex_identifier): If NODE_WARN_OPERATOR is set, warn that identifier is an operator name in C++. gcc/: * fold-const.c (fold_unary): Rename local variable and to and_expr. * c-opts.c (c_common_handle_option): For -Wc++-compat set cpp_opts->warn_cxx_operator_names. gcc/testsuite/: * gcc.dg/Wcxx-compat-13.c: New testcase. From-SVN: r148438
2009-05-16alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry.Ian Lance Taylor1-1/+1
gcc/ChangeLog: * alias.c (struct alias_set_entry_d): Rename from struct alias_set_entry. Change all uses. * except.c (struct call_site_record_d): Rename from struct call_site_record. Change all uses. * except.h (struct eh_region_d): Rename from struct eh_region. Change all uses. * gcse.c (struct hash_table_d): Rename from struct hash_table. Change all uses. * graphite.c (struct ivtype_map_elt_d): Rename fromstruct ivtype_map_elt. Change all uses. (struct rename_map_elt_d): Rename fromstruct rename_map_elt. Change all uses. (struct ifsese_d): Rename fromstruct ifsese. Change all uses. * graphite.h (struct name_tree_d): Rename from struct name_tree. Change all uses. (struct sese_d): Rename from struct sese. Change all uses. * omega.h (struct eqn_d): Rename from struct eqn. Change all uses. (struct omega_pb_d): Rename from struct omega_pb. Change all uses. * optabs.h (struct optab_d): Rename from struct optab. Change all uses. (struct convert_optab_d): Rename from struct convert_optab. Change all uses. * tree-pass.h (struct ipa_opt_pass_d): Rename fromstruct ipa_opt_pass. Change all uses. * tree-predcom.c (struct dref_d): Rename from struct dref. Change all uses. * c-decl.c (pushtag): If -Wc++-compat, warn if the tag is already defined as a typedef. (grokdeclarator): If -Wc++-compat, warn if a typedef is already defined as a tag. gcc/cp/ChangeLog: * cp-tree.h (enum cp_lvalue_kind_flags): Rename from cp_lvalue_kind. Change all uses. (enum base_access_flags): Rename from enum base_access. Change all uses. * parser.c (enum cp_parser_flags): Remove enum tag. gcc/testsuite/ChangeLog: * gcc.dg/Wcxx-compat-10.c: New testcase. libcpp/ChangeLog: * include/cpplib.h (enum cpp_builtin_type): Rename from enum builtin_type. Change all uses. From-SVN: r147605
2009-04-22re PR c++/14875 (When using 'or' keyword, the error message speaks of a '||' ↵Manuel López-Ibáñez1-0/+18
token) 2009-04-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/14875 * c-common.c (c_parse_error): Take a token_flags parameter. Use token_type for the token type instead. Pass token_flags to cpp_type2name. * c-common.h (c_parse_error): Update declaration. * c-parser.c (c_parser_error): Pass 0 as token flags. libcpp/ * lex.c (cpp_type2name): Take a flags parameter. Call cpp_named_operator2name for named operators and cpp_digraph2name for digraphs. (cpp_digraph2name): New. (cpp_spell_token): Use it. (cpp_output_token): Likewise. * include/cpplib.h (cpp_type2name): Update declaration. * init.c (cpp_named_operator2name): New. * internal.h (cpp_named_operator2name): Declare. cp/ * parser.c (cp_parser_error): Pass token->flags to c_parse_error. testsuite/ * g++.dg/parse/parser-pr14875.C: New. * g++.dg/parse/parser-pr14875-2.C: New. * g++.dg/parse/error6.C: Update match string. From-SVN: r146589
2009-04-20re PR c++/13358 (long long and C++ do not mix well)Manuel López-Ibáñez1-1/+1
2009-04-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/13358 * doc/invoke.texi (-Wlong-long): Update description. * c-lex (interpret_integer): Only warn if there was no previous overflow and -Wlong-long is enabled. * c-decl.c (declspecs_add_type): Drop redundant flags. * c.opt (Wlong-long): Init to -1. * c-opts.c (sanitize_cpp_opts): Synchronize cpp's warn_long_long and front-end warn_long_long. Wlong-long only depends on other flags if it is uninitialized. * c-parser.c (disable_extension_diagnostics): warn_long_long is the same for CPP and FE. (restore_extension_diagnostics): Likewise. libcpp/ * init.c (cpp_create_reader): Wlong_long is disabled by default. * expr.c (cpp_classify_number): Give different messages for C and C++ front-ends. cp/ * parser.c (cp_parser_check_decl_spec): Drop redundant flags. * error.c (pedwarn_cxx98): New. * cp-tree.h (pedwarn_cxx98): Declare. testsuite/ * gcc.dg/wtr-int-type-1.c: Use two dg-warning to match two messages. Test for "long long" in system headers. * gcc.dg/c99-longlong-2.c: New. * g++.dg/warn/pr13358.C: New. * g++.dg/warn/pr13358-2.C: New. * g++.dg/warn/pr13358-3.C: New. * g++.dg/warn/pr13358-4.C: New. From-SVN: r146459
2009-04-09Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.Jakub Jelinek1-3/+3
From-SVN: r145841
2009-03-29re PR preprocessor/34695 (Preprocessor warning->error conversion from ↵Joseph Myers1-8/+5
-Werror is silent) PR preprocessor/34695 gcc: * Makefile.in (c-opts.o): Depend on c-tree.h. * c-common.c: Move down include of diagnostic.h. (done_lexing, c_cpp_error): New. * c-common.h (done_lexing): Declare. * c-decl.c (c_write_global_declarations): Don't check cpp_errors (parse_in). * c-opts.c: Include c-tree.h. (c_common_init_options): Set preprocessor error callback. (c_common_handle_option): Do not set preprocessor inhibit_warnings, warnings_are_errors, warn_system_headers, pedantic_errors or inhibit_warnings flags. (c_common_post_options): Do not check cpp_errors (parse_in). (c_common_finish): Do not output dependencies if there were errors. Do not check return value of cpp_finish. * c-ppoutput.c (pp_file_change): Set input_location. * c-tree.h (c_cpp_error): Declare. * diagnostic.c (diagnostic_set_info_translated): Also initialize override_column. (diagnostic_build_prefix): Check override_column. * diagnostic.h (diagnostic_info): Add override_column field. (diagnostic_override_column): Define. gcc/cp: * cp-tree.h (cp_cpp_error): Remove. * error.c (cp_cpp_error): Remove. * parser.c (cp_lexer_new_main): Set done_lexing instead of client_diagnostic and error callback. gcc/fortran: * cpp.c (cb_cpp_error): New. (gfc_cpp_post_options): Don't set cpp_option->inhibit_warnings. Don't check cpp_errors (cpp_in). (gfc_cpp_init_0): Set cb->error. gcc/testsuite: * gcc.dg/builtin-redefine.c, gcc.dg/cpp/redef2.c, gcc.dg/cpp/redef3.c, gcc.dg/cpp/trad/redef2.c: Use dg-message instead of dg-warning for "previous definition" messages. * gcc.dg/cpp/Wvariadic-1.c, gcc.dg/cpp/Wvariadic-3.c: Expect "warnings being treated as errors" message. * gcc.dg/fltconst-1.c: Use -fshow-column. libcpp: * makedepend.c: Remove. * Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove. (all, clean, TAGS_SOURCES, include): Remove makedepend handling. * directives.c (cpp_errors): Remove. * errors.c (print_location, _cpp_begin_message, v_message): Remove. (cpp_error, cpp_error_with_line): Always use error callback. (cpp_error, cpp_error_with_line, cpp_errno): Return bool. * include/cpplib.h (cpp_options): Remove pedantic_errors, inhibit_warnings, warn_system_headers, inhibit_errors, warnings_are_errors, client_diagnostic. (cpp_callbacks): Add extra arguments to error callback; make it return bool. (cpp_finish): Return void. (cpp_destroy): Remove inaccurate comment about return value. (cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove. (CPP_DL_NOTE): Define. * include/line-map.h (linemap_print_containing_files): Remove. * init.c (cpp_finish): Do not check for or return number of errors. * internal.h (cpp_reader): Remove errors field. * line-map.c (linemap_print_containing_files): Remove. * macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message about previous definition. Only emit it if previous diagnostic was emitted. From-SVN: r145263
2008-10-05cpplib.h (cpp_comments, [...]): New structs.Matthew Gingell1-0/+9
2008-10-05 Matthew Gingell <gingell@adacore.com> Arnaud Charlet <charlet@adacore.com> * include/cpplib.h (cpp_comments, cpp_comment_table): New structs. (cpp_get_comments): New function. * internal.h (struct cpp_reader): Add comments field. * init.c (cpp_destroy): Free comments. * lex.c (store_comment, cpp_get_comments): New functions. (comments): New struct. (save_comment): Store comments in comments struct. Co-Authored-By: Arnaud Charlet <charlet@adacore.com> From-SVN: r140883
2008-09-18cpplib.h (struct cpp_options): Add new boolean flag ↵Simon Baldwin1-20/+34
warn_builtin_macro_redefined. * include/cpplib.h (struct cpp_options): Add new boolean flag warn_builtin_macro_redefined. * init.c (cpp_create_reader): Initialize warn_builtin_macro_redefined. * (struct builtin_operator): Split out from previous struct builtin, enhance extra const correctness. * (struct builtin_macro): Split out from previous struct builtin, add new always_warn_if_redefined flag, enhance const correctness. * (mark_named_operators): Use struct builtin_operator. * (cpp_init_special_builtins): Use struct builtin_macro, add NODE_WARN to builtins selectively. * macro.c (warn_of_redefinition): Return false if a builtin macro is not flagged with NODE_WARN. * c-opts.c (c_common_handle_option): Add handling for -Wbuiltin-macro-redefined command line option. * c.opt: Added builtin-macro-redefined option. * doc/invoke.texi (Warning Options): Add -Wbuiltin-macro-redefined documentation. * gcc.dg/builtin-redefine.c: New. From-SVN: r140461
2008-04-18cpp-id-data.h (UC): Was U, conflicts with U...Kris Van Hees1-11/+13
libcpp/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * include/cpp-id-data.h (UC): Was U, conflicts with U... literal. * include/cpplib.h (CHAR16, CHAR32, STRING16, STRING32): New tokens. (struct cpp_options): Added uliterals. (cpp_interpret_string): Update prototype. (cpp_interpret_string_notranslate): Idem. * charset.c (init_iconv_desc): New width member in cset_converter. (cpp_init_iconv): Add support for char{16,32}_cset_desc. (convert_ucn): Idem. (emit_numeric_escape): Idem. (convert_hex): Idem. (convert_oct): Idem. (convert_escape): Idem. (converter_for_type): New function. (cpp_interpret_string): Use converter_for_type, support u and U prefix. (cpp_interpret_string_notranslate): Match changed prototype. (wide_str_to_charconst): Use converter_for_type. (cpp_interpret_charconst): Add support for CPP_CHAR{16,32}. * directives.c (linemarker_dir): Macro U changed to UC. (parse_include): Idem. (register_pragma_1): Idem. (restore_registered_pragmas): Idem. (get__Pragma_string): Support CPP_STRING{16,32}. * expr.c (eval_token): Support CPP_CHAR{16,32}. * init.c (struct lang_flags): Added uliterals. (lang_defaults): Idem. * internal.h (struct cset_converter) <width>: New field. (struct cpp_reader) <char16_cset_desc>: Idem. (struct cpp_reader) <char32_cset_desc>: Idem. * lex.c (digraph_spellings): Macro U changed to UC. (OP, TK): Idem. (lex_string): Add support for u'...', U'...', u... and U.... (_cpp_lex_direct): Idem. * macro.c (_cpp_builtin_macro_text): Macro U changed to UC. (stringify_arg): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. gcc/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * c-common.c (CHAR16_TYPE, CHAR32_TYPE): New macros. (fname_as_string): Match updated cpp_interpret_string prototype. (fix_string_type): Support char16_t* and char32_t*. (c_common_nodes_and_builtins): Add char16_t and char32_t (and derivative) nodes. Register as builtin if C++0x. (c_parse_error): Support CPP_CHAR{16,32}. * c-common.h (RID_CHAR16, RID_CHAR32): New elements. (enum c_tree_index) <CTI_CHAR16_TYPE, CTI_SIGNED_CHAR16_TYPE, CTI_UNSIGNED_CHAR16_TYPE, CTI_CHAR32_TYPE, CTI_SIGNED_CHAR32_TYPE, CTI_UNSIGNED_CHAR32_TYPE, CTI_CHAR16_ARRAY_TYPE, CTI_CHAR32_ARRAY_TYPE>: New elements. (char16_type_node, signed_char16_type_node, unsigned_char16_type_node, char32_type_node, signed_char32_type_node, char16_array_type_node, char32_array_type_node): New defines. * c-lex.c (cb_ident): Match updated cpp_interpret_string prototype. (c_lex_with_flags): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. (lex_string): Support CPP_STRING{16,32}, match updated cpp_interpret_string and cpp_interpret_string_notranslate prototypes. (lex_charconst): Support CPP_CHAR{16,32}. * c-parser.c (c_parser_postfix_expression): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. gcc/cp/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * cvt.c (type_promotes_to): Support char16_t and char32_t. * decl.c (grokdeclarator): Disallow signed/unsigned/short/long on char16_t and char32_t. * lex.c (reswords): Add char16_t and char32_t (for c++0x). * mangle.c (write_builtin_type): Mangle char16_t/char32_t as vendor extended builtin type u8char32_t. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Support RID_CHAR{16,32}. (cp_lexer_print_token): Support CPP_STRING{16,32}. (cp_parser_is_string_literal): Idem. (cp_parser_string_literal): Idem. (cp_parser_primary_expression): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. (cp_parser_simple_type_specifier): Support RID_CHAR{16,32}. * tree.c (char_type_p): Support char16_t and char32_t as char types. * typeck.c (string_conv_p): Support char16_t and char32_t. gcc/testsuite/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> Tests for char16_t and char32_t support. * g++.dg/ext/utf-cvt.C: New * g++.dg/ext/utf-cxx0x.C: New * g++.dg/ext/utf-cxx98.C: New * g++.dg/ext/utf-dflt.C: New * g++.dg/ext/utf-gnuxx0x.C: New * g++.dg/ext/utf-gnuxx98.C: New * g++.dg/ext/utf-mangle.C: New * g++.dg/ext/utf-typedef-cxx0x.C: New * g++.dg/ext/utf-typedef- * g++.dg/ext/utf-typespec.C: New * g++.dg/ext/utf16-1.C: New * g++.dg/ext/utf16-2.C: New * g++.dg/ext/utf16-3.C: New * g++.dg/ext/utf16-4.C: New * g++.dg/ext/utf32-1.C: New * g++.dg/ext/utf32-2.C: New * g++.dg/ext/utf32-3.C: New * g++.dg/ext/utf32-4.C: New * gcc.dg/utf-cvt.c: New * gcc.dg/utf-dflt.c: New * gcc.dg/utf16-1.c: New * gcc.dg/utf16-2.c: New * gcc.dg/utf16-3.c: New * gcc.dg/utf16-4.c: New * gcc.dg/utf32-1.c: New * gcc.dg/utf32-2.c: New * gcc.dg/utf32-3.c: New * gcc.dg/utf32-4.c: New libiberty/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * testsuite/demangle-expected: Added tests for char16_t and char32_t. From-SVN: r134438
2007-09-06tree-cfg.c (remove_bb): Only warn if line is non-zero.Tom Tromey1-1/+9
gcc: * tree-cfg.c (remove_bb): Only warn if line is non-zero. * c-pch.c (c_common_read_pch): Restore current location after reading PCH file. * tree.c (expand_location): Update. (expr_filename): Changed return type. Unified the two cases. (expr_lineno): Likewise. (annotate_with_file_line): Don't use EXPR_LINENO and EXPR_FILENAME as lvalues. * toplev.c (line_table): Changed type. (general_init): Update. (realloc_for_line_map): New function. (general_init): Allocate line_table using GC. * fix-header.c (line_table): Changed type. (read_scan_file): Update. (read_scan_file): Update. * c-ppoutput.c (maybe_print_line): Update. (print_line): Update. (cb_line_change): Update. (cb_define): Update. (pp_file_change): Update. * c-opts.c (c_common_init_options): Update. (finish_options): Update. (push_command_line_include): Update. * c-lex.c (cb_line_change): Update. (cb_def_pragma): Update. (cb_define): Update. (cb_undef): Update. (c_lex_with_flags): Use cpp_get_token_with_location. * input.h (line_table): Changed type. (location_from_locus): New macro. * tree.h (EXPR_FILENAME): No longer an lvalue. (EXPR_LINENO): Likewise. (expr_locus, set_expr_locus): Declare separately for USE_MAPPED_LOCATION. (expr_filename, expr_lineno): Changed return type. * gimplify.c (tree_to_gimple_tuple): Use SET_EXPR_LOCUS. * cfgexpand.c (expand_gimple_cond_expr): Use location_from_locus. (expand_gimple_basic_block): Likewise. * final.c (final_scan_insn): Use expanded_location. gcc/cp: * decl.c (finish_function): Put return's location on line zero of file. gcc/fortran: * scanner.c (get_file): Update. (load_file): Update. (gfc_next_char_literal): Use gfc_linebuf_linenum. * f95-lang.c (gfc_init): Update. * gfortran.h (gfc_linebuf_linenum): New macro. gcc/java: * lang.c (java_post_options): Update. * jcf-parse.c (set_source_filename): Update. (give_name_to_class): Update. (jcf_parse): Update. (duplicate_class_warning): Update. (parse_class_file): Update. (java_parse_file): Update. * expr.c (expand_byte_code): Update. gcc/testsuite: * lib/g++.exp (g++_target_compile): Use -fno-show-column. gcc/treelang: * tree1.c (treelang_init): Update. (treelang_parse_file): Update. (treelang_parse_file): Update. (treelang_parse_file): Update. * lex.l: Update. (update_lineno_charno): Likewise. libcpp: * internal.h (struct cpp_reader) <invocation_location>: New field. (struct cpp_reader) <set_invocation_location>: Likewise. * init.c (cpp_set_line_map): New function. * line-map.c (linemap_add): Use linemap's allocator. * include/line-map.h (GTY): Define. (line_map_realloc): New typedef. (struct line_map): Mark with GTY. (struct line_maps): Likewise. (struct line_maps) <maps>: Likewise. (struct line_maps) <reallocator>: New field. * include/symtab.h (GTY): Conditionally define. * include/cpplib.h (cpp_set_line_map): Declare. (cpp_get_token_with_location): Declare. * macro.c (cpp_get_token): Set invocation_location on the reader. (cpp_get_token_with_location): New function. From-SVN: r128190
2007-07-30directives-only.c: New file.Ollie Wild1-9/+18
libcpp/ * directives-only.c: New file. * internal.h (struct _cpp_dir_only_callbacks): New. (_cpp_preprocess_dir_only): New function. * directives.c (_cpp_handle_directive): Check directives_only before disabling execution of indented directives. * files.c (_cpp_stack_file): Add directives_only check. * include/cpplib.h (struct cpp_options): Add directives_only. (cpp_init_special_builtins): New function. * init.c (cpp_init_special_builtins): New function. (cpp_init_builtins): Move builtin_array initialization to cpp_init_special_builtins. (post_options): Check directives_only before setting pfile->state.prevent_expansion = 1. * macro.c (_cpp_builtin_macro_text): Print an error if __COUNTER__ is expanded inside a directive while -fdirectives-only is enabled. * Makefile.in (libcpp_a_OBJS): Add directives-only.o. (libcpp_a_SOURCES): Add directives-only.c. gcc/ * c-ppoutput.c (print_lines_directives_only): New function. (scan_translation_unit_directives_only): New function. (preprocess_file): Add call to scan_translation_unit_directives_only. * c-opts.c (c_common_handle_option): Add OPT_fdirectives_only. (sanitize_cpp_opts): Add default flag_dump_macros setting for -fdirectives-only. Add errors for -fdirectives-only conflict with -Wunused-macros and -traditional. (finish_options): Add builtin macro initialization for -fdirectives-only + -fpreprocessed. * c.opt (fdirectives-only): New. * doc/cppopts.texi (fdirectives-only): New. gcc/testsuite/ * gcc.dg/cpp/counter-2.c: New test. * gcc.dg/cpp/counter-3.c: New test. * gcc.dg/cpp/dir-only-1.c: New test. * gcc.dg/cpp/dir-only-1.h: New file. * gcc.dg/cpp/dir-only-2.c: New test. * gcc.dg/cpp/dir-only-3.c: New test. * gcc.dg/cpp/dir-only-3a.h: New file. * gcc.dg/cpp/dir-only-3b.h: New file. * gcc.dg/cpp/dir-only-4.c: New test. * gcc.dg/cpp/dir-only-5.c: New test. * gcc.dg/cpp/dir-only-6.c: New test. From-SVN: r127066
2007-05-24macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.Ollie Wild1-0/+1
* macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER. * pch.c (cpp_write_pch_deps): Save __COUNTER__ state. (cpp_write_pch_state): Save __COUNTER__ state. (cpp_valid_state): Check valid __COUNTER__ state. (cpp_read_state): Read new __COUNTER__ state. * include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator. * init.c (builtin_array): Add __COUNTER__/BT_COUNTER. * internal.h (struct cpp_reader): Add counter member. * gcc.dg/cpp/counter-1.c: New test. * gcc.dg/pch/counter-1.c: New test. * gcc.dg/pch/counter-1.hs: New file. * gcc.dg/pch/counter-2.c: New test. * gcc.dg/pch/counter-2.hs: New file. * gcc.dg/pch/counter-3.c: New test. * gcc.dg/pch/counter-3.hs: New file. * doc/cpp.texi (Common Predefined Macros): Add __COUNTER__ description. From-SVN: r125041
2006-11-01cpplib.h (enum c_lang): Add CLK_GNUCXX0X and CLK_CXX0X for experimental ↵Douglas Gregor1-12/+14
C++0x mode. 2006-11-01 Douglas Gregor <doug.gregor@gmail.com> * include/cpplib.h (enum c_lang): Add CLK_GNUCXX0X and CLK_CXX0X for experimental C++0x mode. * init.c (lang_defaults): Add defaults for C++0x modes. C++0x has adopted the preprocessor changes introduced in C99. From-SVN: r118385
2006-02-18cpp.texi (__TIMESTAMP__): Document.Grigory Zagorodnev1-0/+1
2006-02-17 Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com> gcc/ChangeLog: * doc/cpp.texi (__TIMESTAMP__): Document. libcpp/ChangeLog: * macro.c (_cpp_builtin_macro_text): Handle BT_TIMESTAMP. * files.c (_cpp_get_file_stat): New function. * include/cpplib.h (builtin_type): Add BT_TIMESTAMP. * init.c (builtin_array): Add support for __TIMESTAMP__/BT_TIMESTAMP. * internal.h (_cpp_get_file_stat): Prototype. (struct cpp_buffer): Add timestamp. gcc/testsuite/ChangeLog: * gcc.dg/cpp/undef3.c: New test. * gcc.dg/cpp/trad/builtins2.c: New test. From-SVN: r111232
2006-01-23re PR preprocessor/25717 (-dD does not list all defined macros (in ↵Jakub Jelinek1-1/+7
particular, __STDC__)) PR preprocessor/25717 * init.c (cpp_init_builtins): If __STDC__ will not change value between system headers and other sources, define it as a normal macro rather than a builtin. * macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check cpp_in_system_header condition. From-SVN: r110144
2005-11-09re PR c/24101 (Segfault with preprocessed source)Uros Bizjak1-0/+2
libcpp/ PR c/24101 * init.c (read_original_filename): Temporarily set state.in_directive before calling _cpp_lex_direct for CPP_HASH tokens. gcc/ PR c/24101 * toplev.c (process_options): Initialize debug_hooks early in case lang_hooks.post_options ends up calling a debug_hook. gcc/testsuite/ PR c/24101 * gcc.dg/pr24101-1.i, gcc.dg/pr24101-2.i: New tests. * gcc.dg/dg.exp: Run main loop also for *.i files. From-SVN: r106677
2005-10-21Fix bug with -MM -MG.James E Wilson1-1/+1
PR preprocessor/15220 * files.c (_cpp_find_file): New parameter angle_brackets. Fix all callers. Pass to open_file_failed. (open_file_failed): New parameter angle_brackets. Fix all callers. Use in print_dep assignment. * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file. * internal.h (_cpp_find_file): Add new parm to declaration. From-SVN: r105757
2005-09-20c.opt (fextended-identifiers): New.Joseph Myers1-16/+22
gcc: * c.opt (fextended-identifiers): New. * c-opts.c (c_common_handle_option): Handle -fextended-identifiers. * doc/cpp.texi: Update documentation of extended identifiers. * doc/cppopts.texi (-fextended-identifiers): Document. gcc/testsuite: * g++.dg/cpp/ucnid-1.C, g++.dg/cpp/normalize-1.C, g++.dg/other/ucnid-1.C, gcc.dg/cpp/normalize-1.c, gcc.dg/cpp/normalize-2.c, gcc.dg/cpp/normalize-3.c, gcc.dg/cpp/normalize-4.c, gcc.dg/cpp/ucnid-1.c, gcc.dg/cpp/ucnid-2.c, gcc.dg/cpp/ucnid-3.c, gcc.dg/cpp/ucnid-4.c, gcc.dg/cpp/ucnid-5.c, gcc.dg/cpp/ucnid-7.c,gcc.dg/ucnid-1.c, gcc.dg/ucnid-2.c, gcc.dg/ucnid-3.c, gcc.dg/ucnid-4.c, gcc.dg/ucnid-5.c, gcc.dg/ucnid-6.c: Add -fextended-identifiers. * gcc.dg/cpp/ucnid-8.c: New test. libcpp: * include/cpplib.h (struct cpp_options): Add extended_identifiers. * init.c (struct lang_flags, lang_defaults): Add extended_identifiers. (cpp_set_lang): Use it. * lex.c (forms_identifier_p): Check extended_identifiers. From-SVN: r104462
2005-06-29all files: Update FSF address in copyright headers.Kelley Cook1-1/+1
2005-06-29 Kelley Cook <kcook@gcc.gnu.org> * all files: Update FSF address in copyright headers. * makeucnid.c (write_copyright): Update outputted FSF address. From-SVN: r101413
2005-05-28configure.ac: Check declarations for asprintf and vasprintf.Gabriel Dos Reis1-3/+3
* configure.ac: Check declarations for asprintf and vasprintf. * config.in: Regenerate. * configure: Likewise. * charset.c (conversion_loop): Use XRESIZEVEC. (convert_no_conversion): Likewise. (convert_using_iconv): Likewise. (init_iconv_desc): Cast return value of alloca. (cpp_host_to_exec_charset): Use XNEWVEC. (emit_numeric_escape): Use XRESIZEVEC. (cpp_interpret_string): Use XNEWVEC. (cpp_interpret_string): Use XRESIZEVEC. (_cpp_interpret_identifier): Cast return value of alloca. (_cpp_convert_input): Use XNEWVEC and XRESIZEVEC. * directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC. (parse_include): Use XNEWVEC. (insert_pragma_entry): Rename local variable "new" to "new_entry". (save_registered_pragmas): Cast return value of xmemdup. (destringize_and_run): Same for alloca. (parse_assertion): Likewise. (do_assert): Cast allocated storage to proper type. (cpp_define): Likewise. (_cpp_define_builtin): Likewise. (cpp_undef): Likewise. (handle_assertion): Likewise. (cpp_push_buffer): Rename local variable "new" to "new_buffer". * expr.c (CPP_UPLUS): Cast value to type cpp_ttype. (CPP_UMINUS): Likewise. (struct cpp_operator): Rename from struct operator. (_cpp_expand_op_stack): Use XRESIZEVEC. * files.c (pch_open_file): Use XNEWVEC. (pch_open_file): Use XRESIZEVEC. (read_file_guts): Use XNEWVEC and XRESIZEVEC. (dir_name_of_file): Use XNEWVEC. (make_cpp_file): Use XCNEW. (make_cpp_dir): Likewise. (allocate_file_hash_entries): USE XNEWVEC. (cpp_included): Cast return value of htab_find_with_hash. (append_file_to_dir): Use XNEWVEC. (read_filename_string): Likewise. Use XRESIZEVEC too. (read_name_map): Cast return value of alloca. Use XRESIZEVEC. (remap_filename): Use XNEWVEC. (struct pchf_entry): Move definition out of struct pchf_data. (_cpp_save_file_entries): Use XCNEWVAR. (_cpp_read_file_entries): Use XNEWVAR. * identifiers.c (alloc_node): Use XOBNEW. * init.c (cpp_create_reader): Use XCNEW. (cpp_init_builtins): Cast of b->value to enum builtin_type. (read_original_directory): Cast return value of alloca. * lex.c (add_line_note): Use XRESIZEVEC. (warn_about_normalization): Use XNEWVEC. (_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype). (new_buff): Use XNEWVEC. * line-map.c (linemap_add): Use XRESIZEVEC. * macro.c (builtin_macro): Cast return value of alloca. (paste_tokens): Likewise. (expand_arg): Use XNEWVEC and XRESIZEVEC. (_cpp_save_parameter): Use XRESIZEVEC. (create_iso_definition): Cast allocated storage to proper type. (_cpp_create_definition): Likewise. (cpp_macro_definition): Use XRESIZEVEC. * makedepend.c (add_clm): Use XNEW. (add_dir): Likewise. * mkdeps.c (munge): Use XNEWVEC. (deps_init): Use XCNEW. (deps_add_target): Use XRESIZEVEC. (deps_add_default_target): Cast return value of alloca. (deps_add_dep): Use XRESIZEVEC. (deps_add_vpath): Likewise. Use XNEWVEC too. (deps_restore): Likewise. * pch.c (save_idents): Use XNEW and XNEWVEC. (cpp_save_state): Use XNEW. (count_defs): Cast return value of htab_find. (write_defs): Likewise. (cpp_write_pch_deps): Use XNEWVEC. (collect_ht_nodes): Use XRESIZEVEC. (cpp_valid_state): Use XNEWVEC. (save_macros): Use XRESIZEVEC. Cast return value of xmemdup. * symtab.c (ht_create): Use XCNEW. (ht_lookup_with_hash): Cast return value of obstack_copy0. (ht_expand): Use XCNEWVEC. * system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus. (bool): Do not define if __cplusplus. From-SVN: r100295
2005-03-15Index: gcc/ChangeLogGeoffrey Keating1-0/+1
2005-03-14 Geoffrey Keating <geoffk@apple.com> * doc/cppopts.texi (-fexec-charset): Add concept index entry. (-fwide-exec-charset): Likewise. (-finput-charset): Likewise. * doc/invoke.texi (Warning Options): Document -Wnormalized=. * c-opts.c (c_common_handle_option): Handle -Wnormalized=. * c.opt (Wnormalized): New. Index: libcpp/ChangeLog 2005-03-14 Geoffrey Keating <geoffk@apple.com> * init.c (cpp_create_reader): Default warn_normalize to normalized_C. * charset.c: Update for new format of ucnid.h. (ucn_valid_in_identifier): Update for new format of ucnid.h. Add NST parameter, and update it; update callers. (cpp_valid_ucn): Add NST parameter, update callers. Replace abort with cpp_error. (convert_ucn): Pass normalize_state to cpp_valid_ucn. * internal.h (struct normalize_state): New. (INITIAL_NORMALIZE_STATE): New. (NORMALIZE_STATE_RESULT): New. (NORMALIZE_STATE_UPDATE_IDNUM): New. (_cpp_valid_ucn): New. * lex.c (warn_about_normalization): New. (forms_identifier_p): Add normalize_state parameter, update callers. (lex_identifier): Add normalize_state parameter, update callers. Keep the state current. (lex_number): Likewise. (_cpp_lex_direct): Pass normalize_state to subroutines. Check it with warn_about_normalization. * makeucnid.c: New. * ucnid.h: Replace. * ucnid.pl: Remove. * ucnid.tab: Make appropriate for input to makeucnid.c. Remove comments about obsolete version of C++. * include/cpplib.h (enum cpp_normalize_level): New. (struct cpp_options): Add warn_normalize field. Index: gcc/testsuite/ChangeLog 2005-03-14 Geoffrey Keating <geoffk@apple.com> * gcc.dg/cpp/normalize-1.c: New. * gcc.dg/cpp/normalize-2.c: New. * gcc.dg/cpp/normalize-3.c: New. * gcc.dg/cpp/normalize-4.c: New. * gcc.dg/cpp/ucnid-4.c: New. * gcc.dg/cpp/ucnid-5.c: New. * g++.dg/cpp/normalize-1.C: New. * g++.dg/cpp/ucnid-1.C: New. From-SVN: r96459
2005-02-14directives.c, [...]: Update copyright.Kazu Hirata1-1/+1
* directives.c, files.c, init.c, internal.h, macro.c, pch.c, traditional.c: Update copyright. From-SVN: r95012
2005-01-02internal.h: Update references to Cpp lib filenames.Gabriel Dos Reis1-2/+2
* internal.h: Update references to Cpp lib filenames. * directives.c: Likewise. * init.c: Likewise. * macro.c: Likewise. * traditional.c: Likewise. From-SVN: r92799
2004-09-24warnings.m4: New file.Zack Weinberg1-0/+1
config: * warnings.m4: New file. libcpp: * configure.ac: Move AC_PROG_MAKE_SET, AC_PROG_INSTALL to programs cluster. Use ACX_PROG_CC_WARNING_OPTS, ACX_PROG_CC_WARNING_ALMOST_PEDANTIC, ACX_PROG_CC_WARNINGS_ARE_ERRORS. * aclocal.m4, configure: Regenerate. * init.c: Include localedir.h. * Makefile.in (WARN_CFLAGS, ALL_CFLAGS): New variables. (DEFS): Delete. (.c.o): Use $(ALL_CFLAGS). (localedir.h, localedir.hs): New rules. (clean): Use rm -rf to remove directories. (distclean): Also delete localedir.h and localedir.hs. (init.o): Update dependencies. From-SVN: r88074
2004-07-232004-07-23 Matthias Klose <doko@debian.org>Matthias Klose1-1/+1
init.c (init_library): Use PACKAGE for the text domain. From-SVN: r85073
2004-07-04re PR preprocessor/16192 (Bug in expression evaluation when operand is missing)Neil Booth1-0/+2
* doc/cpp.texi: Don't document what we do for ill-formed expressions. * doc/cppopts.texi: Clarify processing of command-line defines. libcpp: PR preprocessor/16192 PR preprocessor/15913 PR preprocessor/15572 * expr.c (_cpp_parse_expr): Handle remaining cases where an expression is missing. * init.c (post_options): Traditional cpp doesn't do // comments. testsuite: * gcc.dg/cpp/if-mop.c: Two new testcases. * gcc.dg/cpp/trad/comment-3.c: New. From-SVN: r84080
2004-06-05Makefile.am: Add makedepend.Zack Weinberg1-12/+0
libcpp: * Makefile.am: Add makedepend. * Makefile.in, aclocal.m4: Regenerate. * charset.c: Insert a space to avoid a warning. * directives.c: Include mkdeps.h. (_cpp_handle_directive): Reenable macro expander if appropriate. (undefine_macros): Inline body of _cpp_free_definition for speed. Do not call undef callback or _cpp_warn_if_unused_macro. (cpp_get_deps): New interface. * files.c (search_cache): Add pfile argument. Check for file that would be found by "" or <> search here... (_cpp_find_file): ...not here. Correct recorded start_dir of files found by directory-of-current-file search that would be found by "" or <> search. * init.c (cpp_add_dependency_target): Delete. * internal.h (struct lexer_state): Add discarding_output flag. * lex.c (lex_identifier): Compute hash function while scanning. * macro.c (cpp_scan_nooutput): Disable macro expansion outside directives. * makedepend.c: New file. * mkdeps.c (struct deps): Add vpath vector. (apply_vpath, deps_add_vpath): New function. (deps_free): Free vpath vector. (deps_add_dep, deps_add_target): Use apply_vpath. * symtab.c (calc_hash): Use HT_HASHSTEP and HT_FINISH. (ht_lookup_with_hash): New function. * cpplib.h, mkdeps.h: Update prototypes. * symtab.h: Update prototypes. (HT_HASHSTEP, HT_FINISH): New macros. gcc: * Makefile.in (MKDEPS_H): New shorthand. (c-opts.o): Update dependencies. * c-opts.c: Include mkdeps.h. (handle_deferred_opts): Use cpp_get_deps and deps_add_target, not cpp_add_dependency_target. From-SVN: r82654
2004-05-24Makefile.def (host_modules): add libcpp.Paolo Bonzini1-0/+631
ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> * Makefile.def (host_modules): add libcpp. * Makefile.tpl: Add dependencies on and for libcpp. * Makefile.in: Regenerate. * configure.in: Add libcpp host module. * configure: Regenerate. config/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> * acx.m4 (ACX_HEADER_STDBOOL, ACX_HEADER_STRING): From gcc. gcc/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> Move libcpp to the toplevel. * Makefile.in: Remove references to libcpp files, use CPPLIBS instead of libcpp.a. Define SYMTAB_H and change hashtable.h to that. * aclocal.m4 (gcc_AC_HEADER_STDBOOL, gcc_AC_HEADER_STRING, gcc_AC_C__BOOL): Remove. * configure.ac (gcc_AC_C__BOOL, HAVE_UCHAR): Remove tests. * configure: Regenerate. * config.in: Regenerate. * c-ppoutput.c: Include ../libcpp/internal.h instead of cpphash.h. * cppcharset.c: Removed. * cpperror.c: Removed. * cppexp.c: Removed. * cppfiles.c: Removed. * cpphash.c: Removed. * cpphash.h: Removed. * cppinit.c: Removed. * cpplex.c: Removed. * cpplib.c: Removed. * cpplib.h: Removed. * cppmacro.c: Removed. * cpppch.c: Removed. * cpptrad.c: Removed. * cppucnid.h: Removed. * cppucnid.pl: Removed. * cppucnid.tab: Removed. * hashtable.c: Removed. * hashtable.h: Removed. * line-map.c: Removed. * line-map.h: Removed. * mkdeps.c: Removed. * mkdeps.h: Removed. * stringpool.h: Include symtab.h instead of hashtable.h. * tree.h: Include symtab.h instead of hashtable.h. * system.h (O_NONBLOCK, O_NOCTTY): Do not define. gcc/cp/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> * Make-lang.in: No need to specify $(LIBCPP). gcc/java/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> * Make-lang.in: Link in $(LIBCPP) instead of mkdeps.o. libcpp/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> Moved libcpp from the gcc subdirectory to the toplevel. * Makefile.am: New file. * Makefile.in: Regenerate. * configure.ac: New file. * configure: Regenerate. * config.in: Regenerate. * charset.c: Moved from gcc/cppcharset.c. Add note about brokenness of input charset detection. Adjust for change in name of cppucnid.h. * errors.c: Moved from gcc/cpperror.c. Do not include intl.h. * expr.c: Moved from gcc/cppexp.c. * files.c: Moved from gcc/cppfiles.c. Do not include intl.h. Remove #define of O_BINARY, it is in system.h. * identifiers.c: Moved from gcc/cpphash.c. * internal.h: Moved from gcc/cpphash.h. Change header guard name. All other files adjusted to match name change. * init.c: Moved from gcc/cppinit.c. (init_library) [ENABLE_NLS]: Call bindtextdomain. * lex.c: Moved from gcc/cpplex.c. * directives.c: Moved from gcc/cpplib.c. * macro.c: Moved from gcc/cppmacro.c. * pch.c: Moved from gcc/cpppch.c. Do not include intl.h. * traditional.c: Moved from gcc/cpptrad.c. * ucnid.h: Moved from gcc/cppucnid.h. Change header guard name. * ucnid.pl: Moved from gcc/cppucnid.pl. * ucnid.tab: Moved from gcc/cppucnid.tab. Change header guard name. * symtab.c: Moved from gcc/hashtable.c. * line-map.c: Moved from gcc. Do not include intl.h. * mkdeps.c: Moved from gcc. * system.h: New file. libcpp/include/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> * cpplib.h: Moved from gcc. Change header guard name. * line-map.h: Moved from gcc. Change header guard name. * mkdeps.h: Moved from gcc. Change header guard name. * symtab.h: Moved from gcc/hashtable.h. Change header guard name. libcpp/po/ChangeLog: 2004-05-23 Paolo Bonzini <bonzini@gnu.org> * be.po: Extracted from gcc/po/be.po. * ca.po: Extracted from gcc/po/ca.po. * da.po: Extracted from gcc/po/da.po. * de.po: Extracted from gcc/po/de.po. * el.po: Extracted from gcc/po/el.po. * es.po: Extracted from gcc/po/es.po. * fr.po: Extracted from gcc/po/fr.po. * ja.po: Extracted from gcc/po/ja.po. * nl.po: Extracted from gcc/po/nl.po. * sv.po: Extracted from gcc/po/sv.po. * tr.po: Extracted from gcc/po/tr.po. From-SVN: r82199