blob: 3fca7fd7b03e36eb9b750fceab1c86f0f9a86e57 [file] [log] [blame]
2021-10-06 Jakub Jelinek <jakub@redhat.com>
* 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 <jakub@redhat.com>
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 <jason@redhat.com>
* macro.c (replace_args): When __VA_OPT__ is on the LHS of ##,
remove trailing avoid_paste tokens.
2021-09-01 Jakub Jelinek <jakub@redhat.com>
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 <msebor@redhat.com>
* include/line-map.h (class rich_location): Disable copying and
assignment.
2021-08-25 Lewis Hyatt <lhyatt@gmail.com>
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 <jakub@redhat.com>
* 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 <jakub@redhat.com>
PR preprocessor/101638
* macro.c (cpp_sys_macro_p): Return true instead of
crashing on builtin macros.
2021-08-05 Jakub Jelinek <jakub@redhat.com>
PR c++/100977
* ucnid.h: Regenerated using Unicode 13.0.0 files.
2021-08-05 Jakub Jelinek <jakub@redhat.com>
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 <jason@redhat.com>
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 <christophe.lyon@linaro.org>
Torbjörn Svensson <torbjorn.svensson@st.com>
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 <jakub@redhat.com>
PR preprocessor/100646
* lex.c (cpp_directive_only_process): Treat end of file as termination
for !is_block comments.
2021-05-12 Jakub Jelinek <jakub@redhat.com>
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 <joseph@codesourcery.com>
* 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 <joseph@codesourcery.com>
* lex.c (cpp_avoid_paste): Do not allow pasting CPP_NUMBER with
CPP_CHAR.
2021-05-11 Joseph Myers <joseph@codesourcery.com>
* init.c (lang_defaults): Enable digit separators for GNUC2X and
STDC2X.
2021-05-07 Jakub Jelinek <jakub@redhat.com>
PR c/100450
* lex.c (cpp_avoid_paste): Handle token1 CPP_PRAGMA like CPP_NAME.
2021-05-06 Joseph Myers <joseph@codesourcery.com>
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 <hjl.tools@gmail.com>
PR bootstrap/99703
* configure: Regenerated.
2021-04-29 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/82359
* directives.c (strtolinenum): Handle digit separators.
2021-04-19 Richard Biener <rguenther@suse.de>
PR preprocessor/100142
* line-map.c (linemap_position_for_loc_and_offset): Revert
unintended s/column_offset/column/ change.
2021-04-13 Nathan Sidwell <nathan@acm.org>
PR preprocessor/99446
* line-map.c (line-map.c): Do not advance to linemaps for
different files.
2021-04-13 Eric Botcazou <ebotcazou@adacore.com>
* 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 <dmalcolm@redhat.com>
PR c/99323
* line-map.c (rich_location::maybe_add_fixit): Reject fix-it hints
at column 0.
2021-02-24 Nathan Sidwell <nathan@acm.org>
PR c++/98718
* include/line-map.h
* line-map.c
2021-02-24 Nathan Sidwell <nathan@acm.org>
PR c++/99072
* init.c (read_original_filename): Expunge all evidence of the
original filename.
2021-02-18 Nathan Sidwell <nathan@acm.org>
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 <nathan@acm.org>
* files.c (_cpp_stack_file): Make buffers end in unread \n.
2021-02-10 David Malcolm <dmalcolm@redhat.com>
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 <jakub@redhat.com>
* expr.c (cpp_classify_number): Use make_signed_t<size_t> instead of
make_signed<size_t>::type in the diagnostics.
2021-02-03 Jakub Jelinek <jakub@redhat.com>
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 <hongtao.liu@intel.com>
PR target/98833
* lex.c (search_line_sse2): Replace builtins with == operator.
2021-01-26 Paul Fee <paul.f.fee@gmail.com>
* 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 <nathan@acm.org>
PR preprocessor/95253
* mkdeps.c (munge): Do not escape ':'.
2020-12-14 Nathan Sidwell <nathan@acm.org>
* 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 <jason@redhat.com>
* init.c (cpp_init_builtins): Update __cplusplus for C++20.
2020-12-01 JeanHeyd Meneide <phdofthehouse@gmail.com>
* 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 <joseph@codesourcery.com>
PR preprocessor/97602
* directives.c (strtolinenum): Check for overflow before it
occurs. Correct comment.
2020-11-24 Nathan Sidwell <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* include/cpplib.h (struct cpp_callbacks): Add
user_deferred_macro & translate_include.
2020-11-17 Nathan Sidwell <nathan@acm.org>
* 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 <nathan@acm.org>
PR preprocessor/97858
* mkdeps.c (munge): Drop varadic args, we only ever use one.
2020-11-13 Joseph Myers <joseph@codesourcery.com>
* 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 <phd@phd.re>
PR c++/91318
* include/cpplib.h: Added cpp_define_unused(), cpp_define_formatted_unused()
* directives.c: Likewise.
2020-11-12 Joseph Myers <joseph@codesourcery.com>
* 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 <guriev-ns@ya.ru>
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 <lhyatt@gmail.com>
* generated_cpp_wcwidth.h: Regenerated from Unicode 13.0.0 data.
2020-11-06 Nathan Sidwell <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* lex.c (_cpp_clean_line): Fix DOS off-by-one error.
2020-11-03 Nathan Sidwell <nathan@acm.org>
* init.c (cpp_read_main_file): Use cpp_get_deps result.
2020-11-03 Nathan Sidwell <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <jakub@redhat.com>
PR bootstrap/97163
* lex.c (search_line_fast): Only use _ARCH_PWR8 Altivec version
for GCC >= 4.5.
2020-09-17 Patrick Palka <ppalka@redhat.com>
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ö <martin@martin.st>
* files.c (remap_filename): Make a strchr return value pointer
to const.
2020-07-30 H.J. Lu <hjl.tools@gmail.com>
PR bootstrap/96202
* configure: Regenerated.
2020-07-29 Tiziano Müller <tiziano.mueller@chem.uzh.ch>
* init.c (builtin_array): Add xref comment.
* traditional.c (fun_like_macro): Add HAS_INCLUDE codes.
2020-07-28 Jakub Jelinek <jakub@redhat.com>
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 <nathan@acm.org>
* init.c (cpp_read_main_file): Always use the last map for
the return value.
2020-07-20 Nathan Sidwell <nathan@acm.org>
* 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 <lhyatt@gmail.com>
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 <nathan@acm.org>
* 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 <hjl.tools@gmail.com>
PR bootstrap/95413
* configure: Regenerated.
2020-05-23 David Edelsohn <dje.gcc@gmail.com>
* Makefile.in (AR): Substitute @AR@.
* configure.ac (CHECK_PROG AR): New.
* configure: Regenerate.
2020-05-20 Nathan Sidwell <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <hongjiu.lu@intel.com>
* configure: Regenerated.
2020-05-13 Jason Merrill <jason@redhat.com>
* include/cpplib.h (enum c_lang): Change CXX2A to CXX20.
* init.c, lex.c: Adjust.
2020-05-12 Nathan Sidwell <nathan@acm.org>
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 <hongjiu.lu@intel.com>
* 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 <nathan@acm.org>
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 <jakub@redhat.com>
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 <msebor@redhat.com>
* include/cpplib.h (cpp_builtin_type): Remove trailing comma to
avoid pedantic warnings in C++ 98 mode.
2020-02-04 Jakub Jelinek <jakub@redhat.com>
* 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 <andrew.burgess@embecosm.com>
* configure: Regenerate.
2020-01-28 Nathan Sidwell <nathan@acm.org>
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 <andrew.burgess@embecosm.com>
* configure: Regenerate.
2020-01-24 Nathan Sidwell <nathan@acm.org>
* expr.c (parse_has_include): Remove bogus controlling macro code.
2020-01-20 Nathan Sidwell <nathan@acm.org>
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 <dmalcolm@redhat.com>
* 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 <jakub@redhat.com>
Update copyright years.
2019-12-18 David Malcolm <dmalcolm@redhat.com>
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 <jakub@redhat.com>
PR preprocessor/92919
* charset.c (wide_str_to_charconst): If str contains just the
NUL terminator, punt quietly.
2019-12-09 David Malcolm <dmalcolm@redhat.com>
* 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 <lhyatt@gmail.com>
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 <joseph@codesourcery.com>
* 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 <jakub@redhat.com>
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 <tim@kompiler.org>
* cpplib.h: Add spaceship operator for C++.
* lex.c: Implement conditional lexing of spaceship operator for C++20.
2019-10-31 Jakub Jelinek <jakub@redhat.com>
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 <nathan@acm.org>
* 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 <joseph@codesourcery.com>
* 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 <nathan@acm.org>
PR preprocessor/91991
* line-map.c (linemap_line_start): Clear max_column_hint if we run
out of locations.
2019-10-02 Richard Biener <rguenther@suse.de>
* internal.h (enum include_type): Remove trailing comma.
2019-10-02 Joseph Myers <joseph@codesourcery.com>
* 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 <ebotcazou@adacore.com>
* 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 <lhyatt@gmail.com>
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 <nathan@acm.org>
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 <nathan@acm.org>
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 <uweigand@de.ibm.com>
* directives.c: Remove references to spu from comments.
* expr.c: Likewise.
2019-08-29 Nathan Sidwell <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <msebor@redhat.com>
* 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 <mliska@suse.cz>
* line-map.c (linemap_get_expansion_filename): Remove
dead assignemts.
* mkdeps.c (make_write): Likewise.
2019-07-02 qing zhao <qing.zhao@oracle.com>
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 <nathan@acm.org>
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 <apinski@marvell.com>
PR pch/81721
* lex.c (cpp_token_val_index <case SPELL_OPERATOR>): If tok->flags
has NAMED_OP set, then return CPP_TOKEN_FLD_NODE.
2019-05-14 Martin Liska <mliska@suse.cz>
PR preprocessor/90382
* line-map.c (first_map_in_common_1): Handle ADHOC
locations.
2019-05-14 Martin Liska <mliska@suse.cz>
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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <jwakely@redhat.com>
* files.c (search_path_exhausted): Fix typo in comment.
2019-02-26 Martin Liska <mliska@suse.cz>
* symtab.c (ht_dump_statistics): Make
horizontal alignment for statistics.
2019-02-20 David Malcolm <dmalcolm@redhat.com>
PR c/89410
* include/line-map.h (linenum_arith_t): New typedef.
(compare): Use it.
2019-02-18 Martin Liska <mliska@suse.cz>
PR c++/89383
* line-map.c (linemap_line_start): Use 1UL in order
to not overflow.
2019-02-11 Martin Liska <mliska@suse.cz>
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 <jakub@redhat.com>
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 <jakub@redhat.com>
Update copyright years.
2018-11-27 Mike Gulick <mgulick@mathworks.com>
PR preprocessor/83173
* location-example.txt: Update example -fdump-internal-locations
output.
2018-11-27 Mike Gulick <mgulick@mathworks.com>
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 <dmalcolm@redhat.com>
* 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 <abidh@codesourcery.com>
* configure: Regenerated.
2018-11-05 Martin Liska <mliska@suse.cz>
* symtab.c (ht_dump_statistics): Replace %zu with %lu format.
2018-11-05 Martin Liska <mliska@suse.cz>
* symtab.c (ht_dump_statistics): Fix format and
pass missing argument.
2018-11-05 Martin Liska <mliska@suse.cz>
* symtab.c (ht_dump_statistics): Make dump conditional
based on alloc_subobject.
2018-10-31 Joseph Myers <joseph@codesourcery.com>
PR bootstrap/82856
* configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
* aclocal.m4, config.in, configure: Regenerate.
2018-10-31 Nathan Sidwell <nathan@acm.org>
* 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 <joseph@codesourcery.com>
* 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 <dmalcolm@redhat.com>
* 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 <nathan@acm.org>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* include/line-map.h (range_label::get_text): Add param
"range_idx".
2018-08-30 Nathan Sidwell <nathan@acm.org>
* include/line-map.h (enum lc_reason): Comment each member
separately.
(struct line_maps): Fix reallocator comment.
2018-08-27 David Malcolm <dmalcolm@redhat.com>
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 <hongjiu.lu@intel.com>
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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <nathan@acm.org>
* 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 <dmalcolm@redhat.com>
* 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 <nathan@acm.org>
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 <nathan@acm.org>
* line-map.c: (linemap_init): Set default allocator here.
(new_linemap): Rather than here. Refactor allocation logic.
2018-07-20 David Malcolm <dmalcolm@redhat.com>
* 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 <bernd.edlinger@hotmail.de>
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 <j_fra@fastmail.us>
Jakub Jelinek <jakub@redhat.com>
* 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 <nathan@acm.org>
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 <jason@redhat.com>
* system.h: #include <new> earlier.
2018-05-17 Jason Merrill <jason@redhat.com>
* line-map.c (linemap_init): Use placement new.
* system.h: #include <new>.
2018-03-14 David Malcolm <dmalcolm@redhat.com>
* include/line-map.h (compare): New function on linenum_type.
2018-02-28 Jonathan Wakely <jwakely@redhat.com>
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 <rguenther@suse.de>
PR bootstrap/82939
* line-map.c (linemap_init): Avoid broken value-init when compiling
with GCC 4.2.
2018-02-15 Jason Merrill <jason@redhat.com>
Jakub Jelinek <jakub@redhat.com>
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 <jakub@redhat.com>
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 <jakub@redhat.com>
* 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 <boris@codesynthesis.com>
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 <kelvin@gcc.gnu.org>
* 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 <jakub@redhat.com>
Update copyright years.
2017-12-20 Michael Weiser <michael.weiser@gmx.de>
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 <bernd.edlinger@hotmail.de>
* internal.h (maybe_print_line): Change signature.
2017-12-05 Jakub Jelinek <jakub@redhat.com>
PR c++/79228
* expr.c (interpret_float_suffix): Avoid memcmp.
(interpret_int_suffix): Likewise. Don't check for if.
2017-12-01 Jason Merrill <jason@redhat.com>
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 <dmalcolm@redhat.com>
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 <egall@gwmail.gwu.edu>
PR preprocessor/81794
* macro.c (check_trad_stringification): Have warning be controlled
by -Wtraditional.
2017-11-20 David Malcolm <dmalcolm@redhat.com>
PR c++/72786
* include/cpplib.h (cpp_macro_definition_location): New decl.
* macro.c (cpp_macro_definition): New function.
2017-11-13 Tom Tromey <tom@tromey.com>
* 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) <va_args_ok>: Update comment.
(struct spec_nodes) <n__VA_OPT__>: New field.
* init.c (struct lang_flags) <va_opt>: 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) <va_opt>: New field.
* identifiers.c (_cpp_init_hashtable): Initialize n__VA_OPT__.
2017-11-13 David Malcolm <dmalcolm@redhat.com>
* 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 <mukesh.kapoor@oracle.com>
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 <tom@codesourcery.com>
PR other/82784
* lex.c (BUF_APPEND): Remove semicolon after
"do {} while (0)".
2017-10-31 David Malcolm <dmalcolm@redhat.com>
* 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 <joseph@codesourcery.com>
* 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 <nathan@acm.org>
PR preprocessor/82506
* macro.c (cpp_quote_string): Escape raw LFs.
2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
Jakub Jelinek <jakub@redhat.com>
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 <jakub@redhat.com>
* 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 <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <jakub@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <jwakely@redhat.com>
* 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 <schwab@suse.de>
* 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 <jason@redhat.com>
* init.c (cpp_init_builtins): Update __cplusplus for C++17.
2017-02-09 Gerald Pfeifer <gerald@pfeifer.com>
* Makefile.in (po/$(PACKAGE).pot): Adjust bug reporting URL.
2017-01-10 David Malcolm <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <jakub@redhat.com>
Update copyright years.
2016-12-15 David Malcolm <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <bonzini@gnu.org>
* 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 <dmalcolm@redhat.com>
* charset.c (cpp_interpret_string_1): Skip locations from
loc_reader when advancing 'p' when handling raw strings.
2016-11-16 Jakub Jelinek <jakub@redhat.com>
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 <rearnsha@arm.com>
* lex.c (search_line_fast): New implementation for AArch64.
2016-10-25 David Malcolm <dmalcolm@redhat.com>
* files.c (destroy_cpp_file): Free file->path.
2016-10-25 David Malcolm <dmalcolm@redhat.com>
* 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 <andris.pavenis@iki.fi>
PR preprocessor/71681
* files.c (remap_filename): Fix handling -remap in subdirectories.
2016-10-12 Jakub Jelinek <jakub@redhat.com>
* 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 <jakub@redhat.com>
* 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 <kelvin@gcc.gnu.org>
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 <polacek@redhat.com>
Jakub Jelinek <jakub@redhat.com>
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 <dmalcolm@redhat.com>
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 <jason@redhat.com>
* line-map.c (linemap_location_from_macro_definition_p): New.
* line-map.h: Declare it.
2016-09-15 David Malcolm <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* include/line-map.h (rich_location::seen_impossible_fixit_p): New
accessor.
2016-08-31 David Malcolm <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* include/line-map.h (class semi_embedded_vec): New class.
(semi_embedded_vec<T, NUM_EMBEDDED>::semi_embedded_vec): New ctor.
(semi_embedded_vec<T, NUM_EMBEDDED>::~semi_embedded_vec): New
dtor.
(semi_embedded_vec<T, NUM_EMBEDDED>::operator[]): New methods.
(semi_embedded_vec<T, NUM_EMBEDDED>::push): New method.
(semi_embedded_vec<T, NUM_EMBEDDED>::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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* include/line-map.h (source_range::from_locations): New method.
2016-08-19 David Malcolm <dmalcolm@redhat.com>
* 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 <joseph@codesourcery.com>
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 <prathamesh.kulkarni@linaro.org>
* expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic.
2016-08-18 David Malcolm <dmalcolm@redhat.com>
* 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 <polacek@redhat.com>
PR c/7652
* pch.c (write_macdef): Add CPP_FALLTHRU.
2016-08-12 Marek Polacek <polacek@redhat.com>
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 <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
* 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 <schwab@suse.de>
* include/cpplib.h: Fix comment typo.
2016-07-27 David Malcolm <dmalcolm@redhat.com>
* include/line-map.h (source_location): Fix line numbers in
comment.
2016-07-11 David Malcolm <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <danglin@gcc.gnu.org>
* line-map.c (location_adhoc_data_update): Use int64_t instead of
long long.
(get_combined_adhoc_loc): Likewise.
2016-06-01 Eduard Sanou <dhole@openmailbox.org>
* 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 <mliska@suse.cz>
* 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 <dhole@openmailbox.org>
Matthias Klose <doko@debian.org>
* 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 <bschmidt@redhat.com>
Patch from Roger Orr <rogero@howzatt.demon.co.uk>
PR preprocessor/69650
* directives.c (do_linemarker): Reread map after calling
cpp_get_token.
2016-04-06 Richard Henderson <rth@redhat.com>
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 <bschmidt@redhat.com>
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 <jakub@redhat.com>
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 <rth@redhat.com>
* line-map.c (new_linemap): Make alloc_size a size_t.
2016-03-14 Jason Merrill <jason@redhat.com>
* expr.c (cpp_classify_number): Hex floats are new in C++1z.
* init.c (lang_defaults): Likewise.
2016-03-09 David Malcolm <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <jakub@redhat.com>
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 <jakub@redhat.com>
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 <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
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 <jakub@redhat.com>
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 <jakub@redhat.com>
Update copyright years.
2015-12-22 David Malcolm <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
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 <jakub@redhat.com>
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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <maltsevm@gmail.com>
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Remove ENABLE_CHECKING.
2015-11-03 Uros Bizjak <ubizjak@gmail.com>
* lex.c (search_line_sse42): Correctly advance the pointer to an
aligned address.
2015-11-02 David Malcolm <dmalcolm@redhat.com>
* 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 <maltsevm@gmail.com>
* 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 <maltsevm@gmail.com>
* system.h (CHECKING_P, gcc_checking_assert): Define.
2015-09-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
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 <polacek@redhat.com>
* system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning.
2015-08-06 Yaakov Selkowitz <yselkowi@redhat.com>
* configure: Regenerate.
2015-07-08 Thomas Schwinge <thomas@codesourcery.com>
* include/line-map.h (RESERVED_LOCATION_COUNT): Change type to
source_location.
2015-07-02 Paolo Carlini <paolo.carlini@oracle.com>
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 <ubizjak@gmail.com>
* lex.c (search_line_sse42) [__GCC_ASM_FLAG_OUTPUTS__]: New main
loop using asm flag outputs.
2015-06-08 Marek Polacek <polacek@redhat.com>
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 <manu@gcc.gnu.org>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <michael.haubenwallner@ssi-schaefer.com>
* aclocal.m4: Regenerated with automake-1.11.6.
2015-05-13 David Malcolm <dmalcolm@redhat.com>
* 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 <dmalcolm@redhat.com>
* 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 <jason@redhat.com>
* 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 <dmalcolm@redhat.com>
* pch.c (cpp_valid_state): Fix indentation so that it reflects the
block structure.
2015-05-05 David Malcolm <dmalcolm@redhat.com>
* 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 <rguenther@suse.de>
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 <jakub@redhat.com>
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 <jakub@redhat.com>
PR preprocessor/61977
* lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change.
2015-03-23 Jakub Jelinek <jakub@redhat.com>
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 <markus@trippelsdorf.de>
PR target/65261
* lex.c (search_line_fast): Silence ubsan errors.
2015-02-03 <dodji@redhat.com>
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 <szabolcs.nagy@arm.com>
* lex.c (search_line_fast): Change __ARM_NEON__ to __ARM_NEON.
2015-01-23 Marek Polacek <polacek@redhat.com>
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 <jakub@redhat.com>
* 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 <jakub@redhat.com>
Update copyright years.
2014-12-19 Jakub Jelinek <jakub@redhat.com>
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 <ubizjak@gmail.com>
* directives.c (cpp_define_formatted): Use xvasprintf.
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
* line-map.c (linemap_position_for_loc_and_offset): Add new
linemap_assert_fails.
2014-12-02 Manuel López-Ibáñez <manu@gcc.gnu.org>
* 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 <manu@gcc.gnu.org>
* line-map.c (linemap_add): Fix typo.
(linemap_line_start): Fix whitespace.
2014-11-29 John Schmerge <jbschmerge@gmail.com>
PR preprocessor/41698
* charset.c (one_utf8_to_utf16): Do not produce surrogate pairs
for 0xffff.
2014-11-25 Jakub Jelinek <jakub@redhat.com>
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 <ubizjak@gmail.com>
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 <manu@gcc.gnu.org>
* include/line-map.h: Include EXPR, so that unused variable warnings
do not occur.
2014-11-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
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 <dmalcolm@redhat.com>
* 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 <joseph@codesourcery.com>
* 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 <joseph@codesourcery.com>
PR preprocessor/9449
* init.c (lang_defaults): Enable extended identifiers for C++ and
C99-based standards.
2014-10-22 Alan Modra <amodra@gmail.com>
* 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 <manu@gcc.gnu.org>
* 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 <wschmidt@linux.vnet.ibm.com>
* 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 <bernd.edlinger@hotmail.de>
Jeff Law <law@redhat.com>
* 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 <bernd.edlinger@hotmail.de>
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 <polacek@redhat.com>
PR c/61405
PR c/53874
* include/cpplib.h (enum cpp_ttype): Define CPP_KEYWORD.
2014-09-17 Jan Hubicka <hubicka@ucw.cz>
* 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 <polacek@redhat.com>
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 <manu@gcc.gnu.org>
* include/cpplib.h (struct cpp_options): Declare warn_normalize as
int instead of enum.
2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
* 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 <manu@gcc.gnu.org>
* 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 <manu@gcc.gnu.org>
* 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 <polacek@redhat.com>
* include/cpplib.h (cpp_options): Use signed char.
* lex.c (_cpp_lex_direct): Don't warn in C++ mode.
2014-08-19 Marek Polacek <polacek@redhat.com>
* lex.c (_cpp_lex_direct): Fix a typo.
2014-08-19 Marek Polacek <polacek@redhat.com>
* 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 <polacek@redhat.com>
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 <polacek@redhat.com>
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 <dodji@redhat.com>
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 <jwakely@redhat.com>
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 <rguenther@suse.de>
* 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 <polacek@redhat.com>
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 <rguenther@suse.de>
* 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 <joey.ye@arm.com>
* 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 <rguenther@suse.de>
* configure.ac: Always set need_64bit_hwint to yes.
* configure: Regenerated.
2014-04-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lex.c: Remove Solaris 9 reference.
2014-02-24 Walter Lee <walt@tilera.com>
* configure.ac: Change "tilepro" triplet to "tilepro*".
* configure: Regenerate.
2014-02-19 Jakub Jelinek <jakub@redhat.com>
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 <jakub@redhat.com>
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 <dodji@redhat.com>
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 <rdsandiford@googlemail.com>
Update copyright years
2013-12-09 Joseph Myers <joseph@codesourcery.com>
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 <wschmidt@linux.vnet.ibm.com>
* lex.c (search_line_fast): Correct for little endian.
2013-11-15 Joseph Myers <joseph@codesourcery.com>
* 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 <joseph@codesourcery.com>
* 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 <burnus@net-b.de>
* macro.c (_cpp_builtin_macro_text): Correct
wording of two warnings.
2013-11-05 Tobias Burnus <burnus@net-b.de>
* 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 <dmalcolm@redhat.com>
* 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 <rearnsha@arm.com>
* configure.ac: Set need_64bit_hwint for all arm targets.
* configure: Regenerated.
2013-07-20 Jakub Jelinek <jakub@redhat.com>
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 <jakub@redhat.com>
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 <dehao@google.com>
* 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 <jakub@redhat.com>
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 <paolo.carlini@oracle.com>
* 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 <sebastian.huber@embedded-brains.de>
PR target/56771
* configure.ac: Require 64-bit int for arm*-*-rtems*.
* configure: Regenerate.
2013-03-06 Jakub Jelinek <jakub@redhat.com>
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 <jakub@redhat.com>
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 <jakub@redhat.com>
* 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 <rdsandiford@googlemail.com>
Update copyright years.
2013-01-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54526 (again)
* lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.
2013-01-03 Marc Glisse <marc.glisse@inria.fr>
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 <jakub@redhat.com>
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 <sellcey@mips.com>
PR pch/55399
* files.c (pch_open_file): Fix check for implicit_preinclude.
2012-11-16 Simon Baldwin <simonb@google.com>
* 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 <ian.bolton@arm.com>
Jim MacArthur <jim.macarthur@arm.com>
Marcus Shawcroft <marcus.shawcroft@arm.com>
Nigel Stephens <nigel.stephens@arm.com>
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Richard Earnshaw <rearnsha@arm.com>
Sofiane Naci <sofiane.naci@arm.com>
Stephen Thomas <stephen.thomas@arm.com>
Tejas Belagod <tejas.belagod@arm.com>
Yufeng Zhang <yufeng.zhang@arm.com>
* configure.ac: Enable AArch64.
* configure: Regenerate.
2012-10-23 Joseph Myers <joseph@codesourcery.com>
* 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 <burnus@net-b.de>
* 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 <fweimer@redhat.com>
* 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 <dehao@google.com>
PR middle-end/54704
* line-map.c (location_adhoc_data_hash): Fix the hash function.
2012-09-25 Dehao Chen <dehao@google.com>
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 <dehao@google.com>
* 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 <dodji@redhat.com>
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 <dnovillo@google.com>
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 <crowl@google.com>
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 <laurynas.biveinis@gmail.com>
* include/line-map.h (line_map_macro): Use the "atomic" GTY option
for the macro_locations field.
2011-06-19 Uros Bizjak <ubizjak@gmail.com>
* lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and
__builtin_ia32_pcmpestri128 instead of asm.
2012-06-04 Dimitrios Apostolou <jimis@gmx.net>
* 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 <dodji@redhat.com>
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 <joseph@codesourcery.com>
* directives.c: Fix typos.
* include/line-map.h: Fix typos.
* line-map.c: Fix typos.
* macro.c: Fix typos.
2012-05-25 Dodji Seketeli <dodji@redhat.com>
PR bootstrap/53459
* lex.c (search_line_fast): Avoid unused local typedefs to simulate
a static assertion.
2012-05-29 Dodji Seketeli <dodji@redhat.com>
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 <dodji@redhat.com>
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 <gingold@adacore.com>
* expr.c (interpret_float_suffix): Add a guard.
2012-05-02 Dodji Seketeli <dodji@redhat.com>
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 <manu@gcc.gnu.org>
Dodji Seketeli <dodji@seketeli.org>
PR c++/52974
* libcpp/files.c (maybe_shorter_path): New.
(find_file_in_dir): Use it.
2012-04-30 Dodji Seketeli <dodji@redhat.com>
Switch -ftrack-macro-expansion=2 on by default.
* init.c (cpp_create_reader): Switch -ftrack-macro-expansion=2 on
by default. Add comments.
Strip "<built-in>" 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 <dodji@redhat.com>
* lex.c (lex_raw_string): Change C++ style comments into C style
comments.
(lex_string): Likewise.
2012-04-27 Ollie Wild <aaw@google.com>
* 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 <manu@gcc.gnu.org>
* 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 <rearnsha@arm.com>
* lex.c (search_line_fast): Provide Neon-optimized version for ARM.
2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lex.c: Remove Solaris 8 reference.
2012-02-14 Walter Lee <walt@tilera.com>
* configure.ac: Require 64-bit hwint for tilegx and tilepro.
* configure: Regenerate.
2012-01-09 Richard Guenther <rguenther@suse.de>
* macro.c (_cpp_builtin_macro_text): Remove unused variable map.
2012-01-09 Gary Funck <gary@intrepid.com>
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 <hainque@adacore.com>
* system.h: Prior to #define, #undef fopen and freopen unconditionally.
2011-12-20 Joseph Myers <joseph@codesourcery.com>
* 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 <schwab@linux-m68k.org>
* configure: Regenerate.
2011-12-19 Andreas Schwab <schwab@linux-m68k.org>
* configure: Regenerate.
2011-12-07 Jakub Jelinek <jakub@redhat.com>
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 <dodji@redhat.com>
* 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 <dnovillo@google.com>
* 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 <matz@suse.de>
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 <paolo.carlini@oracle.com>
* internal.h (uxstrdup, ustrchr): Return const unsigned char *.
2011-11-02 Jason Merrill <jason@redhat.com>
PR c++/50810
* configure.ac: Add -Wno-narrowing to warning options.
2011-10-31 Jason Merrill <jason@redhat.com>
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 <dodji@redhat.com>
* line-map.c (linemap_macro_map_lookup): Fix logic.
2011-10-24 Dodji Seketeli <dodji@redhat.com>
* 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 <dodji@redhat.com>
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 <dodji@redhat.com>
PR bootstrap/50801
* lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of
number of tokens.
2011-10-18 Dodji Seketeli <dodji@redhat.com>
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 <dodji@redhat.com>
* 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 <tromey@redhat.com>
Dodji Seketeli <dodji@redhat.com>
* 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 <tromey@redhat.com>
Dodji Seketeli <dodji@redhat.com>
* 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 <tromey@redhat.com>
Dodji Seketeli <dodji@redhat.com>
* include/cpplib.h (struct cpp_options)<debug>: New struct member.
* include/line-map.h (linemap_dump_location): Declare ...
* line-map.c (linemap_dump_location): ... new function.
2011-10-15 Tom Tromey <tromey@redhat.com>
Dodji Seketeli <dodji@redhat.com>
* include/cpplib.h (struct cpp_options)<track_macro_expansion>:
New option.
* internal.h (struct macro_context): New struct.
(enum context_tokens_kind): New enum.
(struct cpp_context)<tokens_kind>: New member of type enum
context_tokens_kind.
(struct cpp_context)<macro>: Remove this. Replace it with an enum
of macro and macro_context.
(struct cpp_context)<direct_p>: 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)<virt_locs, expanded_virt_locs>: 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 <tromey@redhat>
Dodji Seketeli <dodji@redhat.com>
* include/line-map.h (enum lc_reason)<LC_ENTER_MACRO>: 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)<info_ordinary, info_macro>: 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 <dodji@redhat.com>
* 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 <gchare@google.com>
* 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 <ro@CeBiTec.Uni-Bielefeld.DE>
PR libstdc++/1773
* init.c (cpp_init_builtins): Define __cplusplus 19971L.
2011-08-18 Joseph Myers <joseph@codesourcery.com>
* include/cpplib.h (struct cpp_options): Fix typo.
2011-08-18 Joseph Myers <joseph@codesourcery.com>
* 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 <gchare@google.com>
* include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Remove.
Update all users to use linemap_position_for_column instead.
2011-07-28 Gabriel Charette <gchare@google.com>
* include/line-map.h (struct line_maps):
Remove unused field last_listed. Update all users.
2011-07-28 H.J. Lu <hongjiu.lu@intel.com>
* configure.ac: Set need_64bit_hwint to yes for x86 targets.
* configure: Regenerated.
2011-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* system.h [__cplusplus]: Wrap C function declarations in extern "C".
2011-07-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
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 <dodji@redhat.com>
* directives.c (struct if_stack): Use source_location as type
here.
* include/cpplib.h (struct cpp_callbacks)<include, define, undef,
indent, def_pragma, used_define, used_undef>: Properly use
source_location as parameter type, rather than unsigned int.
2011-07-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
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 <jason@redhat.com>
PR c++/45399
* lex.c (lex_raw_string): Don't check for embedded NUL.
2011-06-06 Dodji Seketeli <dodji@redhat.com>
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 <John.Tytgat@aaug.net>
* files.c (read_file_guts): Add test on non-zero value of S_ISREG.
2011-05-22 Uros Bizjak <ubizjak@gmail.com>
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 <jan.kratochvil@redhat.com>
* system.h (ENUM_BITFIELD): Remove.
2011-04-24 Jakub Jelinek <jakub@redhat.com>
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 <meyering@redhat.com>
* 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 <ktietz@redhat.com>
* files.c (file_hash_eq): Use filename_cmp
instead of strcmp.
(nonexistent_file_hash_eq): Likewise.
(remap_filename): Likewise.
Handle absolute DOS-path,
(append_file_to_dir): Check for IS_DIR_SEPARATOR
instead of slash.
(read_name_map): Likewise.
* linemap.c (linemap_add): Use filename_cmp
instead of strcmp.
* mkdeps.c (apply_vpath): Use filename_ncmp
instead of strncmp.
(deps_restore): Use filename_cmp instead of
strcmp.
* init.c (read_original_directory): Use
IS_DIR_SEPARATOR instead of checking for slash.
2011-03-21 Michael Meissner <meissner@linux.vnet.ibm.com>
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 <rth@redhat.com>
PR bootstrap/45381
* lex.c [ALTIVEC] (search_line_fast): Require gcc version 4.5.
2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
Jakub Jelinek <jakub@redhat.com>
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 <iant@google.com>
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 <kai.tietz@onevision.com>
PR preprocessor/17349
* lex.c (save_comment): Handle in argument passing c++
comments special.
2010-11-02 Ian Lance Taylor <iant@google.com>
* configure.ac: Use AC_SYS_LARGEFILE.
* configure: Rebuild.
* config.in: Rebuild.
2010-10-19 Basile Starynkevitch <basile@starynkevitch.net>
* line-map.h (source_location): Remove obsolete comment
mentioning location_s.
2010-09-29 Kai Tietz <kai.tietz@onevision.com>
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 <joseph@codesourcery.com>
* 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 <iant@google.com>
* init.c: Fix type name in comment.
2010-08-31 Jakub Jelinek <jakub@redhat.com>
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 <ro@CeBiTec.Uni-Bielefeld.DE>
* system.h [HAVE_INTTYPES_H]: Include inttypes.h.
2010-08-24 Richard Henderson <rth@redhat.com>
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 <ro@CeBiTec.Uni-Bielefeld.DE>
* lex.c [__sun__ && __svr4__]: Disable init_vectorized_lexer
etc. on Solaris 2/x86.
2010-08-21 Richard Henderson <rth@redhat.com>
Andi Kleen <ak@linux.intel.com>
David S. Miller <davem@davemloft.net>
* 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 <jakub@redhat.com>
* 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 <joseph@codesourcery.com>
* 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 <joern.rennecke@embecosm.com>
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 <laurynas.biveinis@gmail.com>
* include/symtab.h (ht_identifier_ptr): New.
2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR bootstrap/42798
* configure.ac: Check for declaration of 'basename(char *)'.
* configure: Regenerate.
* config.in: Regenerate.
2010-04-25 Joseph Myers <joseph@codesourcery.com>
* 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 <manu@gcc.gnu.org>
PR cpp/43195
* files.c (report_missing_guard): Test for #pragma once.
2010-04-07 Simon Baldwin <simonb@google.com>
* 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 <jakub@redhat.com>
PR preprocessor/43642
* lex.c (lex_raw_string): Change type of TYPE variable to
unsigned char.
2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* aclocal.m4: Regenerate.
2010-03-29 Jason Merrill <jason@redhat.com>
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 <jakub@redhat.com>
* init.c (read_original_filename): Don't call read_original_directory
if _cpp_handle_directive returns 0.
2010-01-01 Joseph Myers <joseph@codesourcery.com>
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 <charlet@adacore.com>
* 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 <kai.tietz@onevision.com>
* directives.c (do_pragma_push_macro): New pragma handler.
(do_pragma_pop_macro): Likewise.
(_cpp_init_internal_pragmas): Add push_macro and
pop_macro handler to internal pragmas.
(lex_macro_node_from_str): Removed.
(cpp_push_definition): Replace lex_macro_node_from_str
by _cpp_lex_identifier.
(cpp_pop_definition): Likewise.
* internal.h (_cpp_lex_identifier): New prototype.
(def_pragma_macro): New structure.
(cpp_reader): New member pushed_macros.
* lex.c (_cpp_lex_identifier): New function.
(lex_identifier_intern): New function.
* init.c (cpp_create_reader): Initialize pushed_macros
member.
(cpp_destroy): Free elements in pushed_macros member.
* pch.c (_cpp_save_pushed_macros): New function.
(_cpp_restore_pushed_macros): Likewise.
(_cpp_restore_pushed_macros): Use _cpp_save_pushed_macros.
(cpp_read_state): Use _cpp_restore_pushed_macros.
2009-10-19 Jakub Jelinek <jakub@redhat.com>
* 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 <jakub@redhat.com>
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 <jason@redhat.com>
* charset.c (_cpp_valid_ucn): Update C++0x restrictions.
2009-10-09 Neil Vachharajani <nvachhar@google.com>
* directives.c (DIRECTIVE_TABLE): Remove DEPRECATED from ident and
sccs.
2009-09-23 Loren J. Rittle <ljrittle@acm.org>
* configure.ac (AC_CHECK_HEADERS after AC_LANG(C++)): Add sys/stat.h.
* configure: Rebuilt.
2009-09-22 Richard Guenther <rguenther@suse.de>
PR pch/38987
* files.c (pch_open_file): Disallow non-toplevel PCH inclusion.
2009-09-18 Chris Demetriou <cgd@google.com>
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 <kai.tietz@onevision.com>
* configure.ac: Set for i?86-w64-mingw*
need_64bit_hwint to yes.
* configure: Regenerated.
2009-09-10 Jason Merrill <jason@redhat.com>
* directives.c (cpp_define): constify.
2009-09-02 Ian Lance Taylor <iant@google.com>
* macro.c (stringify_arg): Escape CPP_WCHAR tokens.
2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure.ac (AC_PREREQ): Bump to 2.64.
2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
2009-08-17 Tom Tromey <tromey@redhat.com>
PR preprocessor/41067:
* charset.c (convert_escape): Add missing ":" to error text.
2009-07-27 Douglas B Rupp <rupp@gnat.com>
* include/cpplib.h (INO_T_CPP): New macro.
(struct cpp_dir): Use it.
2009-07-20 Jerry Quinn <jlquinn@optonline.net>
PR regression/40800
* configure.ac: Use = instead of == for testing
ENABLE_BUILD_WITH_CXX.
* configure: Rebuild.
2009-07-17 Jerry Quinn <jlquinn@optonline.net>
* 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 <manu@gcc.gnu.org>
* 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 <manu@gcc.gnu.org>
* expr.c (num_div_op): Take explicit location.
2009-06-17 Ian Lance Taylor <iant@google.com>
* include/cpplib.h (progname): Don't declare.
2009-06-12 Ian Lance Taylor <iant@google.com>
* 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 <aldyh@redhat.com>
* include/line-map.h (LAST_SOURCE_COLUMN): New.
2009-06-01 Ian Lance Taylor <iant@google.com>
* 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 <iant@google.com>
* include/cpplib.h (enum cpp_builtin_type): Rename from enum
builtin_type. Change all uses.
2009-05-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
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 <joseph@codesourcery.com>
* 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 <joseph@codesourcery.com>
* charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte
UTF-8 sequences.
2009-04-25 Joseph Myers <joseph@codesourcery.com>
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 <tglek@mozilla.com>
* 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 <manu@gcc.gnu.org>
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 <manu@gcc.gnu.org>
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 <joseph@codesourcery.com>
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 <joseph@codesourcery.com>
* directives.c (parse_include): Pass true to check_eol.
2009-04-18 Joseph Myers <joseph@codesourcery.com>
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 <joseph@codesourcery.com>
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 <joseph@codesourcery.com>
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 <jakub@redhat.com>
* 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 <janis187@us.ibm.com>
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 <joseph@codesourcery.com>
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 <serg@vostok.net>
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 <tromey@redhat.com>
PR preprocessor/39512:
* line-map.c (linemap_init): Initialize 'reallocator' field.
2009-03-30 Jakub Jelinek <jakub@redhat.com>
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 <joseph@codesourcery.com>
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 <joseph@codesourcery.com>
* Makefile.in (po/$(PACKAGE).pot): Use $(mkinstalldirs) not
mkinstalldirs.
2009-03-18 Jakub Jelinek <jakub@redhat.com>
* include/cpplib.h (struct cpp_dir): Reorder fields for 64-bit hosts.
2009-02-21 Joseph Myers <joseph@codesourcery.com>
* 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 <rguenther@suse.de>
Revert last change.
2009-02-13 Richard Guenther <rguenther@suse.de>
* configure.ac: Enable LFS.
* configure: Re-generate.
* config.in: Likewise.
2009-01-05 Ben Elliston <bje@au.ibm.com>
* Makefile.in (.po.gmo): Use mkinstalldirs, not test -d || mkdir.
(.po.pox): Likewise.
(po/$(PACKAGE).pot): Likewise.
2008-12-10 Alexandre Oliva <aoliva@redhat.com>
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 <joseph@codesourcery.com>
* lex.c (cpp_token_len): Use 6 as default length.
2008-10-31 Manuel López-Ibáñez <manu@gcc.gnu.org>
* 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 <gingell@adacore.com>
Arnaud Charlet <charlet@adacore.com>
* include/cpplib.h (cpp_comments, cpp_comment_table): New structs.
(cpp_get_comments): New function.
* internal.h (struct cpp_reader): Add comments field.
* init.c (cpp_destroy): Free comments.
* lex.c (store_comment, cpp_get_comments): New functions.
(comments): New struct.
(save_comment): Store comments in comments struct.
2008-09-18 Simon Baldwin <simonb@google.com>
* 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 <jakub@redhat.com>
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 <manu@gcc.gnu.org>
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 <manu@gcc.gnu.org>
* 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 <bje@au.ibm.com>
* 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 <aph@redhat.com>
PR preprocessor/33305
* macro.c (replace_args): Print a warning for empty macro
arguments in C89 and C++.
2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in ($(srcdir)/aclocal.m4): Update dependencies.
* configure: Regenerate.
2008-06-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in (datarootdir): New variable.
2008-06-12 H.J. Lu <hongjiu.lu@intel.com>
PR preprocessor/36479
* charset.c (cpp_interpret_string_notranslate): Also set
narrow_cset_desc.width.
2008-06-07 Joseph Myers <joseph@codesourcery.com>
* configure.ac (parisc*64*-*-*): Remove.
* configure: Regenerate.
2008-05-30 Tom Tromey <tromey@redhat.com>
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 <dannysmith@users.sourceforge.net>
* include/cpplib.h (struct cpp_dir): Add new field, canonical_name.
2008-05-21 Tom Tromey <tromey@redhat.com>
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 <tromey@redhat.com>
* 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 <tromey@redhat.com>
PR preprocessor/22168:
* include/cpplib.h (struct cpp_options) <objc>: 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 <tromey@redhat.com>
PR preprocessor/35313, PR preprocessor/36088:
* expr.c (optab) <QUERY, COMMA>: Set precedence to 4.
(reduce) <case CPP_QUERY>: Special case CPP_COMMA and CPP_COLON.
2008-05-04 David S. Miller <davem@davemloft.net>
* configure.ac (sparc*-*-*): Always set need_64bit_hwint to yes.
* configure: Regenerate.
2008-04-22 Daniel Franke <franke.daniel@gmail.com>
* include/cpplib.h (cpp_define_formatted): New.
* directives.c (cpp_define_formatted): New.
2008-04-21 Tom Tromey <tromey@redhat.com>
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) <buffer_start>: 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 <kris.van.hees@oracle.com>
* include/cpp-id-data.h (UC): Was U, conflicts with U"..." literal.
* include/cpplib.h (CHAR16, CHAR32, STRING16, STRING32): New tokens.
(struct cpp_options): Added uliterals.
(cpp_interpret_string): Update prototype.
(cpp_interpret_string_notranslate): Idem.
* charset.c (init_iconv_desc): New width member in cset_converter.
(cpp_init_iconv): Add support for char{16,32}_cset_desc.
(convert_ucn): Idem.
(emit_numeric_escape): Idem.
(convert_hex): Idem.
(convert_oct): Idem.
(convert_escape): Idem.
(converter_for_type): New function.
(cpp_interpret_string): Use converter_for_type, support u and U prefix.
(cpp_interpret_string_notranslate): Match changed prototype.
(wide_str_to_charconst): Use converter_for_type.
(cpp_interpret_charconst): Add support for CPP_CHAR{16,32}.
* directives.c (linemarker_dir): Macro U changed to UC.
(parse_include): Idem.
(register_pragma_1): Idem.
(restore_registered_pragmas): Idem.
(get__Pragma_string): Support CPP_STRING{16,32}.
* expr.c (eval_token): Support CPP_CHAR{16,32}.
* init.c (struct lang_flags): Added uliterals.
(lang_defaults): Idem.
* internal.h (struct cset_converter) <width>: New field.
(struct cpp_reader) <char16_cset_desc>: Idem.
(struct cpp_reader) <char32_cset_desc>: Idem.
* lex.c (digraph_spellings): Macro U changed to UC.
(OP, TK): Idem.
(lex_string): Add support for u'...', U'...', u"..." and U"...".
(_cpp_lex_direct): Idem.
* macro.c (_cpp_builtin_macro_text): Macro U changed to UC.
(stringify_arg): Support CPP_CHAR{16,32} and CPP_STRING{16,32}.
2008-04-18 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/35457
* aclocal.m4: Regenerate.
* configure: Regenerate.
2008-04-17 Tom Tromey <tromey@redhat.com>
PR libcpp/34866:
* errors.c (cpp_error): Don't reference a token before the start
of the current run.
2008-04-16 Tom Tromey <tromey@redhat.com>
* Makefile.in (TAGS_SOURCES): New variable.
(TAGS): New target.
2008-04-11 Kaz Kojima <kkojima@gcc.gnu.org>
* configure.ac: (need_64bit_hwint): Need 64bit hwint for sh-*-*
and shbe-*-*.
* configure: Rebuilt.
2008-04-02 Joseph Myers <joseph@codesourcery.com>
* 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 <jakub@redhat.com>
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 <tromey@redhat.com>
* Makefile.in (POSTCOMPILE): New variable.
(.c.o): Use it.
2008-03-13 Tom Tromey <tromey@redhat.com>
PR libcpp/35322:
* directives.c (destringize_and_run): Set pfile->directive.
2008-03-06 Markus Milleder <markus.milleder@generali.at>
PR preprocessor/35458
* mkdeps.c (munge): Quote '#' with a '\'.
2008-02-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
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 <ths@mips.com>
* Makefile.in ($(srcdir)/config.in): Depend on configure.ac.
2008-02-19 Tom Tromey <tromey@redhat.com>
* 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 <jakub@redhat.com>
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 <tromey@redhat.com>
PR c++/34859
* macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS.
2008-01-07 Fred Fish <fnf@specifix.com>
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 <tromey@redhat.com>
PR preprocessor/34602
* directives.c (do_line): Don't try to spell EOF token.
(do_linemarker): Add comment.
2007-12-11 DJ Delorie <dj@redhat.com>
* charset.c (convert_using_iconv): Close out any shift states,
returning to the initial state.
2007-12-06 Tom Tromey <tromey@redhat.com>
PR c/29172
* internal.h (struct cpp_reader) <file_hash_entries>: Changed
type.
<file_hash_entries_allocated, file_hash_entries_used>: 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 <tromey@redhat.com>
PR preprocessor/34288
* configure.ac, config.in: Rebuilt.
* configure.ac: Check for ssize_t.
2007-11-30 Tom Tromey <tromey@redhat.com>
PR preprocessor/32868
* macro.c (_cpp_create_definition): Special case
__STDC_FORMAT_MACROS.
2007-11-16 Michael Matz <matz@suse.de>
* files.c (search_path_head): Fix check for absolute paths.
2007-11-11 Tom Tromey <tromey@redhat.com>
PR c++/17557
* include/cpplib.h (cpp_included_before): Declare.
* files.c (struct file_hash_entry) <location>: New field.
(_cpp_find_file): Initialize new field.
(make_cpp_dir): Likewise.
(cpp_included_before): New function.
2007-11-01 Tom Tromey <tromey@redhat.com>
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 <tromey@redhat.com>
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 <tromey@redhat.com>
* internal.h (struct cpp_reader) <invocation_location>: New
field.
(struct cpp_reader) <set_invocation_location>: Likewise.
* init.c (cpp_set_line_map): New function.
* line-map.c (linemap_add): Use linemap's allocator.
* include/line-map.h (GTY): Define.
(line_map_realloc): New typedef.
(struct line_map): Mark with GTY.
(struct line_maps): Likewise.
(struct line_maps) <maps>: Likewise.
(struct line_maps) <reallocator>: New field.
* include/symtab.h (GTY): Conditionally define.
* include/cpplib.h (cpp_set_line_map): Declare.
(cpp_get_token_with_location): Declare.
* macro.c (cpp_get_token): Set invocation_location on the reader.
(cpp_get_token_with_location): New function.
2007-08-30 Chao-ying Fu <fu@mips.com>
* 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 <tromey@redhat.com>
PR preprocessor/32974
* directives.c (parse_include): Don't check for EOL when
processing #pragma dependency.
2007-07-30 Ollie Wild <aaw@google.com>
* 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 <ubizjak@gmail.com>
* 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 <ubizjak@gmail.com>
* 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 <dannysmith@users.sourceforge.net
* files.c (open_file): Correct typo.
2007-06-16 Vladimir Prus <vladimir@codesourcery.com>
* files.c (open_file): Prevent the call
for stat from overwriting errno.
2007-06-09 Vladimir Prus <vladimir@codesourcery.com>
* files.c (open_file): Account for the
fact that on windows, opening a directory gives
EACCES.
2007-06-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
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 <dave.korn@artimi.com>
PR preprocessor/14331
* lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.
2007-05-24 Ollie Wild <aaw@google.com>
* 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 <simartin@users.sourceforge.net>
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 <iant@google.com>
* 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 <janis187@us.ibm.com>
* 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 <echristo@apple.com>
* expr.c (num_div_op): Don't overflow if the result is
zero.
2007-05-02 Tom Tromey <tromey@redhat.com>
PR preprocessor/28709
* macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.
2007-03-30 Michael Meissner <michael.meissner@amd.com>
* directives.c (lex_macro_node_from_str): Fix alloca call to be
type correct.
2007-03-30 Richard Henderson <rth@redhat.com>
* 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 <brooks.moses@codesourcery.com>
* Makefile.in: Add dummy install-pdf target.
2007-01-30 Tom Tromey <tromey@redhat.com>
PR preprocessor/30468
* mkdeps.c (apply_vpath): Strip successive '/'s if we stripped
'./'.
2007-01-30 Tom Tromey <tromey@redhat.com>
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 <tromey@redhat.com>
* configure: Rebuilt.
2007-01-12 Tom Tromey <tromey@redhat.com>
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 <bonzini@gnu.org>
* configure: Regenerate.
2007-01-11 Paolo Bonzini <bonzini@gnu.org>
* configure: Regenerate.
2007-01-04 Tom Tromey <tromey@redhat.com>
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 <iant@google.com>
* 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 <jakub@redhat.com>
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 <tromey@redhat.com>
PR preprocessor/30001
* charset.c (_cpp_convert_input): Check that to.len is greater
than zero.
2006-11-20 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
* configure.ac (need_64bit_hwint): Need 64bit hwint for SPU.
* configure: Rebuilt.
2006-11-01 Douglas Gregor <doug.gregor@gmail.com>
* include/cpplib.h (enum c_lang): Add CLK_GNUCXX0X and CLK_CXX0X
for experimental C++0x mode.
* init.c (lang_defaults): Add defaults for C++0x modes. C++0x has
adopted the preprocessor changes introduced in C99.
2006-10-29 Joseph Myers <joseph@codesourcery.com>
* configure.ac (need_64bit_hwint): Set for i[34567]86-*-linux*
depending on --enable-targets=all.
* configure: Regenerate.
2006-10-12 Jakub Jelinek <jakub@redhat.com>
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 <bmoses@stanford.edu>
* Makefile.in: Added empty "pdf" target.
2006-09-22 Geoffrey Keating <geoffk@apple.com>
* 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 <joseph@codesourcery.com>
PR c/28768
PR preprocessor/14634
* lex.c (lex_string): Pedwarn for unterminated literals.
2006-09-08 Eric Christopher <echristo@apple.com>
* configure.ac: Add 64-bit HWI support for i?86-darwin.
2006-08-14 Steve Ellcey <sje@cup.hp.com>
PR c++/28288
PR c++/14556
* include/cpplib.h: Remove <?, >?, <?=, and >?= 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 <jakub@redhat.com>
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 <dan@codesourcery.com>
* Makefile.in (CATALOGS): Add po/ prefix.
* configure: Regenerated.
2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.in: Add install-html target. Add install-html to .PHONY
2006-02-17 Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com>
* 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 <jakub@redhat.com>
PR preprocessor/25717
* init.c (cpp_init_builtins): If __STDC__ will not change value
between system headers and other sources, define it as a normal
macro rather than a builtin.
* macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check
cpp_in_system_header condition.
2006-01-05 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Use -MMD instead of -MD.
2006-01-04 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
Richard Henderson <rth@redhat.com>
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 <jakub@redhat.com>
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 <reichelt@igpm.rwth-aachen.de>
PR c++/23333
* include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure.
2005-12-07 Jon Grimm <jgrimm2@us.ibm.com>
Ben Elliston <bje@au.ibm.com>
* 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 <gerald@pfeifer.com>
Ian Lance Taylor <ian@airs.com>
* 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 <per@bothner.com>
Uros Bizjak <uros@kss-loka.si>
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 <wilson@specifix.com>
PR preprocessor/24202
* files.c (_cpp_pop_file_buffer): Set buffer_valid to false.
2005-11-04 Joseph S. Myers <joseph@codesourcery.com>
* 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 <pinskia@physics.uc.edu>
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 <joseph@codesourcery.com>
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 <wilson@specifix.com>
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 <kazu@codesourcery.com>
* configure.ac: Require 64-bit int for arm*-*-*eabi*.
* configure: Regenerate.
2005-10-04 Ian Lance Taylor <ian@airs.com>
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 <joseph@codesourcery.com>
* 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 <jakub@redhat.com>
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 <ghazi@caip.rutgers.edu>
* configure.ac (ACX_PROG_CC_WARNING_OPTS): add
-Wmissing-format-attribute.
* configure: Regenerate.
2005-06-29 Kelley Cook <kcook@gcc.gnu.org>
* all files: Update FSF address in copyright headers.
* makeucnid.c (write_copyright): Update outputted FSF address.
2005-06-13 Zack Weinberg <zack@codesourcery.com>
* 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 <gdr@integrable-solutions.net>
* 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 <zack@codesourcery.com>
* 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 <kunisawa@access.co.jp>
PR bootstrap/21230
* configure: Regenerate.
2005-04-27 Andris Pavenis <pavenis@latnet.lv>
* files.c: Include io.h for DJGPP to get prototype of setmode.
2005-04-19 Per Bothner <per@bothner.com>
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 <ghazi@caip.rutgers.edu>
* system.h (fopen, fdopen, freopen): Define these to the unlocked
libiberty functions.
2005-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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 <jakub@redhat.com>
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 <aj@suse.de>
* lex.c (warn_about_normalization): Cast field width to int to
avoid warning.
2005-03-19 Joseph S. Myers <joseph@codesourcery.com>
* configure.ac: Consistently use solaris2.1[0-9]* instead of
solaris2.1[0-9].
* configure: Regenerate.
2005-03-15 Geoffrey Keating <geoffk@apple.com>
* charset.c (_cpp_valid_ucn): In identifiers, reject a partial
UCN rather than printing an error.
2005-03-14 Geoffrey Keating <geoffk@apple.com>
* lex.c (forms_identifier_p): Disable UCNs in C89 mode.
2005-03-14 Geoffrey Keating <geoffk@apple.com>
* init.c (cpp_create_reader): Default warn_normalize to normalized_C.
* charset.c: Update for new format of ucnid.h.
(ucn_valid_in_identifier): Update for new format of ucnid.h.
Add NST parameter, and update it; update callers.
(cpp_valid_ucn): Add NST parameter, update callers. Replace abort
with cpp_error.
(convert_ucn): Pass normalize_state to cpp_valid_ucn.
* internal.h (struct normalize_state): New.
(INITIAL_NORMALIZE_STATE): New.
(NORMALIZE_STATE_RESULT): New.
(NORMALIZE_STATE_UPDATE_IDNUM): New.
(_cpp_valid_ucn): New.
* lex.c (warn_about_normalization): New.
(forms_identifier_p): Add normalize_state parameter, update callers.
(lex_identifier): Add normalize_state parameter, update callers. Keep
the state current.
(lex_number): Likewise.
(_cpp_lex_direct): Pass normalize_state to subroutines. Check
it with warn_about_normalization.
* makeucnid.c: New.
* ucnid.h: Replace.
* ucnid.pl: Remove.
* ucnid.tab: Make appropriate for input to makeucnid.c. Remove
comments about obsolete version of C++.
* include/cpplib.h (enum cpp_normalize_level): New.
(struct cpp_options): Add warn_normalize field.
2005-03-11 Geoffrey Keating <geoffk@apple.com>
* 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 <jakub@redhat.com>
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 <dpatel@apple.com>
* directives.c (do_line): Save sysp early before line table is
realloc'ed.
2005-02-20 Zack Weinberg <zack@codesourcery.com>
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 <dpatel@apple.com>
* charset.c (_cpp_convert_input): Check '\r' before inserting
'\n' at the end.
2005-02-15 Eric Christopher <echristo@redhat.com>
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 <kazu@cs.umass.edu>
* directives.c, files.c, init.c, internal.h, macro.c, pch.c,
traditional.c: Update copyright.
2005-02-14 Paolo Bonzini <bonzini@gnu.org>
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 <mrs@apple.com>
* 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 <joseph@codesourcery.com>
* configure: Regenerate.
2005-01-11 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* include/cpplib.h (c_lang): Fix comment to say cpp_create_reader.
* include/cpplib.h: Also update copyright years.
2005-01-03 Geoffrey Keating <geoffk@apple.com>
* files.c (_cpp_find_file): Add files found by search_path_exhausted
to the list of all files.
2005-01-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
* 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 <ebotcazou@libertysurf.fr>
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 <neroden@gcc.gnu.org>
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 <roger@eyesopen.com>
Zack Weinberg <zack@codesourcery.com>
* 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 <kcook@gcc.gnu.org>
* aclocal.m4: Regenerate.
2004-11-24 Roger Sayle <roger@eyesopen.com>
PR preprocessor/15824
* configure.ac: Correct HAVE_UCHAR test to #include <sys/types.h>
directly, instead of the non-existant "system.h" and "ansidecl.h".
* configure: Regenerate.
2004-11-23 Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* 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 <dan@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
* configure.ac (i[34567]86-*-solaris2.1[0-9]*): Set
need_64bit_hwint=yes.
* configure: Regenerate.
2004-11-09 Joseph S. Myers <joseph@codesourcery.com>
* 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 <zack@codesourcery.com>
Gerald Pfeifer <gerald@pfeifer.com>
* internal.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H
as well.
2004-10-27 Zack Weinberg <zack@codesourcery.com>
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 <jsm@polyomino.org.uk>
* errors.c (_cpp_begin_message): Print "error: " for errors.
2004-10-10 Andreas Jaeger <aj@suse.de>
* 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 <pinskia@physics.uc.edu>
* 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 <per@bothner.com>
* 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 <zack@codesourcery.com>
* 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 <kcook@gcc.gnu.org>
* Makefile.in (aclocal.m4): Update dependencies.
* configure.ac (AC_CONFIG_MACRO_DIR): New.
* aclocal.m4, configure: Regenerate.
2004-09-17 Zack Weinberg <zack@codesourcery.com>
* 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 <per@bothner.com>
* 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 <austern@apple.com>
Zack Weinberg <zack@codesourcery.com>
* 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 <belyshev@lubercy.com>
PR preprocessor/14699
* symtab.c (ht_dump_statistics): Change type of sum_of_squares
from size_t to double.
2004-08-28 Andreas Schwab <schwab@suse.de>
Andreas Jaeger <aj@suse.de>
* configure.ac: Set PACKAGE correctly.
* configure: Regenerated.
2004-08-25 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Add back top_builddir.
2004-08-25 Paolo Bonzini <bonzini@gnu.org>
* 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 <mark@codesourcery.com>
* configure.ac (arm*-*-eabi*): New target.
(arm*-*-symbianelf*): Likewise.
* configure: Regenerated.
2004-07-24 Bernardo Innocenti <bernie@develer.com>
* 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 <doko@debian.org>
* init.c (init_library): Use PACKAGE for the text domain.
2004-07-16 Andris Pavenis <pavenis@latnet.lv>
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 <neil@duron.akihabara.co.uk>
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 <per@bothner.com>
* include/line-map.h (fileline): Remove old typedef.
* internal.h (struct cpp_reader): Use source_location typedef instead.
2004-06-26 Zack Weinberg <zack@codesourcery.com>
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 <geoffk@apple.com>
* 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 <bonzini@gnu.org>
* Makefile.in: Regenerate with automake 1.8.5.
* aclocal.m4: Likewise.
* configure: Regenerate.
2004-06-11 Zack Weinberg <zack@codesourcery.com>
* 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 <geoffk@apple.com>
* 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 <bonzini@gnu.org>
* Makefile.am (all-local): New.
* Makefile.in: Regenerate.
2004-06-06 Roger Sayle <roger@eyesopen.com>
* Makefile.am (LIBICONV): Declare.
(makedepend_LDADD): Use LIBICONV.
* Makefile.in: Regenerate.
2004-06-05 Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.am (LIBINTL): Declare
(makedepend_LDADD): Use LIBINTL.
* Makefile.in: Regenerate.
2004-06-05 Zack Weinberg <zack@codesourcery.com>
* 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 <geoffk@apple.com>
* 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 <bonzini@gnu.org>
PR bootstrap/15651
* configure.ac: Fix m4 quoting when picking
the size of HOST_WIDE_INT.
* configure: Regenerate.
2004-05-25 Paolo Bonzini <bonzini@gnu.org>
* Makefile.am: the correct directory for
gettext include files is given by @INCINTL@.
* Makefile.in: Regenerate.
2004-05-24 Paolo Bonzini <bonzini@gnu.org>
* system.h [!ENABLE_NLS]: dgettext takes two
parameters.
2004-05-23 Paolo Bonzini <bonzini@gnu.org>
Moved libcpp from the gcc subdirectory to the toplevel.
* Makefile.am: New file.
* Makefile.in: Regenerate.
* configure.ac: New file.
* configure: Regenerate.
* config.in: Regenerate.
* charset.c: Moved from gcc/cppcharset.c. Add note about
brokenness of input charset detection. Adjust for change
in name of cppucnid.h.
* errors.c: Moved from gcc/cpperror.c. Do not include intl.h.
* expr.c: Moved from gcc/cppexp.c.
* files.c: Moved from gcc/cppfiles.c. Do not include intl.h.
Remove #define of O_BINARY, it is in system.h.
* identifiers.c: Moved from gcc/cpphash.c.
* internal.h: Moved from gcc/cpphash.h. Change header
guard name. All other files adjusted to match name change.
* init.c: Moved from gcc/cppinit.c.
(init_library) [ENABLE_NLS]: Call bindtextdomain.
* lex.c: Moved from gcc/cpplex.c.
* directives.c: Moved from gcc/cpplib.c.
* macro.c: Moved from gcc/cppmacro.c.
* pch.c: Moved from gcc/cpppch.c. Do not include intl.h.
* traditional.c: Moved from gcc/cpptrad.c.
* ucnid.h: Moved from gcc/cppucnid.h. Change header
guard name.
* ucnid.pl: Moved from gcc/cppucnid.pl.
* ucnid.tab: Moved from gcc/cppucnid.tab. Change header
guard name.
* symtab.c: Moved from gcc/hashtable.c.
* line-map.c: Moved from gcc. Do not include intl.h.
* mkdeps.c: Moved from gcc.
* system.h: New file.
* 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-2021 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.