2024-09-13 Jakub Jelinek * files.cc (finish_embed): Initialize toks to tok rather than NULL. 2024-09-12 Jakub Jelinek * internal.h (struct cpp_embed_params): Add base64 member. (_cpp_free_embed_params_tokens): Declare. * directives.cc (DIRECTIVE_TABLE): Add IN_I flag to T_EMBED. (save_token_for_embed, _cpp_free_embed_params_tokens): New functions. (EMBED_PARAMS): Add gnu::base64 entry. (_cpp_parse_embed_params): Parse gnu::base64 parameter. If -fpreprocessed without -fdirectives-only, require #embed to have gnu::base64 parameter. Diagnose conflict between gnu::base64 and limit or gnu::offset parameters. (do_embed): Use _cpp_free_embed_params_tokens. * files.cc (finish_embed, base64_dec_fn): New functions. (base64_dec): New array. (B64D0, B64D1, B64D2, B64D3): Define. (finish_base64_embed): New function. (_cpp_stack_embed): Use finish_embed. Handle params->base64 using finish_base64_embed. * macro.cc (builtin_has_embed): Call _cpp_free_embed_params_tokens. 2024-09-12 Jason Merrill * include/cpplib.h (enum cpp_warning_reason): Add CPP_W_CXX{14,17,20,23}_EXTENSIONS. * charset.cc (_cpp_valid_ucn, convert_hex, convert_oct) (convert_escape, narrow_str_to_charconst): Use cpp_pedwarning instead of cpp_error for pedwarns. * directives.cc (directive_diagnostics, _cpp_handle_directive) (do_line, do_elif): Likewise. * expr.cc (cpp_classify_number, eval_token): Likewise. * lex.cc (skip_whitespace, maybe_va_opt_error) (_cpp_lex_direct): Likewise. * macro.cc (_cpp_arguments_ok): Likewise. (replace_args): Use -Wvariadic-macros for pedwarn about empty macro arguments. 2024-09-12 Jakub Jelinek * internal.h (struct cpp_embed_params): Add offset member. * directives.cc (EMBED_PARAMS): Add gnu::offset entry. (enum embed_param_kind): Add NUM_EMBED_STD_PARAMS. (_cpp_parse_embed_params): Use NUM_EMBED_STD_PARAMS rather than NUM_EMBED_PARAMS when parsing standard parameters. Parse gnu::offset parameter. * files.cc (struct _cpp_file): Add offset member. (_cpp_stack_embed): Handle params->offset. 2024-09-12 Jakub Jelinek PR c/105863 * include/cpplib.h: Implement C23 N3017 #embed - a scannable, tooling-friendly binary resource inclusion mechanism paper. (struct cpp_options): Add embed member. (enum cpp_builtin_type): Add BT_HAS_EMBED. (cpp_set_include_chains): Add another cpp_dir * argument to the declaration. * internal.h (enum include_type): Add IT_EMBED. (struct cpp_reader): Add embed_include member. (struct cpp_embed_params_tokens): New type. (struct cpp_embed_params): New type. (_cpp_get_token_no_padding): Declare. (enum _cpp_find_file_kind): Add _cpp_FFK_EMBED and _cpp_FFK_HAS_EMBED. (_cpp_stack_embed): Declare. (_cpp_parse_expr): Change return type to cpp_num_part instead of bool, change second argument from bool to const char * and add third argument. (_cpp_parse_embed_params): Declare. * directives.cc (DIRECTIVE_TABLE): Add embed entry. (end_directive): Don't call skip_rest_of_line for T_EMBED directive. (_cpp_handle_directive): Return 2 rather than 1 for T_EMBED in directives-only mode. (parse_include): Don't Call check_eol for T_EMBED directive. (skip_balanced_token_seq): New function. (EMBED_PARAMS): Define. (enum embed_param_kind): New type. (embed_params): New variable. (_cpp_parse_embed_params): New function. (do_embed): New function. (do_if): Adjust _cpp_parse_expr caller. (do_elif): Likewise. * expr.cc (parse_defined): Diagnose defined in #embed or __has_embed parameters. (_cpp_parse_expr): Change return type to cpp_num_part instead of bool, change second argument from bool to const char * and add third argument. Adjust function comment. For #embed/__has_embed parameters add an artificial CPP_OPEN_PAREN. Use the second argument DIR directly instead of string literals conditional on IS_IF. For #embed/__has_embed parameter, stop on reaching CPP_CLOSE_PAREN matching the artificial one. Diagnose negative or too large embed parameter operands. (num_binary_op): Use #embed instead of #if for diagnostics if inside #embed/__has_embed parameter. (num_div_op): Likewise. * files.cc (struct _cpp_file): Add limit member and embed bitfield. (search_cache): Add IS_EMBED argument, formatting fix. Skip over files with different file->embed from the argument. (find_file_in_dir): Don't call pch_open_file if file->embed. (_cpp_find_file): Handle _cpp_FFK_EMBED and _cpp_FFK_HAS_EMBED. (read_file_guts): Formatting fix. (has_unique_contents): Ignore file->embed files. (search_path_head): Handle IT_EMBED type. (_cpp_stack_embed): New function. (_cpp_get_file_stat): Formatting fix. (cpp_set_include_chains): Add embed argument, save it to pfile->embed_include and compute lens for the chain. * init.cc (struct lang_flags): Add embed member. (lang_defaults): Add embed initializers. (cpp_set_lang): Initialize CPP_OPTION (pfile, embed). (builtin_array): Add __has_embed entry. (cpp_init_builtins): Predefine __STDC_EMBED_NOT_FOUND__, __STDC_EMBED_FOUND__ and __STDC_EMBED_EMPTY__. * lex.cc (cpp_directive_only_process): Handle #embed. * macro.cc (cpp_get_token_no_padding): Rename to ... (_cpp_get_token_no_padding): ... this. No longer static. (builtin_has_include_1): New function. (builtin_has_include): Use it. Use _cpp_get_token_no_padding instead of cpp_get_token_no_padding. (builtin_has_embed): New function. (_cpp_builtin_macro_text): Handle BT_HAS_EMBED. 2024-08-26 Alexander Monakov * internal.h (CPP_BUFFER_PADDING): New macro; use it ... * charset.cc (_cpp_convert_input): ...here, and ... * files.cc (read_file_guts): ...here, and ... * lex.cc (search_line_ssse3): here. 2024-08-23 Alexander Monakov PR preprocessor/116458 * charset.cc (_cpp_convert_input): Bump padding to 64 if HAVE_SSSE3. 2024-08-22 Marc Poulhiès * lex.cc(search_line_ssse3): fix static_assert to use 2 arguments. 2024-08-20 Jakub Jelinek * init.cc (struct lang_flags): Change all members from char typed fields to unsigned bit-fields. (lang_defaults): Change formatting of the initializer so that it fits to 68 columns rather than 147. 2024-08-20 Alexander Monakov * config.in: Regenerate. * configure: Regenerate. * configure.ac: Check for SSSE3 instead of SSE4.2. * files.cc (read_file_guts): Bump padding to 64 if HAVE_SSSE3. * lex.cc (search_line_acc_char): Mark inline, not "unused". (search_line_sse2): Mark inline. (search_line_sse42): Replace with... (search_line_ssse3): ... this new function. Adjust the use... (init_vectorized_lexer): ... here. Simplify. 2024-08-06 Andi Kleen * lex.cc (search_line_mmx): Remove function. (init_vectorized_lexer): Remove search_line_mmx. 2024-07-25 Jakub Jelinek PR c++/110343 * lex.cc: C++26 P2558R2 - Add @, $, and ` to the basic character set. (lex_raw_string): For C++26 allow $@` characters in prefix. * charset.cc (_cpp_valid_ucn): For C++26 reject \u0024 in identifiers. 2024-07-24 David Malcolm * include/rich-location.h (semi_embedded_vec::semi_embedded_vec): Add copy ctor. (rich_location::rich_location): Remove "= delete" from decl of copy ctor. Add deleted decl of move ctor. (rich_location::operator=): Remove "= delete" from decl of copy assignment. Add deleted decl of move assignment. (fixit_hint::fixit_hint): Add copy ctor decl. Add deleted decl of move. (fixit_hint::operator=): Add copy assignment decl. Add deleted decl of move assignment. * line-map.cc (rich_location::rich_location): New copy ctor. (fixit_hint::fixit_hint): New copy ctor. 2024-07-13 David Malcolm * include/rich-location.h (location_range::m_highlight_color): New field. (rich_location::rich_location): Add optional label_highlight_color param. (rich_location::set_highlight_color): New decl. (rich_location::add_range): Add optional label_highlight_color param. (rich_location::set_range): Likewise. * line-map.cc (rich_location::rich_location): Add "label_highlight_color" param and pass it to add_range. (rich_location::set_highlight_color): New. (rich_location::add_range): Add "label_highlight_color" param. (rich_location::set_range): Add "highlight_color" param. 2024-06-21 David Malcolm PR testsuite/109360 * include/rich-location.h (rich_location::get_column_override): New accessor. 2024-06-11 Joseph Myers * include/cpplib.h (CLK_GNUC2Y, CLK_STDC2Y): New. * init.cc (lang_defaults): Add GNUC2Y and STDC2Y entries. (cpp_init_builtins): Define __STDC_VERSION__ to 202500L for GNUC2Y and STDC2Y. 2024-06-07 Jason Merrill * files.cc (_cpp_stack_file): LC_ENTER for -include header unit. 2024-05-29 Jason Merrill * mkdeps.cc (make_write): Change .c++m to .c++-module. 2024-05-28 David Malcolm * Makefile.in (TAGS_SOURCES): Add include/label-text.h. * include/label-text.h: New file. * include/rich-location.h: Include "label-text.h". (class label_text): Move to label-text.h. 2024-05-26 Peter Damianov * lex.cc (do_peek_prev): Correct typo in argument to __builtin_expect() 2024-05-17 David Malcolm * include/rich-location.h (class label_effects): New forward decl. (range_label::get_effects): New vfunc. 2024-04-30 Jakub Jelinek * init.cc (cpp_init_builtins): Change __STDC_VERSION__ for C23 from 202000L to 202311L. 2024-04-17 Christophe Lyon PR preprocessor/114748 * aclocal.m4: Regenerate. * configure: Regenerate. 2024-03-14 Lewis Hyatt PR preprocessor/110558 * macro.cc (builtin_has_include): Set pfile->state.directive_wants_padding prior to lexing the file name, in case it comes from macro expansion. 2024-03-14 Lewis Hyatt PR preprocessor/80755 * files.cc (search_path_head): Add SUPPRESS_DIAGNOSTIC argument defaulting to false. (_cpp_has_header): Silently return false if the search path has been exhausted, rather than issuing a diagnostic and then hitting an assert. 2024-02-22 Jakub Jelinek PR c/114007 * include/cpplib.h (COLON_SCOPE): Define to PURE_ZERO. * lex.cc (_cpp_lex_direct): When lexing CPP_COLON with another colon after it, if !CPP_OPTION (pfile, scope) set COLON_SCOPE flag on the first CPP_COLON token. 2024-02-01 Lewis Hyatt PR preprocessor/105608 * pch.cc (cpp_read_state): Set a valid location for restored macros. 2024-01-04 Raiki Tamura * charset.cc (cpp_check_xid_property): New. * include/cpplib.h (cpp_check_xid_property): New. (enum cpp_xid_property): New. 2023-12-13 Jakub Jelinek PR preprocessor/112956 * lex.cc (_cpp_lex_direct): Initialize c to 0. For CPP_PRAGMA_EOL tokens and if c == 0 also for CPP_EOF set result->src_loc to highest locus. 2023-11-28 Lewis Hyatt PR preprocessor/112701 * expr.cc (num_div_op): Set unsignedp appropriately when returning a stub value for divide by 0. 2023-11-27 Alex Coplan Iain Sandoe PR c++/60512 * include/cpplib.h (struct cpp_callbacks): Add has_feature. (enum cpp_builtin_type): Add BT_HAS_{FEATURE,EXTENSION}. * init.cc: Add __has_{feature,extension}. * macro.cc (_cpp_builtin_macro_text): Handle BT_HAS_{FEATURE,EXTENSION}. 2023-11-24 Alexander Monakov * config.in: Regenerate. * configure: Regenerate. * configure.ac (ENABLE_VALGRIND_CHECKING): Delete. (ENABLE_VALGRIND_ANNOTATIONS): Rename to ENABLE_VALGRIND_WORKAROUNDS. Delete Valgrind header checks. * lex.cc (new_buff): Adjust for renaming. (_cpp_free_buff): Ditto. 2023-11-20 Marc Poulhiès * macro.cc (parse_params): Fix typo in variadic. (create_iso_definition): Likewise. 2023-11-19 David Malcolm * Makefile.in (TAGS_SOURCES): Add "include/rich-location.h". * include/cpplib.h (class rich_location): New forward decl. * include/line-map.h (class range_label) (enum range_display_kind, struct location_range) (class semi_embedded_vec, class rich_location, class label_text) (class range_label, class fixit_hint): Move to... * include/rich-location.h: ...this new file. * internal.h: Include "rich-location.h". 2023-11-14 Jakub Jelinek * makeucnid.cc (write_copyright): Update copyright year. * makeuname2c.cc (write_copyright): Likewise. (struct generated): Update latest Unicode version. (generated_ranges): Add 2ebf0-2ee5d CJK UNIFIED IDEOGRAPH range which was forgotten to be added to 4-8 table, but clearly is expected to be there from the 15.1 additions. * ucnid.h: Regenerated. * uname2c.h: Regenerated. * generated_cpp_wcwidth.h: Regenerated. 2023-11-14 Jakub Jelinek PR c++/110341 * charset.cc: Implement C++26 P1854R4 - Making non-encodable string literals ill-formed. (one_count_chars, convert_count_chars, count_source_chars): New functions. (narrow_str_to_charconst): Change last arg type from cpp_ttype to const cpp_token *. For C++ if pedantic and i > 1 in CPP_CHAR interpret token also as CPP_STRING32 and if number of characters in the CPP_STRING32 is larger than number of bytes in CPP_CHAR, pedwarn on it. Make the diagnostics more detailed. (wide_str_to_charconst): Change last arg type from cpp_ttype to const cpp_token *. Make the diagnostics more detailed. (cpp_interpret_charconst): Adjust narrow_str_to_charconst and wide_str_to_charconst callers. 2023-11-14 Arsen Arsenović * config.in: Regenerate. 2023-11-13 Arsen Arsenović * configure: Regenerate. * aclocal.m4: Regenerate. 2023-11-09 David Malcolm * include/line-map.h (rich_location::get_expanded_location): Make const. (rich_location::get_line_table): New accessor. (rich_location::m_line_table): Make the pointer be const. (rich_location::m_have_expanded_location): Make mutable. (rich_location::m_expanded_location): Likewise. (fixit_hint::affects_line_p): Add const line_maps * param. (linemap_client_expand_location_to_spelling_point): Likewise. * line-map.cc (rich_location::get_expanded_location): Make const. Pass m_line_table to linemap_client_expand_location_to_spelling_point. (rich_location::maybe_add_fixit): Likewise. (fixit_hint::affects_line_p): Add set param and pass to linemap_client_expand_location_to_spelling_point. 2023-11-07 Joseph Myers * directives.cc: Refer to C23 instead of C2X in diagnostics and comments. (STDC2X): Rename to STDC23. * expr.cc: Use cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat and CPP_W_C11_C23_COMPAT instead of CPP_W_C11_C2X_COMPAT. Refer to C23 instead of C2X in diagnostics and comments. * include/cpplib.h: Refer to C23 instead of C2X in diagnostics and comments. (CLK_GNUC2X): Rename to CLK_GNUC23. (CLK_STDC2X): Rename to CLK_STDC23. (CPP_W_C11_C2X_COMPAT): Rename to CPP_W_C11_C23_COMPAT. * init.cc: Use GNUC23 instead of GNUC2X, STDC23 instead of STDC2X and cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat. * lex.cc (maybe_va_opt_error): Refer to C23 instead of C2X in diagnostic. * macro.cc (_cpp_arguments_ok): Refer to C23 instead of C2X in comment. 2023-11-02 Jakub Jelinek PR c++/110342 * include/cpplib.h (TTYPE_TABLE): Add CPP_UNEVAL_STRING literal entry. Use C++11 instead of C++-0x in comments. * charset.cc (convert_escape): Add UNEVAL argument, if true, pedantically diagnose numeric escape sequences. (cpp_interpret_string_1): Formatting fix. Adjust convert_escape caller. (cpp_interpret_string): Formatting string. (cpp_interpret_string_notranslate): Pass type through to cpp_interpret_string if it is CPP_UNEVAL_STRING. 2023-10-31 David Malcolm * include/line-map.h (line_map_macro::get_expansion_point_location): New accessor. (line_map_macro::expansion): Rename field to... (line_map_macro::mexpansion): Rename field to... (MACRO_MAP_EXPANSION_POINT_LOCATION): Delete this function. * line-map.cc (linemap_enter_macro): Update for renaming of field. (linemap_macro_map_loc_to_exp_point): Update for removal of MACRO_MAP_EXPANSION_POINT_LOCATION. 2023-10-23 Lewis Hyatt PR preprocessor/36887 * directives.cc (do_pragma_poison): Store in the extra hash map the location from which an identifier has been poisoned. * lex.cc (identifier_diagnostics_on_lex): When issuing a diagnostic for the use of a poisoned identifier, also add a note indicating the location from which it was poisoned. * identifiers.cc (alloc_node): Convert to template function. (_cpp_init_hashtable): Handle the new extra hash map. (_cpp_destroy_hashtable): Likewise. * include/cpplib.h (struct cpp_hashnode_extra): New struct. (cpp_create_reader): Update prototype to... * init.cc (cpp_create_reader): ...accept an argument for the extra hash table and pass it to _cpp_init_hashtable. * include/symtab.h (ht_lookup): New overload for convenience. * internal.h (struct cpp_reader): Add EXTRA_HASH_TABLE member. (_cpp_init_hashtable): Adjust prototype. 2023-10-08 David Malcolm * include/line-map.h (LINEMAPS_ORDINARY_MAPS): Delete. (LINEMAPS_MACRO_MAPS): Delete. * line-map.cc (linemap_tracks_macro_expansion_locs_p): Update for deletion of LINEMAPS_MACRO_MAPS. (linemap_get_statistics): Likewise. 2023-10-08 David Malcolm * include/line-map.h (maps_info_ordinary::cache): Rename to... (maps_info_ordinary::m_cache): ...this. (maps_info_macro::cache): Rename to... (maps_info_macro::m_cache): ...this. (LINEMAPS_CACHE): Delete. (LINEMAPS_ORDINARY_CACHE): Delete. (LINEMAPS_MACRO_CACHE): Delete. * init.cc (read_original_filename): Update for adding "m_" prefix. * line-map.cc (linemap_add): Eliminate LINEMAPS_ORDINARY_CACHE in favor of a simple field access. (linemap_enter_macro): Likewise for LINEMAPS_MACRO_CACHE. (linemap_ordinary_map_lookup): Likewise for LINEMAPS_ORDINARY_CACHE, twice. (linemap_lookup_macro_index): Likewise for LINEMAPS_MACRO_CACHE. 2023-10-08 David Malcolm * include/line-map.h (LINEMAPS_LAST_ALLOCATED_MAP): Delete. (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Delete. (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Delete. 2023-10-08 David Malcolm * include/line-map.h (line_maps::reallocator): Rename to... (line_maps::m_reallocator): ...this. (line_maps::round_alloc_size): Rename to... (line_maps::m_round_alloc_size): ...this. (line_maps::location_adhoc_data_map): Rename to... (line_maps::m_location_adhoc_data_map): ...this. (line_maps::num_optimized_ranges): Rename to... (line_maps::m_num_optimized_ranges): ..this. (line_maps::num_unoptimized_ranges): Rename to... (line_maps::m_num_unoptimized_ranges): ...this. (get_combined_adhoc_loc): Delete decl. (COMBINE_LOCATION_DATA): Delete. * lex.cc (get_location_for_byte_range_in_cur_line): Update for removal of COMBINE_LOCATION_DATA. (warn_about_normalization): Likewise. (_cpp_lex_direct): Likewise. * line-map.cc (line_maps::~line_maps): Update for "m_" prefix of some fields of line_maps. (rebuild_location_adhoc_htab): Likewise. (can_be_stored_compactly_p): Convert to... (line_maps::can_be_stored_compactly_p): ...this private member function. (get_combined_adhoc_loc): Convert to... (line_maps::get_or_create_combined_loc): ...this public member function. (line_maps::make_location): Update for removal of COMBINE_LOCATION_DATA. (get_data_from_adhoc_loc): Update for "m_" prefix of some fields of line_maps. (get_discriminator_from_adhoc_loc): Likewise. (get_location_from_adhoc_loc): Likewise. (get_range_from_adhoc_loc): Convert to... (line_maps::get_range_from_adhoc_loc): ...this private member function. (line_maps::get_range_from_loc): Update for conversion of get_range_from_adhoc_loc to a member function. (linemap_init): Update for "m_" prefix of some fields of line_maps. (line_map_new_raw): Likewise. (linemap_enter_macro): Likewise. (linemap_get_statistics): Likewise. 2023-10-08 David Malcolm * include/line-map.h (line_maps::pure_location_p): New decl. (line_maps::get_pure_location): New decl. (line_maps::get_range_from_loc): New decl. (line_maps::get_start): New. (line_maps::get_finish): New. (line_maps::make_location): New decl. (get_range_from_loc): Make line_maps param const. (get_discriminator_from_loc): Likewise. (pure_location_p): Likewise. (get_pure_location): Likewise. (linemap_check_files_exited): Likewise. (linemap_tracks_macro_expansion_locs_p): Likewise. (linemap_location_in_system_header_p): Likewise. (linemap_location_from_macro_definition_p): Likewise. (linemap_macro_map_loc_unwind_toward_spelling): Likewise. (linemap_included_from_linemap): Likewise. (first_map_in_common): Likewise. (linemap_compare_locations): Likewise. (linemap_location_before_p): Likewise. (linemap_resolve_location): Likewise. (linemap_unwind_toward_expansion): Likewise. (linemap_unwind_to_first_non_reserved_loc): Likewise. (linemap_expand_location): Likewise. (linemap_get_file_highest_location): Likewise. (linemap_get_statistics): Likewise. (linemap_dump_location): Likewise. (linemap_dump): Likewise. (line_table_dump): Likewise. * internal.h (linemap_get_expansion_line): Likewise. (linemap_get_expansion_filename): Likewise. * line-map.cc (can_be_stored_compactly_p): Likewise. (get_data_from_adhoc_loc): Drop redundant "class". (get_discriminator_from_adhoc_loc): Likewise. (get_location_from_adhoc_loc): Likewise. (get_range_from_adhoc_loc): Likewise. (get_range_from_loc): Make const and move implementation to... (line_maps::get_range_from_loc): ...this new function. (get_discriminator_from_loc): Make line_maps param const. (pure_location_p): Make const and move implementation to... (line_maps::pure_location_p): ...this new function. (get_pure_location): Make const and move implementation to... (line_maps::get_pure_location): ...this new function. (linemap_included_from_linemap): Make line_maps param const. (linemap_check_files_exited): Likewise. (linemap_tracks_macro_expansion_locs_p): Likewise. (linemap_macro_map_loc_unwind_toward_spelling): Likewise. (linemap_get_expansion_line): Likewise. (linemap_get_expansion_filename): Likewise. (linemap_location_in_system_header_p): Likewise. (first_map_in_common_1): Likewise. (linemap_compare_locations): Likewise. (linemap_macro_loc_to_spelling_point): Likewise. (linemap_macro_loc_to_def_point): Likewise. (linemap_macro_loc_to_exp_point): Likewise. (linemap_resolve_location): Likewise. (linemap_location_from_macro_definition_p): Likewise. (linemap_unwind_toward_expansion): Likewise. (linemap_unwind_to_first_non_reserved_loc): Likewise. (linemap_expand_location): Likewise. (linemap_dump): Likewise. (linemap_dump_location): Likewise. (linemap_get_file_highest_location): Likewise. (linemap_get_statistics): Likewise. (line_table_dump): Likewise. 2023-09-20 Lewis Hyatt PR preprocessor/61474 * files.cc (_cpp_find_file): Set DONT_READ to TRUE for fake include files. (_cpp_fake_include): Pass a unique cpp_dir* address so the fake file will not be found when looked up for real. 2023-09-19 Ben Boeckel * include/cpplib.h: Add cpp_fdeps_format enum. (cpp_options): Add fdeps_format field (cpp_finish): Add structured dependency fdeps_stream parameter. * include/mkdeps.h (deps_add_module_target): Add flag for whether a module is exported or not. (fdeps_add_target): Add function. (deps_write_p1689r5): Add function. * init.cc (cpp_finish): Add new preprocessor parameter used for C++ module tracking. * mkdeps.cc (mkdeps): Implement P1689R5 output. 2023-09-06 Jakub Jelinek PR c/102989 * expr.cc (cpp_classify_number): Diagnose wb literal suffixes for -pedantic* before C2X or -Wc11-c2x-compat. 2023-09-06 Jakub Jelinek PR c/102989 * expr.cc (interpret_int_suffix): Handle wb and WB suffixes. * include/cpplib.h (CPP_N_BITINT): Define. 2023-08-07 Alan Modra * configure: Regenerate. 2023-07-19 Lewis Hyatt PR preprocessor/103902 * lex.cc (identifier_diagnostics_on_lex): New function refactoring some common code. (lex_identifier_intern): Use the new function. (lex_identifier): Don't run identifier diagnostics here, rather let the call site do it when needed. (_cpp_lex_direct): Adjust the call sites of lex_identifier () acccordingly. (struct scan_id_result): New struct. (scan_cur_identifier): New function. (create_literal2): New function. (lit_accum::create_literal2): New function. (is_macro): Folded into new function... (maybe_ignore_udl_macro_suffix): ...here. (is_macro_not_literal_suffix): Folded likewise. (lex_raw_string): Handle UTF-8 in UDL suffix via scan_cur_identifier (). (lex_string): Likewise. 2023-07-06 Thomas Schwinge * include/symtab.h (struct ht_identifier): Document different rationale. 2023-06-23 Marek Polacek * include/cpplib.h (c_lang): Add CXX26 and GNUCXX26. * init.cc (lang_defaults): Add rows for CXX26 and GNUCXX26. (cpp_init_builtins): Set __cplusplus to 202400L for C++26. Set __cplusplus to 202302L for C++23. 2023-06-23 Ben Boeckel * charset.cc: Allow `UCS_LIMIT` in UTF-8 strings. 2023-06-22 David Malcolm * charset.cc (get_cppchar_property): New function template, based on... (cpp_wcwidth): ...this function. Rework to use the above. Include "combining-chars.inc". (cpp_is_combining_char): New function Include "printable-chars.inc". (cpp_is_printable_char): New function * combining-chars.inc: New file, generated by contrib/unicode/gen-combining-chars.py. * include/cpplib.h (cpp_is_combining_char): New function decl. (cpp_is_printable_char): New function decl. * printable-chars.inc: New file, generated by contrib/unicode/gen-printable-chars.py. 2023-06-20 Lewis Hyatt PR c++/66290 * macro.cc (_cpp_create_definition): Add location argument. * internal.h (_cpp_create_definition): Adjust prototype. * directives.cc (do_define): Pass new location argument to _cpp_create_definition. (do_undef): Stop passing inferior location to cpp_warning_with_line; the default from cpp_warning is better. (cpp_pop_definition): Pass new location argument to _cpp_create_definition. * pch.cc (cpp_read_state): Likewise. 2023-06-19 Ben Boeckel * charset.cc: Reject encodings of codepoints above 0x10FFFF. UTF-16 does not support such codepoints and therefore all Unicode rejects such values. 2023-06-15 Marek Polacek * configure.ac (--enable-host-shared): Don't set PICFLAG here. (--enable-host-pie): New check. Set PICFLAG after this check. * configure: Regenerate. 2023-06-15 Jakub Jelinek PR preprocessor/80753 * files.cc (struct _cpp_file): Add deferred_error bitfield. (_cpp_find_file): When finding a file in cache with deferred_error set in _cpp_FFK_NORMAL mode, call open_file_failed and clear the flag. Set deferred_error in _cpp_FFK_HAS_INCLUDE mode if open_file_failed hasn't been called. 2023-04-30 Jeff Law Revert: 2023-04-30 Longjun Luo * init.cc (builtin_array): Do not always warn for a redefinition of __LINE__. 2023-04-30 Longjun Luo * init.cc (builtin_array): Do not always warn for a redefinition of __LINE__. 2023-03-25 David Malcolm PR analyzer/109098 * charset.cc (cpp_valid_utf8_p): New function. * include/cpplib.h (cpp_valid_utf8_p): New prototype. 2023-03-16 Jakub Jelinek * makeucnid.cc (write_copyright): Update Unicode copyright years up to 2022. * makeuname2c.cc (write_copyright): Likewise. * ucnid.h: Regenerated. * uname2c.h: Regenerated. 2023-03-13 Lewis Hyatt PR preprocessor/67046 * directives.cc (_cpp_do__Pragma): Increment pfile->keep_tokens to ensure the returned string token is valid. 2023-03-13 Lewis Hyatt * generated_cpp_wcwidth.h: Regenerated for Unicode 15. 2022-12-07 Joseph Myers * init.cc (lang_defaults): Enable va_opt for STDC2X. * lex.cc (maybe_va_opt_error): Adjust diagnostic message for C. * macro.cc (_cpp_arguments_ok): Update comment. 2022-11-23 Marek Polacek Revert: 2022-11-23 Marek Polacek * configure.ac (--enable-host-shared): Don't set PICFLAG here. (--enable-host-pie): New check. Set PICFLAG after this check. * configure: Regenerate. 2022-11-23 Marek Polacek * configure.ac (--enable-host-shared): Don't set PICFLAG here. (--enable-host-pie): New check. Set PICFLAG after this check. * configure: Regenerate. 2022-11-21 Lewis Hyatt * directives.cc (do_pragma): Fix memory leak in token buffer. Fix unwanted paste between two tokens. 2022-11-21 Torbjörn SVENSSON * files.cc: Ensure pattern matches before use. 2022-11-21 Martin Liska * config.in: Re-configure. 2022-11-19 Bernhard Reutner-Fischer PR preprocessor/107691 * configure.ac: Add valgrind header checks. * configure: Regenerate. 2022-11-18 Richard Purdie * macro.cc (_cpp_builtin_macro_text): Don't remap filenames within directives. 2022-11-05 Lewis Hyatt PR preprocessor/55971 * lex.cc (get_fresh_line_impl): New function refactoring the code from... (_cpp_get_fresh_line): ...here. (lex_raw_string): Use the new version of get_fresh_line_impl() to support raw strings containing new lines when processing a directive. 2022-11-04 Jakub Jelinek * makeuname2c.cc (struct generated): Update from Unicode 15.0.0 table 4-8. * ucnid.h: Regenerated for Unicode 15.0.0. * uname2c.h: Likewise. 2022-10-19 Lewis Hyatt * include/cpplib.h (struct cpp_string): Use new "string_length" GTY. * include/symtab.h (struct ht_identifier): Likewise. 2022-10-14 Joseph Myers * charset.cc (ucn_valid_in_identifier): Check xid_identifiers not cplusplus to determine whether to use CXX23 and NXX23 flags. * include/cpplib.h (struct cpp_options): Add xid_identifiers. * init.cc (struct lang_flags, lang_defaults): Add xid_identifiers. (cpp_set_lang): Set xid_identifiers. * lex.cc (warn_about_normalization): Add parameter identifier. Only pedwarn about non-NFC for identifiers, not pp-numbers. (_cpp_lex_direct): Update calls to warn_about_normalization. 2022-10-14 Jakub Jelinek * include/cpplib.h (CPP_N_BFLOAT16): Define. * expr.cc (interpret_float_suffix): Handle bf16 and BF16 suffixes for C++. 2022-09-28 Eugene Rozenfeld * include/line-map.h: Add discriminator to location_adhoc_data. (get_combined_adhoc_loc): Add discriminator parameter. (get_discriminator_from_adhoc_loc): Add external declaration. (get_discriminator_from_loc): Add external declaration. (COMBINE_LOCATION_DATA): Add discriminator parameter. * lex.cc (get_location_for_byte_range_in_cur_line) Pass 0 discriminator in a call to COMBINE_LOCATION_DATA. (warn_about_normalization): Pass 0 discriminator in a call to COMBINE_LOCATION_DATA. (_cpp_lex_direct): Pass 0 discriminator in a call to COMBINE_LOCATION_DATA. * line-map.cc (location_adhoc_data_hash): Use discriminator compute location_adhoc_data hash. (location_adhoc_data_eq): Use discriminator when comparing location_adhoc_data. (can_be_stored_compactly_p): Check discriminator to determine compact storage. (get_combined_adhoc_loc): Add discriminator parameter. (get_discriminator_from_adhoc_loc): New function to get the discriminator from an ad-hoc location. (get_discriminator_from_loc): New function to get the discriminator from a location. 2022-09-27 Jakub Jelinek PR c++/106652 PR c++/85518 * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and {f,F}{32,64,128}x suffixes for C++. 2022-09-08 Lewis Hyatt * line-map.cc (location_adhoc_data_update): Remove reliance on undefined behavior. (get_combined_adhoc_loc): Likewise. (rebuild_location_adhoc_htab): Fix issue where the htab was not properly updated. 2022-09-07 Joseph Myers * include/cpplib.h (struct cpp_options): Add true_false. * expr.cc (eval_token): Check true_false not cplusplus to determine whether to handle true and false keywords. * init.cc (struct lang_flags): Add true_false. (lang_defaults): Update. (cpp_set_lang): Set true_false. 2022-09-07 Jakub Jelinek * include/cpplib.h (struct cpp_options): Add cpp_warn_unicode member. (enum cpp_warning_reason): Add CPP_W_UNICODE. * init.cc (cpp_create_reader): Initialize cpp_warn_unicode. * charset.cc (_cpp_valid_ucn): In possible identifier contexts, don't handle \u{ or \N{ specially in -std=c* modes except -std=c++2{3,b}. In possible identifier contexts, don't emit an error and punt if \N isn't followed by {, or if \N{} surrounds some lower case letters or _. In possible identifier contexts when not C++23, don't emit an error but warning about unknown character names and treat as separate tokens. When treating as separate tokens \u{ or \N{, emit warnings. 2022-09-05 Joseph Myers * init.cc (lang_defaults): Disable trigraphs for C2x. 2022-09-02 David Malcolm PR c/90885 * include/cpplib.h (BOL): Move macro to 1 << 12 since it is not used by C/C++'s unsigned char token flags. (DECIMAL_INT): New, using 1 << 6, so that it is visible as part of C/C++'s 8 bits of token flags. 2022-09-01 Jakub Jelinek PR c++/106655 * include/cpplib.h (struct cpp_options): Implement C++23 P2295R6 - Support for UTF-8 as a portable source file encoding. Add cpp_warn_invalid_utf8 and cpp_input_charset_explicit fields. (enum cpp_warning_reason): Add CPP_W_INVALID_UTF8 enumerator. * init.cc (cpp_create_reader): Initialize cpp_warn_invalid_utf8 and cpp_input_charset_explicit. * charset.cc (_cpp_valid_utf8): Adjust function comment. * lex.cc (UCS_LIMIT): Define. (utf8_continuation): New const variable. (utf8_signifier): Move earlier in the file. (_cpp_warn_invalid_utf8, _cpp_handle_multibyte_utf8): New functions. (_cpp_skip_block_comment): Handle -Winvalid-utf8 warning. (skip_line_comment): Likewise. (lex_raw_string, lex_string): Likewise. (_cpp_lex_direct): Likewise. 2022-08-31 Jakub Jelinek PR preprocessor/106778 * makeuname2c.cc (write_nodes): Reverse order of && operands in assert. 2022-08-26 Jakub Jelinek PR c++/106647 * charset.cc (wide_str_to_charconst): Implement P2362R3 - Remove non-encodable wide character literals and multicharacter. For C++23 use CPP_DL_ERROR instead of CPP_DL_WARNING for "character constant too long for its type" diagnostics on CPP_WCHAR literals. 2022-08-26 Jakub Jelinek PR c++/106648 * charset.cc: Implement C++23 P2071R2 - Named universal character escapes. Include uname2c.h. (hangul_syllables, hangul_count): New variables. (struct uname2c_data): New type. (_cpp_uname2c, _cpp_uname2c_uax44_lm2): New functions. (_cpp_valid_ucn): Use them. Handle named universal character escapes. (convert_ucn): Adjust comment. (convert_escape): Call convert_ucn even for \N. (_cpp_interpret_identifier): Handle named universal character escapes. * lex.cc (get_bidi_ucn): Fix up function comment formatting. (get_bidi_named): New function. (forms_identifier_p, lex_string): Handle named universal character escapes. * makeuname2c.cc: New file. Small parts copied from makeucnid.cc. * uname2c.h: New generated file. 2022-08-24 Jakub Jelinek PR c++/106646 * init.cc: Implement C++23 P2437R1 - Support for #warning. (lang_defaults): Set warning_directive for GNUCXX23 and CXX23. * directives.cc (directive_diagnostics): Use different wording of #warning pedwarn for C++. 2022-08-20 Jakub Jelinek PR c++/106645 * include/cpplib.h (struct cpp_options): Implement P2290R3 - Delimited escape sequences. Add delimite_escape_seqs member. * init.cc (struct lang_flags): Likewise. (lang_defaults): Add delim column. (cpp_set_lang): Copy over delimite_escape_seqs. * charset.cc (extend_char_range): New function. (_cpp_valid_ucn): Use it. Handle delimited escape sequences. (convert_hex): Likewise. (convert_oct): Likewise. (convert_ucn): Use extend_char_range. (convert_escape): Call convert_oct even for \o. (_cpp_interpret_identifier): Handle delimited escape sequences. * lex.cc (get_bidi_ucn_1): Likewise. Add end argument, fill it in. (get_bidi_ucn): Adjust get_bidi_ucn_1 caller. Use end argument to compute num_bytes. 2022-08-18 Joseph Myers * include/cpplib.h (struct cpp_options): Add warning_directive. * init.cc (struct lang_flags, lang_defaults): Add warning_directive. * directives.cc (DIRECTIVE_TABLE): Mark #warning as STDC2X not EXTENSION. (directive_diagnostics): Diagnose #warning with -Wc11-c2x-compat, or with -pedantic for a standard not supporting #warning. 2022-08-16 Tom Honermann PR c++/106423 * include/cpplib.h (cpp_warning_reason): Add CPP_W_CXX20_COMPAT. * init.cc (cpp_create_reader): Add cpp_warn_cxx20_compat. 2022-08-08 Tom Honermann PR preprocessor/106426 * charset.cc (narrow_str_to_charconst): Set signedness of CPP_UTF8CHAR literals based on unsigned_utf8char. * include/cpplib.h (cpp_options): Add unsigned_utf8char. * init.cc (cpp_create_reader): Initialize unsigned_utf8char. 2022-07-15 Jonathan Wakely * include/line-map.h (label_text::take_or_copy): Remove. (label_text::moved_from): Rename to release. (label_text::m_buffer, label_text::m_owned): Make private. (label_text::get, label_text::is_owned): New accessors. 2022-07-13 Marek Polacek PR preprocessor/106272 * include/line-map.h (class label_text): Don't std::move in a return statement. 2022-07-10 Lewis Hyatt PR preprocessor/97498 * directives.cc (destringize_and_run): Override the location of the CPP_PRAGMA token from a _Pragma directive to the location of the expansion point, as is done for the tokens lexed from it. 2022-07-07 David Malcolm * include/line-map.h: Include . (class label_text): Delete maybe_free method in favor of a destructor. Add move ctor and assignment operator. Add deletion of the copy ctor and copy-assignment operator. Rename field m_caller_owned to m_owned. Add std::move where necessary; add moved_from member function. 2022-06-28 Lewis Hyatt * ucnid.h: Regenerated for Unicode 14.0. 2022-06-26 Lewis Hyatt * generated_cpp_wcwidth.h: Generated from updated Unicode data files. 2022-05-29 Jakub Jelinek PR preprocessor/105732 * expr.cc (_cpp_parse_expr): Handle CPP_PADDING by just another token. 2022-05-20 David Malcolm * lex.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". 2022-02-11 Joseph Myers * Makefile.in (po/$(PACKAGE).pot): Also handle cpp_warning_at, cpp_pedwarning_at and cpp_error_at. 2022-02-01 Jakub Jelinek PR preprocessor/104147 * macro.cc (funlike_invocation_p): For padding prefer a token with val.source non-NULL especially if it has PREV_WHITE set on val.source->flags. Add gcc_assert that CPP_PADDING tokens don't have PREV_WHITE set in flags. 2022-02-01 Jakub Jelinek * directives.cc (destringize_and_run): Push &pfile->avoid_paste instead of a copy of pfile->directive_result for the CPP_PADDING case. 2022-01-24 Marek Polacek PR preprocessor/104030 * include/cpplib.h (enum cpp_bidirectional_level): Add bidirectional_ucn. Set values explicitly. * internal.h (cpp_reader): Adjust warn_bidi_p. * lex.cc (maybe_warn_bidi_on_close): Don't warn about UCNs unless UCN checking is on. (maybe_warn_bidi_on_char): Likewise. 2022-01-18 Richard Biener * include/line-map.h (class line_maps): Re-arrange fields to minimize padding. (class rich_location): Likewise. * line-map.cc (rich_location::rich_location): Adjust. 2022-01-17 Martin Liska * Makefile.in: Rename .c names to .cc. 2022-01-17 Martin Liska * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise. 2022-01-17 Martin Liska * charset.c: Moved to... * charset.cc: ...here. * directives.c: Moved to... * directives.cc: ...here. * errors.c: Moved to... * errors.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * files.c: Moved to... * files.cc: ...here. * identifiers.c: Moved to... * identifiers.cc: ...here. * init.c: Moved to... * init.cc: ...here. * lex.c: Moved to... * lex.cc: ...here. * line-map.c: Moved to... * line-map.cc: ...here. * macro.c: Moved to... * macro.cc: ...here. * makeucnid.c: Moved to... * makeucnid.cc: ...here. * mkdeps.c: Moved to... * mkdeps.cc: ...here. * pch.c: Moved to... * pch.cc: ...here. * symtab.c: Moved to... * symtab.cc: ...here. * traditional.c: Moved to... * traditional.cc: ...here. 2022-01-15 Martin Sebor * files.c (_cpp_find_file): Substitute a valid pointer for an invalid one to avoid -Wuse-after-free. 2022-01-12 Clément Chigot * configure.ac: Check sizeof ino_t and dev_t. * config.in: Regenerate. * configure: Regenerate. * include/cpplib.h (INO_T_CPP): Change for AIX. (DEV_T_CPP): New macro. (struct cpp_dir): Use it. 2021-12-30 Jakub Jelinek PR preprocessor/89971 * macro.c (replace_args): For ##__VA_OPT__, if __VA_OPT__ expands to no tokens at all, drop PASTE_LEFT flag from the previous token. 2021-12-04 Jakub Jelinek PR preprocessor/102432 * lex.c (_cpp_lex_direct): If buffer->need_line while pfile->state.in_deferred_pragma, return CPP_PRAGMA_EOL token instead of assertion failure. 2021-12-03 Jakub Jelinek PR pch/71934 * include/line-map.h (class line_maps): Add GTY((callback)) to reallocator and round_alloc_size members. 2021-12-01 Jakub Jelinek PR c++/100977 * init.c (struct lang_flags): Remove cxx23_identifiers. (lang_defaults): Remove cxx23_identifiers initializers. (cpp_set_lang): Don't copy cxx23_identifiers. * include/cpplib.h (struct cpp_options): Adjust comment about c11_identifiers. Remove cxx23_identifiers field. * lex.c (warn_about_normalization): Use cplusplus instead of cxx23_identifiers. * charset.c (ucn_valid_in_identifier): Likewise. 2021-12-01 Jakub Jelinek PR preprocessor/103415 * macro.c (stringify_arg): Remove va_opt argument and va_opt handling. (paste_tokens): On successful paste or in PREV_WHITE and PREV_FALLTHROUGH flags from the *plhs token to the new token. (replace_args): Adjust stringify_arg callers. For #__VA_OPT__, perform token pasting in a separate loop before stringify_arg call. 2021-11-30 Richard Biener * charset.c (convert_escape): Remove unreachable break. 2021-11-30 Jakub Jelinek PR c++/100977 * init.c (lang_defaults): Enable cxx23_identifiers for -std={gnu,c}++{11,14,17,20} too. 2021-11-29 Eric Gallager PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow ETAGS variable to be overridden. 2021-11-23 Christophe Lyon PR preprocessor/103355 * system.h (ATTR_LIKELY): Fix definition. 2021-11-23 Marek Polacek Jonathan Wakely PR preprocessor/103355 * lex.c: Use ATTR_LIKELY instead of [[likely]]. * system.h (ATTR_LIKELY): Define. 2021-11-22 Jakub Jelinek Tobias Burnus PR preprocessor/103165 * internal.h (struct lexer_state): Add ignore__Pragma field. * macro.c (builtin_macro): Don't interpret _Pragma if pfile->state.ignore__Pragma. (expand_arg): Temporarily set pfile->state.ignore__Pragma to 1. 2021-11-17 David Malcolm PR preprocessor/103026 * lex.c (struct bidi::context): New. (bidi::vec): Convert to a vec of context rather than unsigned char. (bidi::ctx_at): Rename to... (bidi::pop_kind_at): ...this and reimplement for above change. (bidi::current_ctx): Update for change to vec. (bidi::current_ctx_ucn_p): Likewise. (bidi::current_ctx_loc): New. (bidi::on_char): Update for usage of context struct. Add "loc" param and pass it when pushing contexts. (get_location_for_byte_range_in_cur_line): New. (get_bidi_utf8): Rename to... (get_bidi_utf8_1): ...this, reintroducing... (get_bidi_utf8): ...as a wrapper, setting *OUT when the result is not NONE. (get_bidi_ucn): Rename to... (get_bidi_ucn_1): ...this, reintroducing... (get_bidi_ucn): ...as a wrapper, setting *OUT when the result is not NONE. (class unpaired_bidi_rich_location): New. (maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when reporting on unpaired bidi chars. Split into singular vs plural spellings. (maybe_warn_bidi_on_char): Pass in a location_t rather than a const uchar * and use it when emitting warnings, and when calling bidi::on_char. (_cpp_skip_block_comment): Capture location when kind is not NONE and pass it to maybe_warn_bidi_on_char. (skip_line_comment): Likewise. (forms_identifier_p): Likewise. (lex_raw_string): Likewise. (lex_string): Likewise. 2021-11-17 David Malcolm PR preprocessor/103026 * lex.c (maybe_warn_bidi_on_close): Use a rich_location and call set_escape_on_output (true) on it. (maybe_warn_bidi_on_char): Likewise. 2021-11-17 Jakub Jelinek PR preprocessor/103130 * lex.c (cpp_directive_only_process): Treat even \*/ as end of block comment. 2021-11-17 Marek Polacek PR preprocessor/103026 * include/cpplib.h (enum cpp_bidirectional_level): New. (struct cpp_options): Add cpp_warn_bidirectional. (enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL. * internal.h (struct cpp_reader): Add warn_bidi_p member function. * init.c (cpp_create_reader): Set cpp_warn_bidirectional. * lex.c (bidi): New namespace. (get_bidi_utf8): New function. (get_bidi_ucn): Likewise. (maybe_warn_bidi_on_close): Likewise. (maybe_warn_bidi_on_char): Likewise. (_cpp_skip_block_comment): Implement warning about bidirectional control characters. (skip_line_comment): Likewise. (forms_identifier_p): Likewise. (lex_identifier): Likewise. (lex_string): Likewise. (lex_raw_string): Likewise. 2021-11-01 David Malcolm * charset.c (convert_escape): Use encoding_rich_location when complaining about nonprintable unknown escape sequences. (cpp_display_width_computation::::cpp_display_width_computation): Pass in policy rather than tabstop. (cpp_display_width_computation::process_next_codepoint): Add "out" param and populate *out if non-NULL. (cpp_display_width_computation::advance_display_cols): Pass NULL to process_next_codepoint. (cpp_byte_column_to_display_column): Pass in policy rather than tabstop. Pass NULL to process_next_codepoint. (cpp_display_column_to_byte_column): Pass in policy rather than tabstop. * errors.c (cpp_diagnostic_get_current_location): New function, splitting out the logic from... (cpp_diagnostic): ...here. (cpp_warning_at): New function. (cpp_pedwarning_at): New function. * include/cpplib.h (cpp_warning_at): New decl for rich_location. (cpp_pedwarning_at): Likewise. (struct cpp_decoded_char): New. (struct cpp_char_column_policy): New. (cpp_display_width_computation::cpp_display_width_computation): Replace "tabstop" param with "policy". (cpp_display_width_computation::process_next_codepoint): Add "out" param. (cpp_display_width_computation::m_tabstop): Replace with... (cpp_display_width_computation::m_policy): ...this. (cpp_byte_column_to_display_column): Replace "tabstop" param with "policy". (cpp_display_width): Likewise. (cpp_display_column_to_byte_column): Likewise. * include/line-map.h (rich_location::escape_on_output_p): New. (rich_location::set_escape_on_output): New. (rich_location::m_escape_on_output): New. * internal.h (cpp_diagnostic_get_current_location): New decl. (class encoding_rich_location): New. * lex.c (skip_whitespace): Use encoding_rich_location when complaining about null characters. (warn_about_normalization): Generate a source range when complaining about improperly normalized tokens, rather than just a point, and use encoding_rich_location so that the source code is escaped on printing. * line-map.c (rich_location::rich_location): Initialize m_escape_on_output. 2021-10-29 Tobias Burnus PR c++/102409 * directives.c (destringize_and_run): Add PRAGMA_OP to the CPP_PRAGMA token's flags to mark is as coming from _Pragma. * include/cpplib.h (PRAGMA_OP): #define, to be used with token flags. * macro.c (collect_args): Only handle CPP_PRAGMA special if PRAGMA_OP is set. 2021-10-22 Eric Gallager PR other/102663 * Makefile.in: Add dummy install-dvi target. 2021-10-18 Martin Liska * charset.c (convert_oct): Remove unused but set variable. 2021-10-06 Jakub Jelinek * init.c (lang_defaults): Implement P2334R1, enable elifdef for -std=c++23 and -std=gnu++23. * directives.c (_cpp_handle_directive): Support elifdef/elifndef if either CPP_OPTION (pfile, elifdef) or !CPP_OPTION (pfile, std). (do_elif): For older non-std modes if pedantic pedwarn about #elifdef/#elifndef directives that change behavior. 2021-09-01 Jakub Jelinek PR c++/100977 * include/cpplib.h (struct cpp_options): Add cxx23_identifiers. * charset.c (CXX23, NXX23): New enumerators. (CID, NFC, NKC, CTX): Renumber. (ucn_valid_in_identifier): Implement P1949R7 - use CXX23 and NXX23 flags for cxx23_identifiers. For start character in non-pedantic mode, allow characters that are allowed as start characters in any of the supported language modes, rather than disallowing characters allowed only as non-start characters in current mode but for characters from other language modes allowing them even if they are never allowed at start. * init.c (struct lang_flags): Add cxx23_identifiers. (lang_defaults): Add cxx23_identifiers column. (cpp_set_lang): Initialize CPP_OPTION (pfile, cxx23_identifiers). * lex.c (warn_about_normalization): If cxx23_identifiers, use cpp_pedwarning_with_line instead of cpp_warning_with_line for "is not in NFC" diagnostics. * makeucnid.c: Adjust usage comment. (CXX23, NXX23): New enumerators. (all_languages): Add CXX23. (not_NFC, not_NFKC, maybe_not_NFC): Renumber. (read_derivedcore): New function. (write_table): Print also CXX23 and NXX23 columns. (main): Require 5 arguments instead of 4, call read_derivedcore. * ucnid.h: Regenerated using Unicode 13.0.0 files. 2021-09-01 Jason Merrill * macro.c (replace_args): When __VA_OPT__ is on the LHS of ##, remove trailing avoid_paste tokens. 2021-09-01 Jakub Jelinek PR preprocessor/101488 * macro.c (replace_args): Fix up handling of CPP_PADDING tokens at the start or end of __VA_OPT__ arguments when preceeded or followed by ##. 2021-08-31 Martin Sebor * include/line-map.h (class rich_location): Disable copying and assignment. 2021-08-25 Lewis Hyatt PR other/93067 * charset.c (init_iconv_desc): Adapt to permit PFILE argument to be NULL. (_cpp_convert_input): Likewise. Also move UTF-8 BOM logic to... (cpp_check_utf8_bom): ...here. New function. (cpp_input_conversion_is_trivial): New function. * files.c (read_file_guts): Allow PFILE argument to be NULL. Add INPUT_CHARSET argument as an alternate source of this information. (read_file): Pass the new argument to read_file_guts. (cpp_get_converted_source): New function. * include/cpplib.h (struct cpp_converted_source): Declare. (cpp_get_converted_source): Declare. (cpp_input_conversion_is_trivial): Declare. (cpp_check_utf8_bom): Declare. 2021-08-17 Jakub Jelinek * macro.c (vaopt_state): Add m_stringify member. (vaopt_state::vaopt_state): Initialize it. (vaopt_state::update): Overwrite it. (vaopt_state::stringify): New method. (stringify_arg): Replace arg argument with first, count arguments and add va_opt argument. Use first instead of arg->first and count instead of arg->count, for va_opt add paste_tokens handling. (paste_tokens): Fix up len calculation. Don't spell rhs twice, instead use %.*s to supply lhs and rhs spelling lengths. Don't call _cpp_backup_tokens here. (paste_all_tokens): Call it here instead. (replace_args): Adjust stringify_arg caller. For vaopt_state::END if stringify is true handle __VA_OPT__ stringification. (create_iso_definition): Handle # __VA_OPT__ similarly to # macro_arg. 2021-08-12 Jakub Jelinek PR preprocessor/101638 * macro.c (cpp_sys_macro_p): Return true instead of crashing on builtin macros. 2021-08-05 Jakub Jelinek PR c++/100977 * ucnid.h: Regenerated using Unicode 13.0.0 files. 2021-08-05 Jakub Jelinek PR c++/100977 * makeucnid.c (write_table): Fix computation of last_combine. * ucnid.h: Regenerated using Unicode 6.3.0 files. 2021-06-16 Jason Merrill PR c++/100796 PR preprocessor/96391 * line-map.c (linemap_compare_locations): Only use comparison with LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort. 2021-05-20 Christophe Lyon Torbjörn Svensson PR c/42579 * include/cpplib.h (cpp_builtin_type): Add BT_FILE_NAME entry. * init.c (builtin_array): Likewise. * macro.c (_cpp_builtin_macro_text): Add support for BT_FILE_NAME. 2021-05-20 Jakub Jelinek PR preprocessor/100646 * lex.c (cpp_directive_only_process): Treat end of file as termination for !is_block comments. 2021-05-12 Jakub Jelinek PR preprocessor/100392 * lex.c (cpp_directive_only_process): If buffer doesn't end with '\n', add buffer->rlimit[0] character to the printed range and CPP_INCREMENT_LINE and increment line_count. 2021-05-11 Joseph Myers * include/cpplib.h (struct cpp_options): Add elifdef. * init.c (struct lang_flags): Add elifdef. (lang_defaults): Update to include elifdef initializers. (cpp_set_lang): Set elifdef for pfile based on language. * directives.c (STDC2X, ELIFDEF): New macros. (EXTENSION): Increase value to 3. (DIRECTIVE_TABLE): Add #elifdef and #elifndef. (_cpp_handle_directive): Do not treat ELIFDEF directives as directives for language versions without the #elifdef feature. (do_elif): Handle #elifdef and #elifndef. (do_elifdef, do_elifndef): New functions. 2021-05-11 Joseph Myers * lex.c (cpp_avoid_paste): Do not allow pasting CPP_NUMBER with CPP_CHAR. 2021-05-11 Joseph Myers * init.c (lang_defaults): Enable digit separators for GNUC2X and STDC2X. 2021-05-07 Jakub Jelinek PR c/100450 * lex.c (cpp_avoid_paste): Handle token1 CPP_PRAGMA like CPP_NAME. 2021-05-06 Joseph Myers PR c++/83873 PR preprocessor/97604 * lex.c (lex_number): Reject adjacent digit separators here. Do not allow digit separators before '.' or an exponent with sign. * expr.c (cpp_classify_number): Do not check for adjacent digit separators here. 2021-05-03 H.J. Lu PR bootstrap/99703 * configure: Regenerated. 2021-04-29 Joseph Myers PR preprocessor/82359 * directives.c (strtolinenum): Handle digit separators. 2021-04-19 Richard Biener PR preprocessor/100142 * line-map.c (linemap_position_for_loc_and_offset): Revert unintended s/column_offset/column/ change. 2021-04-13 Nathan Sidwell PR preprocessor/99446 * line-map.c (line-map.c): Do not advance to linemaps for different files. 2021-04-13 Eric Botcazou * include/line-map.h (IS_MACRO_LOC): Delete. * line-map.c (linemap_location_from_macro_expansion_p): Test LINEMAPS_MACRO_LOWEST_LOCATION of the linemap. 2021-03-02 David Malcolm PR c/99323 * line-map.c (rich_location::maybe_add_fixit): Reject fix-it hints at column 0. 2021-02-24 Nathan Sidwell PR c++/98718 * include/line-map.h * line-map.c 2021-02-24 Nathan Sidwell PR c++/99072 * init.c (read_original_filename): Expunge all evidence of the original filename. 2021-02-18 Nathan Sidwell PR c++/99023 * include/cpplib.h (cpp_find_header_unit): Rename to ... (cpp_probe_header_unit): ... this. * internal.h (_cp_find_header_unit): Declare. * files.c (cpp_find_header_unit): Break apart to .. (test_header_unit): ... this, and ... (_cpp_find_header_unit): ... and, or and ... (cpp_probe_header_unit): ... this. * macro.c (cpp_get_token_1): Call _cpp_find_header_unit. 2021-02-16 Nathan Sidwell * files.c (_cpp_stack_file): Make buffers end in unread \n. 2021-02-10 David Malcolm PR preprocessor/96391 * line-map.c (linemap_compare_locations): Require that the location be <= LINE_MAP_MAX_LOCATION_WITH_COLS when treating locations as coming from the same macro expansion. 2021-02-04 Jakub Jelinek * expr.c (cpp_classify_number): Use make_signed_t instead of make_signed::type in the diagnostics. 2021-02-03 Jakub Jelinek PR preprocessor/98882 * lex.c (cpp_directive_only_process): Don't assert that rlimit[-1] is a newline, instead assert that rlimit[0] is either newline or carriage return. When seeing '\\' followed by '\r', check limit before accessing pos[1]. 2021-02-03 Ed Smith-Rowland <3dw4rd@verizon.net> * expr.c (interpret_int_suffix): Detect 'z' integer suffix. (cpp_classify_number): Compat warning for use of 'z' suffix. * include/cpplib.h (struct cpp_options): New flag. (enum cpp_warning_reason): New flag. (CPP_N_USERDEF): Comment C++0x -> C++11. (CPP_N_SIZE_T): New flag for cpp_classify_number. * init.c (cpp_set_lang): Initialize new flag. 2021-01-27 liuhongt PR target/98833 * lex.c (search_line_sse2): Replace builtins with == operator. 2021-01-26 Paul Fee * include/cpplib.h (c_lang): Add CXX23 and GNUCXX23. * init.c (lang_defaults): Add rows for CXX23 and GNUCXX23. (cpp_init_builtins): Set __cplusplus to 202100L for C++23. 2021-01-15 Nathan Sidwell PR preprocessor/95253 * mkdeps.c (munge): Do not escape ':'. 2020-12-14 Nathan Sidwell * include/cpplib.h (struct cpp_macro): Add imported_p field. (struct cpp_hashnode): Tweak deferred field documentation. * macro.c (_cpp_new_macro): Clear new field. (cpp_get_deferred_macro, get_deferred_or_lazy_macro): Assert more. 2020-12-10 Jason Merrill * init.c (cpp_init_builtins): Update __cplusplus for C++20. 2020-12-01 JeanHeyd Meneide * charset.c (init_iconv_desc): Initialize "to" and "from" fields. * directives.c (cpp_get_narrow_charset_name): New function. (cpp_get_wide_charset_name): Likewise. * include/cpplib.h (cpp_get_narrow_charset_name): Prototype. (cpp_get_wide_charset_name): Likewise. * internal.h (cset_converter): Add "to" and "from" fields. 2020-11-27 Joseph Myers PR preprocessor/97602 * directives.c (strtolinenum): Check for overflow before it occurs. Correct comment. 2020-11-24 Nathan Sidwell * include/cpplib.h (struct cpp_hashnode): Add deferred field. (cpp_set_deferred_macro): Define. (cpp_get_deferred_macro): Declare. (cpp_macro_definition): Reformat, add overload. (cpp_macro_definition_location): Deal with deferred macro. (cpp_alloc_token_string, cpp_compare_macro): Declare. * internal.h (_cpp_notify_macro_use): Return bool (_cpp_maybe_notify_macro_use): Likewise. * directives.c (do_undef): Check macro is not undef before warning. (do_ifdef, do_ifndef): Deal with deferred macro. * expr.c (parse_defined): Likewise. * lex.c (cpp_allocate_token_string): Break out of ... (create_literal): ... here. Call it. (cpp_maybe_module_directive): Deal with deferred macro. * macro.c (cpp_get_token_1): Deal with deferred macro. (warn_of_redefinition): Deal with deferred macro. (compare_macros): Rename to ... (cpp_compare_macro): ... here. Make extern. (cpp_get_deferred_macro): New. (_cpp_notify_macro_use): Deal with deferred macro, return bool indicating definedness. (cpp_macro_definition): Deal with deferred macro. 2020-11-19 Nathan Sidwell * include/cpplib.h (enum cpp_main_search): New. (struct cpp_options): Add main_search field. (cpp_main_loc): Declare. (cpp_retrofit_as_include): Declare. * internal.h (struct cpp_reader): Add main_loc field. (_cpp_in_main_source_file): Not main if main is a header. * init.c (cpp_read_main_file): Use main_search option to locate main file. Set main_loc * files.c (cpp_retrofit_as_include): New. 2020-11-19 Nathan Sidwell * internal.h (cpp_in_system_header): Rename to ... (_cpp_in_system_header): ... here. (cpp_in_primary_file): Rename to ... (_cpp_in_main_source_file): ... here. Compare main_file equality and check main_search value. * lex.c (maybe_va_opt_error, _cpp_lex_direct): Adjust for rename. * macro.c (_cpp_builtin_macro_text): Likewise. (replace_args): Likewise. * directives.c (do_include_next): Likewise. (do_pragma_once, do_pragma_system_header): Likewise. * files.c (struct _cpp_file): Delete main_file field. (pch_open): Check pfile->main_file equality. (make_cpp_file): Drop cpp_reader parm, don't set main_file. (_cpp_find_file): Adjust. (_cpp_stack_file): Check pfile->main_file equality. (struct report_missing_guard_data): Add cpp_reader field. (report_missing_guard): Check pfile->main_file equality. (_cpp_report_missing_guards): Adjust. 2020-11-18 Nathan Sidwell * include/cpplib.h (struct cpp_options): Add module_directives option. (NODE_MODULE): New node flag. (struct cpp_hashnode): Make rid-code a bitfield, increase bits in flags and swap with type field. * init.c (post_options): Create module-directive identifier nodes. * internal.h (struct lexer_state): Add directive_file_token & n_modules fields. Add module node enumerator. * lex.c (cpp_maybe_module_directive): New. (_cpp_lex_token): Call it. (cpp_output_token): Add '"' around CPP_HEADER_NAME token. (do_peek_ident, do_peek_module): New. (cpp_directives_only): Detect module-directive lines. * macro.c (cpp_get_token_1): Deal with directive_file_token triggering. 2020-11-18 Nathan Sidwell * files.c (struct _cpp_file): Add header_unit field. (_cpp_stack_file): Add header unit support. (cpp_find_header_unit): New. * include/cpplib.h (cpp_find_header_unit): Declare. 2020-11-18 Nathan Sidwell * include/cpplib.h (struct cpp_options): Add modules to dep-options. * include/mkdeps.h (deps_add_module_target): Declare. (deps_add_module_dep): Declare. * mkdeps.c (class mkdeps): Add modules, module_name, cmi_name, is_header_unit fields. Adjust cdtors. (deps_add_module_target, deps_add_module_dep): New. (make_write): Write module dependencies, if enabled. 2020-11-17 Nathan Sidwell * include/cpplib.h (struct cpp_callbacks): Add user_deferred_macro & translate_include. 2020-11-17 Nathan Sidwell * include/line-map.h (enum lc_reason): Add LC_MODULE. (MAP_MODULE_P): New. (line_map_new_raw): Declare. (linemap_enter_macro): Move declaration from internal.h (linemap_module_loc, linemap_module_reparent) (linemap_module_restore): Declare. (linemap_lookup_macro_indec): Declare. * internal.h (linemap_enter_macro): Moved to line-map.h. * line-map.c (linemap_new_raw): New, broken out of ... (new_linemap): ... here. Call it. (LAST_SOURCE_LINE_LOCATION): New. (liemap_module_loc, linemap_module_reparent) (linemap_module_restore): New. (linemap_lookup_macro_index): New, broken out of ... (linemap_macro_map_lookup): ... here. Call it. (linemap_dump): Add module dump. 2020-11-17 Nathan Sidwell PR preprocessor/97858 * mkdeps.c (munge): Drop varadic args, we only ever use one. 2020-11-13 Joseph Myers * expr.c (cpp_classify_number): Update diagnostic for binary constants for C. Also diagnose binary constants for -Wc11-c2x-compat. * init.c (lang_defaults): Enable binary constants for GNUC2X and STDC2X. 2020-11-13 Piotr H. Dabrowski PR c++/91318 * include/cpplib.h: Added cpp_define_unused(), cpp_define_formatted_unused() * directives.c: Likewise. 2020-11-12 Joseph Myers * include/cpplib.h (struct cpp_callbacks): Add bool argument to has_attribute. (enum cpp_builtin_type): Add BT_HAS_STD_ATTRIBUTE. * init.c (builtin_array): Add __has_c_attribute. (cpp_init_special_builtins): Handle BT_HAS_STD_ATTRIBUTE. * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_STD_ATTRIBUTE. Update call to has_attribute for BT_HAS_ATTRIBUTE. * traditional.c (fun_like_macro): Handle BT_HAS_STD_ATTRIBUTE. 2020-11-12 Nicholas Guriev PR pch/86674 * files.c (_cpp_find_file): Use CPP_DL_NOTE not CPP_DL_ERROR in call to cpp_error. 2020-11-07 Lewis Hyatt * generated_cpp_wcwidth.h: Regenerated from Unicode 13.0.0 data. 2020-11-06 Nathan Sidwell * include/cpplib.h (enum class CPP_time_kind): New. (cpp_get_date): Declare. * internal.h (struct cpp_reader): Replace source_date_epoch with time_stamp and time_stamp_kind. * init.c (cpp_create_reader): Initialize them. * macro.c (_cpp_builtin_macro_text): Use cpp_get_date. (cpp_get_date): Broken out from _cpp_builtin_macro_text and genericized. 2020-11-03 Nathan Sidwell * lex.c (cpp_peek_token): Do not peek past CPP_PRAGMA. (_cpp_lex_direct): Handle EOF in pragma when setting need_line, not when needing a line. 2020-11-03 Nathan Sidwell * lex.c (_cpp_clean_line): Fix DOS off-by-one error. 2020-11-03 Nathan Sidwell * init.c (cpp_read_main_file): Use cpp_get_deps result. 2020-11-03 Nathan Sidwell * include/mkdeps.h: Include cpplib.h (deps_write): Adjust first parm type. * mkdeps.c: Include internal.h (make_write): Adjust first parm type. Check phony option directly. (deps_write): Adjust first parm type. * init.c (cpp_read_main_file): Use get_deps. * directives.c (cpp_get_deps): Check option before initializing. 2020-11-02 Nathan Sidwell * internal.h (_cpp_notify_macro_use): Add location parm. (_cpp_maybe_notify_macro_use): Likewise. * directives.c (_cpp_do_file_change): Check we've not changed file when optimizing a rewind. (do_ifdef): Pass location to _cpp_maybe_notify_macro_use. (do_ifndef): Likewise. Delete obsolete comment about powerpc. * expr.c (parse_defined): Pass location to _cpp_maybe_notify_macro_use. * macro.c (enter_macro_context): Likewise. (warn_of_redefinition): Break out helper function. Call it. (compare_macros): New function broken out of warn_of_redefinition. (_cpp_new_macro): Zero all fields. (_cpp_notify_macro_use): Add location parameter. 2020-10-20 Nathan Sidwell * lex.c (_cpp_lex_direct): Do not complete EOF processing when parsing_args. * macro.c (collect_args): Do not unwind fake EOF. (funlike_invocation_p): Do not unwind fake EOF. (cpp_context): Replace abort with gcc_assert. 2020-10-19 Nathan Sidwell * internal.h (struct cpp_reader): Rename 'eof' field to 'endarg'. * init.c (cpp_create_reader): Adjust. * macro.c (collect_args): Use endarg for separator. Always rewind in the not-fn case. 2020-10-08 Nathan Sidwell * internal.h (enum include_type): Rename IT_MAIN_INJECT to IT_PRE_MAIN. * init.c (cpp_read_main_file): If there is no line marker, adjust the initial line marker. (read_original_filename): Return bool, peek the buffer directly before trying to tokenize. (read_original_directory): Likewise. Directly prod the string literal. * files.c (_cpp_stack_file): Adjust for IT_PRE_MAIN change. 2020-09-26 Jakub Jelinek PR bootstrap/97163 * lex.c (search_line_fast): Only use _ARCH_PWR8 Altivec version for GCC >= 4.5. 2020-09-17 Patrick Palka PR c/80076 * include/line-map.h (first_map_in_common): Declare. * line-map.c (first_map_in_common): Remove static. 2020-09-07 Martin Storsjö * files.c (remap_filename): Make a strchr return value pointer to const. 2020-07-30 H.J. Lu PR bootstrap/96202 * configure: Regenerated. 2020-07-29 Tiziano Müller * init.c (builtin_array): Add xref comment. * traditional.c (fun_like_macro): Add HAS_INCLUDE codes. 2020-07-28 Jakub Jelinek PR preprocessor/96323 * lex.c (lex_raw_string): For c == '\n' don't continue after reporting an prefix delimiter error. 2020-07-28 Nathan Sidwell * init.c (cpp_read_main_file): Always use the last map for the return value. 2020-07-20 Nathan Sidwell * line-map.c (linemap_add): Simplify column overflow calculation. Add comment about range and column bit init. (linemap_ordinary_map_lookup): Refactor for RAII (linemap_macro_map_lookup): Likewise. 2020-07-14 Lewis Hyatt PR preprocessor/49973 PR other/86904 * include/cpplib.h (struct cpp_options): Removed support for -ftabstop, which is now handled by diagnostic_context. (class cpp_display_width_computation): New class. (cpp_byte_column_to_display_column): Add optional tabstop argument. (cpp_display_width): Likewise. (cpp_display_column_to_byte_column): Likewise. * charset.c (cpp_display_width_computation::cpp_display_width_computation): New function. (cpp_display_width_computation::advance_display_cols): Likewise. (compute_next_display_width): Removed and implemented this functionality in a new function... (cpp_display_width_computation::process_next_codepoint): ...here. (cpp_byte_column_to_display_column): Added tabstop argument. Reimplemented in terms of class cpp_display_width_computation. (cpp_display_column_to_byte_column): Likewise. * init.c (cpp_create_reader): Remove handling of -ftabstop, which is now handled by diagnostic_context. 2020-07-07 Nathan Sidwell * directives.c (do_linemarker): Optimize rewinding to line zero. * files.c (_cpp_stack_file): Start on line zero when about to inject headers. (cpp_push_include, cpp_push_default_include): Use highest_line as the location. * include/cpplib.h (cpp_read_main_file): Add injecting parm. * init.c (cpp_read_main_file): Likewise, inform _cpp_stack_file. * internal.h (enum include_type): Add IT_MAIN_INJECT. 2020-05-29 H.J. Lu PR bootstrap/95413 * configure: Regenerated. 2020-05-23 David Edelsohn * Makefile.in (AR): Substitute @AR@. * configure.ac (CHECK_PROG AR): New. * configure: Regenerate. 2020-05-20 Nathan Sidwell * internal.h (typedef _cpp_file): Delete, unnecessary in C++. (enum _cpp_find_file_kind): New. (_cpp_find_file): Use it, not 3 bools. * files.c (_cpp_find_file): Use _cpp_find_file_kind enum, not bools. (cpp_make_system_header): Break overly long line. (_cpp_stack_include, _cpp_fake_include) (_cpp_do_file_change, _cpp_compare_file_date, _cpp_has_header): Adjust. * init.c (cpp_read_main): Adjust _cpp_find_file call. 2020-05-18 Nathan Sidwell * include/cpplib.h (cpp_get_otions, cpp_get_callbacks) (cpp_get_deps): Mark as PURE. * include/line-map.h (get_combined_adhoc_loc) (get_location_from_adhoc_loc, get_pure_location): Reformat decls. * internal.h (struct lexer_state): Clarify comment. * system.h: Remove now-unneeded bool hackery. * files.c (_cpp_find_file): Store LOC not highest_location. PR preprocessor/95149 * lex.c (struct lit_accum): New. (bufring_append): Replace by lit_accum::append. (lex_raw_string): Reimplement, using fragments of the old version. (lex_string): Adjust lex_raw_string call. PR preprocessor/95182 * macro.c (collect_args): Preserve EOFif we fell out of the main file. (cpp_get_token_1): Reformat a couple of short lines. 2020-05-14 H.J. Lu * configure: Regenerated. 2020-05-13 Jason Merrill * include/cpplib.h (enum c_lang): Change CXX2A to CXX20. * init.c, lex.c: Adjust. 2020-05-12 Nathan Sidwell EOF location is at end of file PR preprocessor/95013 * lex.c (lex_raw_string): Process line notes before incrementing. Correct incrementing condition. Adjust for new _cpp_get_fresh_line EOF behaviour. (_cpp_get_fresh_line): Do not pop buffer at EOF, increment line instead. (_cpp_lex_direct): Adjust for new _cpp_get_fresh_line behaviour. (cpp_directive_only_process): Assert we got a fresh line. * traditional.c (_cpp_read_logical_line_trad): Adjust for new _cpp_get_fresh_line behaviour. 2020-05-12 H.J. Lu * Makefile.in (CET_HOST_FLAGS): New. (COMPILER): Add $(CET_HOST_FLAGS). * configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and AC_SUBST(CET_HOST_FLAGS). Clear CET_HOST_FLAGS if jit isn't enabled. * aclocal.m4: Regenerated. * configure: Likewise. 2020-05-08 Nathan Sidwell Reimplement directives only processing, support raw literals. * directives-only.c: Delete. * Makefile.in (libcpp_a_OBJS, libcpp_a_SOURCES): Remove it. * include/cpplib.h (enum CPP_DO_task): New enum. (cpp_directive_only_preprocess): Declare. * internal.h (_cpp_dir_only_callbacks): Delete. (_cpp_preprocess_dir_only): Delete. * lex.c (do_peek_backslask, do_peek_next, do_peek_prev): New. (cpp_directives_only_process): New implementation. 2020-02-14 Jakub Jelinek Partially implement P1042R1: __VA_OPT__ wording clarifications PR preprocessor/92319 * macro.c (expand_arg): Move declarations before vaopt_state definition. (class vaopt_state): Move enum update_type definition earlier. Remove m_allowed member, add m_arg and m_update members. (vaopt_state::vaopt_state): Change last argument from bool any_args to macro_arg *arg, initialize m_arg and m_update instead of m_allowed. (vaopt_state::update): When bumping m_state from 1 to 2 and m_update is ERROR, determine if __VA_ARGS__ expansion has any non-CPP_PADDING tokens and set m_update to INCLUDE if it has any, DROP otherwise. Return m_update instead of m_allowed ? INCLUDE : DROP in m_state >= 2. (replace_args, create_iso_definition): Adjust last argument to vaopt_state ctor. 2020-02-05 Martin Sebor * include/cpplib.h (cpp_builtin_type): Remove trailing comma to avoid pedantic warnings in C++ 98 mode. 2020-02-04 Jakub Jelinek * macro.c (builtin_has_include): Diagnose __has_include* use outside of preprocessing directives. PR preprocessor/93545 * macro.c (cpp_get_token_no_padding): New function. (builtin_has_include): Use it instead of cpp_get_token. Don't check SEEN_EOL. 2020-02-01 Andrew Burgess * configure: Regenerate. 2020-01-28 Nathan Sidwell PR preprocessor/93452 * internal.h (struct spec_nodes): Drop n__has_include{,_next}. * directives.c (lex_macro_node): Don't check __has_include redef. * expr.c (eval_token): Drop __has_include eval. (parse_has_include): Move to ... * macro.c (builtin_has_include): ... here. (_cpp_builtin_macro_text): Eval __has_include{,_next}. * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_INCLUDE{,_NEXT}. * init.c (builtin_array): Add them. (cpp_init_builtins): Drop __has_include{,_next} init here ... * pch.c (cpp_read_state): ... and here. * traditional.c (enum ls): Drop has_include states ... (_cpp_scan_out_logical_line): ... and here. 2020-01-27 Andrew Burgess * configure: Regenerate. 2020-01-24 Nathan Sidwell * expr.c (parse_has_include): Remove bogus controlling macro code. 2020-01-20 Nathan Sidwell PR preprocessor/80005 * include/cpplib.h (BT_HAS_ATTRIBUTE): Fix comment. * internal.h (struct lexer_state): Delete in__has_include field. (struct spec_nodes): Rename n__has_include{,_next}__ fields. (_cpp_defined_macro_p): New. (_cpp_find_file): Add has_include parm. * directives.c (lex_macro_node): Combine defined, __has_inline{,_next} checking. (do_ifdef, do_ifndef): Use _cpp_defined_macro_p. (_cpp_init_directives): Refactor. * expr.c (parse_defined): Use _cpp_defined_macro_p. (eval_token): Adjust parse_has_include calls. (parse_has_include): Add OP parameter. Reimplement. * files.c (_cpp_find_file): Add HAS_INCLUDE parm. Use it to inhibit error message. (_cpp_stack_include): Adjust _cpp_find_file call. (_cpp_fake_include, _cpp_compare_file_date): Likewise. (open_file_failed): Remove in__has_include check. (_cpp_has_header): Adjust _cpp_find_file call. * identifiers.c (_cpp_init_hashtable): Don't init __has_include{,_next} here ... * init.c (cpp_init_builtins): ... init them here. Define as macros. (cpp_read_main_file): Adjust _cpp_find_file call. * pch.c (cpp_read_state): Adjust __has_include{,_next} access. * traditional.c (_cpp_scan_out_locgical_line): Likewise. PR preprocessor/93306 * expr.c (parse_has_include): Refactor. Check skip_eval before looking. 2020-01-10 David Malcolm * include/line-map.h (class diagnostic_path): New forward decl. (rich_location::get_path): New accessor. (rich_location::set_path): New function. (rich_location::m_path): New field. * line-map.c (rich_location::rich_location): Initialize m_path. 2020-01-01 Jakub Jelinek Update copyright years. 2019-12-18 David Malcolm PR preprocessor/92982 * charset.c (cpp_string_location_reader::cpp_string_location_reader): Delete initialization of m_line_table. * include/cpplib.h (cpp_string_location_reader::m_line_table): Delete unused member. 2019-12-14 Jakub Jelinek PR preprocessor/92919 * charset.c (wide_str_to_charconst): If str contains just the NUL terminator, punt quietly. 2019-12-09 David Malcolm * include/line-map.h (label_text::label_text): Make private. (label_text::borrow): New. (label_text::take): New. (label_text::take_or_copy): New. 2019-12-09 Lewis Hyatt PR preprocessor/49973 * generated_cpp_wcwidth.h: New file generated by ../contrib/unicode/gen_wcwidth.py, supports new cpp_wcwidth function. * charset.c (compute_next_display_width): New function to help implement display columns. (cpp_byte_column_to_display_column): Likewise. (cpp_display_column_to_byte_column): Likewise. (cpp_wcwidth): Likewise. * include/cpplib.h (cpp_byte_column_to_display_column): Declare. (cpp_display_column_to_byte_column): Declare. (cpp_wcwidth): Declare. (cpp_display_width): New function. 2019-11-14 Joseph Myers * charset.c (narrow_str_to_charconst): Make CPP_UTF8CHAR constants unsigned for C. * init.c (lang_defaults): Set utf8_char_literals for GNUC2X and STDC2X. 2019-11-07 Jakub Jelinek PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs * charset.c (narrow_str_to_charconst): Add TYPE argument. For CPP_UTF8CHAR diagnose whenever number of chars is > 1, using CPP_DL_ERROR instead of CPP_DL_WARNING. (wide_str_to_charconst): For CPP_CHAR16 or CPP_CHAR32, use CPP_DL_ERROR instead of CPP_DL_WARNING when multiple char16_t or char32_t chars are needed. (cpp_interpret_charconst): Adjust narrow_str_to_charconst caller. 2019-11-05 Tim van Deurzen * cpplib.h: Add spaceship operator for C++. * lex.c: Implement conditional lexing of spaceship operator for C++20. 2019-10-31 Jakub Jelinek PR preprocessor/92296 * internal.h (struct def_pragma_macro): Add is_builtin bitfield. (_cpp_restore_special_builtin): Declare. * init.c (_cpp_restore_special_builtin): New function. * directives.c (do_pragma_push_macro): For NT_BUILTIN_MACRO set is_builtin and don't try to grab definition. (cpp_pop_definition): Use _cpp_restore_special_builtin to restore builtin macros. 2019-10-15 Nathan Sidwell * include/line-map.h (struct maps_info_ordinary): Make cache mutable. (struct maps_info_macro): Likewise. (LINEMAPS_CACHE): Remove non-ref accessor. Constify ref accessor. (LINEMAPS_ORDINARY_CACHE, LINEMAPS_MACRO_CACHE): Likewise. (LINEMAPS_ORDINARY_MAP_AT, LINEMAPS_MACRO_MAP_AT): Use LINEMAPS_USED and LINEMAPS_MAP_AT. (linemap_lookup): Constify line_map arg. linemap.c (linemap_ordinary_map_lookup, linemap_macro_map_lookup): Constify line_map arg. 2019-10-11 Joseph Myers * include/cpplib.h (struct cpp_options): Add dfp_constants and cpp_warn_c11_c2x_compat. (enum cpp_warning_reason): Add CPP_W_C11_C2X_COMPAT. * init.c (struct lang_flags): Add dfp_constants. (lang_defaults): Set dfp_constants to 1 for GNUC2X and STDC2X and 0 for other languages. (cpp_set_lang): Set dfp_constants from language. (cpp_create_reader): Set cpp_warn_c11_c2x_compat to -1. * expr.c (interpret_float_suffix): Mention DFP constants as C2X in comment. (cpp_classify_number): Do not diagnose DFP constants for languages setting dfp_constants, unless cpp_warn_c11_c2x_compat. 2019-10-04 Nathan Sidwell PR preprocessor/91991 * line-map.c (linemap_line_start): Clear max_column_hint if we run out of locations. 2019-10-02 Richard Biener * internal.h (enum include_type): Remove trailing comma. 2019-10-02 Joseph Myers * include/cpplib.h (struct cpp_options): Add member scope. * init.c (struct lang_flags, lang_defaults): Likewise. (cpp_set_lang): Set scope member of pfile. * lex.c (_cpp_lex_direct): Test CPP_OPTION (pfile, scope) not CPP_OPTION (pfile, cplusplus) for creating CPP_SCOPE tokens. 2019-09-26 Eric Botcazou * charset.c (UCS_LIMIT): New macro. (ucn_valid_in_identifier): Use it instead of a hardcoded constant. (_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than UCS_LIMIT outside of identifiers in C and in C++2a or later. 2019-09-19 Lewis Hyatt PR c/67224 * charset.c (_cpp_valid_utf8): New function to help lex UTF-8 tokens. * internal.h (_cpp_valid_utf8): Declare. * lex.c (forms_identifier_p): Use it to recognize UTF-8 identifiers. (_cpp_lex_direct): Handle UTF-8 in identifiers and CPP_OTHER tokens. Do all work in "default" case to avoid slowing down typical code paths. Also handle $ and UCN in the default case for consistency. 2019-08-30 Nathan Sidwell New # semantics for popping to "" name. libcpp/ * directives.c (do_linemarker): Popping to "" name means get the name from the include stack.. 2019-09-05 Nathan Sidwell PR preprocessor/91639 * directives.c (do_include_common): Tell lexer we're a #include. * files.c (_cpp_stack_file): Lexer will have always incremented. * internal.h (struct cpp_context): Extend in_directive's semantics. * lex.c (_cpp_lex_direct): Increment line for final \n when lexing for an ISO #include. * line-map.c (linemap_line_start): Remember if we overflowed. 2019-09-03 Ulrich Weigand * directives.c: Remove references to spu from comments. * expr.c: Likewise. 2019-08-29 Nathan Sidwell * internal.h (enum include_type): Add IT_MAIN, IT_DIRECTIVE_HWM, IT_HEADER_HWM. (_cpp_stack_file): Take include_type, not a bool. * files.c (_cpp_find_file): Refactor to not hide an if inside a for conditional. (should_stack_file): Break apart to ... (is_known_idempotent_file, has_unique_contents): ... these. (_cpp_stack_file): Replace IMPORT boolean with include_type enum. Refactor to use new predicates. Do linemap compensation here ... (_cpp_stack_include): ... not here. * init.c (cpp_read_main_file): Pass IT_MAIN to _cpp_stack_file. 2019-08-28 Nathan Sidwell * directives-only.c (_cpp_preprocess_dir_only): Use false, not zero for _cpp_handle_directive call. * directives.c (_cpp_handle_directive): Indented is bool. * files.c (struct _cpp_file): Make bools 1 bit bitfields. * internal.h (enum include_type): Reformat and comment. (struct cpp_buffer): Make flags 1 bit bitfields. (_cpp_handle_directive): Indented is bool. 2019-07-09 Martin Sebor * include/line-map.h: Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * mkdeps.c: Same. 2019-07-03 Martin Liska * line-map.c (linemap_get_expansion_filename): Remove dead assignemts. * mkdeps.c (make_write): Likewise. 2019-07-02 qing zhao PR preprocessor/90581 * directives.c (do_include_common): Replace CPP_STACK_MAX with CPP_OPTION (pfile, max_include_depth). * include/cpplib.h (struct cpp_options): Add new field max_include_depth. * init.c (cpp_create_reader): Initiate new field max_include_depth. * internal.h: Delete CPP_STACK_MAX. 2019-06-26 Nathan Sidwell PR preprocessor/90927 * mkdeps.c (mkdeps::vec::operator[]): Add non-const variant. (deps_add_target): Deal with out of order unquoted targets. 2019-05-19 Andrew Pinski PR pch/81721 * lex.c (cpp_token_val_index ): If tok->flags has NAMED_OP set, then return CPP_TOKEN_FLD_NODE. 2019-05-14 Martin Liska PR preprocessor/90382 * line-map.c (first_map_in_common_1): Handle ADHOC locations. 2019-05-14 Martin Liska PR preprocessor/90382 * include/line-map.h (get_data_from_adhoc_loc): Add const to the first argument. (get_location_from_adhoc_loc): Likewise. * line-map.c(get_data_from_adhoc_loc): Add const to the first argument. (get_location_from_adhoc_loc): Likewise. (get_combined_adhoc_loc): Use get_location_from_adhoc_loc (or get_data_from_adhoc_loc). (get_range_from_adhoc_loc): Likewise. (get_pure_location): Likewise. (linemap_position_for_loc_and_offset): Likewise. (linemap_lookup): Likewise. (linemap_ordinary_map_lookup): Likewise. (linemap_macro_map_lookup): Likewise. (linemap_get_expansion_line): Likewise. (linemap_get_expansion_filename): Likewise. (linemap_location_in_system_header_p): Likewise. (linemap_location_from_macro_expansion_p): Likewise. (linemap_macro_loc_to_exp_point): Likewise. (linemap_resolve_location): Likewise. (linemap_unwind_toward_expansion): Likewise. (linemap_unwind_to_first_non_reserved_loc): Likewise. (linemap_expand_location): Likewise. (linemap_dump_location): Likewise. 2019-05-07 Nathan Sidwell * files.c (_cpp_stack_file): Empty filenames aren't dependencies. * mkdeps.c (deps_add_dep): Assert not empty. * include/mkdeps.h (deps_write): Add PHONY arg. (deps_phony_targets): Delete. * init.c (cpp_finish): Just call deps_write. * mkdeps.c (struct mkdeps): Add local vector class. Reimplement vector handling. (munge): Munge to static buffer. (apply_vpath): Adjust vector handling. (deps_init, deps_free): Use new, delete. (deps_add_target): Do not munge here. Record quoting low water mark. (deps_add_dep): Do not munge here. (deps_add_vpath): Adjust vector handling. (make_write_name): New. Munge on demand here. (make_write_vec): New. (deps_phony_targets): Delete. (make_write): New. (deps_write): Forward to deps_Write. (deps_save, deps_restore): Adjust vector handling. 2019-05-06 Nathan Sidwell * include/mkdeps.h: Rename struct deps to struct mkdeps. * mkdeps.c: Likewise. * include/cpplib.h (cpp_get_deps): Rename return type.. * directives.c (cpp_get_deps): Likewise. * internal.h (struct cpp_reader): Rename deps field type. 2019-04-03 Jonathan Wakely * files.c (search_path_exhausted): Fix typo in comment. 2019-02-26 Martin Liska * symtab.c (ht_dump_statistics): Make horizontal alignment for statistics. 2019-02-20 David Malcolm PR c/89410 * include/line-map.h (linenum_arith_t): New typedef. (compare): Use it. 2019-02-18 Martin Liska PR c++/89383 * line-map.c (linemap_line_start): Use 1UL in order to not overflow. 2019-02-11 Martin Liska PR lto/88147 * line-map.c (linemap_line_start): Don't reuse the existing line map if the line offset is sufficiently large to cause overflow when computing location_t values. 2019-01-26 Jakub Jelinek PR preprocessor/88974 * directives.c (SEEN_EOL): Move macro to ... * internal.h (SEEN_EOL): ... here. * expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL (). 2019-01-01 Jakub Jelinek Update copyright years. 2018-11-27 Mike Gulick PR preprocessor/83173 * location-example.txt: Update example -fdump-internal-locations output. 2018-11-27 Mike Gulick PR preprocessor/83173 * files.c (_cpp_stack_include): Check if line_table->highest_location is past current line before decrementing. 2018-11-13 David Malcolm * charset.c: Replace "source_location" with "location_t". * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to MAX_LOCATION_T. * include/line-map.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * location-example.txt: Likewise. * macro.c: Likewise. * pch.c: Likewise. * traditional.c: Likewise. 2018-11-07 Hafiz Abid Qadeer * configure: Regenerated. 2018-11-05 Martin Liska * symtab.c (ht_dump_statistics): Replace %zu with %lu format. 2018-11-05 Martin Liska * symtab.c (ht_dump_statistics): Fix format and pass missing argument. 2018-11-05 Martin Liska * symtab.c (ht_dump_statistics): Make dump conditional based on alloc_subobject. 2018-10-31 Joseph Myers PR bootstrap/82856 * configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE. * aclocal.m4, config.in, configure: Regenerate. 2018-10-31 Nathan Sidwell * internal.h (struct cpp_reader): Rename forced_token_location_p to forced_token_location and drop its pointerness. * include/cpplib.h (cpp_force_token_locations): Take location, not pointer to one. * init.c (cpp_create_reader): Adjust. * lex.c (cpp_read_main_file): * directives.c (do_include_common): Commonize cleanup path. (_cpp_pop_buffer): Fix leak. * include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New predicates. (IS_ADHOC_LOC): Move earlier. (MAP_ORDINARY_P): Use IS_ORDINARY_LOC. * line-map.c (linemap_location_from_macro_expansion_p): Use IS_MACRO_LOC. * include/cpplib.h (cpp_macro_definition_location): Make inline. * macro.c (warn_of_redefinition): Fix comments, examine macro type, use C++ for. (cpp_macro_definition_location): Don't define here. * include/cpplib.h (HT_NODE): Don't cast NODE. (NODE_LEN, NODE_NAME): Use HT_NODE. * directives.c (DIRECTIVE_TABLE): Drop historical frequency comments. * files.c (_cpp_stack_file): Fix indentation. 2018-10-17 Joseph Myers * include/cpplib.h (enum c_lang): Add CLK_GNUC2X and CLK_STDC2X. * init.c (lang_defaults): Add GNUC2X and STDC2X entries. (cpp_init_builtins): Define __STDC_VERSION__ to 202000L for C2X. 2018-10-11 David Malcolm * macro.c (_cpp_arguments_ok): If the argument count is wrong, add a note showing the definition of the macro. 2018-10-11 Nathan Sidwell * include/line-map.h (LINEMAPS_MACRO_LOWEST_LOCATION): Fix off-by-one error. * line-map.c (linemap_enter_macro): Use RAII. Clear all of the macro_locations. 2018-10-09 David Malcolm * charset.c (noop_error_cb): Rename to... (noop_diagnostic_cb): ...this, converting params to enums. (cpp_interpret_string_ranges): Update for renaming and enums. * directives.c (check_eol_1): Convert reason to enum. (do_diagnostic): Convert code and reason to enum. (do_error): Use CPP_W_NONE rather than 0. (do_pragma_dependency): Likewise. * errors.c (cpp_diagnostic_at): Convert level and reason to enums. Update for renaming. (cpp_diagnostic): Convert level and reason to enums. (cpp_error): Convert level to enum. (cpp_warning): Convert reason to enums. (cpp_pedwarning): Likewise. (cpp_warning_syshdr): Likewise. (cpp_diagnostic_with_line): Convert level and reason to enums. Update for renaming. (cpp_error_with_line): Convert level to enum. (cpp_warning_with_line): Convert reason to enums. (cpp_pedwarning_with_line): Likewise. (cpp_warning_with_line_syshdr): Likewise. (cpp_error_at): Convert level to enum. (cpp_errno): Likewise. (cpp_errno_filename): Likewise. * include/cpplib.h (enum cpp_diagnostic_level): Name this enum, and move to before struct cpp_callbacks. (enum cpp_warning_reason): Likewise. (cpp_callbacks::diagnostic): Convert params from int to enums. (cpp_error): Convert int param to enum cpp_diagnostic_level. (cpp_warning): Convert int param to enum cpp_warning_reason. (cpp_pedwarning): Likewise. (cpp_warning_syshdr): Likewise. (cpp_errno): Convert int param to enum cpp_diagnostic_level. (cpp_errno_filename): Likewise. (cpp_error_with_line): Likewise. (cpp_warning_with_line): Convert int param to enum cpp_warning_reason. (cpp_pedwarning_with_line): Likewise. (cpp_warning_with_line_syshdr): Likewise. (cpp_error_at): Convert int param to enum cpp_diagnostic_level. * macro.c (create_iso_definition): Convert int to enum. (_cpp_create_definition): Likewise. 2018-09-17 David Malcolm * include/line-map.h (range_label::get_text): Add param "range_idx". 2018-08-30 Nathan Sidwell * include/line-map.h (enum lc_reason): Comment each member separately. (struct line_maps): Fix reallocator comment. 2018-08-27 David Malcolm PR 87091 * include/line-map.h (enum range_display_kind): New enum. (struct location_range): Replace field "m_show_caret_p" with "m_range_display_kind", converting from bool to the new enum. (class rich_location): Add example of line insertion fix-it hint. (rich_location::add_range): Convert param "show_caret_p" from bool to enum range_display_kind and rename to "range_display_kind", giving it a default of SHOW_RANGE_WITHOUT_CARET. (rich_location::set_range): Likewise, albeit without a default. * line-map.c (rich_location::rich_location): Update for conversion of show_caret_p to tri-state enum. (rich_location::add_range): Likewise. (rich_location::set_range): Likewise. 2018-08-24 H.J. Lu PR bootstrap/86872 * line-map.c (pure_location_p): Return true if linemap_lookup returns NULL. (linemap_add): Set start_location to 0 if we run out of line map space. 2018-08-20 Nathan Sidwell * include/cpplib.h: Fixup some whitespace. (cpp_hashnode): Reduce type to 2 bit & flags to 8. * include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete. Renumber others. (enum node_type): Replace NT_MACRO with NT_USER_MACRO, NT_BUILTIN_MACRO, NT_MACRO_ARG. Delete NT_ASSERTION. (NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE): Delete. (CPP_HASHNODE_VALUE_IDX): Delete. (union _cpp_hashnode_value): GTY tag from enum node_type directly. (struct cpp_hashnode): Adjust GTY desc for value field. (cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust. * directives.c (undefine_macros): Clear value.anwers, adjust flag clearing. (_cpp_test_assertion): No need to check NT_ASSERTION. (do_assert, do_unassert): Likewise. * init.c (cpp_init_special_builtins): Set type not flags. * macro.c (struct macro_arg_saved_data): Add type field. (cpp_get_token_1): Check type not NT_VOID. (_cpp_free_definition): Adjust flag clearing. Nullify value.answers. (_cpp_save_parameter, _cpp_unsave_parameters): Save and restore type. (lex_expansion_token): Check type not flags. (_cpp_create_definition): Set type to NT_USER_MACRO. (_cpp_notify_macro_use): Adjust type checking. * pch.c (write_macdef, count_defs, write_defs, cpp_valid_state) (save_macros): Adjust node type/flag handling. * traditional.c (_cpp_scan_out_logical_line): Check type not flags. * directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p. * include/cpplib.h (enum cpp_macro_kind): Remove trailing comma. (cpp_fun_like_macro_p): Make inline, define. * macro.c (cpp_define_lazily): Use UCHAR_MAX. (cpp_fun_like_macro_p): Delete. * Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h. * include/cpp-id-data.h: Delete. * internal.h: Include cpplib.h not cpp-id-data.h. * include/cpp-id-data.h (struct answer): Delete. * include/cpplib.h (struct answer): Don't forward-declare. (enum cpp_macro_kind): Add cmk_assert. (struct cpp_macro): Union parms and next assert chain. (union _cpp_hashnode_value): 'answer' field is cpp_macro. * directives.c (parse_answer): Convert to use cpp_macro. Return true on success. (parse_assertion, find_answer, _cpp_test_assertion, cpp_do_assert) (cpp_do_unassert): Convert to use cpp_macro. * macro.c (warn_of_redefinition, _cpp_new_macro) (check_trad_stringification, cpp_macro_definition): Adjust macro parm access. * traditional.c (_cpp_replacement_text_len) (_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise. 2018-08-17 Nathan Sidwell * include/cpplib.h (struct cpp_callbacks): Replace user_builtin_macro with user_lazy_macro. (struct cpp_macro): add lazy field. (enum cpp_builtin_type): Remove BT_FIRST_USER, BT_LAST_USER. (cpp_define_lazily): Declare. * macro.c (enter_macro_context) Use _cpp_maybe_notify_macro_use. (warn_of_redefinition): Use cpp_builtin_macro_p, directly call user_lazy_macro hook. (_cpp_new_macro): Clear lazy field. (cpp_define_lazily): Define. (_cpp_notify_macro_use): Adjust lazy definition code. (cpp_macro_definition): No need to do lazy definition here. * pch.c (write_macdef, save_macros): Likewise. * include/cpplib.h (enum cpp_macro_kind): New. (struct cpp_macro): Make body trailing array. Add kind field, delete traditional flag. * internal.h (_cpp_new_macro): Declare. (_cpp_reserve_room): New inline. (_cpp_commit_buf): Declare. (_cpp_create_trad_definition): Return new macro. * lex.c (_cpp_commit_buff): New. * macro.c (macro_real_token_count): Count backwards. (replace_args): Pointer equality not orderedness. (_cpp_save_parameter): Use _cpp_reserve_room. (alloc_expansion_token): Delete. (lex_expansion_token): Return macro pointer. Use _cpp_reserve_room. (create_iso_definition): Allocate macro itself. Adjust for different allocation ordering. (_cpp_new_macro): New. (_cpp_create_definition): Adjust for API changes. * traditional.c (push_replacement_text): Don't set traditional flag. (save_replacement_text): Likewise. (_cpp_create_trad_definition): Allocate macro itself, Adjust for different allocation ordering. * cpp-id-data.h (uchar, UC): Move to internal.h (struct cpp_macro): Move to cpplib.h. * internal.h (uchar, UC): From cpp-id-data.h. * include/cpplib.h (struct cpp_macro): From cpp-id-data.h. 2018-08-16 Nathan Sidwell * internal.h (_cpp_save_parameter): Take parmno, not macro. (_cpp_unsave_parameters): Declare. * macro.c (_cpp_save_parameter): Take parm number, not macro. Return true on success. (_cpp_unsave_parameters): New. (parse_params): Take parm_no and variadic pointers, not macro. Reimplement parsing logic. (create_iso_definition): Adjust parse_params changes. Call _cpp_unsave_parameters here. (_cpp_create_definition): Don't unsave params here. * traditional.c (scan_parameters): Take n_param pointer, adjust. (_cpp_create_trad_definition): Ajust scan_parameters change. Call _cpp_unsave_parameters. * include/cpplib.h (cpp_user_macro_p, cpp_builtin_macro_p) (cpp_macro_p): New inlines. * directives.c (do_pragma_poison): Use cpp_macro_p. (do_ifdef, do_ifndef): Likewise. Use _cpp_maybe_notify_macro_use. (cpp_pop_definition): Use cpp_macro_p. Move _cpp_free_definition earlier. Don't zap node directly. * expr.c (parse_defined): Use _cpp_maybe_notify_macro_use & cpp_macro_p. * files.c (should_stack_file): Use cpp_macro_p. * identifiers.c (cpp_defined): Likewise. * internal.h (_cpp_mark_macro): Use cpp_user_macro_p. (_cpp_notify_macro_use): Declare. (_cpp_maybe_notify_macro_use): New inline. * lex.c (is_macro): Use cpp_macro_p. * macro.c (_cpp_warn_if_unused_macro): Use cpp_user_macro_p. (enter_macro_context): Likewise. (_cpp_create_definition): Use cpp_builtin_macro_p, cpp_user_macro_p. Move _cpp_free_definition earlier. (_cpp_notify_macro_use): New, broken out of multiple call sites. * traditional.c (fun_like_macro_p): Use cpp_builtin_macro_p. (maybe_start_funlike, _cpp_scan_out_logical_line) (push_replacement_text): Likewise. 2018-08-15 David Malcolm * include/line-map.h (struct location_range): Add "m_label" field. (class rich_location): Add description of labels to leading comment. (rich_location::rich_location): Add "label" param, defaulting to NULL. (rich_location::add_range): Likewise. (struct label_text): New struct. (class range_label): New abstract base class. * line-map.c (rich_location::rich_location): Add "label" param; use it. (rich_location::add_range): Likewise. 2018-08-08 Nathan Sidwell Make linemap::included_from a location libcpp/ * include/line-map.h (struct line_map_ordinary): Replace included_from map index with included_at source_location. (ORDINARY_MAP_INCLUDER_FILE_INDEX): Delete. (LAST_SOURCE_LINE_LOCATION): Delete. (LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete. (linemap_included_from): New. (linemap_included_from_linemap): Declare. (MAIN_FILE_P): Adjust. * line-map.c (linemap_included_from_linemap): New. (lonemap_check_files_exited): Use linemap_included_at. (linemap_add): Adjust inclusion setting. (linemap_dump, linemap_dump_location): Adjust. * directives.c (do_linemarker): Use linemap_included_at. 2018-08-07 Nathan Sidwell * line-map.c: (linemap_init): Set default allocator here. (new_linemap): Rather than here. Refactor allocation logic. 2018-07-20 David Malcolm * include/line-map.h (rich_location::set_range): Remove redundant line_maps * parameter. * line-map.c (rich_location::set_range): Likewise. 2018-07-18 Bernd Edlinger PR 69558 * macro.c (enter_macro_context): Change the location info for builtin macros and _Pragma from location of the closing parenthesis to location of the macro expansion point. 2018-07-17 Jason Franklin Jakub Jelinek * lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN, CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style comments is reported only once per file and guard those calls on the preceding cpp_error returning true. 2018-07-03 Nathan Sidwell Reorg line_map data structures for better packing. * include/line-map.h (enum lc_reason): Add LC_HWM. (LINE_MAP_MAX_LOCATION): Define here. (struct line_map): Move reason field to line_map_ordinary. Adjust GTY tagging. (struct line_map_ordinary): Reorder fields for less padding. (struct line_map_macro): Likewise. (MAP_ORDINARY_P): New. (linemap_check_ordinary, linemap_check_macro): Adjust. * line-map.c (LINE_MAP_MAX_SOURCE_LOCATION): Delete. (new_linemap): Take start_location, not reason. Adjust. (linemap_add, linemap_enter_macro): Adjust. (linemap_line_start): Likewise. (linemap_macro_expansion_map_p): Use MAP_ORDINARY_P. (linemap_macro_loc_to_spelling_point): Likewise. (linemap_macro_loc_to_def_point): Likewise. (linemap_dump): Likewise. 2018-05-23 Jason Merrill * system.h: #include earlier. 2018-05-17 Jason Merrill * line-map.c (linemap_init): Use placement new. * system.h: #include . 2018-03-14 David Malcolm * include/line-map.h (compare): New function on linenum_type. 2018-02-28 Jonathan Wakely PR preprocessor/84517 * lex.c (is_macro_not_literal_suffix): New function. (lex_raw_string, lex_string): Use is_macro_not_literal_suffix to decide when to issue -Wliteral-suffix warnings. 2018-02-16 Richard Biener PR bootstrap/82939 * line-map.c (linemap_init): Avoid broken value-init when compiling with GCC 4.2. 2018-02-15 Jason Merrill Jakub Jelinek PR preprocessor/83063 - __VA_OPT__ and ## PR preprocessor/83708 * macro.c (vaopt_state): Reorder m_last_was_paste before m_state. (vaopt_state::vaopt_state): Adjust. (vaopt_state::update_flags): Add BEGIN and END. (vaopt_state::update): Return them. (copy_paste_flag): Factor out of replace_args. (last_token_is): New. (replace_args): Handle BEGIN and END. Avoid padding there. (tokens_buff_last_token_ptr): Return NULL if no tokens. 2018-01-31 Jakub Jelinek PR preprocessor/69869 * traditional.c (skip_macro_block_comment): Return bool, true if the macro block comment is unterminated. (copy_comment): Use return value from skip_macro_block_comment instead of always false. 2018-01-27 Jakub Jelinek * include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from BT_FIRST_USER + 31 to BT_FIRST_USER + 63. 2018-01-18 Boris Kolpackov PR other/70268 * include/cpplib.h (cpp_callbacks::remap_filename): New callback. * macro.c (_cpp_builtin_macro_text): Call remap_filename for __FILE__ and __BASE_FILE__. 2018-01-10 Kelvin Nilsen * lex.c (search_line_fast): Remove illegal coercion of an unaligned pointer value to vector pointer type and replace with use of __builtin_vec_vsx_ld () built-in function, which operates on unaligned pointer values. 2018-01-03 Jakub Jelinek Update copyright years. 2017-12-20 Michael Weiser PR preprocessor/83492 * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]: Fix selection of big-endian shift parameters by using __ARM_BIG_ENDIAN. 2017-12-14 Bernd Edlinger * internal.h (maybe_print_line): Change signature. 2017-12-05 Jakub Jelinek PR c++/79228 * expr.c (interpret_float_suffix): Avoid memcmp. (interpret_int_suffix): Likewise. Don't check for if. 2017-12-01 Jason Merrill PR c++/79228 - extensions hide C++14 complex literal operators * expr.c (interpret_float_suffix): Ignore 'i' in C++14 and up. (interpret_int_suffix): Likewise. 2017-11-28 David Malcolm PR c/82050 * include/line-map.h (LINE_MAP_MAX_COLUMN_NUMBER): Move here. * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): ...from here. (rich_location::maybe_add_fixit): Reject fix-it hints in which the start column exceeds the next column. 2017-11-20 Eric Gallager PR preprocessor/81794 * macro.c (check_trad_stringification): Have warning be controlled by -Wtraditional. 2017-11-20 David Malcolm PR c++/72786 * include/cpplib.h (cpp_macro_definition_location): New decl. * macro.c (cpp_macro_definition): New function. 2017-11-13 Tom Tromey * pch.c (cpp_read_state): Set n__VA_OPT__. * macro.c (vaopt_state): New class. (_cpp_arguments_ok): Check va_opt flag. (replace_args, create_iso_definition): Use vaopt_state. * lex.c (lex_identifier_intern): Possibly issue errors for __VA_OPT__. (lex_identifier): Likewise. (maybe_va_opt_error): New function. * internal.h (struct lexer_state) : Update comment. (struct spec_nodes) : New field. * init.c (struct lang_flags) : New field. (lang_defaults): Add entries for C++2A. Update all entries for va_opt. (cpp_set_lang): Initialize va_opt. * include/cpplib.h (struct cpp_options) : New field. * identifiers.c (_cpp_init_hashtable): Initialize n__VA_OPT__. 2017-11-13 David Malcolm * include/line-map.h (linenum_type): Move this typedef and the comment describing column numbering to near the top of the file. 2017-11-06 Mukesh Kapoor PR c++/80955 * lex.c (lex_string): When checking for a valid macro for the warning related to -Wliteral-suffix (CPP_W_LITERAL_SUFFIX), check that the macro name does not start with an underscore before calling is_macro(). 2017-11-05 Tom de Vries PR other/82784 * lex.c (BUF_APPEND): Remove semicolon after "do {} while (0)". 2017-10-31 David Malcolm * directives.c (_cpp_handle_directive): Update for renaming of cpp_error_at_richloc to cpp_error_at. * errors.c (cpp_diagnostic_at_richloc): Rename to... (cpp_diagnostic_at): ...this, dropping the location_t-based implementation. (cpp_diagnostic): Update for removal of location_t-based cpp_diagnostic_at. (cpp_error_at): Likewise. (cpp_error_at_richloc): Rename to... (cpp_error_at): ...this, and update for renaming of cpp_diagnostic_at_richloc. * include/cpplib.h (cpp_error_at_richloc): Rename to... (cpp_error_at): ...this. 2017-10-30 Joseph Myers * include/cpplib.h (enum c_lang): Add CLK_GNUC17 and CLK_STDC17. * init.c (lang_defaults): Add GNUC17 and STDC17 data. (cpp_init_builtins): Handle C17 value of __STDC_VERSION__. 2017-10-10 Nathan Sidwell PR preprocessor/82506 * macro.c (cpp_quote_string): Escape raw LFs. 2017-09-15 Andrew Sutton Jakub Jelinek Add support for -std=c++2a. * include/cpplib.h (c_lang): Add CXX2A and GNUCXX2A. * init.c (lang_defaults): Add rows for CXX2A and GNUCXX2A. (cpp_init_builtins): Set __cplusplus to 201709L for C++2a. 2017-09-15 Jakub Jelinek * include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z to CLK_GNUCXX17 and CLK_CXX1Z to CLK_CXX17. * init.c (lang_defaults, cpp_init_builtins): Likewise. * expr.c (cpp_classify_number): Use C++17 instead of C++1z in diagnostics. 2017-07-07 David Malcolm PR c++/79300 * line-map.c (linemap_macro_loc_to_def_point): Preserve range information for macro expansions by delaying resolving ad-hoc locations until within the loop. 2017-07-06 David Malcolm PR c++/79300 * include/line-map.h (enum location_aspect): New enum. (linemap_client_expand_location_to_spelling_point): Add enum location_aspect param. * line-map.c (rich_location::get_expanded_location): Update for new param of linemap_client_expand_location_to_spelling_point. (rich_location::maybe_add_fixit): Likewise. (fixit_hint::affects_line_p): Likewise. 2017-06-21 Jakub Jelinek * line-map.c (location_adhoc_data_update): Perform addition in uintptr_t type rather than char * type. Read *data using ptrdiff_t type instead of int64_t. (get_combined_adhoc_loc): Change offset type to ptrdiff_t from int64_t. 2017-06-20 David Malcolm * include/line-map.h (class rich_location): Document that attempts to delete or replace a range *affecting* multiple lines will fail. * line-map.c (rich_location::maybe_add_fixit): Implement this restriction. 2017-06-09 David Malcolm * include/line-map.h (rich_location::fixits_cannot_be_auto_applied): New method. (rich_location::fixits_can_be_auto_applied_p): New accessor. (rich_location::m_fixits_cannot_be_auto_applied): New field. * line-map.c (rich_location::rich_location): Initialize new field. 2017-06-05 David Malcolm * include/cpplib.h (struct cpp_callbacks): Add "comment" callback. * lex.c (_cpp_lex_direct): Call the comment callback if non-NULL. 2017-05-02 David Malcolm * include/line-map.h (class rich_location): Update description of newline handling. (class fixit_hint): Likewise. (fixit_hint::ends_with_newline_p): New decl. * line-map.c (rich_location::maybe_add_fixit): Support newlines in fix-it hints that are insertions of single lines at the start of a line. Don't consolidate into such fix-it hints. (fixit_hint::ends_with_newline_p): New method. 2017-05-01 David Malcolm * include/line-map.h (source_range::intersects_line_p): Delete. (rich_location::add_fixit): Delete. (rich_location::maybe_add_fixit): New method. (class fixit_hint): Reimplement in terms of... (class fixit_replace): ...this. (class fixit_insert): Delete. * line-map.c (linemap_position_for_loc_and_offset): Drop overzealous linemap_assert_fails. (source_range::intersects_line_p): Rename to... (fixit_hint::affects_line_p): New function. (rich_location::add_fixit_insert_before): Reimplement in terms of maybe_add_fixit, moving validation there. (rich_location::add_fixit_insert_after): Likewise. (column_before_p): Delete. (rich_location::add_fixit_replace): Reimplement in terms of maybe_add_fixit, moving validation there. Convert closed input range to half-open range. (rich_location::add_fixit): Delete. (rich_location::maybe_add_fixit): New function. (fixit_insert::fixit_insert): Delete. (fixit_insert::~fixit_insert): Delete. (fixit_insert::affects_line_p): Delete. (fixit_insert::maybe_append_replace): Delete. (fixit_replace::fixit_replace): Rename to... (fixit_hint::fixit_hint): ...this, rewriting as necessary. (fixit_replace::~fixit_replace): Delete. (fixit_replace::affects_line_p): Delete. (fixit_replace::maybe_append_replace): Rename to... (fixit_hint::maybe_append): ...this, rewriting as necessary. 2017-04-03 Jonathan Wakely * include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment. * lex.c (search_line_fast): Likewise. * pch.h (cpp_valid_state): Likewise. 2017-03-21 Andreas Schwab * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]: Convert 64-bit value to boolean before passing to __builtin_expect. 2017-03-16 Jason Merrill * init.c (cpp_init_builtins): Update __cplusplus for C++17. 2017-02-09 Gerald Pfeifer * Makefile.in (po/$(PACKAGE).pot): Adjust bug reporting URL. 2017-01-10 David Malcolm PR c++/77949 * line-map.c (linemap_position_for_column): When calling linemap_start_line, detect if a new linemap was created with 0 column bits, and bail out early if this is the case. (linemap_position_for_loc_and_offset): Replace overzealous linemap_assert_fails with a simple conditional; use correct bit count. 2017-01-07 David Malcolm PR c++/72803 * line-map.c (linemap_line_start): When determining if the highest column given out so far will fit into a proposed change to the current map, use the effective number of column bits, rather than the total number of column + range bits. 2017-01-01 Jakub Jelinek Update copyright years. 2016-12-15 David Malcolm PR preprocessor/78680 PR preprocessor/78811 * lex.c (_cpp_lex_direct): Only determine the end-location of the token and build a range for non-reserved start locations. Do not do it for EOF tokens. 2016-12-12 David Malcolm PR preprocessor/78680 * lex.c (_cpp_lex_direct): Ensure line notes are processed before computing the end-point of the token. 2016-11-23 Paolo Bonzini * include/cpplib.h (struct cpp_options): Add new member warn_expansion_to_defined. (CPP_W_EXPANSION_TO_DEFINED): New enum member. * expr.c (parse_defined): Warn for all uses of "defined" in macros, and tie warning to CPP_W_EXPANSION_TO_DEFINED. Make it a pedwarning instead of a warning. * system.h (HAVE_DESIGNATED_INITIALIZERS): Do not use "defined" in macros. 2016-11-17 David Malcolm * charset.c (cpp_interpret_string_1): Skip locations from loc_reader when advancing 'p' when handling raw strings. 2016-11-16 Jakub Jelinek PR bootstrap/72823 * configure.ac (ENABLE_ASSERT_CHECKING): Define if gcc configure would define that macro. * configure: Regenerated. * config.in: Regenerated. 2016-11-08 Richard Earnshaw * lex.c (search_line_fast): New implementation for AArch64. 2016-10-25 David Malcolm * files.c (destroy_cpp_file): Free file->path. 2016-10-25 David Malcolm * include/line-map.h (line_maps::~line_maps): New dtor. (location_adhoc_data_fini): Delete decl. * line-map.c (line_maps::~line_maps): New dtor. (location_adhoc_data_fini): Delete. 2016-10-21 Andris Pavenis PR preprocessor/71681 * files.c (remap_filename): Fix handling -remap in subdirectories. 2016-10-12 Jakub Jelinek * include/cpplib.h (struct cpp_options): Add cpp_warn_implicit_fallthrough. * init.c (cpp_create_reader): Initialize it to 0. * lex.c (fallthrough_comment_p): Handle different cpp_warn_implicit_fallthrough levels. Whitespace fixes. 2016-10-08 Jakub Jelinek * lex.c (fallthrough_comment_p): Accept Else, fallthrough. * lex.c (fallthrough_comment_p): Extend to handle more common FALLTHRU comment styles. * lex.c (fallthrough_comment_p): Fix off-by-one size comparison errors, cleanup. (_cpp_lex_direct): Allow arbitrary comments in between fallthrough_comment_p comment and following token. 2016-10-04 Kelvin Nilsen PR target/77847 * lex.c (search_line_fast): Add a FALLTHROUGH comment to correct compiler error in the version of this function that is conditionally compiled when GCC_VERSION >= 4005 and both __ALTIVEC__ and __BIG_ENDIAN__ symbols are defined. 2016-09-26 Marek Polacek Jakub Jelinek PR c/7652 * include/cpplib.h (PREV_FALLTHROUGH): Define. * internal.h (CPP_FALLTHRU): Define. * lex.c (fallthrough_comment_p): New function. (_cpp_lex_direct): Set PREV_FALLTHROUGH on tokens succeeding a falls through comment. 2016-09-23 David Malcolm PR preprocessor/77672 * charset.c (cpp_interpret_string_1): Add a source_range for the NUL-terminator, using the location of the trailing quote of the final string. 2016-09-21 Jason Merrill * line-map.c (linemap_location_from_macro_definition_p): New. * line-map.h: Declare it. 2016-09-15 David Malcolm * include/line-map.h (class rich_location): Note that newlines aren't supported in fix-it text. * line-map.c (rich_location::add_fixit_insert_before): Reject attempts to add fix-its containing newlines. (rich_location::add_fixit_replace): Likewise. 2016-09-13 David Malcolm * include/line-map.h (class rich_location): Add description of fix-it hints to leading comment. (rich_location::add_fixit_insert): Rename both overloaded methods to.. (rich_location::add_fixit_insert_before): ...this, updating their comments. (rich_location::add_fixit_insert_after): Two new overloaded methods. (rich_location::stop_supporting_fixits): New method. * line-map.c (rich_location::add_fixit_insert): Rename both overloaded methods to.. (rich_location::add_fixit_insert_before): ...this, updating their comments. (rich_location::add_fixit_insert_after): Two new methods. (rich_location::reject_impossible_fixit): Split out failure-handling into... (rich_location::stop_supporting_fixits): New method. 2016-09-02 David Malcolm * include/line-map.h (rich_location::seen_impossible_fixit_p): New accessor. 2016-08-31 David Malcolm * include/line-map.h (class fixit_remove): Remove stray decl. (fixit_hint::affects_line_p): Make const. (fixit_insert::affects_line_p): Likewise. (fixit_replace::affects_line_p): Likewise. * line-map.c (fixit_insert::affects_line_p): Likewise. (fixit_replace::affects_line_p): Likewise. 2016-08-30 David Malcolm * include/line-map.h (class semi_embedded_vec): New class. (semi_embedded_vec::semi_embedded_vec): New ctor. (semi_embedded_vec::~semi_embedded_vec): New dtor. (semi_embedded_vec::operator[]): New methods. (semi_embedded_vec::push): New method. (semi_embedded_vec::truncate): New method. (rich_location::get_num_locations): Reimplement in terms of m_ranges. (rich_location::get_range): Make non-inline. (rich_location::get_num_fixit_hints): Reimplement in terms of m_fixit_hints. (rich_location::add_fixit): New function. (rich_location::MAX_RANGES): Rename to... (rich_location::STATICALLY_ALLOCATED_RANGES): ...this. (rich_location::MAX_FIXIT_HINTS): Rename to... (rich_location::STATICALLY_ALLOCATED_RANGES): ...this, and make private. (rich_location::m_num_ranges): Eliminate in favor of... (rich_location::m_ranges): ...this, converting from a fixed-size array to a semi_embedded_vec. (rich_location::m_num_fixit_hints): Eliminate in favor of... (rich_location::m_fixit_hints): ...this, converting from a fixed-size array to a semi_embedded_vec. * line-map.c (rich_location::rich_location): Update for above changes. (rich_location::~rich_location): Likewise. (rich_location::get_loc): Likewise. (rich_location::get_range): New methods. (rich_location::add_range): Update for above changes. (rich_location::set_range): Likewise. (rich_location::add_fixit_insert): Likewise. (rich_location::add_fixit_replace): Likewise. (rich_location::get_last_fixit_hint): Likewise. (rich_location::reject_impossible_fixit): Likewise. (rich_location::add_fixit): New method. 2016-08-30 David Malcolm * include/line-map.h (rich_location::add_fixit_insert): Add comments. Add overload omitting the source_location param. (rich_location::add_fixit_remove): Add comments. Add overloads omitting the range, and accepting a source_location. (rich_location::add_fixit_replace): Likewise. * line-map.c (rich_location::add_fixit_insert): Add comments. Add overload omitting the source_location param. (rich_location::add_fixit_remove): Add comments. Add overloads omitting the range, and accepting a source_location. (rich_location::add_fixit_replace): Likewise. 2016-08-26 David Malcolm * include/line-map.h (get_pure_location): New decl. * line-map.c (get_pure_location): Move here, from gcc/input.c, adding a line_maps * param. (rich_location::add_fixit_insert): Call get_pure_location on "where". (rich_location::add_fixit_replace): Call get_pure_location on the end-points. 2016-08-26 David Malcolm * include/line-map.h (rich_location): Eliminate unimplemented constructor based on source_range. (rich_location::get_last_fixit_hint): New method. (rich_location::reject_impossible_fixit): New method. (rich_location): Add fields m_line_table and m_seen_impossible_fixit. (fixit_hint::maybe_append_replace): New pure virtual function. (fixit_insert::maybe_append_replace): New function. (fixit_replace::maybe_append_replace): New function. * line-map.c (rich_location::rich_location): Initialize m_line_table and m_seen_impossible_fixit. (rich_location::add_fixit_insert): Call reject_impossible_fixit and bail out if true. (column_before_p): New function. (rich_location::add_fixit_replace): Call reject_impossible_fixit and bail out if true. Attempt to consolidate with neighboring fixits. (rich_location::get_last_fixit_hint): New method. (rich_location::reject_impossible_fixit): New method. (fixit_insert::maybe_append_replace): New method. (fixit_replace::maybe_append_replace): New method. 2016-08-23 David Malcolm * include/line-map.h (source_range::from_locations): New method. 2016-08-19 David Malcolm * include/line-map.h (fixit_hint::kind): Delete REPLACE. (class fixit_remove): Delete. * line-map.c (rich_location::add_fixit_remove): Reimplement by calling add_fixit_replace with an empty string. (fixit_remove::fixit_remove): Delete. (fixit_remove::affects_line_p): Delete. 2016-08-19 Joseph Myers PR c/32187 * include/cpplib.h (CPP_N_FLOATN, CPP_N_FLOATNX) (CPP_N_WIDTH_FLOATN_NX, CPP_FLOATN_SHIFT, CPP_FLOATN_MAX): New macros. * expr.c (interpret_float_suffix): Handle fN, fNx, FN and FNx suffixes. 2016-08-19 Prathamesh Kulkarni * expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic. 2016-08-18 David Malcolm * directives.c (directive_names): New array. (_cpp_handle_directive): Offer spelling suggestions for misspelled directives. * errors.c (cpp_diagnostic_at_richloc): New function. (cpp_error_at_richloc): New function. * include/cpplib.h (struct cpp_callbacks): Add field "get_suggestion". (cpp_error_at_richloc): New decl. 2016-08-18 Marek Polacek PR c/7652 * pch.c (write_macdef): Add CPP_FALLTHRU. 2016-08-12 Marek Polacek PR c/7652 * lex.c (search_line_fast): Add FALLTHRU. (_cpp_lex_direct): Likewise. (cpp_token_val_index): Adjust fall through comment. * macro.c (parse_params): Add FALLTHRU. * pch.c (count_defs): Adjust fall through comment. (write_defs): Likewise. 2016-08-06 David Malcolm PR bootstrap/72823 * charset.c (_cpp_valid_ucn): Replace overzealous assert with one that allows for char_range to be non-NULL when loc_reader is NULL. 2016-08-05 David Malcolm * charset.c (cpp_substring_ranges::cpp_substring_ranges): New constructor. (cpp_substring_ranges::~cpp_substring_ranges): New destructor. (cpp_substring_ranges::add_range): New method. (cpp_substring_ranges::add_n_ranges): New method. (_cpp_valid_ucn): Add "char_range" and "loc_reader" params; if they are non-NULL, read position information from *loc_reader and update char_range->m_finish accordingly. (convert_ucn): Add "char_range", "loc_reader", and "ranges" params. If loc_reader is non-NULL, read location information from it, and update *ranges accordingly, using char_range. Conditionalize the conversion into tbuf on tbuf being non-NULL. (convert_hex): Likewise, conditionalizing the call to emit_numeric_escape on tbuf. (convert_oct): Likewise. (convert_escape): Add params "loc_reader" and "ranges". If loc_reader is non-NULL, read location information from it, and update *ranges accordingly. Conditionalize the conversion into tbuf on tbuf being non-NULL. (cpp_interpret_string): Rename to... (cpp_interpret_string_1): ...this, adding params "loc_readers" and "out". Use "to" to conditionalize the initialization and usage of "tbuf", such as running the converter. If "loc_readers" is non-NULL, use the instances within it, reading location information from them, and passing them to convert_escape; likewise write to "out" if loc_readers is non-NULL. Check for leading quote and issue an error if it is not present. Update boundary check from "== limit" to ">= limit" to protect against erroneous location values to calls that are not parsing string literals. (cpp_interpret_string): Reimplement in terms to cpp_interpret_string_1. (noop_error_cb): New function. (cpp_interpret_string_ranges): New function. (cpp_string_location_reader::cpp_string_location_reader): New constructor. (cpp_string_location_reader::get_next): New method. * include/cpplib.h (class cpp_string_location_reader): New class. (class cpp_substring_ranges): New class. (cpp_interpret_string_ranges): New prototype. * internal.h (_cpp_valid_ucn): Add params "char_range" and "loc_reader". * lex.c (forms_identifier_p): Pass NULL for new params to _cpp_valid_ucn. 2016-08-01 Andreas Schwab * include/cpplib.h: Fix comment typo. 2016-07-27 David Malcolm * include/line-map.h (source_location): Fix line numbers in comment. 2016-07-11 David Malcolm * include/line-map.h (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): Move here from line-map.c. (LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise. * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): Move from here to line-map.h. (LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise. 2016-06-22 David Malcolm * directives.c (do_include_common): Pass on "location" to _cpp_stack_include. * errors.c (cpp_diagnostic): Reimplement in terms of... (cpp_diagnostic_at): New function. (cpp_error_at): New function. (cpp_errno_filename): Add "loc" param and use it by using cpp_error_at rather than cpp_error. * files.c (find_file_in_dir): Add "loc" param and pass it to open_file_failed. (_cpp_find_file): Add "loc" param. Use it to convert calls to cpp_error to cpp_error_at, and pass it to find_file_in_dir and open_file_failed. (read_file_guts): Add "loc" param. Use it to convert calls to cpp_error to cpp_error_at. Pass it to cpp_errno_filename. (read_file): Add "loc" param. Pass it to open_file_failed and read_file_guts. (should_stack_file): Add "loc" param. Pass it to read_file. (_cpp_stack_file): Add "loc" param. Pass it to should_stack_file. (_cpp_stack_include): Add "loc" param. Pass it to _cpp_find_file and _cpp_stack_file. (open_file_failed): Add "loc" param. Pass it to cpp_errno_filename. (_cpp_fake_include): Add 0 as a source_location in call to _cpp_find_file. (_cpp_compare_file_date): Likewise. (cpp_push_include): Likewise for call to _cpp_stack_include. (cpp_push_default_include): Likewise. (_cpp_save_file_entries): Likewise for call to open_file_failed. (_cpp_has_header): Likewise for call to _cpp_find_file. * include/cpplib.h (cpp_errno_filename): Add source_location param. (cpp_error_at): New declaration. * init.c (cpp_read_main_file): Add 0 as a source_location in calls to _cpp_find_file and _cpp_stack_file. * internal.h (_cpp_find_file): Add source_location param. (_cpp_stack_file): Likewise. (_cpp_stack_include): Likewise. 2016-06-22 David Malcolm * include/line-map.h (fixit_hint::get_start_loc): New pure virtual function. (fixit_hint::maybe_get_end_loc): Likewise. (fixit_insert::get_start_loc): New function, implementing fixit_hint::get_start_loc. (fixit_insert::maybe_get_end_loc): New function, implementing fixit_hint::maybe_get_end_loc. (fixit_remove::get_start_loc): New function, implementing fixit_hint::get_start_loc. (fixit_remove::maybe_get_end_loc): New function, implementing fixit_hint::maybe_get_end_loc. (fixit_replace::get_start_loc): New function, implementing fixit_hint::get_start_loc. (fixit_replace::maybe_get_end_loc): New function, implementing fixit_hint::maybe_get_end_loc. 2016-06-21 John David Anglin * line-map.c (location_adhoc_data_update): Use int64_t instead of long long. (get_combined_adhoc_loc): Likewise. 2016-06-01 Eduard Sanou * include/cpplib.h (cpp_callbacks): Add get_source_date_epoch callback. * include/cpplib.h (cpp_init_source_date_epoch): Remove prototype. * init.c (cpp_init_source_date_epoch): Remove function. * init.c (cpp_create_reader): Initialize pfile->source_date_epoch. * internal.h (cpp_reader): Extend comment about source_date_epoch. * macro.c (_cpp_builtin_macro_text): Use get_source_date_epoch callback only once, read pfile->source_date_epoch on future passes. Check that get_source_date_epoch callback is not NULL. 2016-05-20 Martin Liska * config.in: Regenerated. * configure: Likewise. * configure.ac: Handle --enable-valgrind-annotations. * lex.c (new_buff): Use ENABLE_VALGRIND_ANNOTATIONS instead of ENABLE_VALGRIND_CHECKING. (_cpp_free_buff): Likewise. 2016-04-28 Eduard Sanou Matthias Klose * include/cpplib.h (cpp_init_source_date_epoch): Prototype. * init.c (cpp_init_source_date_epoch): New function. * internal.h: Added source_date_epoch variable to struct cpp_reader to store a reproducible date. * macro.c (_cpp_builtin_macro_text): Set pfile->date timestamp from pfile->source_date_epoch instead of localtime if source_date_epoch is set, to be used for __DATE__ and __TIME__ macros to help reproducible builds. 2016-04-13 Bernd Schmidt Patch from Roger Orr PR preprocessor/69650 * directives.c (do_linemarker): Reread map after calling cpp_get_token. 2016-04-06 Richard Henderson PR preprocessor/61817 PR preprocessor/69391 * internal.h (_cpp_builtin_macro_text): Update decl. * macro.c (_cpp_builtin_macro_text): Accept location for __LINE__. (builtin_macro): Accept a second location for __LINE__. (enter_macro_context): Compute both virtual and real expansion locations for the macro. 2016-03-25 Bernd Schmidt PR lto/69650 * directives.c (do_linemarker): Test for file left but not entered here. * line-map.c (linemap_add): Not here. 2016-03-21 Jakub Jelinek PR target/70296 * include/cpplib.h (cpp_fun_like_macro_p): New prototype. * macro.c (cpp_fun_like_macro_p): New function. 2016-03-15 Richard Henderson * line-map.c (new_linemap): Make alloc_size a size_t. 2016-03-14 Jason Merrill * expr.c (cpp_classify_number): Hex floats are new in C++1z. * init.c (lang_defaults): Likewise. 2016-03-09 David Malcolm PR c/68473 PR c++/70105 * line-map.c (linemap_macro_map_loc_unwind_toward_spelling): Move decl... * include/line-map.h (linemap_macro_map_loc_unwind_toward_spelling): ...here, converting from static to extern. 2016-03-09 David Malcolm PR c/68473 PR c++/70105 * include/line-map.h (source_range::debug): Delete. (struct location_range): Update comment. Replace expanded_location fields "m_start", "m_finish", and "m_caret" with a source_location field: "m_loc". (class rich_location): Reword comment. (rich_location::get_loc): Reimplement in terms of a new overloaded variant which takes an unsigned int. (rich_location::get_loc_addr): Delete. (rich_location::add_range): Drop params "start" and "finish" in favor of param "loc". Drop overloaded variants taking a source_range or location_range *. (rich_location::lazily_expand_location): Delete in favor of... (rich_location::get_expanded_location): New decl. (rich_location::m_loc): Delete field. (rich_location::m_column_override): New field. * line-map.c (rich_location::rich_location): Drop name of line_maps * param. Update initializations for deletion of field "m_loc" and addition of field "m_column_override". Reimplement body as a call to add_range. Delete overloaded variant taking a source_range. (rich_location::get_loc): New function. (rich_location::lazily_expand_location): Delete in favor of... (rich_location::get_expanded_location): New function. (rich_location::override_column): Reimplement. (rich_location::add_range): Drop params "start" and "finish" in favor of param "loc". Eliminate location expansion in favor of simply storing loc. Drop overloaded variants taking a source_range or location_range *. (rich_location::set_range): Eliminate location expansion. 2016-02-29 David Malcolm PR preprocessor/69985 (linemap_position_for_loc_and_offset): Rename param from "offset" to "column_offset". Right-shift the column_offset by m_range_bits of the pertinent ordinary map whenever offsetting a source_location. For clarity, offset the column by the column offset, rather than the other way around. 2016-02-23 David Malcolm PR preprocessor/69126 PR preprocessor/69543 * line-map.c (linemap_compare_locations): At the function top, replace inlined bodies of get_location_from_adhoc_loc with calls to get_location_from_adhoc_loc. Add a pair of calls to get_location_from_adhoc_loc at the bottom of the function, to avoid meaningless comparisons of ad-hoc and non-ad-hoc locations. 2016-02-08 David Malcolm PR preprocessor/69664 * errors.c (cpp_diagnostic_with_line): Only call rich_location::override_column if the column is non-zero. * line-map.c (rich_location::override_column): Update columns within m_ranges[0]. Add assertions to verify that doing so is sane. 2016-02-05 Jakub Jelinek PR c++/69628 * charset.c (cpp_interpret_charconst): Clear *PCHARS_SEEN and *UNSIGNEDP if bailing out early due to errors. 2016-01-28 Jakub Jelinek PR pch/68176 * files.c (_cpp_find_file): Set file->implicit_preinclude even if included from file->implicit_preinclude header. * directives.c (destringize_and_run): Adjust prototype. 2016-01-27 David Malcolm PR preprocessor/69126 * directives.c (destringize_and_run): Add expansion_loc param; use it when handling unexpanded pragmas to fixup the locations of the synthesized tokens. (_cpp_do__Pragma): Add expansion_loc param and use it when calling destringize_and_run. * internal.h (_cpp_do__Pragma): Add expansion_loc param. * macro.c (builtin_macro): Pass expansion location of _Pragma to _cpp_do__Pragma. 2016-01-14 David Malcolm PR preprocessor/69177 * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): New constant. (LINE_MAP_MAX_LOCATION_WITH_COLS): Add note about unit tests to comment. (can_be_stored_compactly_p): Reduce threshold from LINE_MAP_MAX_LOCATION_WITH_COLS to LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES. (get_combined_adhoc_loc): Likewise. (get_range_from_loc): Likewise. (linemap_line_start): Ensure that a new ordinary map is created when transitioning from range-packing being enabled to disabled, at the LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES threshold. Set range_bits to 0 for new ordinary maps when beyond this limit. Prevent the "increase the column bits of a freshly created map" optimization if the range bits has reduced. 2016-01-08 Jakub Jelinek PR c++/69145 * files.c (cpp_included_before): If IS_ADHOC_LOC (location), lookup real location from the line_table. 2016-01-04 Jakub Jelinek Update copyright years. 2015-12-22 David Malcolm * line-map.c (get_combined_adhoc_loc): Remove condition on locus < RESERVED_LOCATION_COUNT when considering whether a caret == start == finish location can be simply stored as the caret location. 2015-12-07 David Malcolm * include/line-map.h (rich_location::set_range): Add line_maps * param; convert param from source_range to source_location. Drop "overwrite_loc_p" param. * line-map.c (rich_location::set_range): Likewise, acting as if "overwrite_loc_p" were true, and getting range from the location. 2015-11-20 David Malcolm PR 62314 * include/line-map.h (source_range::intersects_line_p): New method. (rich_location::~rich_location): New. (rich_location::add_fixit_insert): New method. (rich_location::add_fixit_remove): New method. (rich_location::add_fixit_replace): New method. (rich_location::get_num_fixit_hints): New accessor. (rich_location::get_fixit_hint): New accessor. (rich_location::MAX_FIXIT_HINTS): New constant. (rich_location::m_num_fixit_hints): New field. (rich_location::m_fixit_hints): New field. (class fixit_hint): New class. (class fixit_insert): New class. (class fixit_remove): New class. (class fixit_replace): New class. * line-map.c (source_range::intersects_line_p): New method. (rich_location::rich_location): Add initialization of m_num_fixit_hints to both ctors. (rich_location::~rich_location): New. (rich_location::add_fixit_insert): New method. (rich_location::add_fixit_remove): New method. (rich_location::add_fixit_replace): New method. (fixit_insert::fixit_insert): New. (fixit_insert::~fixit_insert): New. (fixit_insert::affects_line_p): New. (fixit_remove::fixit_remove): New. (fixit_remove::affects_line_p): New. (fixit_replace::fixit_replace): New. (fixit_replace::~fixit_replace): New. (fixit_replace::affects_line_p): New. 2015-11-19 Jakub Jelinek PR preprocessor/60736 * include/cpplib.h (cpp_errno_filename): New prototype. * errors.c (cpp_errno): Don't handle msgid "" specially, use _(msgid) instead of msgid as argument to cpp_error. (cpp_errno_filename): New function. * files.c (read_file_guts): Use cpp_errno_filename instead of cpp_errno. (open_file_failed): Likewise. Use file->name if file->path is NULL in diagnostics. 2015-11-13 David Malcolm * errors.c (cpp_diagnostic): Pass pfile->line_table to rich_location ctor. (cpp_diagnostic_with_line): Likewise. * include/cpplib.h (struct cpp_token): Update comment for src_loc to indicate that the range of the token is "baked into" the source_location. * include/line-map.h (source_location): Update the descriptive comment to reflect the packing scheme for short ranges, adding worked examples of location encoding. (struct line_map_ordinary): Drop field "column_bits" in favor of field "m_column_and_range_bits"; add field "m_range_bits". (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete. (location_adhoc_data): Add source_range field. (struct line_maps): Add fields "default_range_bits", "num_optimized_ranges" and "num_unoptimized_ranges". (get_combined_adhoc_loc): Add source_range param. (get_range_from_loc): New declaration. (pure_location_p): New prototype. (COMBINE_LOCATION_DATA): Add source_range param. (SOURCE_LINE): Update for renaming of column_bits. (SOURCE_COLUMN): Likewise. Shift the column right by the map's range_bits. (LAST_SOURCE_LINE_LOCATION): Update for renaming of column_bits. (linemap_position_for_line_and_column): Add line_maps * params. (rich_location::rich_location): Likewise. * lex.c (_cpp_lex_direct): Capture the range of the token, baking it into token->src_loc via a call to COMBINE_LOCATION_DATA. * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): Reduce from 1U << 17 to 1U << 12. (location_adhoc_data_hash): Add the src_range into the hash value. (location_adhoc_data_eq): Require equality of the src_range values. (can_be_stored_compactly_p): New function. (get_combined_adhoc_loc): Add src_range param, and store it, via a bit-packing scheme for short ranges, otherwise within the lookaside table. Remove the requirement that data is non-NULL. (get_range_from_adhoc_loc): New function. (get_range_from_loc): New function. (pure_location_p): New function. (linemap_add): Ensure that start_location has zero for the range_bits, unless we're past LINE_MAP_MAX_LOCATION_WITH_COLS. Initialize range_bits to zero. Assert that the start_location is "pure". (linemap_line_start): Assert that the column_and_range_bits >= range_bits. Update determinination of whether we need to start a new map using the effective column bits, without the range bits. Use the set's default_range_bits in new maps, apart from those with column_bits == 0, which should also have 0 range_bits. Increase the column bits for new maps by the range bits. When adding lines to an existing map, use set->highest_line directly rather than offsetting highest by SOURCE_COLUMN. Add assertions to sanity-check the return value. (linemap_position_for_column): Offset to_column by range_bits. Update set->highest_location if necessary. (linemap_position_for_line_and_column): Add line_maps * param. Update the calculation to offset the column by range_bits, and conditionalize it on being <= LINE_MAP_MAX_LOCATION_WITH_COLS. Bound it by LINEMAPS_MACRO_LOWEST_LOCATION. Update set->highest_location if necessary. (linemap_position_for_loc_and_offset): Handle ad-hoc locations; pass "set" to linemap_position_for_line_and_column. (linemap_macro_map_loc_unwind_toward_spelling): Add line_maps param. Handle ad-hoc locations. (linemap_location_in_system_header_p): Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_macro_loc_to_spelling_point): Retain ad-hoc locations. Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_resolve_location): Retain ad-hoc locations. Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_unwind_toward_expansion): Pass on "set" to call to linemap_macro_map_loc_unwind_toward_spelling. (linemap_expand_location): Extract the data pointer before extracting the location. (rich_location::rich_location): Add line_maps param; use it to extract the range from the source_location. * location-example.txt: Regenerate, showing new representation. 2015-11-06 David Malcolm * errors.c (cpp_diagnostic): Update for change in signature of "error" callback. (cpp_diagnostic_with_line): Likewise, calling override_column on the rich_location. * include/cpplib.h (struct cpp_callbacks): Within "error" callback, convert param from source_location to rich_location *, and drop column_override param. * include/line-map.h (struct source_range): New struct. (struct location_range): New struct. (class rich_location): New class. (linemap_client_expand_location_to_spelling_point): New declaration. * line-map.c (rich_location::rich_location): New ctors. (rich_location::lazily_expand_location): New method. (rich_location::override_column): New method. (rich_location::add_range): New methods. (rich_location::set_range): New method. 2015-11-06 David Malcolm * include/line-map.h (struct linemap_stats): Add fields "adhoc_table_size" and "adhoc_table_entries_used". * line-map.c (linemap_get_statistics): Populate above fields. 2015-11-04 Mikhail Maltsev * config.in: Regenerate. * configure: Regenerate. * configure.ac: Remove ENABLE_CHECKING. 2015-11-03 Uros Bizjak * lex.c (search_line_sse42): Correctly advance the pointer to an aligned address. 2015-11-02 David Malcolm * include/line-map.h (source_location): In the table in the descriptive comment, show UNKNOWN_LOCATION, BUILTINS_LOCATION, LINE_MAP_MAX_LOCATION_WITH_COLS, LINE_MAP_MAX_SOURCE_LOCATION. Add notes about ad-hoc values. 2015-10-21 Mikhail Maltsev * include/line-map.h: Use CHECKING_P instead of ENABLE_CHECKING. * init.c: Likewise. * macro.c (struct macro_arg_token_iter, set_arg_token, macro_arg_token_iter_init, macro_arg_token_iter_forward, macro_arg_token_iter_get_token, macro_arg_token_iter_get_location, alloc_expanded_arg_mem, _cpp_backup_tokens): Likewise. * config.in: Regenerate. * configure: Regenerate. * configure.ac (CHECKING_P): Define. * system.h (fancy_abort): Declare. (abort): Define. (gcc_assert): Define. Use CHECKING_P. 2015-10-13 Mikhail Maltsev * system.h (CHECKING_P, gcc_checking_assert): Define. 2015-09-21 Manuel López-Ibáñez PR c/66415 * line-map.c (linemap_position_for_loc_and_offset): Handle the case of long lines encoded in multiple maps. 2015-09-07 Marek Polacek * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning. 2015-08-06 Yaakov Selkowitz * configure: Regenerate. 2015-07-08 Thomas Schwinge * include/line-map.h (RESERVED_LOCATION_COUNT): Change type to source_location. 2015-07-02 Paolo Carlini PR preprocessor/53690 * charset.c (_cpp_valid_ucn): Add cppchar_t * parameter and change return type to bool. Fix encoding of \u0000 and \U00000000 in C++. (convert_ucn): Adjust call. * lex.c (forms_identifier_p): Likewise. * internal.h (_cpp_valid_ucn): Adjust declaration. 2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net> Implement N4197 - Adding u8 character literals * include/cpplib.h (UTF8CHAR, UTF8CHAR_USERDEF): New cpp tokens; (struct cpp_options): Add utf8_char_literals. * init.c (struct lang_flags): Add utf8_char_literals; (struct lang_flags lang_defaults): Add column for utf8_char_literals. * macro.c (stringify_arg()): Treat CPP_UTF8CHAR token; * expr.c (cpp_userdef_char_remove_type(), cpp_userdef_char_add_type()): Treat CPP_UTF8CHAR_USERDEF, CPP_UTF8CHAR tokens; (cpp_userdef_char_p()): Treat CPP_UTF8CHAR_USERDEF token; (eval_token(), _cpp_parse_expr()): Treat CPP_UTF8CHAR token. * lex.c (lex_string(), _cpp_lex_direct()): Include CPP_UTF8CHAR tokens. * charset.c (converter_for_type(), cpp_interpret_charconst()): Treat CPP_UTF8CHAR token. 2015-06-30 Uros Bizjak * lex.c (search_line_sse42) [__GCC_ASM_FLAG_OUTPUTS__]: New main loop using asm flag outputs. 2015-06-08 Marek Polacek PR c/66415 * line-map.c (linemap_position_for_loc_and_offset): Remove linemap_assert_fails; reverse conditions. 2015-05-26 Manuel López-Ibáñez * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER LINE_MAP_MAX_LOCATION_WITH_COLS,LINE_MAP_MAX_SOURCE_LOCATION): New constants. (linemap_line_start): Use them. (linemap_position_for_column): Use them. 2015-05-20 David Malcolm * include/line-map.h (MAP_START_LOCATION): Eliminate the non-const variant, and tweak comment for the const variant. (ORDINARY_MAP_STARTING_LINE_NUMBER): Drop the non-const variant. (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise. (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise. (SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete. (ORDINARY_MAP_FILE_NAME): Drop the non-const variant. (MACRO_MAP_MACRO): Likewise. (MACRO_MAP_NUM_MACRO_TOKENS): Likewise. (MACRO_MAP_LOCATIONS): Likewise. (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise. * line-map.c (linemap_add): Replace writes through macros with direct field accesses. (linemap_enter_macro): Likewise. (linemap_line_start): Likewise. 2015-05-19 David Malcolm * directives.c (do_line): Strengthen local "map" from const line_map * to const line_map_ordinary *. (do_linemarker): Likewise. (_cpp_do_file_change): Assert that we're not dealing with a macro map. Introduce local "ord_map" via a call to linemap_check_ordinary, guarded within the check for non-NULL. Use it for typesafety. * files.c (cpp_make_system_header): Strengthen local "map" from const line_map * to const line_map_ordinary *. * include/cpplib.h (struct cpp_callbacks): Likewise for second parameter of "file_change" callback. * include/line-map.h (struct line_map): Convert from a struct containing a union to a base class. (struct line_map_ordinary): Convert to a subclass of line_map. (struct line_map_macro): Likewise. (linemap_check_ordinary): Strengthen return type from line_map * to line_map_ordinary *, and add a const-variant. (linemap_check_macro): New pair of functions. (ORDINARY_MAP_STARTING_LINE_NUMBER): Strengthen param from const line_map * to const line_map_ordinary *, eliminating call to linemap_check_ordinary. Likewise for the non-const variant. (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise. (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise. (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Likewise. (ORDINARY_MAP_FILE_NAME): Likewise. (MACRO_MAP_MACRO): Strengthen param from const line_map * to const line_map_macro *. Likewise for the non-const variant. (MACRO_MAP_NUM_MACRO_TOKENS): Likewise. (MACRO_MAP_LOCATIONS): Likewise. (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise. (struct maps_info): Replace with... (struct maps_info_ordinary):...this and... (struct maps_info_macro): ...this. (struct line_maps): Convert fields "info_ordinary" and "info_macro" to the above new structs. (LINEMAPS_MAP_INFO): Delete both functions. (LINEMAPS_MAPS): Likewise. (LINEMAPS_ALLOCATED): Rewrite both variants to avoid using LINEMAPS_MAP_INFO. (LINEMAPS_USED): Likewise. (LINEMAPS_CACHE): Likewise. (LINEMAPS_MAP_AT): Likewise. (LINEMAPS_ORDINARY_MAPS): Strengthen return type from line_map * to line_map_ordinary *. (LINEMAPS_ORDINARY_MAP_AT): Likewise. (LINEMAPS_LAST_ORDINARY_MAP): Likewise. (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise. (LINEMAPS_MACRO_MAPS): Strengthen return type from line_map * to line_map_macro *. (LINEMAPS_MACRO_MAP_AT): Likewise. (LINEMAPS_LAST_MACRO_MAP): Likewise. (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise. (linemap_map_get_macro_name): Strengthen param from const line_map * to const line_map_macro *. (SOURCE_LINE): Strengthen first param from const line_map * to const line_map_ordinary *, removing call to linemap_check_ordinary. (SOURCE_COLUMN): Likewise. (LAST_SOURCE_LINE_LOCATION): Likewise. (LAST_SOURCE_LINE): Strengthen first param from const line_map * to const line_map_ordinary *. (LAST_SOURCE_COLUMN): Likewise. (INCLUDED_FROM): Strengthen return type from line_map * to line_map_ordinary *., and second param from const line_map * to const line_map_ordinary *, removing call to linemap_check_ordinary. (MAIN_FILE_P): Strengthen param from const line_map * to const line_map_ordinary *, removing call to linemap_check_ordinary. (linemap_position_for_line_and_column): Strengthen param from const line_map * to const line_map_ordinary *. (LINEMAP_FILE): Strengthen param from const line_map * to const line_map_ordinary *, removing call to linemap_check_ordinary. (LINEMAP_LINE): Likewise. (LINEMAP_SYSP): Likewise. (linemap_resolve_location): Strengthen final param from const line_map ** to const line_map_ordinary **. * internal.h (CPP_INCREMENT_LINE): Likewise for local "map". (linemap_enter_macro): Strengthen return type from const line_map * to const line_map_macro *. (linemap_add_macro_token): Likewise for first param. * line-map.c (linemap_check_files_exited): Strengthen local "map" from const line_map * to const line_map_ordinary *. (new_linemap): Introduce local "map_size" and use it when calculating how large the buffer should be. Rewrite based on change of info_macro and info_ordinary into distinct types. (linemap_add): Strengthen locals "map" and "from" from line_map * to line_map_ordinary *. (linemap_enter_macro): Strengthen return type from const line_map * to const line_map_macro *, and local "map" from line_map * to line_map_macro *. (linemap_add_macro_token): Strengthen param "map" from const line_map * to const line_map_macro *. (linemap_line_start): Strengthen local "map" from line_map * to line_map_ordinary *. (linemap_position_for_column): Likewise. (linemap_position_for_line_and_column): Strengthen first param from const line_map * to const line_map_ordinary *. (linemap_position_for_loc_and_offset): Strengthen local "map" from const line_map * to const line_map_ordinary *. (linemap_ordinary_map_lookup): Likewise for return type and locals "cached" and "result". (linemap_macro_map_lookup): Strengthen return type and locals "cached" and "result" from const line_map * to const line_map_macro *. (linemap_macro_map_loc_to_exp_point): Likewise for param "map". (linemap_macro_map_loc_to_def_point): Likewise. (linemap_macro_map_loc_unwind_toward_spelling): Likewise. (linemap_get_expansion_line): Strengthen local "map" from const line_map * to const line_map_ordinary *. (linemap_get_expansion_filename): Likewise. (linemap_map_get_macro_name): Strengthen param from const line_map * to const line_map_macro *. (linemap_location_in_system_header_p): Add call to linemap_check_ordinary in region guarded by !linemap_macro_expansion_map_p. Introduce local "macro_map" via linemap_check_macro in other region, using it in place of "map" for typesafety. (first_map_in_common_1): Add calls to linemap_check_macro. (trace_include): Strengthen param "map" from const line_map * to const line_map_ordinary *. (linemap_macro_loc_to_spelling_point): Strengthen final param from const line_map ** to const line_map_ordinary **. Replace a C-style cast with a const_cast, and add calls to linemap_check_macro and linemap_check_ordinary. (linemap_macro_loc_to_def_point): Likewise. (linemap_macro_loc_to_exp_point): Likewise. (linemap_resolve_location): Strengthen final param from const line_map ** to const line_map_ordinary **. (linemap_unwind_toward_expansion): Introduce local "macro_map" via a checked cast and use it in place of *map. (linemap_unwind_to_first_non_reserved_loc): Strengthen local "map1" from const line_map * to const line_map_ordinary *. (linemap_expand_location): Introduce local "ord_map" via a checked cast and use it in place of map. (linemap_dump): Make local "map" const. Strengthen local "includer_map" from line_map * to const line_map_ordinary *. Introduce locals "ord_map" and "macro_map" via checked casts and use them in place of "map" for typesafety. (linemap_dump_location): Strengthen local "map" from const line_map * to const line_map_ordinary *. (linemap_get_file_highest_location): Update for elimination of union. (linemap_get_statistics): Strengthen local "cur_map" from line_map * to const line_map_macro *. Update uses of sizeof to use the appropriate line_map subclasses. * macro.c (_cpp_warn_if_unused_macro): Add call to linemap_check_ordinary. (builtin_macro): Strengthen local "map" from const line_map * to const line_map_macro *. (enter_macro_context): Likewise. (replace_args): Likewise. (tokens_buff_put_token_to): Likewise for param "map". (tokens_buff_add_token): Likewise. 2015-05-13 David Malcolm * include/line-map.h (source_location): Add a reference to location-example.txt to the descriptive comment. * location-example.txt: New file. 2015-05-13 David Malcolm * include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro to a const source_location. (RESERVED_LOCATION_COUNT): Likewise. (linemap_check_ordinary): Convert from a macro to a pair of inline functions, for const/non-const arguments. (MAP_START_LOCATION): Likewise. (ORDINARY_MAP_STARTING_LINE_NUMBER): Likewise. (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise. (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise. (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Convert from a macro to a pair of inline functions, for const/non-const arguments, where the latter is named... (SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): New function. (ORDINARY_MAP_FILE_NAME): Convert from a macro to a pair of inline functions, for const/non-const arguments. (MACRO_MAP_MACRO): Likewise. (MACRO_MAP_NUM_MACRO_TOKENS): Likewise. (MACRO_MAP_LOCATIONS): Likewise. (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise. (LINEMAPS_MAP_INFO): Likewise. (LINEMAPS_MAPS): Likewise. (LINEMAPS_ALLOCATED): Likewise. (LINEMAPS_USED): Likewise. (LINEMAPS_CACHE): Likewise. (LINEMAPS_ORDINARY_CACHE): Likewise. (LINEMAPS_MACRO_CACHE): Likewise. (LINEMAPS_MAP_AT): Convert from a macro to an inline function. (LINEMAPS_LAST_MAP): Likewise. (LINEMAPS_LAST_ALLOCATED_MAP): Likewise. (LINEMAPS_ORDINARY_MAPS): Likewise. (LINEMAPS_ORDINARY_MAP_AT): Likewise. (LINEMAPS_ORDINARY_ALLOCATED): Likewise. (LINEMAPS_ORDINARY_USED): Likewise. (LINEMAPS_LAST_ORDINARY_MAP): Likewise. (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise. (LINEMAPS_MACRO_MAPS): Likewise. (LINEMAPS_MACRO_MAP_AT): Likewise. (LINEMAPS_MACRO_ALLOCATED): Likewise. (LINEMAPS_MACRO_USED): Likewise. (LINEMAPS_MACRO_LOWEST_LOCATION): Likewise. (LINEMAPS_LAST_MACRO_MAP): Likewise. (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise. (IS_ADHOC_LOC): Likewise. (COMBINE_LOCATION_DATA): Likewise. (SOURCE_LINE): Likewise. (SOURCE_COLUMN): Likewise. (LAST_SOURCE_LINE_LOCATION): Likewise. (LAST_SOURCE_LINE): Likewise. (LAST_SOURCE_COLUMN): Likewise. (LAST_SOURCE_LINE_LOCATION) (INCLUDED_FROM): Likewise. (MAIN_FILE_P): Likewise. (LINEMAP_FILE): Likewise. (LINEMAP_LINE): Likewise. (LINEMAP_SYSP): Likewise. (linemap_location_before_p): Likewise. * line-map.c (linemap_check_files_exited): Make local "map" const. (linemap_add): Use SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS. (linemap_line_start): Likewise. 2015-05-13 Michael Haubenwallner * aclocal.m4: Regenerated with automake-1.11.6. 2015-05-13 David Malcolm * include/line-map.h (linemap_assert): Move up within the file to before all of the map accessor macros. (linemap_assert_fails): Likewise. (linemap_check_ordinary): Likewise. (linemap_macro_expansion_map_p): Likewise. 2015-05-12 David Malcolm * directives.c (do_line): Set seen_line_directive on line_table. (do_linemarker): Likewise. * include/line-map.h (struct line_maps): Add new field "seen_line_directive". 2015-05-08 Jason Merrill * include/cpplib.h: Add CPP_W_CXX11_COMPAT. (struct cpp_options): Add cpp_warn_cxx11_compat. * init.c (cpp_create_reader): Initialize it. * lex.c (lex_string): Add -Wc++11-compat warning. 2015-05-05 David Malcolm * pch.c (cpp_valid_state): Fix indentation so that it reflects the block structure. 2015-05-05 David Malcolm * include/line-map.h: Fix comment at the top of the file. (source_location): Rewrite and expand the comment for this typedef, adding an ascii-art table to clarify how source_location values are allocated. * line-map.c: Fix comment at the top of the file. 2015-04-09 Richard Biener PR pch/65550 * files.c (pch_open_file): Allow main and pre-included files when trying to open a PCH. 2015-04-06 Jakub Jelinek PR preprocessor/61977 * lex.c (cpp_peek_token): If peektok is CPP_EOF, back it up with all tokens peeked by the current function. 2015-04-02 Jakub Jelinek PR preprocessor/61977 * lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change. 2015-03-23 Jakub Jelinek PR preprocessor/65238 * internal.h (_cpp_scan_out_logical_line): Add third argument. * directives.c (prepare_directive_trad): Pass false to it. * traditional.c (_cpp_read_logical_line_trad, _cpp_create_trad_definition): Likewise. (struct fun_macro): Add paramc field. (fun_like_macro): New function. (maybe_start_funlike): Handle NODE_BUILTIN macros. Initialize macro->paramc field. (save_argument): Use macro->paramc instead of macro->node->value.macro->paramc. (push_replacement_text): Formatting fix. (recursive_macro): Use fun_like_macro helper. (_cpp_scan_out_logical_line): Likewise. Add BUILTIN_MACRO_ARG argument. Initialize fmacro.paramc field. Handle builtin function-like macros. 2015-03-16 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/64626 * lex.c (lex_number): If a number ends with digit-seps (') skip back and let lex_string take them. 2015-03-02 Markus Trippelsdorf PR target/65261 * lex.c (search_line_fast): Silence ubsan errors. 2015-02-03 PR preprocessor/64803 * internal.h (cpp_reader::top_most_macro_node): New data member. * macro.c (enter_macro_context): Pass the location of the end of the top-most invocation of the function-like macro, or the location of the expansion point of the top-most object-like macro. (cpp_get_token_1): Store the top-most macro node in the new pfile->top_most_macro_node data member. (_cpp_pop_context): Clear the new cpp_reader::top_most_macro_node data member. 2015-01-30 Szabolcs Nagy * lex.c (search_line_fast): Change __ARM_NEON__ to __ARM_NEON. 2015-01-23 Marek Polacek DR#412 PR preprocessor/60570 * directives.c (do_elif): Don't evaluate #elif conditionals when they don't need to be. 2015-01-16 Jakub Jelinek * expr.c (cpp_classify_number): Add N_() around ?: string literals used in cpp_error_with_line call as format string. 2015-01-05 Jakub Jelinek Update copyright years. 2014-12-19 Jakub Jelinek PR preprocessor/63831 * directives.c (lex_macro_node): Remove __has_attribute__ handling. * internal.h (struct spec_node): Remove n__has_attribute__ field. (struct lexer_state): Remove in__has_attribute__ field. * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_ATTRIBUTE. * identifiers.c (_cpp_init_hashtable): Remove __has_attribute__ handling. * init.c (builtin_array): Add __has_attribute and __has_cpp_attribute. (cpp_init_special_builtins): Don't initialize __has_attribute or __has_cpp_attribute if CLK_ASM or pfile->cb.has_attribute is NULL. * traditional.c (enum ls): Remove ls_has_attribute, ls_has_attribute_close. (_cpp_scan_out_logical_line): Remove __has_attribute__ handling. * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_ATTRIBUTE. * pch.c (cpp_read_state): Remove __has_attribute__ handling. * expr.c (eval_token): Likewise. (parse_has_attribute): Removed. 2014-12-11 Uros Bizjak * directives.c (cpp_define_formatted): Use xvasprintf. 2014-12-05 Manuel López-Ibáñez * line-map.c (linemap_position_for_loc_and_offset): Add new linemap_assert_fails. 2014-12-02 Manuel López-Ibáñez * include/line-map.h (linemap_assert_fails): Declare. * line-map.c (linemap_position_for_loc_and_offset): Use it. 2014-12-02 Manuel López-Ibáñez * line-map.c (linemap_add): Fix typo. (linemap_line_start): Fix whitespace. 2014-11-29 John Schmerge PR preprocessor/41698 * charset.c (one_utf8_to_utf16): Do not produce surrogate pairs for 0xffff. 2014-11-25 Jakub Jelinek PR preprocessor/60436 * line-map.c (linemap_line_start): If highest is above 0x60000000 and we are still tracking columns or highest is above 0x70000000, force add_map. 2014-11-20 Uros Bizjak PR target/63966 * lex.c [__i386__ || __x86_64__]: Compile special SSE functions only for (__GNUC__ >= 5 || !defined(__PIC__)). 2014-11-13 Manuel López-Ibáñez * include/line-map.h: Include EXPR, so that unused variable warnings do not occur. 2014-11-11 Manuel López-Ibáñez PR fortran/44054 * include/line-map.h (linemap_position_for_loc_and_offset): Declare. * line-map.c (linemap_position_for_loc_and_offset): New. 2014-11-11 David Malcolm * ChangeLog.jit: New. 2014-11-10 Edward Smith-Rowland <3dw4rd@verizon.net> * include/cpplib.h (cpp_callbacks): Add has_attribute. * internal.h (lexer_state): Add in__has_attribute__. * directives.c (lex_macro_node): Prevent use of __has_attribute__ as a macro. * expr.c (parse_has_attribute): New function; (eval_token): Look for __has_attribute__ and route to parse_has_attribute. * identifiers.c (_cpp_init_hashtable): Initialize n__has_attribute__. * pch.c (cpp_read_state): Initialize n__has_attribute__. * traditional.c (enum ls): Add ls_has_attribute, ls_has_attribute_close; (_cpp_scan_out_logical_line): Attend to __has_attribute__. 2014-11-06 Joseph Myers * include/cpp-id-data.h (struct cpp_macro): Update comment regarding parameters. * include/cpplib.h (struct cpp_macro_arg, struct cpp_identifier): Add spelling fields. (struct cpp_token): Update comment on macro_arg. * internal.h (_cpp_save_parameter): Add extra argument. (_cpp_spell_ident_ucns): New declaration. * lex.c (lex_identifier): Add SPELLING argument. Set *SPELLING to original spelling of identifier. (_cpp_lex_direct): Update calls to lex_identifier. (_cpp_spell_ident_ucns): New function, factored out of cpp_spell_token. (cpp_spell_token): Adjust FORSTRING argument semantics to return original spelling of identifiers. Use _cpp_spell_ident_ucns in !FORSTRING case. (_cpp_equiv_tokens): Check spellings of identifiers and macro arguments are identical. * macro.c (macro_arg_saved_data): New structure. (paste_tokens): Use original spellings of identifiers from cpp_spell_token. (_cpp_save_parameter): Add argument SPELLING. Save both canonical node and its value. (parse_params): Update calls to _cpp_save_parameter. (lex_expansion_token): Save spelling of macro argument tokens. (_cpp_create_definition): Extract canonical node from saved data. (cpp_macro_definition): Use UCNs in spelling of macro name. Use original spellings of macro argument tokens and identifiers. * traditional.c (scan_parameters): Update call to _cpp_save_parameter. 2014-11-05 Joseph Myers PR preprocessor/9449 * init.c (lang_defaults): Enable extended identifiers for C++ and C99-based standards. 2014-10-22 Alan Modra * symtab.c (ht_create): Use obstack_specify_allocation in place of _obstack_begin. * files.c (_cpp_init_files): Likewise. * init.c (cpp_create_reader): Likewise. * identifiers.c (_cpp_init_hashtable): Likewise. 2014-10-14 Manuel López-Ibáñez * include/line-map.h (linemap_location_from_macro_expansion_p): const struct line_maps * argument. (linemap_position_for_line_and_column): const struct line_map * argument. * line-map.c (linemap_add_macro_token): Use correct argument name in comment. (linemap_position_for_line_and_column): const struct line_map * argument. (linemap_macro_map_loc_to_def_point): Fix comment. Make static. (linemap_location_from_macro_expansion_p): const struct line_maps * argument. (linemap_resolve_location): Fix argument names in comment. 2014-10-03 Bill Schmidt * lex.c (search_line_fast): Add new version to be used for Power8 and later targets when Altivec is enabled. Restrict the existing Altivec version to big-endian systems so that lvsr is not used on little endian, where it is deprecated. Remove LE-specific code from the now-BE-only version. 2014-10-02 Bernd Edlinger Jeff Law * charset.c (convert_no_conversion): Reallocate memory with 25% headroom. 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net> Implement SD-6: SG10 Feature Test Recommendations * internal.h (lexer_state, spec_nodes): Add in__has_include__. * directives.c: Support __has_include__ builtin. * expr.c (parse_has_include): New function to parse __has_include__ builtin; (eval_token()): Use it. * files.c (_cpp_has_header()): New funtion to look for header; (open_file_failed()): Not an error to not find a header file for __has_include__. * identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__. * pch.c (cpp_read_state): Lookup __has_include__. * traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through __has_include__ statements. 2014-09-30 Bernd Edlinger PR preprocessor/58893 * errors.c (cpp_diagnostic): Fix possible out of bounds access. * files.c (_cpp_stack_include): Initialize src_loc for IT_CMDLINE. 2014-09-24 Marek Polacek PR c/61405 PR c/53874 * include/cpplib.h (enum cpp_ttype): Define CPP_KEYWORD. 2014-09-17 Jan Hubicka * charset.c (conversion): Rename to ... (cpp_conversion): ... this one; update. * files.c (file_hash_entry): Rename to ... (cpp_file_hash_entry): ... this one ; update. 2014-09-17 Marek Polacek PR c/61854 * init.c (struct lang_flags): Remove cplusplus_comments. (cpp_set_lang): Likewise. (post_options): Likewise. * lex.c (_cpp_lex_direct): Disallow C++ style comments in C90/C94. 2014-09-09 Manuel López-Ibáñez * include/cpplib.h (struct cpp_options): Declare warn_normalize as int instead of enum. 2014-09-04 Manuel López-Ibáñez * macro.c (replace_args): Use cpp_pedwarning, cpp_warning and CPP_W flags. * include/cpplib.h: Add CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC. * init.c (cpp_create_reader): Do not init to -1 here. * expr.c (num_binary_op): Use cpp_pedwarning. 2014-08-29 Manuel López-Ibáñez * directives.c (check_eol_1): New. (check_eol_endif_labels): New. (check_eol): Call check_eol_1. (do_else,do_endif): Call check_eol_endif_labels. 2014-08-29 Manuel López-Ibáñez * macro.c (warn_of_redefinition): Suppress warnings for builtins that lack the NODE_WARN flag, unless Wbuiltin-macro-redefined. (_cpp_create_definition): Use Wbuiltin-macro-redefined for builtins that lack the NODE_WARN flag. * directives.c (do_undef): Likewise. * init.c (cpp_init_special_builtins): Do not change flags depending on Wbuiltin-macro-redefined. 2014-08-28 Edward Smith-Rowland <3dw4rd@verizon.net> PR cpp/23827 - standard C++ should not have hex float preprocessor tokens * libcpp/init.c (lang_flags): Change CXX98 flag for extended numbers from 1 to 0. * libcpp/expr.c (cpp_classify_number): Weite error message for improper use of hex floating literal. 2014-08-23 Edward Smith-Rowland <3dw4rd@verizon.net> * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z; Rename CLK_GNUCXX1Y, CLK_CXX1Y to CLK_GNUCXX14, CLK_CXX14; * init.c (struct lang_flags lang_defaults): Add column for trigraphs; Add rows for CLK_GNUCXX1Z, CLK_CXX1Z; (cpp_set_lang): Set trigraphs; (cpp_init_builtins): Set __cplusplus to 201402L for C++14; Set __cplusplus to 201500L for C++17. * expr.c (cpp_classify_number): Change C++1y to C++14 in binary constants error message. 2014-08-20 Marek Polacek * include/cpplib.h (cpp_options): Use signed char. * lex.c (_cpp_lex_direct): Don't warn in C++ mode. 2014-08-19 Marek Polacek * lex.c (_cpp_lex_direct): Fix a typo. 2014-08-19 Marek Polacek * charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat. * lex.c (_cpp_lex_direct): Likewise. * macro.c (replace_args): Likewise. (parse_params): Likewise. * include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat to char. 2014-08-10 Marek Polacek PR c/51849 * lex.c (_cpp_lex_direct): Warn when -Wc90-c99-compat is in effect. * charset.c (_cpp_valid_ucn): Likewise. * include/cpplib.h (cpp_options): Add cpp_warn_c90_c99_compat. * macro.c (replace_args): Warn when -Wc90-c99-compat is in effect. (parse_params): Likewise. 2014-07-27 Marek Polacek PR c/61861 * macro.c (builtin_macro): Add location parameter. Set location of builtin macro to the expansion point. (enter_macro_context): Pass location to builtin_macro. 2014-07-16 Dodji Seketeli Support location tracking for built-in macro tokens * include/line-map.h (line_maps::builtin_location): New data member. (line_map_init): Add a new parameter to initialize the new line_maps::builtin_location data member. * line-map.c (linemap_init): Initialize the line_maps::builtin_location data member. * macro.c (builtin_macro): Create a macro map and track the token resulting from the expansion of a built-in macro. 2014-07-10 Edward Smith-Rowland <3dw4rd@verizon.net> Jonathan Wakely PR preprocessor/61389 * macro.c (_cpp_arguments_ok, parse_params, create_iso_definition): Warning messages mention C++11 in c++ mode and C99 in c mode. * lex.c (lex_identifier_intern, lex_identifier): Ditto 2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped by preprocessor * lex.c (lex_raw_string ()): Do not warn about invalid suffix if skipping. (lex_string ()): Ditto. 2014-06-04 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/61038 * macro.c (stringify_arg (cpp_reader *, macro_arg *)): Combine user-defined escape logic with the other string and char logic. 2014-05-26 Richard Biener * configure.ac: Remove long long and __int64 type checks, add check for uint64_t and fail if that wasn't found. * include/cpplib.h (cpp_num_part): Use uint64_t. * config.in: Regenerate. * configure: Likewise. 2014-05-21 Marek Polacek PR c/61212 * files.c (find_file_in_dir): Add parens around &&. 2014-05-20 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/61038 * macro.c (stringify_arg (cpp_reader *, macro_arg *)): Check for user-defined literal strings and user-defined literal chars to escape necessary characters. 2014-05-20 Richard Biener * configure.ac: Copy gcc logic of detecting a 64bit type. Remove HOST_WIDE_INT define. * include/cpplib.h: typedef cpp_num_part to a 64bit type, similar to how hwint.h does it. * config.in: Regenerate. * configure: Likewise. 2014-05-09 Joey Ye * files.c (find_file_in_dir): Always try to shorten for DOS non-system headers. * init.c (ENABLE_CANONICAL_SYSTEM_HEADERS): Default enabled for DOS. 2014-05-07 Richard Biener * configure.ac: Always set need_64bit_hwint to yes. * configure: Regenerated. 2014-04-22 Rainer Orth * lex.c: Remove Solaris 9 reference. 2014-02-24 Walter Lee * configure.ac: Change "tilepro" triplet to "tilepro*". * configure: Regenerate. 2014-02-19 Jakub Jelinek PR preprocessor/58844 * macro.c (enter_macro_context): Only push macro_real_token_count (macro) tokens rather than macro->count tokens, regardless of CPP_OPTION (pfile, track-macro-expansion). 2014-02-07 Jakub Jelinek PR preprocessor/56824 * line-map.c (get_combined_adhoc_loc, linemap_get_expansion_line, linemap_get_expansion_filename, linemap_location_in_system_header_p, linemap_location_from_macro_expansion_p, linemap_macro_loc_to_spelling_point, linemap_macro_loc_to_def_point, linemap_macro_loc_to_exp_point, linemap_expand_location): Fix formatting. (linemap_compare_locations): Look through adhoc locations for both l0 and l1. 2014-01-23 Dodji Seketeli PR PR preprocessor/58580 * include/line-map.h (linemap_get_file_highest_location): Declare new function. * line-map.c (linemap_get_file_highest_location): Define it. 2014-01-02 Richard Sandiford Update copyright years 2013-12-09 Joseph Myers PR preprocessor/55715 * expr.c (num_binary_op): Implement subtraction directly rather than with negation and falling through into addition case. 2013-11-18 Bill Schmidt * lex.c (search_line_fast): Correct for little endian. 2013-11-15 Joseph Myers * ucnid.tab: Add C11 and C11NOSTART data. * makeucnid.c (digit): Rename enum value to N99. (C11, N11, all_languages): New enum values. (NUM_CODE_POINTS, MAX_CODE_POINT): New macros. (flags, decomp, combining_value): Use NUM_CODE_POINTS as array size. (decomp): Use unsigned int as element type. (all_decomp): New array. (read_ucnid): Handle C11 and C11NOSTART. Use MAX_CODE_POINT. (read_table): Use MAX_CODE_POINT. Store all decompositions in all_decomp. (read_derived): Use MAX_CODE_POINT. (write_table): Use NUM_CODE_POINTS. Print N99, C11 and N11 flags. Print whole array variable declaration rather than just array contents. (char_id_valid, write_context_switch): New functions. (main): Call write_context_switch. * ucnid.h: Regenerate. * include/cpplib.h (struct cpp_options): Add c11_identifiers. * init.c (struct lang_flags): Add c11_identifiers. (cpp_set_lang): Set c11_identifiers option from selected language. * internal.h (struct normalize_state): Document "previous" as previous starter character. (NORMALIZE_STATE_UPDATE_IDNUM): Take character as argument. * charset.c (DIG): Rename enum value to N99. (C11, N11): New enum values. (struct ucnrange): Give name to struct. Use short for flags and unsigned int for end of range. Include ucnid.h for whole variable declaration. (ucn_valid_in_identifier): Allow for characters up to 0x10FFFF. Allow for C11 in determining valid characters and valid start characters. Use check_nfc for non-Hangul context-dependent checks. Only store starter characters in nst->previous. (_cpp_valid_ucn): Pass new argument to NORMALIZE_STATE_UPDATE_IDNUM. * lex.c (lex_identifier): Pass new argument to NORMALIZE_STATE_UPDATE_IDNUM. Call NORMALIZE_STATE_UPDATE_IDNUM after initial non-UCN part of identifier. (lex_number): Pass new argument to NORMALIZE_STATE_UPDATE_IDNUM. 2013-11-15 Joseph Myers * ucnid.tab: Mark C99 digits as [C99DIG]. * makeucnid.c (read_ucnid): Handle [C99DIG]. (read_table): Don't check for digit characters. * ucnid.h: Regenerate. 2013-11-06 Tobias Burnus * macro.c (_cpp_builtin_macro_text): Correct wording of two warnings. 2013-11-05 Tobias Burnus * include/cpplib.h (CPP_W_DATE_TIME): Added. (cpp_options): Add warn_date_time. * init.c (cpp_create_reader): Init it. * macro.c (_cpp_builtin_macro_text): Warn when __DATE__/__TIME__/__TIMESTAMP__ is used. 2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net> Implement C++14 digit separators. * include/cpplib.h (cpp_options): Add digit_separators flag. * internal.h (DIGIT_SEP(c)): New macro. * expr.c (cpp_classify_number): Check improper placement of digit sep; (cpp_interpret_integer): Skip over digit separators. * init.c (lang_flags): Add digit_separators flag; (lang_defaults): Add digit separator flags per language; (cpp_set_lang): Set digit_separators * lex.c (lex_number): Add digits separator to allowable characters for C++14. 2013-10-15 David Malcolm * Makefile.in (PICFLAG): New. (ALL_CFLAGS): Add PICFLAG. (ALL_CXXFLAGS): Likewise. * configure.ac: Add --enable-host-shared, setting up new PICFLAG variable. * configure: Regenerate. 2013-08-07 Richard Earnshaw * configure.ac: Set need_64bit_hwint for all arm targets. * configure: Regenerated. 2013-07-20 Jakub Jelinek PR preprocessor/57620 * lex.c (lex_raw_string): Undo phase1 and phase2 transformations between R" and final " rather than only in between R"del( and )del". 2013-07-10 Jakub Jelinek PR preprocessor/57824 * lex.c (lex_raw_string): Allow reading new-lines if in_deferred_pragma or if parsing_args and there is still data in the current buffer. * include/cpplib.h (cpp_token_val_index): Change parameter type to const cpp_token *. * lex.c (cpp_token_val_index): Likewise. PR preprocessor/57757 * lex.c (cpp_avoid_paste): Avoid pasting CPP_{,W,UTF8}STRING or CPP_STRING{16,32} with CPP_NAME or SPELL_LITERAL token that starts if a-zA-Z_. 2013-06-28 Ed Smith-Rowland <3dw4rd@verizon.net> * lex.c (lex_raw_string(), lex_string()): Constrain suffixes treated as concatenated literal and macro to just the patterns found in inttypes.h; (is_macro()): New. 2013-06-24 Dehao Chen * files.c (_cpp_stack_include): Fix the highest_location when header file is guarded by #ifndef and is included twice. 2013-04-28 Jakub Jelinek N3472 binary constants * include/cpplib.h (struct cpp_options): Fix a typo in user_literals field comment. Add binary_constants field. * init.c (struct lang_flags): Add binary_constants field. (lang_defaults): Add bin_cst column to the table. (cpp_set_lang): Initialize CPP_OPTION (pfile, binary_constants). * expr.c (cpp_classify_number): Talk about C++11 instead of C++0x in diagnostics. Accept binary constants if CPP_OPTION (pfile, binary_constants) even when pedantic. Adjust pedwarn message. 2013-04-24 Paolo Carlini * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y. * init.c (lang_defaults): Add defaults for the latter. (cpp_init_builtins): Define __cplusplus as 201300L for the latter. * lex.c (_cpp_lex_direct): Update. 2013-04-03 Sebastian Huber PR target/56771 * configure.ac: Require 64-bit int for arm*-*-rtems*. * configure: Regenerate. 2013-03-06 Jakub Jelinek PR middle-end/56461 * internal.h (struct cpp_buffer): Add to_free field. (_cpp_pop_file_buffer): Add third argument. * files.c (_cpp_stack_file): Set buffer->to_free. (_cpp_pop_file_buffer): Add to_free argument. Free to_free if non-NULL, and if equal to file->buffer_start, also clear file->buffer{,_start,_valid}. * directives.c (_cpp_pop_buffer): Pass buffer->to_free to _cpp_pop_file_buffer. 2013-03-01 Jakub Jelinek PR middle-end/56461 * files.c (_cpp_save_file_entries): Free result at the end. * pch.c (cpp_string_free): New function. (cpp_save_state): Use it in htab_create call. (cpp_write_pch_deps): Free ss->defs. Destroy ss->definedhash. 2013-02-28 Jakub Jelinek * files.c (_cpp_find_file): If returning early, before storing something to *hash_slot and *hash_slot is NULL, call htab_clear_slot on it. Access *hash_slot using void * type rather than struct file_hash_entry * to avoid aliasing issues. * configure.ac: Don't define ENABLE_CHECKING whenever --enable-checking is seen, instead use similar --enable-checking=yes vs. --enable-checking=release default as gcc/ subdir has and define ENABLE_CHECKING if ENABLE_CHECKING is defined in gcc/. Define ENABLE_VALGRIND_CHECKING if requested. * lex.c (new_buff): If ENABLE_VALGRIND_CHECKING, put _cpp_buff struct first in the allocated buffer and result->base after it. (_cpp_free_buff): If ENABLE_VALGRIND_CHECKING, free buff itself instead of buff->base. * config.in: Regenerated. * configure: Regenerated. 2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/55582 * lex.c (lex_raw_string): Allow string literal with suffix beginning with 's' to be parsed as a C++11 user-defined literal. 2013-01-14 Richard Sandiford Update copyright years. 2013-01-04 Paolo Carlini PR c++/54526 (again) * lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2. 2013-01-03 Marc Glisse PR bootstrap/50177 * line-map.c (get_combined_adhoc_loc): Cast from extern "C" type. (new_linemap): Likewise. (linemap_enter_macro): Likewise. 2012-12-03 Jakub Jelinek PR bootstrap/55380 PR other/54691 * files.c (read_file_guts): Allocate extra 16 bytes instead of 1 byte at the end of buf. Pass size + 16 instead of size to _cpp_convert_input. * charset.c (_cpp_convert_input): Reallocate if there aren't at least 16 bytes beyond to.len in the buffer. Clear 16 bytes at to.text + to.len. 2012-11-21 Steve Ellcey PR pch/55399 * files.c (pch_open_file): Fix check for implicit_preinclude. 2012-11-16 Simon Baldwin * include/cpplib.h (struct cpp_options): Add canonical_system_headers. * files.c (find_file_in_dir): Call maybe_shorter_path() only if canonical_system_headers is set. * init.c (cpp_create_reader): Initialize canonical_system_headers. * configure.ac: Add new --enable-canonical-system-headers. * configure: Regenerate. * config.in: Regenerate. 2012-11-09 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/54413 * include/cpplib.h (cpp_interpret_float_suffix): Add cpp_reader* arg. (cpp_interpret_int_suffix): Add cpp_reader* arg. * init.c (cpp_create_reader): Iitialize new flags. * expr.c (interpret_float_suffix): Use new flags. (cpp_interpret_float_suffix): Add cpp_reader* arg. (interpret_int_suffix): Use new flags. (cpp_interpret_int_suffix): Add cpp_reader* arg. (cpp_classify_number): Adjust calls to interpret_x_suffix. 2012-10-23 Ian Bolton Jim MacArthur Marcus Shawcroft Nigel Stephens Ramana Radhakrishnan Richard Earnshaw Sofiane Naci Stephen Thomas Tejas Belagod Yufeng Zhang * configure.ac: Enable AArch64. * configure: Regenerate. 2012-10-23 Joseph Myers * files.c (struct _cpp_file): Add implicit_preinclude. (pch_open_file): Allow a previously opened implicitly included file. (_cpp_find_file): Add implicit_preinclude argument. Free file and do not call open_file_failed if implicit_preinclude. Store implicit_preinclude value. (_cpp_stack_include, _cpp_fake_include, _cpp_compare_file_date): Update calls to _cpp_find_file. (_cpp_stack_include): Handle IT_DEFAULT. (cpp_push_default_include): New. * include/cpplib.h (cpp_push_default_include): Declare. * init.c (cpp_read_main_file): Update call to _cpp_find_file. * internal.h (enum include_type): Add IT_DEFAULT. (_cpp_find_file): Update prototype. 2012-10-15 Tobias Burnus * files.c (read_file_guts, _cpp_save_file_entries): Free memory before returning. * lex.c (warn_about_normalization): Ditto. * mkdeps.c (deps_save): Ditto. * pch.c (cpp_valid_state): Ditto. 2012-10-04 Florian Weimer * directives.c (do_pragma_warning_or_error): New. (do_pragma_warning): New. (do_pragma_error): New. (_cpp_init_internal_pragmas): Register new pragmas. 2012-09-25 Dehao Chen PR middle-end/54704 * line-map.c (location_adhoc_data_hash): Fix the hash function. 2012-09-25 Dehao Chen PR middle-end/54645 * include/line-map.h (location_adhoc_data): Move location_adhoc_data into GC. (location_adhoc_data_map): Likewise. (line_maps): Likewise. (rebuild_location_adhoc_htab): New Function. * line-map.c (+rebuild_location_adhoc_htab): new Funcion. (get_combined_adhoc_loc): Move location_adhoc_data into GC. (location_adhoc_data_fini): Likewise. (linemap_init): Likewise. (location_adhoc_data_init): Remove Function. 2012-09-19 Dehao Chen * include/line-map.h (MAX_SOURCE_LOCATION): New value. (location_adhoc_data_fini): New. (get_combined_adhoc_loc): New. (get_data_from_adhoc_loc): New. (get_location_from_adhoc_loc): New. (location_adhoc_data_map): New. (COMBINE_LOCATION_DATA): New. (IS_ADHOC_LOC): New. (expanded_location): New field. (line_maps): New field. * line-map.c (location_adhoc_data): New. (location_adhoc_data_hash): New. (location_adhoc_data_eq): New. (location_adhoc_data_update): New. (get_combined_adhoc_loc): New. (get_data_from_adhoc_loc): New. (get_location_from_adhoc_loc): New. (location_adhoc_data_init): New. (location_adhoc_data_fini): New. (linemap_init): Initialize location_adhoc_data. (linemap_lookup): Change to use new location. (linemap_ordinary_map_lookup): Likewise. (linemap_macro_map_lookup): Likewise. (linemap_macro_map_loc_to_def_point): Likewise. (linemap_macro_map_loc_unwind_toward_spel): Likewise. (linemap_get_expansion_line): Likewise. (linemap_get_expansion_filename): Likewise. (linemap_location_in_system_header_p): Likewise. (linemap_location_from_macro_expansion_p): Likewise. (linemap_macro_loc_to_spelling_point): Likewise. (linemap_macro_loc_to_def_point): Likewise. (linemap_macro_loc_to_exp_point): Likewise. (linemap_resolve_location): Likewise. (linemap_unwind_toward_expansion): Likewise. (linemap_unwind_to_first_non_reserved_loc): Likewise. (linemap_expand_location): Likewise. (linemap_dump_location): Likewise. (linemap_line_start): Likewise. 2012-05-25 Dodji Seketeli PR preprocessor/53469 * directives.c (do_pragma): Use the virtual location for the pragma token, instead of its spelling location. 2012-08-14 Diego Novillo Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. 2012-07-30 Laurynas Biveinis * include/line-map.h (line_map_macro): Use the "atomic" GTY option for the macro_locations field. 2011-06-19 Uros Bizjak * lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and __builtin_ia32_pcmpestri128 instead of asm. 2012-06-04 Dimitrios Apostolou * line-map.c (linemap_enter_macro): Don't zero max_column_hint in every macro. This improves performance by reducing the number of reallocations when track-macro-expansion is on. 2012-06-04 Dodji Seketeli PR preprocessor/53463 * line-map.c (linemap_location_in_system_header_p): For built-in macro tokens, check the first expansion point location that is not for a token coming from a built-in macro. 2012-05-29 Joseph Myers * directives.c: Fix typos. * include/line-map.h: Fix typos. * line-map.c: Fix typos. * macro.c: Fix typos. 2012-05-25 Dodji Seketeli PR bootstrap/53459 * lex.c (search_line_fast): Avoid unused local typedefs to simulate a static assertion. 2012-05-29 Dodji Seketeli PR preprocessor/53229 * internal.h (cpp_reader::set_invocation_location): Remove. (cpp_reader::about_to_expand_macro_p): New member flag. * directives.c (do_pragma): Remove Kludge as pfile->set_invocation_location is no more. * macro.c (cpp_get_token_1): Do away with the use of cpp_reader::set_invocation_location. Just collect the macro expansion point when we are about to expand the top-most macro. Do not override cpp_reader::about_to_expand_macro_p. This fixes gcc.dg/cpp/paste12.c by making get_token_no_padding properly handle locations of expansion points. (cpp_get_token_with_location): Adjust, as cpp_reader::set_invocation_location is no more. (paste_tokens): Take a virtual location parameter for the LHS of the pasting operator. Use it in diagnostics. Update comments. (paste_all_tokens): Tighten the assert. Propagate the location of the expansion point when no virtual locations are available. Pass the virtual location to paste_tokens. (in_macro_expansion_p): New static function. (enter_macro_context): Set the cpp_reader::about_to_expand_macro_p flag until we really start expanding the macro. 2012-05-16 Dodji Seketeli PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. 2012-05-10 Tristan Gingold * expr.c (interpret_float_suffix): Add a guard. 2012-05-02 Dodji Seketeli Properly initialize cpp_context in destringize_and_run * directives.c (destringize_and_run): Properly initialize the new context. * macro.c (_cpp_pop_context): Assert that we shouldn't try to pop the initial base context, which has the same life time as the current instance of cpp_file. 2012-04-30 Manuel López-Ibáñez Dodji Seketeli PR c++/52974 * libcpp/files.c (maybe_shorter_path): New. (find_file_in_dir): Use it. 2012-04-30 Dodji Seketeli Switch -ftrack-macro-expansion=2 on by default. * init.c (cpp_create_reader): Switch -ftrack-macro-expansion=2 on by default. Add comments. Strip "" loc from displayed expansion context * include/line-map.h (linemap_unwind_toward_expansion): Fix typo in comment. (linemap_unwind_to_first_non_reserved_loc): Declare new function. * line-map.c (linemap_unwind_to_first_non_reserved_loc): Define new function. Fix expansion point loc for macro-like tokens * macro.c (macro_of_context): New static function. (_cpp_push_token_context, push_extended_tokens_context): If the macro argument is NULL, it means we are continuing the expansion of the current macro, if any. Update comments. (_cpp_pop_context): Re-enable expansion of the macro only when we are really out of the context of the current expansion. Fix token pasting with -ftrack-macro-expansion * macro.c (paste_all_tokens): Put the token resulting from pasting into an extended token context with -ftrack-macro-location is in effect. Fix cpp_sys_macro_p with -ftrack-macro-expansion * macro.c (cpp_sys_macro_p): Support -ftrack-macro-expansion. 2012-04-29 Dodji Seketeli * lex.c (lex_raw_string): Change C++ style comments into C style comments. (lex_string): Likewise. 2012-04-27 Ollie Wild * include/cpplib.h (struct cpp_options): Add new field, warn_literal_suffix. (CPP_W_LITERAL_SUFFIX): New enum. * init.c (cpp_create_reader): Default initialization of warn_literal_suffix. * lex.c (lex_raw_string): Treat user-defined literals which don't begin with '_' as separate tokens and produce a warning. (lex_string): Ditto. 2012-04-26 Manuel López-Ibáñez * line-map.c (linemap_resolve_location): Synchronize comments with those in line-map.h. * include/line-map.h (linemap_resolve_location): Fix spelling in comment. 2012-03-22 Richard Earnshaw * lex.c (search_line_fast): Provide Neon-optimized version for ARM. 2012-03-14 Rainer Orth * lex.c: Remove Solaris 8 reference. 2012-02-14 Walter Lee * configure.ac: Require 64-bit hwint for tilegx and tilepro. * configure: Regenerate. 2012-01-09 Richard Guenther * macro.c (_cpp_builtin_macro_text): Remove unused variable map. 2012-01-09 Gary Funck PR preprocessor/33919 * files.c (_cpp_get_file_name): New. Implement file name access function. * internal.h (_cpp_get_file_name): New prototype. * macro.c (_cpp_builtin_macro_text): Call _cpp_get_file_name() to use pfile->main_file in lieu of traversing INCLUDED_FROM chain. 2012-01-03 Olivier Hainque * system.h: Prior to #define, #undef fopen and freopen unconditionally. 2011-12-20 Joseph Myers * include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11. (CLK_STDC1X): Change to CLK_STDC11. * init.c (lang_defaults): Update comments. (cpp_init_builtins): Update language tests. Use 201112L for C11 __STDC_VERSION__. 2011-12-20 Andreas Schwab * configure: Regenerate. 2011-12-19 Andreas Schwab * configure: Regenerate. 2011-12-07 Jakub Jelinek PR bootstrap/50237 * internal.h (_cpp_init_lexer): New prototype. * init.c (init_library): Call it. * lex.c (init_vectorized_lexer): Remove constructor attribute, add inline keyword. (HAVE_init_vectorized_lexer): Define. (_cpp_init_lexer): New function. 2011-12-03 Dodji Seketeli * macro.c (tokens_buff_remove_last_token) (tokens_buff_put_token_to): Add an 'inline' function specifier to the prototype. 2011-11-22 Diego Novillo * include/line-map.h (linemap_dump): Declare. (line_table_dump): Declare. * line-map.c (linemap_dump): New. (line_table_dump): New. 2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/50958 * expr.c (cpp_userdef_char_remove_type): Fix typo. 2011-11-03 Michael Matz PR bootstrap/50857 * configure.ac: Check for -fno-exceptions -fno-rtti. * configure: Regenerate. * Makefile.in (NOEXCEPTION_FLAGS): New flag. (ALL_CXXFLAGS): Use it. 2011-11-02 Paolo Carlini * internal.h (uxstrdup, ustrchr): Return const unsigned char *. 2011-11-02 Jason Merrill PR c++/50810 * configure.ac: Add -Wno-narrowing to warning options. 2011-10-31 Jason Merrill PR libstdc++/1773 * init.c (cpp_init_builtins): Set __cplusplus for C++11. PR c++/50920 * include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11, CLK_GNUCXX0X to CLK_GNUCXX11. 2011-10-26 Ed Smith-Rowland <3dw4rd@verizon.net> Implement C++11 user-defined literals. * 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. 2011-10-24 Dodji Seketeli * line-map.c (linemap_macro_map_lookup): Fix logic. 2011-10-24 Dodji Seketeli * include/line-map.h (linemap_expand_location): Take a line table parameter. Update comment. (linemap_resolve_location): Update comment. (linemap_expand_location_full): Remove. * line-map.c (linemap_resolve_location): Handle reserved locations; return a NULL map in those cases. (linemap_expand_location): If location is reserved, return a zeroed expanded location. Update comment. Take a line table to assert that the function takes non-virtual locations only. (linemap_expand_location_full): remove. (linemap_dump_location): Handle the fact that linemap_resolve_location can return NULL line maps when the location resolves to a reserved location. * line-map.c (linemap_macro_map_lookup): Fix logic. 2011-10-22 Dodji Seketeli PR bootstrap/50778 * include/internal.h (_cpp_remaining_tokens_num_in_context): Take the context to act upon. * lex.c (_cpp_remaining_tokens_num_in_context): Likewise. Update comment. (cpp_token_from_context_at): Likewise. (cpp_peek_token): Use the context to peek tokens from. 2011-10-20 Dodji Seketeli PR bootstrap/50801 * lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of number of tokens. 2011-10-18 Dodji Seketeli PR bootstrap/50760 * include/line-map.h (struct linemap_stats): Change the type of the members from size_t to long. * macro.c (macro_arg_token_iter_init): Unconditionally initialize iter->location_ptr. 2011-10-17 Dodji Seketeli * line-map.c (linemap_macro_map_loc_to_exp_point): Avoid setting a variable without using it if ENABLE_CHECKING is not defined. Mark the LOCATION parameter as being unused. 2011-10-15 Tom Tromey Dodji Seketeli * include/line-map.h (struct line_maps::alloced_size_for_request): New member. * line-map.c (new_linemap): Use set->alloced_size_for_request to get the actual allocated size of line maps. 2011-10-15 Tom Tromey Dodji Seketeli * line-map.h (struct linemap_stats): Declare new struct. (linemap_get_statistics): Declare ... * line-map.c (linemap_get_statistics): ... new function. * macro.c (num_expanded_macros_counter, num_macro_tokens_counter): Declare new counters. (enter_macro_context, replace_args): Update num_macro_tokens_counter. (cpp_get_token_1): Update num_expanded_macros_counter. 2011-10-15 Tom Tromey Dodji Seketeli * include/cpplib.h (struct cpp_options): New struct member. * include/line-map.h (linemap_dump_location): Declare ... * line-map.c (linemap_dump_location): ... new function. 2011-10-15 Tom Tromey Dodji Seketeli * include/cpplib.h (struct cpp_options): New option. * internal.h (struct macro_context): New struct. (enum context_tokens_kind): New enum. (struct cpp_context): New member of type enum context_tokens_kind. (struct cpp_context): Remove this. Replace it with an enum of macro and macro_context. (struct cpp_context): Remove. (_cpp_remaining_tokens_num_in_context): Declare new function. * directives.c (destringize_and_run): Adjust. * lex.c (_cpp_remaining_tokens_num_in_context) (_cpp_token_from_context_at): Define new functions (cpp_peek_token): Use them. * init.c (cpp_create_reader): Initialize the base context to zero. (_cpp_token_from_context_at): Define new static function. (cpp_peek_token): Use new _cpp_remaining_tokens_num_in_context and _cpp_token_from_context_at. * macro.c (struct macro_arg): New members. (enum macro_arg_token_kind): New enum. (struct macro_arg_token_iter): New struct. (maybe_adjust_loc_for_trad_cpp, push_extended_tokens_context) (alloc_expanded_arg_mem, ensure_expanded_arg_room) (delete_macro_args, set_arg_token, get_arg_token_location) (arg_token_ptr_at, macro_arg_token_iter_init) (macro_arg_token_iter_get_token) (macro_arg_token_iter_get_location, macro_arg_token_iter_forward) (expanded_token_index, tokens_buff_new, tokens_buff_count) (tokens_buff_last_token_ptr, tokens_buff_put_token_to) (tokens_buff_add_token, tokens_buff_remove_last_token) (reached_end_of_context, consume_next_token_from_context): New static functions. (cpp_get_token_1): New static function. Split and extended from cpp_get_token. Use reached_end_of_context and consume_next_token_from_context. Unify its return point. Move the location tweaking from cpp_get_token_with_location in here. (cpp_get_token): Use cpp_get_token_1 (stringify_arg): Use the new arg_token_at. (paste_all_tokens): Support tokens coming from extended tokens contexts. (collect_args): Return the number of collected arguments, by parameter. Store virtual locations of tokens that constitute the collected args. (funlike_invocation_p): Return the number of collected arguments, by parameter. (enter_macro_context): Add a parameter for macro expansion point. Pass it to replace_args and to the "used" cpp callback. Get the number of function-like macro arguments from funlike_invocation_p, pass it to the new delete_macro_args to free the memory used by macro args. When -ftrack-macro-expansion is in effect, for macros that have no arguments, create a macro map for the macro expansion and use it to allocate proper virtual locations for tokens resulting from the expansion. Push an extended tokens context containing the tokens resulting from macro expansion and their virtual locations. (replace_args): Rename the different variables named 'count' into variables with more meaningful names. Create a macro map; allocate virtual locations of tokens resulting from this expansion. Use macro_arg_token_iter to iterate over tokens of a given macro. Handle the case of the argument of -ftrack-macro-expansion being < 2. Don't free macro arguments memory resulting from expand_arg here, as these are freed by the caller of replace_arg using delete_macro_args now. Push extended token context. (next_context, push_ptoken_context, _cpp_push_token_context) (_cpp_push_text_context): Properly initialize the context. (expand_arg): Use the new alloc_expanded_arg_mem, push_extended_tokens_context, cpp_get_token_1, and set_arg_token. (_cpp_pop_context): Really free the memory held by the context. Handle freeing memory used by extended tokens contexts. (cpp_get_token_with_location): Use cpp_get_token_1. (cpp_sys_macro_p): Adjust. (_cpp_backup_tokens): Support the new kinds of token contexts. * traditional.c (recursive_macro): Adjust. 2011-10-15 Tom Tromey Dodji Seketeli * include/line-map.h (enum lc_reason): New enum member. (MAX_SOURCE_LOCATION): New constant. (struct line_map_ordinary, struct line_map_macro): New structs. (struct line_map): Turn this into a union of the two above. Add comments. (struct maps_info): New struct. (struct line_maps): Two new fields. These now carry the map information that was previously scattered in struct line_maps. (struct map_info::allocated): Fix comment. (MAP_START_LOCATION, ORDINARY_MAP_FILE_NAME) (ORDINARY_MAP_STARTING_LINE_NUMBER) (ORDINARY_MAP_INCLUDER_FILE_INDEX) (ORDINARY_MAP_IN_SYSTEM_HEADER_P) (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS, MACRO_MAP_MACRO) (MACRO_MAP_NUM_MACRO_TOKENS MACRO_MAP_LOCATIONS) (MACRO_MAP_EXPANSION_POINT_LOCATION) (LOCATION_POSSIBLY_IN_MACRO_MAP_P, LINEMAPS_MAP_INFO) (LINEMAPS_MAPS, LINEMAPS_ALLOCATE, LINEMAPS_USED, LINEMAPS_CACHE) (LINEMAPS_LAST_MAP, LINEMAPS_LAST_ALLOCATED_MAP) (LINEMAPS_ORDINARY_MAPS, LINEMAPS_ORDINARY_ALLOCATED) (LINEMAPS_ORDINARY_USED, LINEMAPS_ORDINARY_CACHE) (LINEMAPS_LAST_ORDINARY_MAP, LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP) (LINEMAPS_MACRO_MAPS, LINEMAPS_MACRO_ALLOCATED) (LINEMAPS_MACRO_USED, LINEMAPS_MACRO_CACHE) (LINEMAPS_LAST_MACRO_MAP, LINEMAPS_LAST_ALLOCATED_MACRO_MAP) (LINEMAPS_MAP_AT, LINEMAPS_ORDINARY_MAP_AT) (LINEMAPS_MACRO_MAP_AT): New accessors for ordinary and macro map information. (linemap_check_ordinary, linemap_assert) (linemap_location_before_p): New macros. (linemap_position_for_line_and_column) (linemap_tracks_macro_expansion_locs_p, linemap_add_macro_token) (linemap_macro_expansion_map_p) (linemap_macro_map_loc_to_def_point) (linemap_macro_map_loc_unwind_once) (linemap_macro_map_loc_to_exp_point, linemap_step_out_once) (linemap_get_source_line linemap_get_source_column) (linemap_map_get_macro_name, linemap_get_file_path) (linemap_location_in_system_header_p) (linemap_location_from_macro_expansion_p): Declare new functions. (SOURCE_LINE, SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION) (LINEMAP_FILE, LINEMAP_LINE, LINEMAP_SYSP): Assert that this accessors act on ordinary maps only. (INCLUDED_FROM): Return NULL for main files; use the new accessors. (LINEMAP_POSITION_FOR_COLUMN): Use the new accessors. (struct expanded_location): Move here from gcc/input.h (linemap_resolve_location, linemap_expand_location) (linemap_expand_location_full): Declare new functions. * line-map.c: Include cpplib.h, internal.h (linemap_enter_macro, linemap_add_macro_token) (linemap_get_expansion_line, linemap_get_expansion_filename): New functions that are private to libcpp. (linemap_assert): New macro. (linemap_macro_loc_to_exp_point, linemap_macro_loc_to_exp_point) (linemap_macro_loc_unwind, linemap_macro_map_loc_to_def_point) (linemap_macro_map_loc_unwind_toward_spelling) (linemap_macro_map_loc_to_exp_point) (first_map_in_common_1, first_map_in_common): New static functions. (new_linemap): Define new static functions. Extracted and enhanced from ... (linemap_add): ... here. Use linemap_assert in lieu of abort previously. (linemap_tracks_macro_expansion_locs_p) (linemap_add_macro_token, linemap_macro_expansion_map_p) (linemap_check_ordinary, linemap_macro_map_loc_to_exp_point) (linemap_macro_map_loc_to_def_point) (linemap_macro_map_loc_unwind_once) (linemap_step_out_once, linemap_map_get_index) (linemap_get_source_line,linemap_get_source_column) (linemap_get_file_path, linemap_map_get_macro_name) (linemap_location_in_system_header_p) (linemap_location_originated_from_system_header_p) (linemap_location_from_macro_expansion_p) (linemap_tracks_macro_expansion_locs_p) (linemap_resolve_location, linemap_expand_location) (linemap_expand_location_full) (linemap_tracks_macro_expansion_locs_p) (linemap_position_for_line_and_column, linemap_compare_locations): Define new public functions. (linemap_init): Initialize ordinary and macro maps information in the map set. (linemap_check_files_exited): Use the new accessors. (linemap_free): Remove this dead code. (linemap_line_start): Assert this uses an ordinary map. Adjust to use the new ordinary map accessors and data structures. Don't overflow past the lowest possible macro token's location. (linemap_position_for_column): Assert the ordinary maps of the map set are really ordinary. Use ordinary map accessors. (linemap_lookup): Keep the same logic but generalize to allow lookup of both ordinary and macro maps. Do not crash when called with an empty line table. * directives-only.c (_cpp_preprocess_dir_only): Adjust to use the new API of line-map.h. * directives.c (start_directive, do_line, do_linemarker) (do_linemarker): Likewise. * files.c (_cpp_find_file, _cpp_stack_include, open_file_failed) (make_cpp_dir, cpp_make_system_header): Likewise. * init.c (cpp_read_main_file): Likewise. * internal.h (CPP_INCREMENT_LINE): Likewise. (linemap_enter_macro, linemap_add_macro_token) (linemap_get_expansion_line, linemap_get_expansion_filename): New functions private to libcpp. * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment) (skip_line_comment, skip_whitespace, lex_raw_string) (_cpp_lex_direct): Likewise. * macro.c (_cpp_builtin_macro_text): Likewise. (_cpp_aligned_alloc): Initialize the new name member of the macro. * traditional.c (copy_comment, _cpp_scan_out_logical_line): Likewise. * errors.c (cpp_diagnostic): Adjust to new linemap API. 2011-08-28 Dodji Seketeli * line-map.c (linemap_add): Assert that reason must not be LC_RENAME when called for the first time on a "main input file". 2011-08-22 Gabriel Charette * 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. 2011-08-18 Rainer Orth PR libstdc++/1773 * init.c (cpp_init_builtins): Define __cplusplus 19971L. 2011-08-18 Joseph Myers * include/cpplib.h (struct cpp_options): Fix typo. 2011-08-18 Joseph Myers * 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. 2011-08-15 Gabriel Charette * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Remove. Update all users to use linemap_position_for_column instead. 2011-07-28 Gabriel Charette * include/line-map.h (struct line_maps): Remove unused field last_listed. Update all users. 2011-07-28 H.J. Lu * configure.ac: Set need_64bit_hwint to yes for x86 targets. * configure: Regenerated. 2011-07-25 Rainer Orth * system.h [__cplusplus]: Wrap C function declarations in extern "C". 2011-07-22 Rainer Orth Ralf Wildenhues PR bootstrap/49794 * configure.ac: Test AM_ICONV with CXX. * configure: Regenerate. * system.h (HAVE_DESIGNATED_INITIALIZERS): Never define for C++. 2011-07-15 Dodji Seketeli * directives.c (struct if_stack): Use source_location as type here. * include/cpplib.h (struct cpp_callbacks): Properly use source_location as parameter type, rather than unsigned int. 2011-07-07 Rainer Orth PR target/39150 * configure.ac (host_wide_int): Handle x86_64-*-solaris2.1[0-9] like i[34567]86-*-solaris2.1[0-9]*. * configure: Regenerate. 2011-06-16 Jason Merrill PR c++/45399 * lex.c (lex_raw_string): Don't check for embedded NUL. 2011-06-06 Dodji Seketeli PR preprocessor/48532 * directives.c (do_pragma): Don't forget the invocation location when parsing the pragma name of a namespaced pragma directive. 2011-05-29 John Tytgat * files.c (read_file_guts): Add test on non-zero value of S_ISREG. 2011-05-22 Uros Bizjak PR target/49104 * lex.c (init_vectorized_lexer): Do not set "minimum" when __3dNOW_A__ is defined. Check bit_MMXEXT and bit_CMOV to use search_line_mmx. 2011-04-25 Jan Kratochvil * system.h (ENUM_BITFIELD): Remove. 2011-04-24 Jakub Jelinek PR preprocessor/48740 * lex.c (lex_raw_string): When raw string ends with ??) followed by raw prefix and ", ensure it is preprocessed with ??) rather than ??]. 2011-04-20 Jim Meyering * files.c (destroy_cpp_file): Remove useless if-before-free. * init.c (cpp_destroy): Likewise. * macro.c (replace_args): Likewise. * pch.c (cpp_valid_state): Likewise. 2011-03-25 Kai Tietz * 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. 2011-03-21 Michael Meissner PR preprocessor/48192 * directives.c (do_ifdef): Do not consider conditional macros as being defined. (do_ifndef): Ditto. * expr.c (parse_defined): Ditto. 2011-03-18 Richard Henderson PR bootstrap/45381 * lex.c [ALTIVEC] (search_line_fast): Require gcc version 4.5. 2011-11-04 Eric Botcazou Jakub Jelinek PR preprocessor/39213 * directives.c (end_directive): Call _cpp_remove_overlay for deferred pragmas as well in traditional mode. 2010-11-17 Ian Lance Taylor PR bootstrap/45538 * configure.ac: Use AC_USE_SYSTEM_EXTENSIONS. Remove switch of AC_LANG based on ENABLE_BUILD_WITH_CXX. 2010-11-16 Kai Tietz PR preprocessor/17349 * lex.c (save_comment): Handle in argument passing c++ comments special. 2010-11-02 Ian Lance Taylor * configure.ac: Use AC_SYS_LARGEFILE. * configure: Rebuild. * config.in: Rebuild. 2010-10-19 Basile Starynkevitch * line-map.h (source_location): Remove obsolete comment mentioning location_s. 2010-09-29 Kai Tietz PR preprocessor/45362 * directives.c (cpp_pop_definition): Make static. (do_pragma_push_macro): Reworked to store text definition. (do_pragma_pop_macro): Add free text definition. (cpp_push_definition): Removed. * include/cpplib.h (cpp_push_definition): Removed. (cpp_pop_definition): Likewise. * internal.h (def_pragma_macro): Remove member 'value' and add new members 'definition', 'line', 'syshdr', 'sued' and 'is_undef'. * pch.c (_cpp_restore_pushed_macros): Rework to work on text definition and store additional macro flags. (_cpp_save_pushed_macros): Likewise. 2010-09-29 Joseph Myers * 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. 2010-09-15 Ian Lance Taylor * init.c: Fix type name in comment. 2010-08-31 Jakub Jelinek PR preprocessor/45457 * expr.c (parse_defined): Call pfile->cb.user_builtin_macro hook if needed. * directives.c (do_ifdef, do_ifndef): Likewise. 2010-08-26 Rainer Orth * system.h [HAVE_INTTYPES_H]: Include inttypes.h. 2010-08-24 Richard Henderson PR bootstrap/45376 * configure.ac (HAVE_SSE4): New check. * configure, config.in: Rebuild. * lex.c (search_line_sse42): Omit if !HAVE_SSE4. 2010-08-24 Rainer Orth * lex.c [__sun__ && __svr4__]: Disable init_vectorized_lexer etc. on Solaris 2/x86. 2010-08-21 Richard Henderson Andi Kleen David S. Miller * configure.ac (AC_C_BIGENDIAN, AC_TYPE_UINTPTR_T): New tests. (ssize_t): Check via AC_TYPE_SSIZE_T instead of AC_CHECK_TYPE. (ptrdiff_t): Check via AC_CHECK_TYPE. * config.in, configure: Rebuild. * system.h: Include stdint.h, if available. * lex.c (WORDS_BIGENDIAN): Provide default. (acc_char_mask_misalign, acc_char_replicate, acc_char_cmp, acc_char_index, search_line_acc_char, repl_chars, search_line_mmx, search_line_sse2, search_line_sse42, init_vectorized_lexer, search_line_fast): New. (_cpp_clean_line): Use search_line_fast. Restructure the fast loop to make it clear when we're leaving the loop. Stay in the fast loop for non-trigraph '?'. 2010-06-11 Jakub Jelinek * include/cpplib.h (struct cpp_callbacks): Add user_builtin_macro callback. (enum cpp_builtin_type): Add BT_FIRST_USER and BT_LAST_USER. (cpp_macro_definition): Remove const qual from second argument. * macro.c (enter_macro_context): Call user_builtin_macro callback for NODE_BUILTIN !NODE_USED macros. (warn_of_redefinition): Likewise. Remove const qual from second argument. (cpp_macro_definition): Likewise. * pch.c (write_macdef, save_macros): Call user_builtin_macro callback for NODE_BUILTIN !NODE_USED macros. 2010-06-10 Joseph Myers * include/cpplib.h (struct cpp_options): Remove show_column. * init.c (cpp_create_reader, post_options): Don't set show_column. 2010-06-09 Joern Rennecke PR bootstrap/44432 * configure.ac: Before using ZW_PROG_COMPILER_DEPENDENCIES for C++, check that C++ compiler works. * configure: Regenerate. 2010-06-08 Laurynas Biveinis * include/symtab.h (ht_identifier_ptr): New. 2010-06-03 Joern Rennecke Ralf Wildenhues PR bootstrap/42798 * configure.ac: Check for declaration of 'basename(char *)'. * configure: Regenerate. * config.in: Regenerate. 2010-04-25 Joseph Myers * 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. 2010-04-09 Manuel López-Ibáñez PR cpp/43195 * files.c (report_missing_guard): Test for #pragma once. 2010-04-07 Simon Baldwin * directives.c (do_diagnostic): Add warning reason argument, call appropriate error reporting function for code. (directive_diagnostics): Call specific warning functions with warning reason where appropriate. (do_error, do_warning, do_pragma_dependency): Add warning reason argument to do_diagnostic calls. * macro.c (_cpp_warn_if_unused_macro, enter_macro_context, _cpp_create_definition): Call specific warning functions with warning reason where appropriate. * Makefile.in: Add new diagnostic functions to gettext translations. * include/cpplib.h (struct cpp_callbacks): Add warning reason code to error callback. (CPP_DL_WARNING, CPP_DL_WARNING_SYSHDR, CPP_DL_PEDWARN, CPP_DL_ERROR, CPP_DL_ICE, CPP_DL_NOTE, CPP_DL_FATAL): Replace macros with enums. (CPP_W_NONE, CPP_W_DEPRECATED, CPP_W_COMMENTS, CPP_W_MISSING_INCLUDE_DIRS, CPP_W_TRIGRAPHS, CPP_W_MULTICHAR, CPP_W_TRADITIONAL, CPP_W_LONG_LONG, CPP_W_ENDIF_LABELS, CPP_W_NUM_SIGN_CHANGE, CPP_W_VARIADIC_MACROS, CPP_W_BUILTIN_MACRO_REDEFINED, CPP_W_DOLLARS, CPP_W_UNDEF, CPP_W_UNUSED_MACROS, CPP_W_CXX_OPERATOR_NAMES, CPP_W_NORMALIZE, CPP_W_INVALID_PCH, CPP_W_WARNING_DIRECTIVE): New enums for cpp warning reason codes. (cpp_warning, cpp_pedwarning, cpp_warning_syshdr, cpp_warning_with_line, cpp_pedwarning_with_line, cpp_warning_with_line_syshdr): New specific error reporting functions. * pch.c (cpp_valid_state): Call specific warning functions with warning reason where appropriate. * errors.c (cpp_diagnostic, cpp_diagnostic_with_line): New central diagnostic handlers. (cpp_warning, cpp_pedwarning, cpp_warning_syshdr, cpp_warning_with_line, cpp_pedwarning_with_line, cpp_warning_with_line_syshdr): New specific error reporting functions. * expr.c (cpp_classify_number, eval_token, num_unary_op): Call specific warning functions with warning reason where appropriate. * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment, warn_about_normalization, lex_identifier_intern, lex_identifier, _cpp_lex_direct): Ditto. * charset.c (_cpp_valid_ucn, convert_hex, convert_escape, narrow_str_to_charconst): Ditto. 2010-04-06 Jakub Jelinek PR preprocessor/43642 * lex.c (lex_raw_string): Change type of TYPE variable to unsigned char. 2010-04-02 Ralf Wildenhues * aclocal.m4: Regenerate. 2010-03-29 Jason Merrill More N3077 raw string changes * charset.c (cpp_interpret_string): Don't transform UCNs in raw strings. * lex.c (bufring_append): Split out from... (lex_raw_string): ...here. Undo trigraph and line splicing transformations. Do process line notes in multi-line literals. (_cpp_process_line_notes): Ignore notes that were already handled. Some raw string changes from N3077 * charset.c (cpp_interpret_string): Change inner delimiters to (). * lex.c (lex_raw_string): Likewise. Also disallow '\' in delimiter. 2010-02-11 Jakub Jelinek * init.c (read_original_filename): Don't call read_original_directory if _cpp_handle_directive returns 0. 2010-01-01 Joseph Myers PR preprocessor/41947 * expr.c (cpp_classify_number): Give error for hexadecimal floating-point constant with no digits before or after point. 2009-11-20 Arnaud Charlet * macro.c (enter_macro_context): Call cb.used callback if defined. * directives.c (do_idef, do_ifndef): Ditto. * include/cpplib.h (struct cpp_callbacks): Add used callback. 2009-11-11 Kai Tietz * 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. 2009-10-19 Jakub Jelinek * charset.c (cpp_init_iconv): Initialize utf8_cset_desc. (_cpp_destroy_iconv): Destroy utf8_cset_desc, char16_cset_desc and char32_cset_desc. (converter_for_type): Handle CPP_UTF8STRING. (cpp_interpret_string): Handle CPP_UTF8STRING and raw-strings. * directives.c (get__Pragma_string): Handle CPP_UTF8STRING. (parse_include): Reject raw strings. * include/cpplib.h (CPP_UTF8STRING): New token type. * internal.h (struct cpp_reader): Add utf8_cset_desc field. * lex.c (lex_raw_string): New function. (lex_string): Handle u8 string literals, call lex_raw_string for raw string literals. (_cpp_lex_direct): Call lex_string even for u8" and {,u,U,L,u8}R" sequences. * macro.c (stringify_arg): Handle CPP_UTF8STRING. 2009-10-14 Jakub Jelinek PR preprocessor/41543 * include/line-map.h (RESERVED_LOCATION_COUNT): Define. * line-map.c (linemap_init): Initialize highest_location and highest_line to RESERVED_LOCATION_COUNT-1 instead of 0. 2009-10-09 Jason Merrill * charset.c (_cpp_valid_ucn): Update C++0x restrictions. 2009-10-09 Neil Vachharajani * directives.c (DIRECTIVE_TABLE): Remove DEPRECATED from ident and sccs. 2009-09-23 Loren J. Rittle * configure.ac (AC_CHECK_HEADERS after AC_LANG(C++)): Add sys/stat.h. * configure: Rebuilt. 2009-09-22 Richard Guenther PR pch/38987 * files.c (pch_open_file): Disallow non-toplevel PCH inclusion. 2009-09-18 Chris Demetriou PR preprocessor/28435: * include/cpplib.h (struct cpp_options): Add new member deps.need_preprocessor_output. * files.c (open_file_failed): If preprocessor output is needed always report an error. 2009-09-13 Kai Tietz * configure.ac: Set for i?86-w64-mingw* need_64bit_hwint to yes. * configure: Regenerated. 2009-09-10 Jason Merrill * directives.c (cpp_define): constify. 2009-09-02 Ian Lance Taylor * macro.c (stringify_arg): Escape CPP_WCHAR tokens. 2009-08-24 Ralf Wildenhues * configure.ac (AC_PREREQ): Bump to 2.64. 2009-08-22 Ralf Wildenhues * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. 2009-08-17 Tom Tromey PR preprocessor/41067: * charset.c (convert_escape): Add missing ":" to error text. 2009-07-27 Douglas B Rupp * include/cpplib.h (INO_T_CPP): New macro. (struct cpp_dir): Use it. 2009-07-20 Jerry Quinn PR regression/40800 * configure.ac: Use = instead of == for testing ENABLE_BUILD_WITH_CXX. * configure: Rebuild. 2009-07-17 Jerry Quinn * directives.c (do_linemarker, do_line): Use CPP_STRING for ignored enum value. * files.c (find_file_in_dir): Add cast from void* to char*. * symtab.c (ht_lookup_with_hash): Add cast from void* to char*. * Makefile.in: (WARN_CFLAGS): Use general and C-specific warnings. (CXX, CXXFLAGS, WARN_CXXFLAGS, ALL_CXXFLAGS, ENABLE_BUILD_WITH_CXX, CCDEPMODE, CXXDEPMODE, COMPILER, COMPILER_FLAGS): New. (DEPMODE): Set from CCDEPMODE or CXXDEPMODE. (COMPILE.base): Use COMPILER instead of CC. Use COMPILER_FLAGS instead of ALL_CFLAGS. * configure.ac: Invoke AC_PROG_CXX. Separate C-specific warnings from other warnings. Add -Wc++-compat to C-specific warnings. Check for --enable-build-with-cxx. Set and substitute ENABLE_BUILD_WITH_CXX. Invoke ZW_PROG_COMPILER_DEPENDENCIES according to ENABLE_BUILD_WITH_CXX. Invoke AC_LANG before AC_CHECK_HEADERS. * configure: Rebuild. * include/cpp-id-data.h: Remove extern "C". * include/line-map.h: Likewise. * include/mkdeps.h: Likewise. * include/symtab.h: Likewise. * internal.h: Likewise. 2009-06-23 Manuel Lopez-Ibanez * directives.c (parse_include): Add location argument. Update all calls. (parse_answer): Likewise. (do_include_common): Error with exact location. (parse_assertion): Likewise. 2009-06-18 Manuel López-Ibáñez * expr.c (num_div_op): Take explicit location. 2009-06-17 Ian Lance Taylor * include/cpplib.h (progname): Don't declare. 2009-06-12 Ian Lance Taylor * 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++. 2009-06-01 Aldy Hernandez * include/line-map.h (LAST_SOURCE_COLUMN): New. 2009-06-01 Ian Lance Taylor * include/cpp-id-data.h: Add extern "C". * include/line-map.h: Likewise. * include/mkdeps.h: Likewise. * include/symtab.h: Likewise. * internal.h: Likewise. 2009-05-15 Ian Lance Taylor * include/cpplib.h (enum cpp_builtin_type): Rename from enum builtin_type. Change all uses. 2009-05-14 Manuel Lopez-Ibanez PR cpp/36674 * directives (do_linemarker): Compensate for the increment in location that occurs when we reach the end of line. * files (_cpp_stack_include): Mention _cpp_find_file in the comment. 2009-05-10 Joseph Myers * include/cpplib.h (enum cpp_token_fld_kind): Add CPP_TOKEN_FLD_TOKEN_NO. (struct cpp_macro_arg, struct cpp_identifier): Define. (union cpp_token_u): Use struct cpp_identifier for identifiers. Use struct cpp_macro_arg for macro arguments. Add token_no for CPP_PASTE token numbers. * directives.c (_cpp_handle_directive, lex_macro_node, do_pragma, do_pragma_poison, parse_assertion): Use val.node.node in place of val.node. * expr.c (parse_defined, eval_token): Use val.node.node in place of val.node. * lex.c (cpp_ideq, _cpp_lex_direct, cpp_token_len, cpp_spell_token, cpp_output_token, _cpp_equiv_tokens, cpp_token_val_index): Use val.macro_arg.arg_no or val.token_no in place of val.arg_no. Use val.node.node in place of val.node. * macro.c (replace_args, cpp_get_token, parse_params, lex_expansion_token, create_iso_definition, cpp_macro_definition): Use val.macro_arg.arg_no or val.token_no in place of val.arg_no. Use val.node.node in place of val.node. 2009-05-03 Joseph Myers * charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte UTF-8 sequences. 2009-04-25 Joseph Myers PR preprocessor/39559 * expr.c (cpp_interpret_integer): Use a pedwarn for decimal constants larger than intmax_t in C99 mode. 2009-04-21 Taras Glek * include/cpp-id-data.h: Update GTY annotations to new syntax. * include/cpplib.h: Likewise. * include/line-map.h: Likewise. * include/symtab.h: Likewise. 2009-04-22 Manuel Lopez-Ibanez PR c++/14875 * 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. 2009-04-21 Manuel Lopez-Ibanez PR c++/13358 * 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. 2009-04-19 Joseph Myers PR preprocessor/20078 * include/cpp-id-data.h (struct cpp_macro): Add extra_tokens field. * include/cpplib.h (SP_DIGRAPH, SP_PREV_WHITE): Define. (struct cpp_token): Change flags to unsigned short. * lex.c (_cpp_lex_direct): Initialize arg_no for CPP_PASTE tokens. (_cpp_equiv_tokens): Check arg_no for CPP_PASTE tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_ARG_NO for CPP_PASTE tokens. * macro.c (macro_real_token_count): New. (enter_macro_context, replace_args): Use macro_real_token_count. (create_iso_definition): Record whitespace surrounding and digraph spelling of # and ## tokens using SP_PREV_WHITE and SP_DIGRAPH. Set extra_tokens and save CPP_PASTE tokens with arg_no set for multiple consecutive ## tokens. (_cpp_create_definition): Initialize extra_tokens. (cpp_macro_definition): Use macro_real_token_count. 2009-04-18 Joseph Myers * directives.c (parse_include): Pass true to check_eol. 2009-04-18 Joseph Myers PR preprocessor/39646 * include/line-map.h (enum lc_reason): Add LC_RENAME_VERBATIM. * line-map.c (linemap_add): Handle LC_RENAME_VERBATIM. * directives.c (do_line, do_linemarker): Use LC_RENAME_VERBATIM in place of LC_RENAME. 2009-04-18 Joseph Myers PR preprocessor/39647 * directives.c (check_eol): Add parameter expand. (do_undef, parse_include, do_line, do_linemarker, do_ident, do_pragma_once, do_pragma_system_header, do_ifdef, do_ifndef, do_else, do_endif, do_assert, do_unassert): All callers changed. Pass true from do_line, false elsewhere. 2009-04-12 Joseph Myers PR preprocessor/31869 * macro.c (stringify_arg): Handle NULL source token in padding token where previous padding token did not have source token with preceding whitespace. 2009-04-09 Jakub Jelinek * Makefile.in: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * charset.c: Likewise. * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * identifiers.c: Likewise. * include/cpp-id-data.h: Likewise. * include/cpplib.h: Likewise. * include/line-map.h: Likewise. * include/mkdeps.h: Likewise. * include/symtab.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * macro.c: Likewise. * makeucnid.c: Likewise. * mkdeps.c: Likewise. * pch.c: Likewise. * symtab.c: Likewise. * system.h: Likewise. * traditional.c: Likewise. * ucnid.tab: Likewise. * ucnid.h: Regenerate. 2009-04-01 Janis Johnson PR c/39027 * include/cpplib.h (CPP_N_DEFAULT): Define. * expr.c (interpret_float_suffix): Recognize d or D for double, return new value for default. (cpp_classify_number): Issue pedwarn for use of d or D in suffix. PR c/33466 * expr.c (interpret_float_suffix): Reject invalid suffix that uses letters from decimal float and fixed-point suffixes. 2009-03-31 Joseph Myers PR preprocessor/15638 * files.c (_cpp_find_file): Call open_file_failed after diagnosing invalid PCH. (open_file_failed): Make error for missing file fatal. * include/cpplib.h (CPP_DL_FATAL): Define. 2009-03-30 Sergiy Vyshnevetskiy PR preprocessor/31932: * internal.h: Don't mention HAVE_ICONV_H. * configure, config.in: Rebuild. * configure.ac: Don't check for iconv.h. 2009-03-30 Tom Tromey PR preprocessor/39512: * line-map.c (linemap_init): Initialize 'reallocator' field. 2009-03-30 Jakub Jelinek PR target/39558 * macro.c (cpp_get_token): If macro_to_expand returns NULL and used some tokens, add CPP_PADDING before next token. 2009-03-29 Joseph Myers PR preprocessor/34695 * 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. 2009-03-28 Joseph Myers * Makefile.in (po/$(PACKAGE).pot): Use $(mkinstalldirs) not mkinstalldirs. 2009-03-18 Jakub Jelinek * include/cpplib.h (struct cpp_dir): Reorder fields for 64-bit hosts. 2009-02-21 Joseph Myers * lex.c (lex_string): Return a CPP_LESS token for missing '>' in a header name. (_cpp_lex_direct): Handle this. 2009-02-15 Richard Guenther Revert last change. 2009-02-13 Richard Guenther * configure.ac: Enable LFS. * configure: Re-generate. * config.in: Likewise. 2009-01-05 Ben Elliston * Makefile.in (.po.gmo): Use mkinstalldirs, not test -d || mkdir. (.po.pox): Likewise. (po/$(PACKAGE).pot): Likewise. 2008-12-10 Alexandre Oliva PR target/37033 * pch.c (cpp_valid_state): Improve message for poisoned symbols. Allow for differences in __GCC_HAVE_DWARF2_CFI_ASM. 2008-11-29 Joseph Myers * lex.c (cpp_token_len): Use 6 as default length. 2008-10-31 Manuel López-Ibáñez * expr.c (struct op): Add location. (_cpp_parse_expr): Propagate locations throught the stack of expressions. (reduce): Likewise. (check_promotion): Use explicit location in errors. 2008-10-05 Matthew Gingell Arnaud Charlet * 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. 2008-09-18 Simon Baldwin * 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. 2008-07-31 Jakub Jelinek PR preprocessor/36649 * files.c (struct report_missing_guard_data): New type. (report_missing_guard): Put paths into an array instead of printing them right away. Return 1 rather than 0. (report_missing_guard_cmp): New function. (_cpp_report_missing_guards): Sort and print paths gathered by report_missing_guard callback. 2008-07-22 Manuel Lopez-Ibanez PR 28079 * directives.c (strtolinenum): Handle overflow. (do_line): Give a warning if line number overflowed. (do_linemarker): Update call to strtolinenum. 2008-07-21 Manuel Lopez-Ibanez * include/line-map.h (linenum_type): New typedef. (struct line_map): Use it. (SOURCE_LINE): Second arguments is a LOCATION not a LINE. (SOURCE_COLUMN): Likewise. * macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store source_location values in a variable of type linenum_type. * directives.c (struct if_stack): Use linenum_type. (strtoul_for_line): Rename as strtolinenum. (do_line): Use linenum_type. (do_linemarker): Use linenum_type and strtolinenum. (_cpp_do_file_change): Use linenum_t. * line-map.c (linemap_add): Likewise. (linemap_line_start): Likewise. * traditional.c (struct fun_macro): 'line' is a source_location. * errors.c (print_location): Use linenum_type. * directives-only.c (_cpp_preprocess_dir_only): Likewise. * internal.h (CPP_INCREMENT_LINE): Likewise. * lex.c (_cpp_skip_block_comment): Use source_location. 2008-07-14 Ben Elliston * include/cpplib.h (NODE_CONDITIONAL): New. (struct cpp_callbacks): New macro_to_expand field. (struct cpp_hashnode): Adjust size of flags and type fields. (cpp_peek_token): Prototype. * lex.c (cpp_peek_token): New function. (_cpp_temp_token): Protect pre-existing lookaheads. * macro.c (cpp_get_token): Expand any conditional macros. (_cpp_backup_tokens_direct): New. (_cpp_backup_tokens): Call _cpp_backup_tokens_direct. (warn_of_redefinition): Silently allow redefined conditional macros. (_cpp_create_definition): Remove the conditional flag when a user defines one of the conditional macros. * internal.h (_cpp_backup_tokens_direct): New prototype. 2008-06-13 Andrew Haley PR preprocessor/33305 * macro.c (replace_args): Print a warning for empty macro arguments in C89 and C++. 2008-06-17 Ralf Wildenhues * Makefile.in ($(srcdir)/aclocal.m4): Update dependencies. * configure: Regenerate. 2008-06-16 Ralf Wildenhues * Makefile.in (datarootdir): New variable. 2008-06-12 H.J. Lu PR preprocessor/36479 * charset.c (cpp_interpret_string_notranslate): Also set narrow_cset_desc.width. 2008-06-07 Joseph Myers * configure.ac (parisc*64*-*-*): Remove. * configure: Regenerate. 2008-05-30 Tom Tromey PR preprocessor/36320: * internal.h (_cpp_parse_expr): Update. * expr.c (_cpp_parse_expr): Add 'is_if' argument. Update error messages. * directives.c (do_if): Update. (do_elif): Require expression if processing group. 2008-05-30 Danny Smith * include/cpplib.h (struct cpp_dir): Add new field, canonical_name. 2008-05-21 Tom Tromey PR preprocessor/27777: * lex.c (cpp_output_line_to_string): New function. * internal.h (_cpp_begin_message): Don't declare. * errors.c (_cpp_begin_message): Now static. * include/cpplib.h (cpp_output_line_to_string): Declare. * directives.c (do_diagnostic): Rewrote. Use cpp_output_line_to_string. Don't use _cpp_begin_message. 2008-05-21 Tom Tromey * include/symtab.h (HT_ALLOCED): Remove. (ht_purge): Declare. * symtab.c (DELETED): New define. (ht_lookup): Update comment. (ht_lookup_with_hash): Handle deleted entries. Remove HT_ALLOCED code. Use subobject allocator for strings, if it exists. (ht_expand): Handle deleted entries. (ht_forall): Likewise. (ht_purge): New function. (ht_dump_statistics): Print deletion statistics. 2008-05-13 Tom Tromey PR preprocessor/22168: * include/cpplib.h (struct cpp_options) : Update documentation. * expr.c (eval_token): Warn for use of assertions. * directives.c (directive_diagnostics): Warn about extensions. (DEPRECATED): New define. (DIRECTIVE_TABLE): Use it. 2008-05-06 Tom Tromey PR preprocessor/35313, PR preprocessor/36088: * expr.c (optab) : Set precedence to 4. (reduce) : Special case CPP_COMMA and CPP_COLON. 2008-05-04 David S. Miller * configure.ac (sparc*-*-*): Always set need_64bit_hwint to yes. * configure: Regenerate. 2008-04-22 Daniel Franke * include/cpplib.h (cpp_define_formatted): New. * directives.c (cpp_define_formatted): New. 2008-04-21 Tom Tromey PR libcpp/33415: * charset.c (_cpp_convert_input): Add buffer_start argument. Ignore UTF-8 BOM if seen. * internal.h (_cpp_convert_input): Add argument. * files.c (struct _cpp_file) : New field. (destroy_cpp_file): Free buffer_start, not buffer. (_cpp_pop_file_buffer): Likewise. (read_file_guts): Update. 2008-04-18 Kris Van Hees * 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) : New field. (struct cpp_reader) : Idem. (struct cpp_reader) : 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}. 2008-04-18 Paolo Bonzini PR bootstrap/35457 * aclocal.m4: Regenerate. * configure: Regenerate. 2008-04-17 Tom Tromey PR libcpp/34866: * errors.c (cpp_error): Don't reference a token before the start of the current run. 2008-04-16 Tom Tromey * Makefile.in (TAGS_SOURCES): New variable. (TAGS): New target. 2008-04-11 Kaz Kojima * configure.ac: (need_64bit_hwint): Need 64bit hwint for sh-*-* and shbe-*-*. * configure: Rebuilt. 2008-04-02 Joseph Myers * include/cpplib.h (struct cpp_callbacks): Add used_define, used_undef and before_define. (NODE_USED): Define. * directives.c (do_define, do_undef, undefine_macros, do_ifdef, do_ifndef, cpp_pop_definition): Handle new flag and use new callbacks. * expr.c (parse_defined): Handle new flag and use new callbacks. * macro.c (enter_macro_context, _cpp_free_definition): Handle new flag and use new callbacks. 2008-04-01 Jakub Jelinek PR pch/13675 * files.c (struct _cpp_file): Remove pch field. (pch_open_file): Don't set file->pch, just file->pchname. (should_stack_file): After pfile->cb.read_pch call free pchname and clear pchname, don't close file->fd. Test file->pchname instead of file->pch. Don't close fd after cb. (_cpp_stack_include): Test file->pchname instead of file->pch. 2008-03-28 Tom Tromey * Makefile.in (POSTCOMPILE): New variable. (.c.o): Use it. 2008-03-13 Tom Tromey PR libcpp/35322: * directives.c (destringize_and_run): Set pfile->directive. 2008-03-06 Markus Milleder PR preprocessor/35458 * mkdeps.c (munge): Quote '#' with a '\'. 2008-02-27 Ralf Wildenhues PR preprocessor/35379 * mkdeps.c (deps_write): Ensure the first target always appears in the first column, without leading backslash newline. Avoid some more extra whitespace. 2008-02-25 Thiemo Seufer * Makefile.in ($(srcdir)/config.in): Depend on configure.ac. 2008-02-19 Tom Tromey * traditional.c (lex_identifier): Use CPP_HASHNODE. * lex.c (lex_identifier): Use CPP_HASHNODE. * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Wrap in do-while. * identifiers.c (alloc_node): Change return type. (_cpp_init_hashtable): Don't cast 'alloc_node'. (proxy_assertion_broken): New declaration. (cpp_forall_identifiers): Move comment. * line-map.c (linemap_add): Comment fix. (linemap_line_start): Indentation fix. 2008-01-25 Jakub Jelinek PR preprocessor/34692 * macro.c (collect_args): Add pragma_buff argument. Push CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather than into arguments. Reset prevent_expansion and parsing_args state at CPP_PRAGMA_EOL/CPP_EOF. (funlike_invocation_p): Add pragma_buff argument, pass it through to collect_args. (enter_macro_context): Add result argument. Adjust funlike_invocation_p caller. Emit all deferred pragma tokens gathered during collect_args before the expansion, add a padding token. Return 2 instead of 1 if any pragma tokens were prepended. (cpp_get_token): If enter_macro_context returns 2, don't return a padding token, instead cycle to grab CPP_PRAGMA token. * directives.c (_cpp_handle_directive): If was_parsing_args in deferred pragma, leave parsing_args and prevent_expansion as is. 2008-01-22 Tom Tromey PR c++/34859 * macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS. 2008-01-07 Fred Fish PR preprocessor/30363 * traditional.c (replace_args_and_push): Add local variable cxtquote, calculate the replacement text size assuming a worst case of every input character quoted with backslash, and properly handle output quoting of quote characters in actual arguments used in function-like macros. 2008-01-03 Tom Tromey PR preprocessor/34602 * directives.c (do_line): Don't try to spell EOF token. (do_linemarker): Add comment. 2007-12-11 DJ Delorie * charset.c (convert_using_iconv): Close out any shift states, returning to the initial state. 2007-12-06 Tom Tromey PR c/29172 * internal.h (struct cpp_reader) : Changed type. : Removed. * files.c (FILE_HASH_POOL_SIZE): New macro. (struct file_hash_entry_pool): New. (destroy_all_cpp_files): New function. (allocate_file_hash_entries): Allocate a file_hash_entry_pool. (new_file_hash_entry): Update. (free_file_hash_entries): New function. (_cpp_cleanup_files): Call free_file_hash_entries and destroy_all_cpp_files. (cpp_clear_file_cache): New function. * include/cpplib.h (cpp_clear_file_cache): Declare. 2007-12-03 Tom Tromey PR preprocessor/34288 * configure.ac, config.in: Rebuilt. * configure.ac: Check for ssize_t. 2007-11-30 Tom Tromey PR preprocessor/32868 * macro.c (_cpp_create_definition): Special case __STDC_FORMAT_MACROS. 2007-11-16 Michael Matz * files.c (search_path_head): Fix check for absolute paths. 2007-11-11 Tom Tromey PR c++/17557 * include/cpplib.h (cpp_included_before): Declare. * files.c (struct file_hash_entry) : New field. (_cpp_find_file): Initialize new field. (make_cpp_dir): Likewise. (cpp_included_before): New function. 2007-11-01 Tom Tromey PR preprocessor/30805 * macro.c (paste_tokens): Handle padding token. (paste_tokens): Don't abort unless padding has PASTE_LEFT flag. 2007-10-31 Tom Tromey PR preprocessor/30786 * macro.c (builtin_macro): Return result of _cpp_do__Pragma. * directives.c (_cpp_do__Pragma): Return error status. * internal.h (_cpp_do__Pragma): Update. * directives.c (get__Pragma_string): Back up if EOF seen. 2007-09-06 Tom Tromey * internal.h (struct cpp_reader) : New field. (struct cpp_reader) : 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) : Likewise. (struct line_maps) : 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. 2007-08-30 Chao-ying Fu * expr.c (interpret_float_suffix): Support hr, r, lr, llr, uhr, ur, ulr, ullr, hk, k, lk, llk, uhk, uk, ulk, ullk. (cpp_classify_number): Support decimal fixed-point constants without exponents. Warn about fixed-point constants when -pedantic. * include/cpplib.h (CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE): Change comments to support fixed-point values. (CPP_N_FRACT, CPP_N_ACCUM): Define. 2007-08-18 Tom Tromey PR preprocessor/32974 * directives.c (parse_include): Don't check for EOL when processing #pragma dependency. 2007-07-30 Ollie Wild * 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. 2007-07-04 Uros Bizjak * traditional.c (_cpp_scan_out_logical_line): Initialize fmacro.args, fmacro.node, fmacro.offset, fmacro.line and fmacro.args to prevent 'may be used uninitialized' warning. 2007-07-03 Uros Bizjak * include/cpplib.h (CPP_N_WIDTH_MD, CPP_N_MD_W, CPP_N_MD_Q): Add new constants. * expr.c (interpret_float_suffix): Process 'w', 'W', 'q' and 'Q' suffixes. Return CPP_N_MD_W for 'w' or 'W' suffixes and CPP_N_MD_Q for 'q' or 'Q' suffixes. 2007-06-17 Danny Smith * files.c (open_file): Prevent the call for stat from overwriting errno. 2007-06-09 Vladimir Prus * files.c (open_file): Account for the fact that on windows, opening a directory gives EACCES. 2007-06-05 Joerg Wunsch PR preprocessor/23479 * expr.c (cpp_classify_number): Implement 0b-prefixed binary integer constants. (append_digit): Likewise. * include/cpplib.h: Add CPP_N_BINARY, to be used for 0b-prefixed binary integer constants. 2007-05-31 Dave Korn PR preprocessor/14331 * lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF. 2007-05-24 Ollie Wild * 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. 2007-05-23 Simon Martin PR preprocessor/20077 * macro.c (create_iso_definition): Fixed the method to determine whether the token-pasting operator appears at the beginning or the end of a macro. 2007-05-21 Ian Lance Taylor * internal.h (struct cpp_reader): Add new fields: nonexistent_file_hash and nonexistent_file_ob. * files.c: Include "obstack.h". (find_file_in_dir): Before trying to open the file, look up the path name in the hash table of nonexistent files. After failing to open the file, add the path name to the hash table. (_cpp_find_file): Cache the results of looking up the file name starting with the quote and bracket chain heads, if we can. (nonexistent_file_hash_eq): New static function. (_cpp_init_files): Initialize pfile->nonexistent_file_hash and pfile->nonexistent_file_ob. (_cpp_cleanup_files): Free pfile->nonexistent_file_hash and pfile->nonexistent_file_ob. 2007-05-14 Janis Johnson * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic. PR c/31924 * expr.c (interpret_float_suffix): Check for invalid suffix. 2007-05-02 Eric Christopher * expr.c (num_div_op): Don't overflow if the result is zero. 2007-05-02 Tom Tromey PR preprocessor/28709 * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs. 2007-03-30 Michael Meissner * directives.c (lex_macro_node_from_str): Fix alloca call to be type correct. 2007-03-30 Richard Henderson * directives.c (lex_macro_node_from_str): New. (cpp_push_definition, cpp_pop_definition): New. * include/cpplib.h (cpp_push_definition, cpp_pop_definition): Declare. 2007-03-01 Brooks Moses * Makefile.in: Add dummy install-pdf target. 2007-01-30 Tom Tromey PR preprocessor/30468 * mkdeps.c (apply_vpath): Strip successive '/'s if we stripped './'. 2007-01-30 Tom Tromey PR preprocessor/29966 * macro.c (lex_expansion_token): Save and restore cpp_reader's cur_token. (_cpp_create_definition): Don't restore cur_token here. * lex.c (_cpp_lex_token): Added assertion. 2007-01-27 Tom Tromey * configure: Rebuilt. 2007-01-12 Tom Tromey PR preprocessor/28227 * directives.c (lex_macro_node): Added 'is_def_or_undef' argument. (do_define): Update. (do_undef): Update. (do_ifdef): Update. (do_ifndef): Update. 2007-01-11 Paolo Bonzini * configure: Regenerate. 2007-01-11 Paolo Bonzini * configure: Regenerate. 2007-01-04 Tom Tromey PR preprocessor/28165 * internal.h (cpp_in_primary_file): New function. * directives.c (do_include_next): Use cpp_in_primary_file. (do_pragma_once): Likewise. (do_pragma_system_header): Likewise. 2006-12-29 Ian Lance Taylor * lex.c (_cpp_clean_line): Add uses of __builtin_expect. Don't look backward at the end of the line unless we saw a backslash. 2006-12-29 Jakub Jelinek PR preprocessor/29612 * directives.c (do_linemarker): Set pfile->buffer->sysp always, not only when new_sysp is non-zero. 2006-12-28 Tom Tromey PR preprocessor/30001 * charset.c (_cpp_convert_input): Check that to.len is greater than zero. 2006-11-20 Trevor Smigiel * configure.ac (need_64bit_hwint): Need 64bit hwint for SPU. * configure: Rebuilt. 2006-11-01 Douglas Gregor * 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. 2006-10-29 Joseph Myers * configure.ac (need_64bit_hwint): Set for i[34567]86-*-linux* depending on --enable-targets=all. * configure: Regenerate. 2006-10-12 Jakub Jelinek PR preprocessor/28709 * macro.c (paste_tokens): Do error reporting here, use BUF with the spelled LHS token as opposed to spelling it again. (paste_all_tokens): Don't report errors here, just break on failure. 2006-10-10 Brooks Moses * Makefile.in: Added empty "pdf" target. 2006-09-22 Geoffrey Keating * configure.ac: Make need_64_bit_hwint case for x86-darwin match exactly the glob in gcc/config.gcc. * configure: Regenerate. 2006-09-13 Joseph S. Myers PR c/28768 PR preprocessor/14634 * lex.c (lex_string): Pedwarn for unterminated literals. 2006-09-08 Eric Christopher * configure.ac: Add 64-bit HWI support for i?86-darwin. 2006-08-14 Steve Ellcey PR c++/28288 PR c++/14556 * include/cpplib.h: Remove ?, ?= tokens. (CPP_LAST_EQ): Change. (CPP_LAST_PUNCTUATOR): Change. * expr.c (cpp_operator): Remove MIN and MAX. (reduce): Remove CPP_MIN and CPP_MAX. (num_binary_op): Ditto. * lex.c (_cpp_lex_direct): Ditto. (cpp_avoid_paste): Remove ? as legal symbol after > or <. 2006-06-09 Jakub Jelinek PR preprocessor/27746 * directives.c (do_pragma): Handle pragma with valid namespace and invalid name coming from macro expansion. * directives.c (destringize_and_run): Initialize next field in context. PR c/27747 PR c++/27748 * directives.c (destringize_and_run): Set NO_EXPAND on the tokens. * macro.c (_cpp_backup_tokens): Fix comment typo. 2006-05-31 Daniel Jacobowitz * Makefile.in (CATALOGS): Add po/ prefix. * configure: Regenerated. 2006-05-23 Carlos O'Donell * Makefile.in: Add install-html target. Add install-html to .PHONY 2006-02-17 Grigory Zagorodnev * 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. 2006-01-23 Jakub Jelinek 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) : Only check cpp_in_system_header condition. 2006-01-05 Paolo Bonzini * Makefile.in: Use -MMD instead of -MD. 2006-01-04 Dmitry Kurochkin Richard Henderson Merge from gomp branch: * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. 2006-01-01 Jakub Jelinek PR c++/25294 * directives.c (do_pragma): If pragma line ends with multi-line block comment, end the saved deferred pragma string before that comment. Handle embedded '\0' chars on the pragma line. 2005-12-22 Volker Reichelt PR c++/23333 * include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure. 2005-12-07 Jon Grimm Ben Elliston * include/cpplib.h (CPP_N_DFLOAT): New. * expr.c (interpret_float_suffix): Identify df, dd, and dl suffixes as decimal floating point constants. (cpp_classify_number): Disallow hexadecimal DFP constants. 2005-11-14 Gerald Pfeifer Ian Lance Taylor * include/cpplib.h (struct cpp_callbacks): Annotate error with ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0). 2005-11-09 Per Bothner Uros Bizjak PR c/24101 * init.c (read_original_filename): Temporarily set state.in_directive before calling _cpp_lex_direct for CPP_HASH tokens. 2005-11-03 James E Wilson PR preprocessor/24202 * files.c (_cpp_pop_file_buffer): Set buffer_valid to false. 2005-11-04 Joseph S. Myers * include/cpplib.h (struct cpp_callbacks): Make error take va_list* parameter. * errors.c (cpp_error): Update call to callback. 2005-11-03 Andrew Pinski PR preprocessor/22042 * macro.c (_cpp_builtin_macro_text): Lower the needed max buffer size. (cpp_quote_string): Don't octalify non printable charactors. 2005-11-03 Joseph S. Myers PR c++/17964 * include/cpplib.h (struct cpp_options): Add client_diagnostic. (struct cpp_callbacks): Add error. * errors.c (cpp_error): If client_diagnostic, use error callback. * charset.c (convert_escape): Don't use %03o in diagnostic. 2005-10-21 James E Wilson 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. 2005-10-08 Kazu Hirata * configure.ac: Require 64-bit int for arm*-*-*eabi*. * configure: Regenerate. 2005-10-04 Ian Lance Taylor PR preprocessor/13726 * directives.c (check_eol_return_comments): New static function. (parse_include): Add buf parameter. Change all callers. (do_include_common): If not discard comments, turn on save_comments. Pass collected comments to include callback. * include/cpplib.h (struct cpp_callbacks): Add new parameter to include callback: cpp_token list. 2005-09-20 Joseph S. Myers * 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. 2005-08-30 Jakub Jelinek PR preprocessor/20348 PR preprocessor/20356 * files.c (_cpp_find_file, search_cache): Revert 2004-06-26 and 2004-06-05 changes. 2005-07-23 Kaveh R. Ghazi * configure.ac (ACX_PROG_CC_WARNING_OPTS): add -Wmissing-format-attribute. * configure: Regenerate. 2005-06-29 Kelley Cook * all files: Update FSF address in copyright headers. * makeucnid.c (write_copyright): Update outputted FSF address. 2005-06-13 Zack Weinberg * configure.ac: Invoke ZW_CREATE_DEPDIR and ZW_PROG_COMPILER_DEPENDENCIES. * aclocal.m4, configure: Regenerate. * Makefile.in (DEPMODE, DEPDIR, depcomp, COMPILE.base, COMPILE): New variables. (distclean): Clean up $(DEPDIR) and its contents. (.c.o): Use $(COMPILE). Include $(DEPDIR)/*.Po for most object->header dependencies. 2005-05-28 Gabriel Dos Reis * 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. 2005-05-12 Zack Weinberg * directives.c (#sccs table entry): Mark IN_I, consistent with #ident. (do_sccs): Delete function definition, #define to do_ident. (do_ident): Don't hardwire directive name. 2005-05-12 Ryota Kunisawa PR bootstrap/21230 * configure: Regenerate. 2005-04-27 Andris Pavenis * files.c: Include io.h for DJGPP to get prototype of setmode. 2005-04-19 Per Bothner PR preprocessor/20907 * line-map.c (linemap_line_start): Fix bug when we need to increse column_bits but can re-use the current line_map. 2005-04-19 Kaveh R. Ghazi * system.h (fopen, fdopen, freopen): Define these to the unlocked libiberty functions. 2005-04-11 Kaveh R. Ghazi * configure.ac (libcpp_UNLOCKED_FUNCS): New. (AC_CHECK_FUNCS, AC_CHECK_DECLS): Check for libcpp_UNLOCKED_FUNCS. * system.h (putchar, getc, getchar, clearerr, feof, fileno, fflush, fgetc, fgets, ferror, fread): Redefine to the associated _unlocked function. (fwrite_unlocked): Fix prototype. * configure, config.in: Regenerate. 2005-04-05 Jakub Jelinek PR preprocessor/19475 * macro.c (create_iso_definition): For < ISO C99, don't pedwarn if there is no whitespace between macro name and its replacement, but the replacement starts with a basic character set character. 2005-03-28 Andreas Jaeger * lex.c (warn_about_normalization): Cast field width to int to avoid warning. 2005-03-19 Joseph S. Myers * configure.ac: Consistently use solaris2.1[0-9]* instead of solaris2.1[0-9]. * configure: Regenerate. 2005-03-15 Geoffrey Keating * charset.c (_cpp_valid_ucn): In identifiers, reject a partial UCN rather than printing an error. 2005-03-14 Geoffrey Keating * lex.c (forms_identifier_p): Disable UCNs in C89 mode. 2005-03-14 Geoffrey Keating * 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. 2005-03-11 Geoffrey Keating * directives.c (glue_header_name): Update call to cpp_spell_token. * internal.h (_cpp_interpret_identifier): New. * charset.c (_cpp_interpret_identifier): New. (_cpp_valid_ucn): Allow UCN version of '$'. * lex.c (lex_identifier): Add extra parameter to indicate if initial character was '$' or '\'. Support identifiers with UCNs. (forms_identifier_p): Allow UCNs. (_cpp_lex_direct): Pass extra parameter to lex_identifier. (utf8_to_ucn): New. (cpp_spell_token): Add FORSTRING parameter. Use it. (cpp_token_as_text): Update call to cpp_spell_token. (cpp_output_token): Write UCNs back out. (stringify_arg): Update call to cpp_spell_token. (paste_tokens): Likewise. (cpp_macro_definition): Likewise. * macro.c (stringify_arg): Likewise. (paste_tokens): Likewise. (cpp_macro_definition): Likewise. * include/cpplib.h: Add parameter to cpp_spell_token. 2005-03-04 Jakub Jelinek PR bootstrap/20282 PR bootstrap/20305 * macro.c (replace_args, cpp_get_token): Copy whole cpp_token_u instead of just cpp_string field from it. 2005-02-28 Devang Patel * directives.c (do_line): Save sysp early before line table is realloc'ed. 2005-02-20 Zack Weinberg PR 18785 * charset.c (LAST_POSSIBLY_BASIC_SOURCE_CHAR): New helper macro. (cpp_host_to_exec_charset): New function. * include/cpplib.h: Declare cpp_host_to_exec_charset. 2005-02-19 Devang Patel * charset.c (_cpp_convert_input): Check '\r' before inserting '\n' at the end. 2005-02-15 Eric Christopher PR preprocessor/19077 * macro.c (cpp_macro_definition): Move handling of whitespace to PREV_WHITE conditional. Remove overloading of len variable. 2005-02-14 Kazu Hirata * directives.c, files.c, init.c, internal.h, macro.c, pch.c, traditional.c: Update copyright. 2005-02-14 Paolo Bonzini PR bootstrap/19818 * configure.ac: Check for declaration of basename and getopt. * config.in: Regenerate. * configure: Regenerate. * internal.h (ustrcspn): New. * macro.c (create_iso_definition): Fix allocation of memory. (padding_token): Add cast to remove const-ness. * pch.c (cpp_read_state): Use ustrcspn. 2005-02-08 Mike Stump * files.c (pchf_adder): Remove. (struct pchf_adder_info): Likewise. (_cpp_save_file_entries): Write out all files so that #import works. 2005-01-23 Joseph S. Myers * configure: Regenerate. 2005-01-11 Tobias Schlueter * include/cpplib.h (c_lang): Fix comment to say cpp_create_reader. * include/cpplib.h: Also update copyright years. 2005-01-03 Geoffrey Keating * files.c (_cpp_find_file): Add files found by search_path_exhausted to the list of all files. 2005-01-01 Gabriel Dos Reis * internal.h: Update references to Cpp lib filenames. * directives.c: Likewise. * init.c: Likewise. * macro.c: Likewise. * traditional.c: Likewise. 2004-12-15 Eric Botcazou PR preprocessor/15167 * files.c (destroy_cpp_file): New function. (should_stack_file): Make a new file if the compared file is still stacked. 2004-11-28 Nathanael Nerode PR preprocessor/17610 * directives.c (do_include_common): Error out if an empty filename is given for #include (or #include_next or #import). 2004-11-27 Roger Sayle Zack Weinberg * internal.h: Replace all uses of uchar with unsigned char. * include/cpp-id-data.h: Likewise. Guard typedef of uchar with !IN_GCC, so uchar is only defined whilst building libcpp. 2004-11-24 Kelley Cook * aclocal.m4: Regenerate. 2004-11-24 Roger Sayle PR preprocessor/15824 * configure.ac: Correct HAVE_UCHAR test to #include directly, instead of the non-existant "system.h" and "ansidecl.h". * configure: Regenerate. 2004-11-23 Daniel Jacobowitz Joseph Myers * internal.h (struct lexer_state): Add in_deferred_pragma. * directives.c (struct pragma_entry): Add allow_expansion. (insert_pragma_entry): Take allow_expansion flag. (register_pragma): Likewise. (cpp_register_pragma): Likewise. (_cpp_init_internal_pragmas): Update calls to cpp_register_pragma. (do_pragma): Honor allow_expansion. (cpp_handle_deferred_pragma): Set in_deferred_pragma. * include/cpplib.h (cpp_register_pragma): Update prototype. 2004-11-18 Daniel Jacobowitz Mark Mitchell * configure.ac (i[34567]86-*-solaris2.1[0-9]*): Set need_64bit_hwint=yes. * configure: Regenerate. 2004-11-09 Joseph S. Myers * Makefile.in ($(PACKAGE).pot): New rule. Depend on po/$(PACKAGE).pot. (po/$(PACKAGE).pot): Use ":" instead of "," in --keyword arguments. Add keywords _, N_, SYNTAX_ERROR and SYNTAX_ERROR2. Remove local srcdir path from generated file. 2004-11-04 Zack Weinberg Gerald Pfeifer * internal.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H as well. 2004-10-27 Zack Weinberg PR 18075 * directives.c (do_pragma): Do not defer pragmas which are unknown. (cpp_handle_deferred_pragma): Add cast to silence warning. 2004-10-14 Joseph S. Myers * errors.c (_cpp_begin_message): Print "error: " for errors. 2004-10-10 Andreas Jaeger * makedepend.c: Include mkdeps.h for prototype of deps_add_vpath. * Makefile.in (makedepend.o): Add dependency on mkdeps.h. 2004-10-08 Andrew Pinski * pch.c (cpp_write_pch_state): Remove variable z as it is not used. (cpp_read_state): Remove unused variables, m, d and mac_count. 2004-09-29 Per Bothner * directives.c (cpp_handle_deferred_pragma): Save, clear and restore cb.line_change. Otherwise do_pragma will call the line_change call-back with a meaningless line number. 2004-09-24 Zack Weinberg * 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. 2004-09-22 Kelley Cook * Makefile.in (aclocal.m4): Update dependencies. * configure.ac (AC_CONFIG_MACRO_DIR): New. * aclocal.m4, configure: Regenerate. 2004-09-17 Zack Weinberg * charset.c (_cpp_destroy_iconv, emit_numeric_escape) (_cpp_convert_input, _cpp_default_encoding): Add comments. Some other comments in this file also tweaked. * directives.c (do_pragma): Save current buffer position before lexing the pragma keywords; don't call _cpp_backup_tokens in the defer_pragmas case. 2004-09-15 Per Bothner * include/line-map.h (line_map_start): Add parameter names so preceding comment makes sense. (linemap_add): Remove from comment mention of non-existing parameter. 2004-09-09 Matt Austern Zack Weinberg * include/cpplib.h (TTYPE_TABLE): Remove CPP_ and SPELL_ prefixes throughout. Add entry for PRAGMA. Remove unnecessary "= 0" from EQ. (enum cpp_ttype): Adjust OP and TK definitions to restore prefixes, via token-paste. (CPP_LAST_EQ, CPP_FIRST_DIGRAPH, CPP_LAST_PUNCTUATOR, CPP_LAST_CPP_OP): Change from #defines to additional cpp_ttype enumerators. (struct cpp_options): Add defer_pragmas. (cpp_handle_deferred_pragma): Prototype new interface. * internal.h (struct cpp_reader): Add directive_result. * directives.c (struct pragma_entry): Add is_internal field; give boolean fields type bool. (start_directive): Initialize pfile->directive_result.type. (_cpp_do__Pragma): Likewise. (run_directive): Do not crash if pfile->buffer->prev is NULL. (insert_pragma_entry): Add 'internal' argument; set new->is_internal from it. (register_pragma): New static function, bulk of former cpp_register_pragma here; add 'internal' argument, pass along to insert_pragma_entry. (cpp_register_pragma): Now a wrapper around register_pragma which always passes false for 'internal' argument. (_cpp_init_internal_pragmas): Call register_pragma directly, passing true for 'internal'. (do_pragma): If CPP_OPTION (pfile, defer_pragmas) and this isn't an internal pragma, save text till the end of the line as a CPP_PRAGMA token instead of executing the pragma. (cpp_handle_deferred_pragma): New interface. * lex.c (token_spellings): Adjust OP and TK definitions to match changes to cpplib.h. (_cpp_lex_token): Check for a directive-result token and return it if present. (cpp_token_val_index): Handle CPP_PRAGMA. * macro.c (cpp_builtin_macro_text): Correct comment. (builtin_macro): Handle directive-result tokens from _cpp_do__Pragma. 2004-09-06 Serge Belyshev PR preprocessor/14699 * symtab.c (ht_dump_statistics): Change type of sum_of_squares from size_t to double. 2004-08-28 Andreas Schwab Andreas Jaeger * configure.ac: Set PACKAGE correctly. * configure: Regenerated. 2004-08-25 Paolo Bonzini * Makefile.in: Add back top_builddir. 2004-08-25 Paolo Bonzini * configure.ac: Replace Automake macro invocations with manual Autoconf checks and substitutions. * configure: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * Makefile.am: Removed. * Makefile.in: Heavy simplification and reorganization. 2004-08-09 Mark Mitchell * configure.ac (arm*-*-eabi*): New target. (arm*-*-symbianelf*): Likewise. * configure: Regenerated. 2004-07-24 Bernardo Innocenti * internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Remove. * directives.c: Use XNEW-family macros from libiberty. * lex.c: Likewise. * macro.c: Likewise. * cpplib.h (cpp_deps_style): Export enum with name. 2004-07-23 Matthias Klose * init.c (init_library): Use PACKAGE for the text domain. 2004-07-16 Andris Pavenis PR preprocessor/16366 * internal.h (struct cpp_reader): New field dir_hash. * files.c (make_cpp_dir): Use dir_hash, not file_hash. (_cpp_init_files, _cpp_cleanup_files): Update for new field. 2004-07-04 Neil Booth 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. 2004-06-30 Per Bothner * include/line-map.h (fileline): Remove old typedef. * internal.h (struct cpp_reader): Use source_location typedef instead. 2004-06-26 Zack Weinberg Partially revert patch of 2004-06-05. * files.c (search_cache): Remove pfile argument. Don't check for file that would be found by "" or <> search here... (_cpp_find_file): ...do it here, before calling find_file_in_dir. Do not apply directory-of-current-file correction to files found by this check. Rearrange code slightly. 2004-06-21 Geoffrey Keating * files.c (should_stack_file): Correct swapped parameters to call to cb.read_pch. * pch.c (cpp_valid_state): Handle -fpreprocessed. 2004-06-15 Paolo Bonzini * Makefile.in: Regenerate with automake 1.8.5. * aclocal.m4: Likewise. * configure: Regenerate. 2004-06-11 Zack Weinberg * configure.ac: Don't invoke ACX_HEADER_STDBOOL. * configure, config.in: Regenerate. * system.h: Unconditionally define bool as unsigned char, BOOL_BITFIELD as unsigned int. * .cvsignore: New file. 2004-06-09 Geoffrey Keating * traditional.c (push_replacement_text): Set macro->traditional. (save_replacement_text): Likewise. * pch.c (cpp_write_pch_state): Don't write list of defined macros. (struct save_macro_item): Delete. (struct save_macro_data): Use a character array not the previous structured format. (save_macros): Save macro as text not as internal structures. (cpp_prepare_state): Update for changes to save_macro_data. (cpp_read_state): Don't read macros defined in PCH. Restore -D macros as text. * macro.c (create_iso_definition): Honour alloc_subobject. Clear traditional flag. (_cpp_create_definition): Honour alloc_subobject. * lex.c (cpp_token_val_index): New. * internal.h: Include cpp-id-data.h. (uchar): Move definition to cpp-id-data.h. (U): Likewise. (cpp_macro): Likewise. * directives.c (struct answer): Move to cpp-id-data.h. (do_assert): Honour alloc_subobject. * include/symtab.h (struct ht): Add field 'alloc_subobject'. * include/cpplib.h (struct cpp_string): Add GTY marker. (enum cpp_token_fld_kind): New. (struct cpp_token): Add GTY markers. (cpp_token_val_index): Prototype. (CPP_HASHNODE_VALUE_IDX): New. (struct cpp_hashnode): Don't skip fields of 'value' when marking. * include/cpp-id-data.h: New file. 2004-06-09 Paolo Bonzini * Makefile.am (all-local): New. * Makefile.in: Regenerate. 2004-06-06 Roger Sayle * Makefile.am (LIBICONV): Declare. (makedepend_LDADD): Use LIBICONV. * Makefile.in: Regenerate. 2004-06-05 Andrew Pinski * Makefile.am (LIBINTL): Declare (makedepend_LDADD): Use LIBINTL. * Makefile.in: Regenerate. 2004-06-05 Zack Weinberg * 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. 2004-05-29 Geoffrey Keating * symtab.c (ht_create): Set entries_owned. (ht_destroy): Honour entries_owned. (ht_expand): Likewise. (ht_load): New. * include/symtab.h (struct ht): New field 'entries_owned' (ht_load): New prototype. 2004-05-26 Paolo Bonzini PR bootstrap/15651 * configure.ac: Fix m4 quoting when picking the size of HOST_WIDE_INT. * configure: Regenerate. 2004-05-25 Paolo Bonzini * Makefile.am: the correct directory for gettext include files is given by @INCINTL@. * Makefile.in: Regenerate. 2004-05-24 Paolo Bonzini * system.h [!ENABLE_NLS]: dgettext takes two parameters. 2004-05-23 Paolo Bonzini 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. * include/cpplib.h: Moved from gcc. Change header guard name. * include/line-map.h: Moved from gcc. Change header guard name. * include/mkdeps.h: Moved from gcc. Change header guard name. * include/symtab.h: Moved from gcc/hashtable.h. Change header guard name. Copyright (C) 2004-2024 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.