1 2023-09-20 Lewis Hyatt <lhyatt@gmail.com>
4 * files.cc (_cpp_find_file): Set DONT_READ to TRUE for fake
6 (_cpp_fake_include): Pass a unique cpp_dir* address so
7 the fake file will not be found when looked up for real.
9 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
11 * include/cpplib.h: Add cpp_fdeps_format enum.
12 (cpp_options): Add fdeps_format field
13 (cpp_finish): Add structured dependency fdeps_stream parameter.
14 * include/mkdeps.h (deps_add_module_target): Add flag for
15 whether a module is exported or not.
16 (fdeps_add_target): Add function.
17 (deps_write_p1689r5): Add function.
18 * init.cc (cpp_finish): Add new preprocessor parameter used for C++
20 * mkdeps.cc (mkdeps): Implement P1689R5 output.
22 2023-09-06 Jakub Jelinek <jakub@redhat.com>
25 * expr.cc (cpp_classify_number): Diagnose wb literal suffixes
26 for -pedantic* before C2X or -Wc11-c2x-compat.
28 2023-09-06 Jakub Jelinek <jakub@redhat.com>
31 * expr.cc (interpret_int_suffix): Handle wb and WB suffixes.
32 * include/cpplib.h (CPP_N_BITINT): Define.
34 2023-08-07 Alan Modra <amodra@gmail.com>
36 * configure: Regenerate.
38 2023-07-19 Lewis Hyatt <lhyatt@gmail.com>
40 PR preprocessor/103902
41 * lex.cc (identifier_diagnostics_on_lex): New function refactoring
43 (lex_identifier_intern): Use the new function.
44 (lex_identifier): Don't run identifier diagnostics here, rather let
45 the call site do it when needed.
46 (_cpp_lex_direct): Adjust the call sites of lex_identifier ()
48 (struct scan_id_result): New struct.
49 (scan_cur_identifier): New function.
50 (create_literal2): New function.
51 (lit_accum::create_literal2): New function.
52 (is_macro): Folded into new function...
53 (maybe_ignore_udl_macro_suffix): ...here.
54 (is_macro_not_literal_suffix): Folded likewise.
55 (lex_raw_string): Handle UTF-8 in UDL suffix via
56 scan_cur_identifier ().
57 (lex_string): Likewise.
59 2023-07-06 Thomas Schwinge <thomas@codesourcery.com>
61 * include/symtab.h (struct ht_identifier): Document different
64 2023-06-23 Marek Polacek <polacek@redhat.com>
66 * include/cpplib.h (c_lang): Add CXX26 and GNUCXX26.
67 * init.cc (lang_defaults): Add rows for CXX26 and GNUCXX26.
68 (cpp_init_builtins): Set __cplusplus to 202400L for C++26.
69 Set __cplusplus to 202302L for C++23.
71 2023-06-23 Ben Boeckel <me@benboeckel.net>
73 * charset.cc: Allow `UCS_LIMIT` in UTF-8 strings.
75 2023-06-22 David Malcolm <dmalcolm@redhat.com>
77 * charset.cc (get_cppchar_property): New function template, based
79 (cpp_wcwidth): ...this function. Rework to use the above.
80 Include "combining-chars.inc".
81 (cpp_is_combining_char): New function
82 Include "printable-chars.inc".
83 (cpp_is_printable_char): New function
84 * combining-chars.inc: New file, generated by
85 contrib/unicode/gen-combining-chars.py.
86 * include/cpplib.h (cpp_is_combining_char): New function decl.
87 (cpp_is_printable_char): New function decl.
88 * printable-chars.inc: New file, generated by
89 contrib/unicode/gen-printable-chars.py.
91 2023-06-20 Lewis Hyatt <lhyatt@gmail.com>
94 * macro.cc (_cpp_create_definition): Add location argument.
95 * internal.h (_cpp_create_definition): Adjust prototype.
96 * directives.cc (do_define): Pass new location argument to
97 _cpp_create_definition.
98 (do_undef): Stop passing inferior location to cpp_warning_with_line;
99 the default from cpp_warning is better.
100 (cpp_pop_definition): Pass new location argument to
101 _cpp_create_definition.
102 * pch.cc (cpp_read_state): Likewise.
104 2023-06-19 Ben Boeckel <ben.boeckel@kitware.com>
106 * charset.cc: Reject encodings of codepoints above 0x10FFFF.
107 UTF-16 does not support such codepoints and therefore all
108 Unicode rejects such values.
110 2023-06-15 Marek Polacek <polacek@redhat.com>
112 * configure.ac (--enable-host-shared): Don't set PICFLAG here.
113 (--enable-host-pie): New check. Set PICFLAG after this check.
114 * configure: Regenerate.
116 2023-06-15 Jakub Jelinek <jakub@redhat.com>
118 PR preprocessor/80753
119 * files.cc (struct _cpp_file): Add deferred_error bitfield.
120 (_cpp_find_file): When finding a file in cache with deferred_error
121 set in _cpp_FFK_NORMAL mode, call open_file_failed and clear the flag.
122 Set deferred_error in _cpp_FFK_HAS_INCLUDE mode if open_file_failed
125 2023-04-30 Jeff Law <jlaw@ventanamicro>
128 2023-04-30 Longjun Luo <luolongjuna@gmail.com>
130 * init.cc (builtin_array): Do not always warn for a redefinition
133 2023-04-30 Longjun Luo <luolongjuna@gmail.com>
135 * init.cc (builtin_array): Do not always warn for a redefinition
138 2023-03-25 David Malcolm <dmalcolm@redhat.com>
141 * charset.cc (cpp_valid_utf8_p): New function.
142 * include/cpplib.h (cpp_valid_utf8_p): New prototype.
144 2023-03-16 Jakub Jelinek <jakub@redhat.com>
146 * makeucnid.cc (write_copyright): Update Unicode copyright years
148 * makeuname2c.cc (write_copyright): Likewise.
149 * ucnid.h: Regenerated.
150 * uname2c.h: Regenerated.
152 2023-03-13 Lewis Hyatt <lhyatt@gmail.com>
154 PR preprocessor/67046
155 * directives.cc (_cpp_do__Pragma): Increment pfile->keep_tokens to
156 ensure the returned string token is valid.
158 2023-03-13 Lewis Hyatt <lhyatt@gmail.com>
160 * generated_cpp_wcwidth.h: Regenerated for Unicode 15.
162 2022-12-07 Joseph Myers <joseph@codesourcery.com>
164 * init.cc (lang_defaults): Enable va_opt for STDC2X.
165 * lex.cc (maybe_va_opt_error): Adjust diagnostic message for C.
166 * macro.cc (_cpp_arguments_ok): Update comment.
168 2022-11-23 Marek Polacek <polacek@redhat.com>
171 2022-11-23 Marek Polacek <polacek@redhat.com>
173 * configure.ac (--enable-host-shared): Don't set PICFLAG here.
174 (--enable-host-pie): New check. Set PICFLAG after this check.
175 * configure: Regenerate.
177 2022-11-23 Marek Polacek <polacek@redhat.com>
179 * configure.ac (--enable-host-shared): Don't set PICFLAG here.
180 (--enable-host-pie): New check. Set PICFLAG after this check.
181 * configure: Regenerate.
183 2022-11-21 Lewis Hyatt <lhyatt@gmail.com>
185 * directives.cc (do_pragma): Fix memory leak in token buffer. Fix
186 unwanted paste between two tokens.
188 2022-11-21 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
190 * files.cc: Ensure pattern matches before use.
192 2022-11-21 Martin Liska <mliska@suse.cz>
194 * config.in: Re-configure.
196 2022-11-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
198 PR preprocessor/107691
199 * configure.ac: Add valgrind header checks.
200 * configure: Regenerate.
202 2022-11-18 Richard Purdie <richard.purdie@linuxfoundation.org>
204 * macro.cc (_cpp_builtin_macro_text): Don't remap filenames within
207 2022-11-05 Lewis Hyatt <lhyatt@gmail.com>
209 PR preprocessor/55971
210 * lex.cc (get_fresh_line_impl): New function refactoring the code
212 (_cpp_get_fresh_line): ...here.
213 (lex_raw_string): Use the new version of get_fresh_line_impl() to
214 support raw strings containing new lines when processing a directive.
216 2022-11-04 Jakub Jelinek <jakub@redhat.com>
218 * makeuname2c.cc (struct generated): Update from Unicode 15.0.0
220 * ucnid.h: Regenerated for Unicode 15.0.0.
221 * uname2c.h: Likewise.
223 2022-10-19 Lewis Hyatt <lhyatt@gmail.com>
225 * include/cpplib.h (struct cpp_string): Use new "string_length" GTY.
226 * include/symtab.h (struct ht_identifier): Likewise.
228 2022-10-14 Joseph Myers <joseph@codesourcery.com>
230 * charset.cc (ucn_valid_in_identifier): Check xid_identifiers not
231 cplusplus to determine whether to use CXX23 and NXX23 flags.
232 * include/cpplib.h (struct cpp_options): Add xid_identifiers.
233 * init.cc (struct lang_flags, lang_defaults): Add xid_identifiers.
234 (cpp_set_lang): Set xid_identifiers.
235 * lex.cc (warn_about_normalization): Add parameter identifier.
236 Only pedwarn about non-NFC for identifiers, not pp-numbers.
237 (_cpp_lex_direct): Update calls to warn_about_normalization.
239 2022-10-14 Jakub Jelinek <jakub@redhat.com>
241 * include/cpplib.h (CPP_N_BFLOAT16): Define.
242 * expr.cc (interpret_float_suffix): Handle bf16 and BF16 suffixes for
245 2022-09-28 Eugene Rozenfeld <erozen@microsoft.com>
247 * include/line-map.h: Add discriminator to location_adhoc_data.
248 (get_combined_adhoc_loc): Add discriminator parameter.
249 (get_discriminator_from_adhoc_loc): Add external declaration.
250 (get_discriminator_from_loc): Add external declaration.
251 (COMBINE_LOCATION_DATA): Add discriminator parameter.
252 * lex.cc (get_location_for_byte_range_in_cur_line) Pass 0 discriminator
253 in a call to COMBINE_LOCATION_DATA.
254 (warn_about_normalization): Pass 0 discriminator in a call to
255 COMBINE_LOCATION_DATA.
256 (_cpp_lex_direct): Pass 0 discriminator in a call to
257 COMBINE_LOCATION_DATA.
258 * line-map.cc (location_adhoc_data_hash): Use discriminator compute
259 location_adhoc_data hash.
260 (location_adhoc_data_eq): Use discriminator when comparing
262 (can_be_stored_compactly_p): Check discriminator to determine
264 (get_combined_adhoc_loc): Add discriminator parameter.
265 (get_discriminator_from_adhoc_loc): New function to get the discriminator
266 from an ad-hoc location.
267 (get_discriminator_from_loc): New function to get the discriminator
270 2022-09-27 Jakub Jelinek <jakub@redhat.com>
274 * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
275 {f,F}{32,64,128}x suffixes for C++.
277 2022-09-08 Lewis Hyatt <lhyatt@gmail.com>
279 * line-map.cc (location_adhoc_data_update): Remove reliance on
281 (get_combined_adhoc_loc): Likewise.
282 (rebuild_location_adhoc_htab): Fix issue where the htab was not
285 2022-09-07 Joseph Myers <joseph@codesourcery.com>
287 * include/cpplib.h (struct cpp_options): Add true_false.
288 * expr.cc (eval_token): Check true_false not cplusplus to
289 determine whether to handle true and false keywords.
290 * init.cc (struct lang_flags): Add true_false.
291 (lang_defaults): Update.
292 (cpp_set_lang): Set true_false.
294 2022-09-07 Jakub Jelinek <jakub@redhat.com>
296 * include/cpplib.h (struct cpp_options): Add cpp_warn_unicode member.
297 (enum cpp_warning_reason): Add CPP_W_UNICODE.
298 * init.cc (cpp_create_reader): Initialize cpp_warn_unicode.
299 * charset.cc (_cpp_valid_ucn): In possible identifier contexts, don't
300 handle \u{ or \N{ specially in -std=c* modes except -std=c++2{3,b}.
301 In possible identifier contexts, don't emit an error and punt
302 if \N isn't followed by {, or if \N{} surrounds some lower case
303 letters or _. In possible identifier contexts when not C++23, don't
304 emit an error but warning about unknown character names and treat as
305 separate tokens. When treating as separate tokens \u{ or \N{, emit
308 2022-09-05 Joseph Myers <joseph@codesourcery.com>
310 * init.cc (lang_defaults): Disable trigraphs for C2x.
312 2022-09-02 David Malcolm <dmalcolm@redhat.com>
315 * include/cpplib.h (BOL): Move macro to 1 << 12 since it is
316 not used by C/C++'s unsigned char token flags.
317 (DECIMAL_INT): New, using 1 << 6, so that it is visible as
318 part of C/C++'s 8 bits of token flags.
320 2022-09-01 Jakub Jelinek <jakub@redhat.com>
323 * include/cpplib.h (struct cpp_options): Implement C++23
324 P2295R6 - Support for UTF-8 as a portable source file encoding.
325 Add cpp_warn_invalid_utf8 and cpp_input_charset_explicit fields.
326 (enum cpp_warning_reason): Add CPP_W_INVALID_UTF8 enumerator.
327 * init.cc (cpp_create_reader): Initialize cpp_warn_invalid_utf8
328 and cpp_input_charset_explicit.
329 * charset.cc (_cpp_valid_utf8): Adjust function comment.
330 * lex.cc (UCS_LIMIT): Define.
331 (utf8_continuation): New const variable.
332 (utf8_signifier): Move earlier in the file.
333 (_cpp_warn_invalid_utf8, _cpp_handle_multibyte_utf8): New functions.
334 (_cpp_skip_block_comment): Handle -Winvalid-utf8 warning.
335 (skip_line_comment): Likewise.
336 (lex_raw_string, lex_string): Likewise.
337 (_cpp_lex_direct): Likewise.
339 2022-08-31 Jakub Jelinek <jakub@redhat.com>
341 PR preprocessor/106778
342 * makeuname2c.cc (write_nodes): Reverse order of && operands in
345 2022-08-26 Jakub Jelinek <jakub@redhat.com>
348 * charset.cc (wide_str_to_charconst): Implement P2362R3 - Remove
349 non-encodable wide character literals and multicharacter. For
350 C++23 use CPP_DL_ERROR instead of CPP_DL_WARNING for
351 "character constant too long for its type" diagnostics on CPP_WCHAR
354 2022-08-26 Jakub Jelinek <jakub@redhat.com>
357 * charset.cc: Implement C++23 P2071R2 - Named universal character
358 escapes. Include uname2c.h.
359 (hangul_syllables, hangul_count): New variables.
360 (struct uname2c_data): New type.
361 (_cpp_uname2c, _cpp_uname2c_uax44_lm2): New functions.
362 (_cpp_valid_ucn): Use them. Handle named universal character escapes.
363 (convert_ucn): Adjust comment.
364 (convert_escape): Call convert_ucn even for \N.
365 (_cpp_interpret_identifier): Handle named universal character escapes.
366 * lex.cc (get_bidi_ucn): Fix up function comment formatting.
367 (get_bidi_named): New function.
368 (forms_identifier_p, lex_string): Handle named universal character
370 * makeuname2c.cc: New file. Small parts copied from makeucnid.cc.
371 * uname2c.h: New generated file.
373 2022-08-24 Jakub Jelinek <jakub@redhat.com>
376 * init.cc: Implement C++23 P2437R1 - Support for #warning.
377 (lang_defaults): Set warning_directive for GNUCXX23 and CXX23.
378 * directives.cc (directive_diagnostics): Use different wording of
379 #warning pedwarn for C++.
381 2022-08-20 Jakub Jelinek <jakub@redhat.com>
384 * include/cpplib.h (struct cpp_options): Implement
385 P2290R3 - Delimited escape sequences. Add delimite_escape_seqs
387 * init.cc (struct lang_flags): Likewise.
388 (lang_defaults): Add delim column.
389 (cpp_set_lang): Copy over delimite_escape_seqs.
390 * charset.cc (extend_char_range): New function.
391 (_cpp_valid_ucn): Use it. Handle delimited escape sequences.
392 (convert_hex): Likewise.
393 (convert_oct): Likewise.
394 (convert_ucn): Use extend_char_range.
395 (convert_escape): Call convert_oct even for \o.
396 (_cpp_interpret_identifier): Handle delimited escape sequences.
397 * lex.cc (get_bidi_ucn_1): Likewise. Add end argument, fill it in.
398 (get_bidi_ucn): Adjust get_bidi_ucn_1 caller. Use end argument to
401 2022-08-18 Joseph Myers <joseph@codesourcery.com>
403 * include/cpplib.h (struct cpp_options): Add warning_directive.
404 * init.cc (struct lang_flags, lang_defaults): Add
406 * directives.cc (DIRECTIVE_TABLE): Mark #warning as STDC2X not
408 (directive_diagnostics): Diagnose #warning with -Wc11-c2x-compat,
409 or with -pedantic for a standard not supporting #warning.
411 2022-08-16 Tom Honermann <tom@honermann.net>
414 * include/cpplib.h (cpp_warning_reason): Add CPP_W_CXX20_COMPAT.
415 * init.cc (cpp_create_reader): Add cpp_warn_cxx20_compat.
417 2022-08-08 Tom Honermann <tom@honermann.net>
419 PR preprocessor/106426
420 * charset.cc (narrow_str_to_charconst): Set signedness of CPP_UTF8CHAR
421 literals based on unsigned_utf8char.
422 * include/cpplib.h (cpp_options): Add unsigned_utf8char.
423 * init.cc (cpp_create_reader): Initialize unsigned_utf8char.
425 2022-07-15 Jonathan Wakely <jwakely@redhat.com>
427 * include/line-map.h (label_text::take_or_copy): Remove.
428 (label_text::moved_from): Rename to release.
429 (label_text::m_buffer, label_text::m_owned): Make private.
430 (label_text::get, label_text::is_owned): New accessors.
432 2022-07-13 Marek Polacek <polacek@redhat.com>
434 PR preprocessor/106272
435 * include/line-map.h (class label_text): Don't std::move in a return
438 2022-07-10 Lewis Hyatt <lhyatt@gmail.com>
440 PR preprocessor/97498
441 * directives.cc (destringize_and_run): Override the location of
442 the CPP_PRAGMA token from a _Pragma directive to the location of
443 the expansion point, as is done for the tokens lexed from it.
445 2022-07-07 David Malcolm <dmalcolm@redhat.com>
447 * include/line-map.h: Include <utility>.
448 (class label_text): Delete maybe_free method in favor of a
449 destructor. Add move ctor and assignment operator. Add deletion
450 of the copy ctor and copy-assignment operator. Rename field
451 m_caller_owned to m_owned. Add std::move where necessary; add
452 moved_from member function.
454 2022-06-28 Lewis Hyatt <lhyatt@gmail.com>
456 * ucnid.h: Regenerated for Unicode 14.0.
458 2022-06-26 Lewis Hyatt <lhyatt@gmail.com>
460 * generated_cpp_wcwidth.h: Generated from updated Unicode data files.
462 2022-05-29 Jakub Jelinek <jakub@redhat.com>
464 PR preprocessor/105732
465 * expr.cc (_cpp_parse_expr): Handle CPP_PADDING by just another
468 2022-05-20 David Malcolm <dmalcolm@redhat.com>
470 * lex.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and
473 2022-02-11 Joseph Myers <joseph@codesourcery.com>
475 * Makefile.in (po/$(PACKAGE).pot): Also handle cpp_warning_at,
476 cpp_pedwarning_at and cpp_error_at.
478 2022-02-01 Jakub Jelinek <jakub@redhat.com>
480 PR preprocessor/104147
481 * macro.cc (funlike_invocation_p): For padding prefer a token
482 with val.source non-NULL especially if it has PREV_WHITE set
483 on val.source->flags. Add gcc_assert that CPP_PADDING tokens
484 don't have PREV_WHITE set in flags.
486 2022-02-01 Jakub Jelinek <jakub@redhat.com>
488 * directives.cc (destringize_and_run): Push &pfile->avoid_paste
489 instead of a copy of pfile->directive_result for the CPP_PADDING
492 2022-01-24 Marek Polacek <polacek@redhat.com>
494 PR preprocessor/104030
495 * include/cpplib.h (enum cpp_bidirectional_level): Add
496 bidirectional_ucn. Set values explicitly.
497 * internal.h (cpp_reader): Adjust warn_bidi_p.
498 * lex.cc (maybe_warn_bidi_on_close): Don't warn about UCNs
499 unless UCN checking is on.
500 (maybe_warn_bidi_on_char): Likewise.
502 2022-01-18 Richard Biener <rguenther@suse.de>
504 * include/line-map.h (class line_maps): Re-arrange fields
506 (class rich_location): Likewise.
507 * line-map.cc (rich_location::rich_location): Adjust.
509 2022-01-17 Martin Liska <mliska@suse.cz>
511 * Makefile.in: Rename .c names to .cc.
513 2022-01-17 Martin Liska <mliska@suse.cz>
515 * Makefile.in: Rename .c names to .cc.
516 * charset.cc (convert_escape): Likewise.
517 * directives.cc (directive_diagnostics): Likewise.
518 (_cpp_handle_directive): Likewise.
519 (lex_macro_node): Likewise.
520 * include/cpplib.h (struct _cpp_file): Likewise.
521 (PURE_ZERO): Likewise.
522 (cpp_defined): Likewise.
523 (cpp_error_at): Likewise.
524 (cpp_forall_identifiers): Likewise.
525 (cpp_compare_macros): Likewise.
526 (cpp_get_converted_source): Likewise.
527 (cpp_read_state): Likewise.
528 (cpp_directive_only_process): Likewise.
529 (struct cpp_decoded_char): Likewise.
530 * include/line-map.h (enum lc_reason): Likewise.
531 (enum location_aspect): Likewise.
532 * include/mkdeps.h: Likewise.
533 * init.cc (cpp_destroy): Likewise.
534 (cpp_finish): Likewise.
535 * internal.h (struct cpp_reader): Likewise.
536 (_cpp_defined_macro_p): Likewise.
537 (_cpp_backup_tokens_direct): Likewise.
538 (_cpp_destroy_hashtable): Likewise.
539 (_cpp_has_header): Likewise.
540 (_cpp_expand_op_stack): Likewise.
541 (_cpp_commit_buff): Likewise.
542 (_cpp_restore_special_builtin): Likewise.
543 (_cpp_bracket_include): Likewise.
544 (_cpp_replacement_text_len): Likewise.
546 * line-map.cc (linemap_macro_loc_to_exp_point): Likewise.
547 (linemap_check_files_exited): Likewise.
548 (line_map_new_raw): Likewise.
549 * traditional.cc (enum ls): Likewise.
551 2022-01-17 Martin Liska <mliska@suse.cz>
553 * charset.c: Moved to...
554 * charset.cc: ...here.
555 * directives.c: Moved to...
556 * directives.cc: ...here.
557 * errors.c: Moved to...
558 * errors.cc: ...here.
559 * expr.c: Moved to...
561 * files.c: Moved to...
563 * identifiers.c: Moved to...
564 * identifiers.cc: ...here.
565 * init.c: Moved to...
569 * line-map.c: Moved to...
570 * line-map.cc: ...here.
571 * macro.c: Moved to...
573 * makeucnid.c: Moved to...
574 * makeucnid.cc: ...here.
575 * mkdeps.c: Moved to...
576 * mkdeps.cc: ...here.
579 * symtab.c: Moved to...
580 * symtab.cc: ...here.
581 * traditional.c: Moved to...
582 * traditional.cc: ...here.
584 2022-01-15 Martin Sebor <msebor@redhat.com>
586 * files.c (_cpp_find_file): Substitute a valid pointer for
587 an invalid one to avoid -Wuse-after-free.
589 2022-01-12 Clément Chigot <clement.chigot@atos.net>
591 * configure.ac: Check sizeof ino_t and dev_t.
592 * config.in: Regenerate.
593 * configure: Regenerate.
594 * include/cpplib.h (INO_T_CPP): Change for AIX.
595 (DEV_T_CPP): New macro.
596 (struct cpp_dir): Use it.
598 2021-12-30 Jakub Jelinek <jakub@redhat.com>
600 PR preprocessor/89971
601 * macro.c (replace_args): For ##__VA_OPT__, if __VA_OPT__ expands
602 to no tokens at all, drop PASTE_LEFT flag from the previous token.
604 2021-12-04 Jakub Jelinek <jakub@redhat.com>
606 PR preprocessor/102432
607 * lex.c (_cpp_lex_direct): If buffer->need_line while
608 pfile->state.in_deferred_pragma, return CPP_PRAGMA_EOL token instead
609 of assertion failure.
611 2021-12-03 Jakub Jelinek <jakub@redhat.com>
614 * include/line-map.h (class line_maps): Add GTY((callback)) to
615 reallocator and round_alloc_size members.
617 2021-12-01 Jakub Jelinek <jakub@redhat.com>
620 * init.c (struct lang_flags): Remove cxx23_identifiers.
621 (lang_defaults): Remove cxx23_identifiers initializers.
622 (cpp_set_lang): Don't copy cxx23_identifiers.
623 * include/cpplib.h (struct cpp_options): Adjust comment about
624 c11_identifiers. Remove cxx23_identifiers field.
625 * lex.c (warn_about_normalization): Use cplusplus instead of
627 * charset.c (ucn_valid_in_identifier): Likewise.
629 2021-12-01 Jakub Jelinek <jakub@redhat.com>
631 PR preprocessor/103415
632 * macro.c (stringify_arg): Remove va_opt argument and va_opt handling.
633 (paste_tokens): On successful paste or in PREV_WHITE and
634 PREV_FALLTHROUGH flags from the *plhs token to the new token.
635 (replace_args): Adjust stringify_arg callers. For #__VA_OPT__,
636 perform token pasting in a separate loop before stringify_arg call.
638 2021-11-30 Richard Biener <rguenther@suse.de>
640 * charset.c (convert_escape): Remove unreachable break.
642 2021-11-30 Jakub Jelinek <jakub@redhat.com>
645 * init.c (lang_defaults): Enable cxx23_identifiers for
646 -std={gnu,c}++{11,14,17,20} too.
648 2021-11-29 Eric Gallager <egallager@gcc.gnu.org>
651 * Makefile.in: Use ETAGS variable in TAGS target.
652 * configure: Regenerate.
653 * configure.ac: Allow ETAGS variable to be overridden.
655 2021-11-23 Christophe Lyon <christophe.lyon@foss.st.com>
657 PR preprocessor/103355
658 * system.h (ATTR_LIKELY): Fix definition.
660 2021-11-23 Marek Polacek <polacek@redhat.com>
661 Jonathan Wakely <jwakely@redhat.com>
663 PR preprocessor/103355
664 * lex.c: Use ATTR_LIKELY instead of [[likely]].
665 * system.h (ATTR_LIKELY): Define.
667 2021-11-22 Jakub Jelinek <jakub@redhat.com>
668 Tobias Burnus <tobias@codesourcery.com>
670 PR preprocessor/103165
671 * internal.h (struct lexer_state): Add ignore__Pragma field.
672 * macro.c (builtin_macro): Don't interpret _Pragma if
673 pfile->state.ignore__Pragma.
674 (expand_arg): Temporarily set pfile->state.ignore__Pragma to 1.
676 2021-11-17 David Malcolm <dmalcolm@redhat.com>
678 PR preprocessor/103026
679 * lex.c (struct bidi::context): New.
680 (bidi::vec): Convert to a vec of context rather than unsigned
682 (bidi::ctx_at): Rename to...
683 (bidi::pop_kind_at): ...this and reimplement for above change.
684 (bidi::current_ctx): Update for change to vec.
685 (bidi::current_ctx_ucn_p): Likewise.
686 (bidi::current_ctx_loc): New.
687 (bidi::on_char): Update for usage of context struct. Add "loc"
688 param and pass it when pushing contexts.
689 (get_location_for_byte_range_in_cur_line): New.
690 (get_bidi_utf8): Rename to...
691 (get_bidi_utf8_1): ...this, reintroducing...
692 (get_bidi_utf8): ...as a wrapper, setting *OUT when the result is
694 (get_bidi_ucn): Rename to...
695 (get_bidi_ucn_1): ...this, reintroducing...
696 (get_bidi_ucn): ...as a wrapper, setting *OUT when the result is
698 (class unpaired_bidi_rich_location): New.
699 (maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when
700 reporting on unpaired bidi chars. Split into singular vs plural
702 (maybe_warn_bidi_on_char): Pass in a location_t rather than a
703 const uchar * and use it when emitting warnings, and when calling
705 (_cpp_skip_block_comment): Capture location when kind is not NONE
706 and pass it to maybe_warn_bidi_on_char.
707 (skip_line_comment): Likewise.
708 (forms_identifier_p): Likewise.
709 (lex_raw_string): Likewise.
710 (lex_string): Likewise.
712 2021-11-17 David Malcolm <dmalcolm@redhat.com>
714 PR preprocessor/103026
715 * lex.c (maybe_warn_bidi_on_close): Use a rich_location
716 and call set_escape_on_output (true) on it.
717 (maybe_warn_bidi_on_char): Likewise.
719 2021-11-17 Jakub Jelinek <jakub@redhat.com>
721 PR preprocessor/103130
722 * lex.c (cpp_directive_only_process): Treat even \*/ as end of block
725 2021-11-17 Marek Polacek <polacek@redhat.com>
727 PR preprocessor/103026
728 * include/cpplib.h (enum cpp_bidirectional_level): New.
729 (struct cpp_options): Add cpp_warn_bidirectional.
730 (enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL.
731 * internal.h (struct cpp_reader): Add warn_bidi_p member
733 * init.c (cpp_create_reader): Set cpp_warn_bidirectional.
734 * lex.c (bidi): New namespace.
735 (get_bidi_utf8): New function.
736 (get_bidi_ucn): Likewise.
737 (maybe_warn_bidi_on_close): Likewise.
738 (maybe_warn_bidi_on_char): Likewise.
739 (_cpp_skip_block_comment): Implement warning about bidirectional
741 (skip_line_comment): Likewise.
742 (forms_identifier_p): Likewise.
743 (lex_identifier): Likewise.
744 (lex_string): Likewise.
745 (lex_raw_string): Likewise.
747 2021-11-01 David Malcolm <dmalcolm@redhat.com>
749 * charset.c (convert_escape): Use encoding_rich_location when
750 complaining about nonprintable unknown escape sequences.
751 (cpp_display_width_computation::::cpp_display_width_computation):
752 Pass in policy rather than tabstop.
753 (cpp_display_width_computation::process_next_codepoint): Add "out"
754 param and populate *out if non-NULL.
755 (cpp_display_width_computation::advance_display_cols): Pass NULL
756 to process_next_codepoint.
757 (cpp_byte_column_to_display_column): Pass in policy rather than
758 tabstop. Pass NULL to process_next_codepoint.
759 (cpp_display_column_to_byte_column): Pass in policy rather than
761 * errors.c (cpp_diagnostic_get_current_location): New function,
762 splitting out the logic from...
763 (cpp_diagnostic): ...here.
764 (cpp_warning_at): New function.
765 (cpp_pedwarning_at): New function.
766 * include/cpplib.h (cpp_warning_at): New decl for rich_location.
767 (cpp_pedwarning_at): Likewise.
768 (struct cpp_decoded_char): New.
769 (struct cpp_char_column_policy): New.
770 (cpp_display_width_computation::cpp_display_width_computation):
771 Replace "tabstop" param with "policy".
772 (cpp_display_width_computation::process_next_codepoint): Add "out"
774 (cpp_display_width_computation::m_tabstop): Replace with...
775 (cpp_display_width_computation::m_policy): ...this.
776 (cpp_byte_column_to_display_column): Replace "tabstop" param with
778 (cpp_display_width): Likewise.
779 (cpp_display_column_to_byte_column): Likewise.
780 * include/line-map.h (rich_location::escape_on_output_p): New.
781 (rich_location::set_escape_on_output): New.
782 (rich_location::m_escape_on_output): New.
783 * internal.h (cpp_diagnostic_get_current_location): New decl.
784 (class encoding_rich_location): New.
785 * lex.c (skip_whitespace): Use encoding_rich_location when
786 complaining about null characters.
787 (warn_about_normalization): Generate a source range when
788 complaining about improperly normalized tokens, rather than just a
789 point, and use encoding_rich_location so that the source code
790 is escaped on printing.
791 * line-map.c (rich_location::rich_location): Initialize
794 2021-10-29 Tobias Burnus <tobias@codesourcery.com>
797 * directives.c (destringize_and_run): Add PRAGMA_OP to the
798 CPP_PRAGMA token's flags to mark is as coming from _Pragma.
799 * include/cpplib.h (PRAGMA_OP): #define, to be used with token flags.
800 * macro.c (collect_args): Only handle CPP_PRAGMA special if PRAGMA_OP
803 2021-10-22 Eric Gallager <egallager@gcc.gnu.org>
806 * Makefile.in: Add dummy install-dvi target.
808 2021-10-18 Martin Liska <mliska@suse.cz>
810 * charset.c (convert_oct): Remove unused but set variable.
812 2021-10-06 Jakub Jelinek <jakub@redhat.com>
814 * init.c (lang_defaults): Implement P2334R1, enable elifdef for
815 -std=c++23 and -std=gnu++23.
816 * directives.c (_cpp_handle_directive): Support elifdef/elifndef if
817 either CPP_OPTION (pfile, elifdef) or !CPP_OPTION (pfile, std).
818 (do_elif): For older non-std modes if pedantic pedwarn about
819 #elifdef/#elifndef directives that change behavior.
821 2021-09-01 Jakub Jelinek <jakub@redhat.com>
824 * include/cpplib.h (struct cpp_options): Add cxx23_identifiers.
825 * charset.c (CXX23, NXX23): New enumerators.
826 (CID, NFC, NKC, CTX): Renumber.
827 (ucn_valid_in_identifier): Implement P1949R7 - use CXX23 and
828 NXX23 flags for cxx23_identifiers. For start character in
829 non-pedantic mode, allow characters that are allowed as start
830 characters in any of the supported language modes, rather than
831 disallowing characters allowed only as non-start characters in
832 current mode but for characters from other language modes allowing
833 them even if they are never allowed at start.
834 * init.c (struct lang_flags): Add cxx23_identifiers.
835 (lang_defaults): Add cxx23_identifiers column.
836 (cpp_set_lang): Initialize CPP_OPTION (pfile, cxx23_identifiers).
837 * lex.c (warn_about_normalization): If cxx23_identifiers, use
838 cpp_pedwarning_with_line instead of cpp_warning_with_line for
839 "is not in NFC" diagnostics.
840 * makeucnid.c: Adjust usage comment.
841 (CXX23, NXX23): New enumerators.
842 (all_languages): Add CXX23.
843 (not_NFC, not_NFKC, maybe_not_NFC): Renumber.
844 (read_derivedcore): New function.
845 (write_table): Print also CXX23 and NXX23 columns.
846 (main): Require 5 arguments instead of 4, call read_derivedcore.
847 * ucnid.h: Regenerated using Unicode 13.0.0 files.
849 2021-09-01 Jason Merrill <jason@redhat.com>
851 * macro.c (replace_args): When __VA_OPT__ is on the LHS of ##,
852 remove trailing avoid_paste tokens.
854 2021-09-01 Jakub Jelinek <jakub@redhat.com>
856 PR preprocessor/101488
857 * macro.c (replace_args): Fix up handling of CPP_PADDING tokens at the
858 start or end of __VA_OPT__ arguments when preceeded or followed by ##.
860 2021-08-31 Martin Sebor <msebor@redhat.com>
862 * include/line-map.h (class rich_location): Disable copying and
865 2021-08-25 Lewis Hyatt <lhyatt@gmail.com>
868 * charset.c (init_iconv_desc): Adapt to permit PFILE argument to
870 (_cpp_convert_input): Likewise. Also move UTF-8 BOM logic to...
871 (cpp_check_utf8_bom): ...here. New function.
872 (cpp_input_conversion_is_trivial): New function.
873 * files.c (read_file_guts): Allow PFILE argument to be NULL. Add
874 INPUT_CHARSET argument as an alternate source of this information.
875 (read_file): Pass the new argument to read_file_guts.
876 (cpp_get_converted_source): New function.
877 * include/cpplib.h (struct cpp_converted_source): Declare.
878 (cpp_get_converted_source): Declare.
879 (cpp_input_conversion_is_trivial): Declare.
880 (cpp_check_utf8_bom): Declare.
882 2021-08-17 Jakub Jelinek <jakub@redhat.com>
884 * macro.c (vaopt_state): Add m_stringify member.
885 (vaopt_state::vaopt_state): Initialize it.
886 (vaopt_state::update): Overwrite it.
887 (vaopt_state::stringify): New method.
888 (stringify_arg): Replace arg argument with first, count arguments
889 and add va_opt argument. Use first instead of arg->first and
890 count instead of arg->count, for va_opt add paste_tokens handling.
891 (paste_tokens): Fix up len calculation. Don't spell rhs twice,
892 instead use %.*s to supply lhs and rhs spelling lengths. Don't call
893 _cpp_backup_tokens here.
894 (paste_all_tokens): Call it here instead.
895 (replace_args): Adjust stringify_arg caller. For vaopt_state::END
896 if stringify is true handle __VA_OPT__ stringification.
897 (create_iso_definition): Handle # __VA_OPT__ similarly to # macro_arg.
899 2021-08-12 Jakub Jelinek <jakub@redhat.com>
901 PR preprocessor/101638
902 * macro.c (cpp_sys_macro_p): Return true instead of
903 crashing on builtin macros.
905 2021-08-05 Jakub Jelinek <jakub@redhat.com>
908 * ucnid.h: Regenerated using Unicode 13.0.0 files.
910 2021-08-05 Jakub Jelinek <jakub@redhat.com>
913 * makeucnid.c (write_table): Fix computation of last_combine.
914 * ucnid.h: Regenerated using Unicode 6.3.0 files.
916 2021-06-16 Jason Merrill <jason@redhat.com>
919 PR preprocessor/96391
920 * line-map.c (linemap_compare_locations): Only use comparison with
921 LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort.
923 2021-05-20 Christophe Lyon <christophe.lyon@linaro.org>
924 Torbjörn Svensson <torbjorn.svensson@st.com>
927 * include/cpplib.h (cpp_builtin_type): Add BT_FILE_NAME entry.
928 * init.c (builtin_array): Likewise.
929 * macro.c (_cpp_builtin_macro_text): Add support for BT_FILE_NAME.
931 2021-05-20 Jakub Jelinek <jakub@redhat.com>
933 PR preprocessor/100646
934 * lex.c (cpp_directive_only_process): Treat end of file as termination
935 for !is_block comments.
937 2021-05-12 Jakub Jelinek <jakub@redhat.com>
939 PR preprocessor/100392
940 * lex.c (cpp_directive_only_process): If buffer doesn't end with '\n',
941 add buffer->rlimit[0] character to the printed range and
942 CPP_INCREMENT_LINE and increment line_count.
944 2021-05-11 Joseph Myers <joseph@codesourcery.com>
946 * include/cpplib.h (struct cpp_options): Add elifdef.
947 * init.c (struct lang_flags): Add elifdef.
948 (lang_defaults): Update to include elifdef initializers.
949 (cpp_set_lang): Set elifdef for pfile based on language.
950 * directives.c (STDC2X, ELIFDEF): New macros.
951 (EXTENSION): Increase value to 3.
952 (DIRECTIVE_TABLE): Add #elifdef and #elifndef.
953 (_cpp_handle_directive): Do not treat ELIFDEF directives as
954 directives for language versions without the #elifdef feature.
955 (do_elif): Handle #elifdef and #elifndef.
956 (do_elifdef, do_elifndef): New functions.
958 2021-05-11 Joseph Myers <joseph@codesourcery.com>
960 * lex.c (cpp_avoid_paste): Do not allow pasting CPP_NUMBER with
963 2021-05-11 Joseph Myers <joseph@codesourcery.com>
965 * init.c (lang_defaults): Enable digit separators for GNUC2X and
968 2021-05-07 Jakub Jelinek <jakub@redhat.com>
971 * lex.c (cpp_avoid_paste): Handle token1 CPP_PRAGMA like CPP_NAME.
973 2021-05-06 Joseph Myers <joseph@codesourcery.com>
976 PR preprocessor/97604
977 * lex.c (lex_number): Reject adjacent digit separators here. Do
978 not allow digit separators before '.' or an exponent with sign.
979 * expr.c (cpp_classify_number): Do not check for adjacent digit
982 2021-05-03 H.J. Lu <hjl.tools@gmail.com>
985 * configure: Regenerated.
987 2021-04-29 Joseph Myers <joseph@codesourcery.com>
989 PR preprocessor/82359
990 * directives.c (strtolinenum): Handle digit separators.
992 2021-04-19 Richard Biener <rguenther@suse.de>
994 PR preprocessor/100142
995 * line-map.c (linemap_position_for_loc_and_offset): Revert
996 unintended s/column_offset/column/ change.
998 2021-04-13 Nathan Sidwell <nathan@acm.org>
1000 PR preprocessor/99446
1001 * line-map.c (line-map.c): Do not advance to linemaps for
1004 2021-04-13 Eric Botcazou <ebotcazou@adacore.com>
1006 * include/line-map.h (IS_MACRO_LOC): Delete.
1007 * line-map.c (linemap_location_from_macro_expansion_p): Test
1008 LINEMAPS_MACRO_LOWEST_LOCATION of the linemap.
1010 2021-03-02 David Malcolm <dmalcolm@redhat.com>
1013 * line-map.c (rich_location::maybe_add_fixit): Reject fix-it hints
1016 2021-02-24 Nathan Sidwell <nathan@acm.org>
1019 * include/line-map.h
1022 2021-02-24 Nathan Sidwell <nathan@acm.org>
1025 * init.c (read_original_filename): Expunge all evidence of the
1028 2021-02-18 Nathan Sidwell <nathan@acm.org>
1031 * include/cpplib.h (cpp_find_header_unit): Rename to ...
1032 (cpp_probe_header_unit): ... this.
1033 * internal.h (_cp_find_header_unit): Declare.
1034 * files.c (cpp_find_header_unit): Break apart to ..
1035 (test_header_unit): ... this, and ...
1036 (_cpp_find_header_unit): ... and, or and ...
1037 (cpp_probe_header_unit): ... this.
1038 * macro.c (cpp_get_token_1): Call _cpp_find_header_unit.
1040 2021-02-16 Nathan Sidwell <nathan@acm.org>
1042 * files.c (_cpp_stack_file): Make buffers end in unread \n.
1044 2021-02-10 David Malcolm <dmalcolm@redhat.com>
1046 PR preprocessor/96391
1047 * line-map.c (linemap_compare_locations): Require that
1048 the location be <= LINE_MAP_MAX_LOCATION_WITH_COLS when
1049 treating locations as coming from the same macro expansion.
1051 2021-02-04 Jakub Jelinek <jakub@redhat.com>
1053 * expr.c (cpp_classify_number): Use make_signed_t<size_t> instead of
1054 make_signed<size_t>::type in the diagnostics.
1056 2021-02-03 Jakub Jelinek <jakub@redhat.com>
1058 PR preprocessor/98882
1059 * lex.c (cpp_directive_only_process): Don't assert that rlimit[-1]
1060 is a newline, instead assert that rlimit[0] is either newline or
1061 carriage return. When seeing '\\' followed by '\r', check limit
1062 before accessing pos[1].
1064 2021-02-03 Ed Smith-Rowland <3dw4rd@verizon.net>
1066 * expr.c (interpret_int_suffix): Detect 'z' integer suffix.
1067 (cpp_classify_number): Compat warning for use of 'z' suffix.
1068 * include/cpplib.h (struct cpp_options): New flag.
1069 (enum cpp_warning_reason): New flag.
1070 (CPP_N_USERDEF): Comment C++0x -> C++11.
1071 (CPP_N_SIZE_T): New flag for cpp_classify_number.
1072 * init.c (cpp_set_lang): Initialize new flag.
1074 2021-01-27 liuhongt <hongtao.liu@intel.com>
1077 * lex.c (search_line_sse2): Replace builtins with == operator.
1079 2021-01-26 Paul Fee <paul.f.fee@gmail.com>
1081 * include/cpplib.h (c_lang): Add CXX23 and GNUCXX23.
1082 * init.c (lang_defaults): Add rows for CXX23 and GNUCXX23.
1083 (cpp_init_builtins): Set __cplusplus to 202100L for C++23.
1085 2021-01-15 Nathan Sidwell <nathan@acm.org>
1087 PR preprocessor/95253
1088 * mkdeps.c (munge): Do not escape ':'.
1090 2020-12-14 Nathan Sidwell <nathan@acm.org>
1092 * include/cpplib.h (struct cpp_macro): Add imported_p field.
1093 (struct cpp_hashnode): Tweak deferred field documentation.
1094 * macro.c (_cpp_new_macro): Clear new field.
1095 (cpp_get_deferred_macro, get_deferred_or_lazy_macro): Assert
1098 2020-12-10 Jason Merrill <jason@redhat.com>
1100 * init.c (cpp_init_builtins): Update __cplusplus for C++20.
1102 2020-12-01 JeanHeyd Meneide <phdofthehouse@gmail.com>
1104 * charset.c (init_iconv_desc): Initialize "to" and "from" fields.
1105 * directives.c (cpp_get_narrow_charset_name): New function.
1106 (cpp_get_wide_charset_name): Likewise.
1107 * include/cpplib.h (cpp_get_narrow_charset_name): Prototype.
1108 (cpp_get_wide_charset_name): Likewise.
1109 * internal.h (cset_converter): Add "to" and "from" fields.
1111 2020-11-27 Joseph Myers <joseph@codesourcery.com>
1113 PR preprocessor/97602
1114 * directives.c (strtolinenum): Check for overflow before it
1115 occurs. Correct comment.
1117 2020-11-24 Nathan Sidwell <nathan@acm.org>
1119 * include/cpplib.h (struct cpp_hashnode): Add deferred field.
1120 (cpp_set_deferred_macro): Define.
1121 (cpp_get_deferred_macro): Declare.
1122 (cpp_macro_definition): Reformat, add overload.
1123 (cpp_macro_definition_location): Deal with deferred macro.
1124 (cpp_alloc_token_string, cpp_compare_macro): Declare.
1125 * internal.h (_cpp_notify_macro_use): Return bool
1126 (_cpp_maybe_notify_macro_use): Likewise.
1127 * directives.c (do_undef): Check macro is not undef before
1129 (do_ifdef, do_ifndef): Deal with deferred macro.
1130 * expr.c (parse_defined): Likewise.
1131 * lex.c (cpp_allocate_token_string): Break out of ...
1132 (create_literal): ... here. Call it.
1133 (cpp_maybe_module_directive): Deal with deferred macro.
1134 * macro.c (cpp_get_token_1): Deal with deferred macro.
1135 (warn_of_redefinition): Deal with deferred macro.
1136 (compare_macros): Rename to ...
1137 (cpp_compare_macro): ... here. Make extern.
1138 (cpp_get_deferred_macro): New.
1139 (_cpp_notify_macro_use): Deal with deferred macro, return bool
1140 indicating definedness.
1141 (cpp_macro_definition): Deal with deferred macro.
1143 2020-11-19 Nathan Sidwell <nathan@acm.org>
1145 * include/cpplib.h (enum cpp_main_search): New.
1146 (struct cpp_options): Add main_search field.
1147 (cpp_main_loc): Declare.
1148 (cpp_retrofit_as_include): Declare.
1149 * internal.h (struct cpp_reader): Add main_loc field.
1150 (_cpp_in_main_source_file): Not main if main is a header.
1151 * init.c (cpp_read_main_file): Use main_search option to locate
1152 main file. Set main_loc
1153 * files.c (cpp_retrofit_as_include): New.
1155 2020-11-19 Nathan Sidwell <nathan@acm.org>
1157 * internal.h (cpp_in_system_header): Rename to ...
1158 (_cpp_in_system_header): ... here.
1159 (cpp_in_primary_file): Rename to ...
1160 (_cpp_in_main_source_file): ... here. Compare main_file equality
1161 and check main_search value.
1162 * lex.c (maybe_va_opt_error, _cpp_lex_direct): Adjust for rename.
1163 * macro.c (_cpp_builtin_macro_text): Likewise.
1164 (replace_args): Likewise.
1165 * directives.c (do_include_next): Likewise.
1166 (do_pragma_once, do_pragma_system_header): Likewise.
1167 * files.c (struct _cpp_file): Delete main_file field.
1168 (pch_open): Check pfile->main_file equality.
1169 (make_cpp_file): Drop cpp_reader parm, don't set main_file.
1170 (_cpp_find_file): Adjust.
1171 (_cpp_stack_file): Check pfile->main_file equality.
1172 (struct report_missing_guard_data): Add cpp_reader field.
1173 (report_missing_guard): Check pfile->main_file equality.
1174 (_cpp_report_missing_guards): Adjust.
1176 2020-11-18 Nathan Sidwell <nathan@acm.org>
1178 * include/cpplib.h (struct cpp_options): Add module_directives
1180 (NODE_MODULE): New node flag.
1181 (struct cpp_hashnode): Make rid-code a bitfield, increase bits in
1182 flags and swap with type field.
1183 * init.c (post_options): Create module-directive identifier nodes.
1184 * internal.h (struct lexer_state): Add directive_file_token &
1185 n_modules fields. Add module node enumerator.
1186 * lex.c (cpp_maybe_module_directive): New.
1187 (_cpp_lex_token): Call it.
1188 (cpp_output_token): Add '"' around CPP_HEADER_NAME token.
1189 (do_peek_ident, do_peek_module): New.
1190 (cpp_directives_only): Detect module-directive lines.
1191 * macro.c (cpp_get_token_1): Deal with directive_file_token
1194 2020-11-18 Nathan Sidwell <nathan@acm.org>
1196 * files.c (struct _cpp_file): Add header_unit field.
1197 (_cpp_stack_file): Add header unit support.
1198 (cpp_find_header_unit): New.
1199 * include/cpplib.h (cpp_find_header_unit): Declare.
1201 2020-11-18 Nathan Sidwell <nathan@acm.org>
1203 * include/cpplib.h (struct cpp_options): Add modules to
1205 * include/mkdeps.h (deps_add_module_target): Declare.
1206 (deps_add_module_dep): Declare.
1207 * mkdeps.c (class mkdeps): Add modules, module_name, cmi_name,
1208 is_header_unit fields. Adjust cdtors.
1209 (deps_add_module_target, deps_add_module_dep): New.
1210 (make_write): Write module dependencies, if enabled.
1212 2020-11-17 Nathan Sidwell <nathan@acm.org>
1214 * include/cpplib.h (struct cpp_callbacks): Add
1215 user_deferred_macro & translate_include.
1217 2020-11-17 Nathan Sidwell <nathan@acm.org>
1219 * include/line-map.h (enum lc_reason): Add LC_MODULE.
1220 (MAP_MODULE_P): New.
1221 (line_map_new_raw): Declare.
1222 (linemap_enter_macro): Move declaration from internal.h
1223 (linemap_module_loc, linemap_module_reparent)
1224 (linemap_module_restore): Declare.
1225 (linemap_lookup_macro_indec): Declare.
1226 * internal.h (linemap_enter_macro): Moved to line-map.h.
1227 * line-map.c (linemap_new_raw): New, broken out of ...
1228 (new_linemap): ... here. Call it.
1229 (LAST_SOURCE_LINE_LOCATION): New.
1230 (liemap_module_loc, linemap_module_reparent)
1231 (linemap_module_restore): New.
1232 (linemap_lookup_macro_index): New, broken out of ...
1233 (linemap_macro_map_lookup): ... here. Call it.
1234 (linemap_dump): Add module dump.
1236 2020-11-17 Nathan Sidwell <nathan@acm.org>
1238 PR preprocessor/97858
1239 * mkdeps.c (munge): Drop varadic args, we only ever use one.
1241 2020-11-13 Joseph Myers <joseph@codesourcery.com>
1243 * expr.c (cpp_classify_number): Update diagnostic for binary
1244 constants for C. Also diagnose binary constants for
1246 * init.c (lang_defaults): Enable binary constants for GNUC2X and
1249 2020-11-13 Piotr H. Dabrowski <phd@phd.re>
1252 * include/cpplib.h: Added cpp_define_unused(), cpp_define_formatted_unused()
1253 * directives.c: Likewise.
1255 2020-11-12 Joseph Myers <joseph@codesourcery.com>
1257 * include/cpplib.h (struct cpp_callbacks): Add bool argument to
1259 (enum cpp_builtin_type): Add BT_HAS_STD_ATTRIBUTE.
1260 * init.c (builtin_array): Add __has_c_attribute.
1261 (cpp_init_special_builtins): Handle BT_HAS_STD_ATTRIBUTE.
1262 * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_STD_ATTRIBUTE.
1263 Update call to has_attribute for BT_HAS_ATTRIBUTE.
1264 * traditional.c (fun_like_macro): Handle BT_HAS_STD_ATTRIBUTE.
1266 2020-11-12 Nicholas Guriev <guriev-ns@ya.ru>
1269 * files.c (_cpp_find_file): Use CPP_DL_NOTE not CPP_DL_ERROR in call to
1272 2020-11-07 Lewis Hyatt <lhyatt@gmail.com>
1274 * generated_cpp_wcwidth.h: Regenerated from Unicode 13.0.0 data.
1276 2020-11-06 Nathan Sidwell <nathan@acm.org>
1278 * include/cpplib.h (enum class CPP_time_kind): New.
1279 (cpp_get_date): Declare.
1280 * internal.h (struct cpp_reader): Replace source_date_epoch with
1281 time_stamp and time_stamp_kind.
1282 * init.c (cpp_create_reader): Initialize them.
1283 * macro.c (_cpp_builtin_macro_text): Use cpp_get_date.
1284 (cpp_get_date): Broken out from _cpp_builtin_macro_text and
1287 2020-11-03 Nathan Sidwell <nathan@acm.org>
1289 * lex.c (cpp_peek_token): Do not peek past CPP_PRAGMA.
1290 (_cpp_lex_direct): Handle EOF in pragma when setting need_line,
1291 not when needing a line.
1293 2020-11-03 Nathan Sidwell <nathan@acm.org>
1295 * lex.c (_cpp_clean_line): Fix DOS off-by-one error.
1297 2020-11-03 Nathan Sidwell <nathan@acm.org>
1299 * init.c (cpp_read_main_file): Use cpp_get_deps result.
1301 2020-11-03 Nathan Sidwell <nathan@acm.org>
1303 * include/mkdeps.h: Include cpplib.h
1304 (deps_write): Adjust first parm type.
1305 * mkdeps.c: Include internal.h
1306 (make_write): Adjust first parm type. Check phony option
1308 (deps_write): Adjust first parm type.
1309 * init.c (cpp_read_main_file): Use get_deps.
1310 * directives.c (cpp_get_deps): Check option before initializing.
1312 2020-11-02 Nathan Sidwell <nathan@acm.org>
1314 * internal.h (_cpp_notify_macro_use): Add location parm.
1315 (_cpp_maybe_notify_macro_use): Likewise.
1316 * directives.c (_cpp_do_file_change): Check we've not changed file
1317 when optimizing a rewind.
1318 (do_ifdef): Pass location to _cpp_maybe_notify_macro_use.
1319 (do_ifndef): Likewise. Delete obsolete comment about powerpc.
1320 * expr.c (parse_defined): Pass location to
1321 _cpp_maybe_notify_macro_use.
1322 * macro.c (enter_macro_context): Likewise.
1323 (warn_of_redefinition): Break out helper function. Call it.
1324 (compare_macros): New function broken out of warn_of_redefinition.
1325 (_cpp_new_macro): Zero all fields.
1326 (_cpp_notify_macro_use): Add location parameter.
1328 2020-10-20 Nathan Sidwell <nathan@acm.org>
1330 * lex.c (_cpp_lex_direct): Do not complete EOF processing when
1332 * macro.c (collect_args): Do not unwind fake EOF.
1333 (funlike_invocation_p): Do not unwind fake EOF.
1334 (cpp_context): Replace abort with gcc_assert.
1336 2020-10-19 Nathan Sidwell <nathan@acm.org>
1338 * internal.h (struct cpp_reader): Rename 'eof' field to 'endarg'.
1339 * init.c (cpp_create_reader): Adjust.
1340 * macro.c (collect_args): Use endarg for separator. Always rewind
1343 2020-10-08 Nathan Sidwell <nathan@acm.org>
1345 * internal.h (enum include_type): Rename IT_MAIN_INJECT to
1347 * init.c (cpp_read_main_file): If there is no line marker, adjust
1348 the initial line marker.
1349 (read_original_filename): Return bool, peek the buffer directly
1350 before trying to tokenize.
1351 (read_original_directory): Likewise. Directly prod the string
1353 * files.c (_cpp_stack_file): Adjust for IT_PRE_MAIN change.
1355 2020-09-26 Jakub Jelinek <jakub@redhat.com>
1358 * lex.c (search_line_fast): Only use _ARCH_PWR8 Altivec version
1361 2020-09-17 Patrick Palka <ppalka@redhat.com>
1364 * include/line-map.h (first_map_in_common): Declare.
1365 * line-map.c (first_map_in_common): Remove static.
1367 2020-09-07 Martin Storsjö <martin@martin.st>
1369 * files.c (remap_filename): Make a strchr return value pointer
1372 2020-07-30 H.J. Lu <hjl.tools@gmail.com>
1375 * configure: Regenerated.
1377 2020-07-29 Tiziano Müller <tiziano.mueller@chem.uzh.ch>
1379 * init.c (builtin_array): Add xref comment.
1380 * traditional.c (fun_like_macro): Add HAS_INCLUDE codes.
1382 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1384 PR preprocessor/96323
1385 * lex.c (lex_raw_string): For c == '\n' don't continue after reporting
1386 an prefix delimiter error.
1388 2020-07-28 Nathan Sidwell <nathan@acm.org>
1390 * init.c (cpp_read_main_file): Always use the last map for
1393 2020-07-20 Nathan Sidwell <nathan@acm.org>
1395 * line-map.c (linemap_add): Simplify column overflow calculation.
1396 Add comment about range and column bit init.
1397 (linemap_ordinary_map_lookup): Refactor for RAII
1398 (linemap_macro_map_lookup): Likewise.
1400 2020-07-14 Lewis Hyatt <lhyatt@gmail.com>
1402 PR preprocessor/49973
1404 * include/cpplib.h (struct cpp_options): Removed support for -ftabstop,
1405 which is now handled by diagnostic_context.
1406 (class cpp_display_width_computation): New class.
1407 (cpp_byte_column_to_display_column): Add optional tabstop argument.
1408 (cpp_display_width): Likewise.
1409 (cpp_display_column_to_byte_column): Likewise.
1411 (cpp_display_width_computation::cpp_display_width_computation): New
1413 (cpp_display_width_computation::advance_display_cols): Likewise.
1414 (compute_next_display_width): Removed and implemented this
1415 functionality in a new function...
1416 (cpp_display_width_computation::process_next_codepoint): ...here.
1417 (cpp_byte_column_to_display_column): Added tabstop argument.
1418 Reimplemented in terms of class cpp_display_width_computation.
1419 (cpp_display_column_to_byte_column): Likewise.
1420 * init.c (cpp_create_reader): Remove handling of -ftabstop, which is now
1421 handled by diagnostic_context.
1423 2020-07-07 Nathan Sidwell <nathan@acm.org>
1425 * directives.c (do_linemarker): Optimize rewinding to line zero.
1426 * files.c (_cpp_stack_file): Start on line zero when about to inject
1428 (cpp_push_include, cpp_push_default_include): Use highest_line as
1430 * include/cpplib.h (cpp_read_main_file): Add injecting parm.
1431 * init.c (cpp_read_main_file): Likewise, inform _cpp_stack_file.
1432 * internal.h (enum include_type): Add IT_MAIN_INJECT.
1434 2020-05-29 H.J. Lu <hjl.tools@gmail.com>
1437 * configure: Regenerated.
1439 2020-05-23 David Edelsohn <dje.gcc@gmail.com>
1441 * Makefile.in (AR): Substitute @AR@.
1442 * configure.ac (CHECK_PROG AR): New.
1443 * configure: Regenerate.
1445 2020-05-20 Nathan Sidwell <nathan@acm.org>
1447 * internal.h (typedef _cpp_file): Delete, unnecessary in C++.
1448 (enum _cpp_find_file_kind): New.
1449 (_cpp_find_file): Use it, not 3 bools.
1450 * files.c (_cpp_find_file): Use _cpp_find_file_kind enum, not
1452 (cpp_make_system_header): Break overly long line.
1453 (_cpp_stack_include, _cpp_fake_include)
1454 (_cpp_do_file_change, _cpp_compare_file_date, _cpp_has_header): Adjust.
1455 * init.c (cpp_read_main): Adjust _cpp_find_file call.
1457 2020-05-18 Nathan Sidwell <nathan@acm.org>
1459 * include/cpplib.h (cpp_get_otions, cpp_get_callbacks)
1460 (cpp_get_deps): Mark as PURE.
1461 * include/line-map.h (get_combined_adhoc_loc)
1462 (get_location_from_adhoc_loc, get_pure_location): Reformat decls.
1463 * internal.h (struct lexer_state): Clarify comment.
1464 * system.h: Remove now-unneeded bool hackery.
1465 * files.c (_cpp_find_file): Store LOC not highest_location.
1467 PR preprocessor/95149
1468 * lex.c (struct lit_accum): New.
1469 (bufring_append): Replace by lit_accum::append.
1470 (lex_raw_string): Reimplement, using fragments of the old version.
1471 (lex_string): Adjust lex_raw_string call.
1473 PR preprocessor/95182
1474 * macro.c (collect_args): Preserve EOFif we fell out of the main
1476 (cpp_get_token_1): Reformat a couple of short lines.
1478 2020-05-14 H.J. Lu <hongjiu.lu@intel.com>
1480 * configure: Regenerated.
1482 2020-05-13 Jason Merrill <jason@redhat.com>
1484 * include/cpplib.h (enum c_lang): Change CXX2A to CXX20.
1485 * init.c, lex.c: Adjust.
1487 2020-05-12 Nathan Sidwell <nathan@acm.org>
1489 EOF location is at end of file
1490 PR preprocessor/95013
1491 * lex.c (lex_raw_string): Process line notes before incrementing.
1492 Correct incrementing condition. Adjust for new
1493 _cpp_get_fresh_line EOF behaviour.
1494 (_cpp_get_fresh_line): Do not pop buffer at EOF, increment line
1496 (_cpp_lex_direct): Adjust for new _cpp_get_fresh_line behaviour.
1497 (cpp_directive_only_process): Assert we got a fresh line.
1498 * traditional.c (_cpp_read_logical_line_trad): Adjust for new
1499 _cpp_get_fresh_line behaviour.
1501 2020-05-12 H.J. Lu <hongjiu.lu@intel.com>
1503 * Makefile.in (CET_HOST_FLAGS): New.
1504 (COMPILER): Add $(CET_HOST_FLAGS).
1505 * configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and
1506 AC_SUBST(CET_HOST_FLAGS). Clear CET_HOST_FLAGS if jit isn't
1508 * aclocal.m4: Regenerated.
1509 * configure: Likewise.
1511 2020-05-08 Nathan Sidwell <nathan@acm.org>
1513 Reimplement directives only processing, support raw literals.
1514 * directives-only.c: Delete.
1515 * Makefile.in (libcpp_a_OBJS, libcpp_a_SOURCES): Remove it.
1516 * include/cpplib.h (enum CPP_DO_task): New enum.
1517 (cpp_directive_only_preprocess): Declare.
1518 * internal.h (_cpp_dir_only_callbacks): Delete.
1519 (_cpp_preprocess_dir_only): Delete.
1520 * lex.c (do_peek_backslask, do_peek_next, do_peek_prev): New.
1521 (cpp_directives_only_process): New implementation.
1523 2020-02-14 Jakub Jelinek <jakub@redhat.com>
1525 Partially implement P1042R1: __VA_OPT__ wording clarifications
1526 PR preprocessor/92319
1527 * macro.c (expand_arg): Move declarations before vaopt_state
1529 (class vaopt_state): Move enum update_type definition earlier. Remove
1530 m_allowed member, add m_arg and m_update members.
1531 (vaopt_state::vaopt_state): Change last argument from bool any_args
1532 to macro_arg *arg, initialize m_arg and m_update instead of m_allowed.
1533 (vaopt_state::update): When bumping m_state from 1 to 2 and m_update
1534 is ERROR, determine if __VA_ARGS__ expansion has any non-CPP_PADDING
1535 tokens and set m_update to INCLUDE if it has any, DROP otherwise.
1536 Return m_update instead of m_allowed ? INCLUDE : DROP in m_state >= 2.
1537 (replace_args, create_iso_definition): Adjust last argument to
1540 2020-02-05 Martin Sebor <msebor@redhat.com>
1542 * include/cpplib.h (cpp_builtin_type): Remove trailing comma to
1543 avoid pedantic warnings in C++ 98 mode.
1545 2020-02-04 Jakub Jelinek <jakub@redhat.com>
1547 * macro.c (builtin_has_include): Diagnose __has_include* use outside
1548 of preprocessing directives.
1550 PR preprocessor/93545
1551 * macro.c (cpp_get_token_no_padding): New function.
1552 (builtin_has_include): Use it instead of cpp_get_token. Don't check
1555 2020-02-01 Andrew Burgess <andrew.burgess@embecosm.com>
1557 * configure: Regenerate.
1559 2020-01-28 Nathan Sidwell <nathan@acm.org>
1561 PR preprocessor/93452
1562 * internal.h (struct spec_nodes): Drop n__has_include{,_next}.
1563 * directives.c (lex_macro_node): Don't check __has_include redef.
1564 * expr.c (eval_token): Drop __has_include eval.
1565 (parse_has_include): Move to ...
1566 * macro.c (builtin_has_include): ... here.
1567 (_cpp_builtin_macro_text): Eval __has_include{,_next}.
1568 * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_INCLUDE{,_NEXT}.
1569 * init.c (builtin_array): Add them.
1570 (cpp_init_builtins): Drop __has_include{,_next} init here ...
1571 * pch.c (cpp_read_state): ... and here.
1572 * traditional.c (enum ls): Drop has_include states ...
1573 (_cpp_scan_out_logical_line): ... and here.
1575 2020-01-27 Andrew Burgess <andrew.burgess@embecosm.com>
1577 * configure: Regenerate.
1579 2020-01-24 Nathan Sidwell <nathan@acm.org>
1581 * expr.c (parse_has_include): Remove bogus controlling macro code.
1583 2020-01-20 Nathan Sidwell <nathan@acm.org>
1585 PR preprocessor/80005
1586 * include/cpplib.h (BT_HAS_ATTRIBUTE): Fix comment.
1587 * internal.h (struct lexer_state): Delete in__has_include field.
1588 (struct spec_nodes): Rename n__has_include{,_next}__ fields.
1589 (_cpp_defined_macro_p): New.
1590 (_cpp_find_file): Add has_include parm.
1591 * directives.c (lex_macro_node): Combine defined,
1592 __has_inline{,_next} checking.
1593 (do_ifdef, do_ifndef): Use _cpp_defined_macro_p.
1594 (_cpp_init_directives): Refactor.
1595 * expr.c (parse_defined): Use _cpp_defined_macro_p.
1596 (eval_token): Adjust parse_has_include calls.
1597 (parse_has_include): Add OP parameter. Reimplement.
1598 * files.c (_cpp_find_file): Add HAS_INCLUDE parm. Use it to
1599 inhibit error message.
1600 (_cpp_stack_include): Adjust _cpp_find_file call.
1601 (_cpp_fake_include, _cpp_compare_file_date): Likewise.
1602 (open_file_failed): Remove in__has_include check.
1603 (_cpp_has_header): Adjust _cpp_find_file call.
1604 * identifiers.c (_cpp_init_hashtable): Don't init
1605 __has_include{,_next} here ...
1606 * init.c (cpp_init_builtins): ... init them here. Define as
1608 (cpp_read_main_file): Adjust _cpp_find_file call.
1609 * pch.c (cpp_read_state): Adjust __has_include{,_next} access.
1610 * traditional.c (_cpp_scan_out_locgical_line): Likewise.
1612 PR preprocessor/93306
1613 * expr.c (parse_has_include): Refactor. Check skip_eval before
1616 2020-01-10 David Malcolm <dmalcolm@redhat.com>
1618 * include/line-map.h (class diagnostic_path): New forward decl.
1619 (rich_location::get_path): New accessor.
1620 (rich_location::set_path): New function.
1621 (rich_location::m_path): New field.
1622 * line-map.c (rich_location::rich_location): Initialize m_path.
1624 2020-01-01 Jakub Jelinek <jakub@redhat.com>
1626 Update copyright years.
1628 2019-12-18 David Malcolm <dmalcolm@redhat.com>
1630 PR preprocessor/92982
1632 (cpp_string_location_reader::cpp_string_location_reader): Delete
1633 initialization of m_line_table.
1634 * include/cpplib.h (cpp_string_location_reader::m_line_table):
1635 Delete unused member.
1637 2019-12-14 Jakub Jelinek <jakub@redhat.com>
1639 PR preprocessor/92919
1640 * charset.c (wide_str_to_charconst): If str contains just the
1641 NUL terminator, punt quietly.
1643 2019-12-09 David Malcolm <dmalcolm@redhat.com>
1645 * include/line-map.h (label_text::label_text): Make private.
1646 (label_text::borrow): New.
1647 (label_text::take): New.
1648 (label_text::take_or_copy): New.
1650 2019-12-09 Lewis Hyatt <lhyatt@gmail.com>
1652 PR preprocessor/49973
1653 * generated_cpp_wcwidth.h: New file generated by
1654 ../contrib/unicode/gen_wcwidth.py, supports new cpp_wcwidth function.
1655 * charset.c (compute_next_display_width): New function to help
1656 implement display columns.
1657 (cpp_byte_column_to_display_column): Likewise.
1658 (cpp_display_column_to_byte_column): Likewise.
1659 (cpp_wcwidth): Likewise.
1660 * include/cpplib.h (cpp_byte_column_to_display_column): Declare.
1661 (cpp_display_column_to_byte_column): Declare.
1662 (cpp_wcwidth): Declare.
1663 (cpp_display_width): New function.
1665 2019-11-14 Joseph Myers <joseph@codesourcery.com>
1667 * charset.c (narrow_str_to_charconst): Make CPP_UTF8CHAR constants
1669 * init.c (lang_defaults): Set utf8_char_literals for GNUC2X and
1672 2019-11-07 Jakub Jelinek <jakub@redhat.com>
1674 PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs
1675 * charset.c (narrow_str_to_charconst): Add TYPE argument. For
1676 CPP_UTF8CHAR diagnose whenever number of chars is > 1, using
1677 CPP_DL_ERROR instead of CPP_DL_WARNING.
1678 (wide_str_to_charconst): For CPP_CHAR16 or CPP_CHAR32, use
1679 CPP_DL_ERROR instead of CPP_DL_WARNING when multiple char16_t
1680 or char32_t chars are needed.
1681 (cpp_interpret_charconst): Adjust narrow_str_to_charconst caller.
1683 2019-11-05 Tim van Deurzen <tim@kompiler.org>
1685 * cpplib.h: Add spaceship operator for C++.
1686 * lex.c: Implement conditional lexing of spaceship operator for C++20.
1688 2019-10-31 Jakub Jelinek <jakub@redhat.com>
1690 PR preprocessor/92296
1691 * internal.h (struct def_pragma_macro): Add is_builtin bitfield.
1692 (_cpp_restore_special_builtin): Declare.
1693 * init.c (_cpp_restore_special_builtin): New function.
1694 * directives.c (do_pragma_push_macro): For NT_BUILTIN_MACRO
1695 set is_builtin and don't try to grab definition.
1696 (cpp_pop_definition): Use _cpp_restore_special_builtin to restore
1699 2019-10-15 Nathan Sidwell <nathan@acm.org>
1701 * include/line-map.h (struct maps_info_ordinary): Make cache
1703 (struct maps_info_macro): Likewise.
1704 (LINEMAPS_CACHE): Remove non-ref accessor. Constify ref accessor.
1705 (LINEMAPS_ORDINARY_CACHE, LINEMAPS_MACRO_CACHE): Likewise.
1706 (LINEMAPS_ORDINARY_MAP_AT, LINEMAPS_MACRO_MAP_AT): Use
1707 LINEMAPS_USED and LINEMAPS_MAP_AT.
1708 (linemap_lookup): Constify line_map arg.
1709 linemap.c (linemap_ordinary_map_lookup, linemap_macro_map_lookup):
1710 Constify line_map arg.
1712 2019-10-11 Joseph Myers <joseph@codesourcery.com>
1714 * include/cpplib.h (struct cpp_options): Add dfp_constants and
1715 cpp_warn_c11_c2x_compat.
1716 (enum cpp_warning_reason): Add CPP_W_C11_C2X_COMPAT.
1717 * init.c (struct lang_flags): Add dfp_constants.
1718 (lang_defaults): Set dfp_constants to 1 for GNUC2X and STDC2X and
1719 0 for other languages.
1720 (cpp_set_lang): Set dfp_constants from language.
1721 (cpp_create_reader): Set cpp_warn_c11_c2x_compat to -1.
1722 * expr.c (interpret_float_suffix): Mention DFP constants as C2X in
1724 (cpp_classify_number): Do not diagnose DFP constants for languages
1725 setting dfp_constants, unless cpp_warn_c11_c2x_compat.
1727 2019-10-04 Nathan Sidwell <nathan@acm.org>
1729 PR preprocessor/91991
1730 * line-map.c (linemap_line_start): Clear max_column_hint if we run
1733 2019-10-02 Richard Biener <rguenther@suse.de>
1735 * internal.h (enum include_type): Remove trailing comma.
1737 2019-10-02 Joseph Myers <joseph@codesourcery.com>
1739 * include/cpplib.h (struct cpp_options): Add member scope.
1740 * init.c (struct lang_flags, lang_defaults): Likewise.
1741 (cpp_set_lang): Set scope member of pfile.
1742 * lex.c (_cpp_lex_direct): Test CPP_OPTION (pfile, scope) not
1743 CPP_OPTION (pfile, cplusplus) for creating CPP_SCOPE tokens.
1745 2019-09-26 Eric Botcazou <ebotcazou@adacore.com>
1747 * charset.c (UCS_LIMIT): New macro.
1748 (ucn_valid_in_identifier): Use it instead of a hardcoded constant.
1749 (_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than
1750 UCS_LIMIT outside of identifiers in C and in C++2a or later.
1752 2019-09-19 Lewis Hyatt <lhyatt@gmail.com>
1755 * charset.c (_cpp_valid_utf8): New function to help lex UTF-8 tokens.
1756 * internal.h (_cpp_valid_utf8): Declare.
1757 * lex.c (forms_identifier_p): Use it to recognize UTF-8 identifiers.
1758 (_cpp_lex_direct): Handle UTF-8 in identifiers and CPP_OTHER tokens.
1759 Do all work in "default" case to avoid slowing down typical code paths.
1760 Also handle $ and UCN in the default case for consistency.
1762 2019-08-30 Nathan Sidwell <nathan@acm.org>
1764 New # semantics for popping to "" name.
1766 * directives.c (do_linemarker): Popping to "" name means get the
1767 name from the include stack..
1769 2019-09-05 Nathan Sidwell <nathan@acm.org>
1771 PR preprocessor/91639
1772 * directives.c (do_include_common): Tell lexer we're a #include.
1773 * files.c (_cpp_stack_file): Lexer will have always incremented.
1774 * internal.h (struct cpp_context): Extend in_directive's
1776 * lex.c (_cpp_lex_direct): Increment line for final \n when lexing
1777 for an ISO #include.
1778 * line-map.c (linemap_line_start): Remember if we overflowed.
1780 2019-09-03 Ulrich Weigand <uweigand@de.ibm.com>
1782 * directives.c: Remove references to spu from comments.
1785 2019-08-29 Nathan Sidwell <nathan@acm.org>
1787 * internal.h (enum include_type): Add IT_MAIN, IT_DIRECTIVE_HWM,
1789 (_cpp_stack_file): Take include_type, not a bool.
1790 * files.c (_cpp_find_file): Refactor to not hide an if inside a
1792 (should_stack_file): Break apart to ...
1793 (is_known_idempotent_file, has_unique_contents): ... these.
1794 (_cpp_stack_file): Replace IMPORT boolean with include_type enum.
1795 Refactor to use new predicates. Do linemap compensation here ...
1796 (_cpp_stack_include): ... not here.
1797 * init.c (cpp_read_main_file): Pass IT_MAIN to _cpp_stack_file.
1799 2019-08-28 Nathan Sidwell <nathan@acm.org>
1801 * directives-only.c (_cpp_preprocess_dir_only): Use false, not
1802 zero for _cpp_handle_directive call.
1803 * directives.c (_cpp_handle_directive): Indented is bool.
1804 * files.c (struct _cpp_file): Make bools 1 bit bitfields.
1805 * internal.h (enum include_type): Reformat and comment.
1806 (struct cpp_buffer): Make flags 1 bit bitfields.
1807 (_cpp_handle_directive): Indented is bool.
1809 2019-07-09 Martin Sebor <msebor@redhat.com>
1811 * include/line-map.h: Change class-key from class to struct and vice
1812 versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.
1815 2019-07-03 Martin Liska <mliska@suse.cz>
1817 * line-map.c (linemap_get_expansion_filename): Remove
1819 * mkdeps.c (make_write): Likewise.
1821 2019-07-02 qing zhao <qing.zhao@oracle.com>
1823 PR preprocessor/90581
1824 * directives.c (do_include_common): Replace CPP_STACK_MAX with
1825 CPP_OPTION (pfile, max_include_depth).
1826 * include/cpplib.h (struct cpp_options): Add new field
1828 * init.c (cpp_create_reader): Initiate new field max_include_depth.
1829 * internal.h: Delete CPP_STACK_MAX.
1831 2019-06-26 Nathan Sidwell <nathan@acm.org>
1833 PR preprocessor/90927
1834 * mkdeps.c (mkdeps::vec::operator[]): Add non-const variant.
1835 (deps_add_target): Deal with out of order unquoted targets.
1837 2019-05-19 Andrew Pinski <apinski@marvell.com>
1840 * lex.c (cpp_token_val_index <case SPELL_OPERATOR>): If tok->flags
1841 has NAMED_OP set, then return CPP_TOKEN_FLD_NODE.
1843 2019-05-14 Martin Liska <mliska@suse.cz>
1845 PR preprocessor/90382
1846 * line-map.c (first_map_in_common_1): Handle ADHOC
1849 2019-05-14 Martin Liska <mliska@suse.cz>
1851 PR preprocessor/90382
1852 * include/line-map.h (get_data_from_adhoc_loc): Add const to
1854 (get_location_from_adhoc_loc): Likewise.
1855 * line-map.c(get_data_from_adhoc_loc): Add const to
1857 (get_location_from_adhoc_loc): Likewise.
1858 (get_combined_adhoc_loc): Use get_location_from_adhoc_loc
1859 (or get_data_from_adhoc_loc).
1860 (get_range_from_adhoc_loc): Likewise.
1861 (get_pure_location): Likewise.
1862 (linemap_position_for_loc_and_offset): Likewise.
1863 (linemap_lookup): Likewise.
1864 (linemap_ordinary_map_lookup): Likewise.
1865 (linemap_macro_map_lookup): Likewise.
1866 (linemap_get_expansion_line): Likewise.
1867 (linemap_get_expansion_filename): Likewise.
1868 (linemap_location_in_system_header_p): Likewise.
1869 (linemap_location_from_macro_expansion_p): Likewise.
1870 (linemap_macro_loc_to_exp_point): Likewise.
1871 (linemap_resolve_location): Likewise.
1872 (linemap_unwind_toward_expansion): Likewise.
1873 (linemap_unwind_to_first_non_reserved_loc): Likewise.
1874 (linemap_expand_location): Likewise.
1875 (linemap_dump_location): Likewise.
1877 2019-05-07 Nathan Sidwell <nathan@acm.org>
1879 * files.c (_cpp_stack_file): Empty filenames aren't dependencies.
1880 * mkdeps.c (deps_add_dep): Assert not empty.
1882 * include/mkdeps.h (deps_write): Add PHONY arg.
1883 (deps_phony_targets): Delete.
1884 * init.c (cpp_finish): Just call deps_write.
1885 * mkdeps.c (struct mkdeps): Add local vector class. Reimplement
1887 (munge): Munge to static buffer.
1888 (apply_vpath): Adjust vector handling.
1889 (deps_init, deps_free): Use new, delete.
1890 (deps_add_target): Do not munge here. Record quoting low water mark.
1891 (deps_add_dep): Do not munge here.
1892 (deps_add_vpath): Adjust vector handling.
1893 (make_write_name): New. Munge on demand here.
1894 (make_write_vec): New.
1895 (deps_phony_targets): Delete.
1897 (deps_write): Forward to deps_Write.
1898 (deps_save, deps_restore): Adjust vector handling.
1900 2019-05-06 Nathan Sidwell <nathan@acm.org>
1902 * include/mkdeps.h: Rename struct deps to struct mkdeps.
1903 * mkdeps.c: Likewise.
1904 * include/cpplib.h (cpp_get_deps): Rename return type..
1905 * directives.c (cpp_get_deps): Likewise.
1906 * internal.h (struct cpp_reader): Rename deps field type.
1908 2019-04-03 Jonathan Wakely <jwakely@redhat.com>
1910 * files.c (search_path_exhausted): Fix typo in comment.
1912 2019-02-26 Martin Liska <mliska@suse.cz>
1914 * symtab.c (ht_dump_statistics): Make
1915 horizontal alignment for statistics.
1917 2019-02-20 David Malcolm <dmalcolm@redhat.com>
1920 * include/line-map.h (linenum_arith_t): New typedef.
1923 2019-02-18 Martin Liska <mliska@suse.cz>
1926 * line-map.c (linemap_line_start): Use 1UL in order
1929 2019-02-11 Martin Liska <mliska@suse.cz>
1932 * line-map.c (linemap_line_start): Don't reuse the existing line
1933 map if the line offset is sufficiently large to cause overflow
1934 when computing location_t values.
1936 2019-01-26 Jakub Jelinek <jakub@redhat.com>
1938 PR preprocessor/88974
1939 * directives.c (SEEN_EOL): Move macro to ...
1940 * internal.h (SEEN_EOL): ... here.
1941 * expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL ().
1943 2019-01-01 Jakub Jelinek <jakub@redhat.com>
1945 Update copyright years.
1947 2018-11-27 Mike Gulick <mgulick@mathworks.com>
1949 PR preprocessor/83173
1950 * location-example.txt: Update example -fdump-internal-locations
1953 2018-11-27 Mike Gulick <mgulick@mathworks.com>
1955 PR preprocessor/83173
1956 * files.c (_cpp_stack_include): Check if
1957 line_table->highest_location is past current line before
1960 2018-11-13 David Malcolm <dmalcolm@redhat.com>
1962 * charset.c: Replace "source_location" with "location_t".
1963 * directives-only.c: Likewise.
1964 * directives.c: Likewise.
1965 * errors.c: Likewise.
1967 * files.c: Likewise.
1968 * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to
1970 * include/line-map.h: Likewise.
1972 * internal.h: Likewise.
1974 * line-map.c: Likewise.
1975 * location-example.txt: Likewise.
1976 * macro.c: Likewise.
1978 * traditional.c: Likewise.
1980 2018-11-07 Hafiz Abid Qadeer <abidh@codesourcery.com>
1982 * configure: Regenerated.
1984 2018-11-05 Martin Liska <mliska@suse.cz>
1986 * symtab.c (ht_dump_statistics): Replace %zu with %lu format.
1988 2018-11-05 Martin Liska <mliska@suse.cz>
1990 * symtab.c (ht_dump_statistics): Fix format and
1991 pass missing argument.
1993 2018-11-05 Martin Liska <mliska@suse.cz>
1995 * symtab.c (ht_dump_statistics): Make dump conditional
1996 based on alloc_subobject.
1998 2018-10-31 Joseph Myers <joseph@codesourcery.com>
2001 * configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
2002 * aclocal.m4, config.in, configure: Regenerate.
2004 2018-10-31 Nathan Sidwell <nathan@acm.org>
2006 * internal.h (struct cpp_reader): Rename forced_token_location_p
2007 to forced_token_location and drop its pointerness.
2008 * include/cpplib.h (cpp_force_token_locations): Take location, not
2010 * init.c (cpp_create_reader): Adjust.
2011 * lex.c (cpp_read_main_file):
2013 * directives.c (do_include_common): Commonize cleanup path.
2014 (_cpp_pop_buffer): Fix leak.
2016 * include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New
2018 (IS_ADHOC_LOC): Move earlier.
2019 (MAP_ORDINARY_P): Use IS_ORDINARY_LOC.
2020 * line-map.c (linemap_location_from_macro_expansion_p): Use
2023 * include/cpplib.h (cpp_macro_definition_location): Make inline.
2024 * macro.c (warn_of_redefinition): Fix comments, examine macro
2026 (cpp_macro_definition_location): Don't define here.
2028 * include/cpplib.h (HT_NODE): Don't cast NODE.
2029 (NODE_LEN, NODE_NAME): Use HT_NODE.
2031 * directives.c (DIRECTIVE_TABLE): Drop historical frequency
2033 * files.c (_cpp_stack_file): Fix indentation.
2035 2018-10-17 Joseph Myers <joseph@codesourcery.com>
2037 * include/cpplib.h (enum c_lang): Add CLK_GNUC2X and CLK_STDC2X.
2038 * init.c (lang_defaults): Add GNUC2X and STDC2X entries.
2039 (cpp_init_builtins): Define __STDC_VERSION__ to 202000L for C2X.
2041 2018-10-11 David Malcolm <dmalcolm@redhat.com>
2043 * macro.c (_cpp_arguments_ok): If the argument count is wrong, add
2044 a note showing the definition of the macro.
2046 2018-10-11 Nathan Sidwell <nathan@acm.org>
2048 * include/line-map.h (LINEMAPS_MACRO_LOWEST_LOCATION): Fix
2050 * line-map.c (linemap_enter_macro): Use RAII. Clear all of the
2053 2018-10-09 David Malcolm <dmalcolm@redhat.com>
2055 * charset.c (noop_error_cb): Rename to...
2056 (noop_diagnostic_cb): ...this, converting params to enums.
2057 (cpp_interpret_string_ranges): Update for renaming and enums.
2058 * directives.c (check_eol_1): Convert reason to enum.
2059 (do_diagnostic): Convert code and reason to enum.
2060 (do_error): Use CPP_W_NONE rather than 0.
2061 (do_pragma_dependency): Likewise.
2062 * errors.c (cpp_diagnostic_at): Convert level and reason to enums.
2063 Update for renaming.
2064 (cpp_diagnostic): Convert level and reason to enums.
2065 (cpp_error): Convert level to enum.
2066 (cpp_warning): Convert reason to enums.
2067 (cpp_pedwarning): Likewise.
2068 (cpp_warning_syshdr): Likewise.
2069 (cpp_diagnostic_with_line): Convert level and reason to enums.
2070 Update for renaming.
2071 (cpp_error_with_line): Convert level to enum.
2072 (cpp_warning_with_line): Convert reason to enums.
2073 (cpp_pedwarning_with_line): Likewise.
2074 (cpp_warning_with_line_syshdr): Likewise.
2075 (cpp_error_at): Convert level to enum.
2076 (cpp_errno): Likewise.
2077 (cpp_errno_filename): Likewise.
2078 * include/cpplib.h (enum cpp_diagnostic_level): Name this enum,
2079 and move to before struct cpp_callbacks.
2080 (enum cpp_warning_reason): Likewise.
2081 (cpp_callbacks::diagnostic): Convert params from int to enums.
2082 (cpp_error): Convert int param to enum cpp_diagnostic_level.
2083 (cpp_warning): Convert int param to enum cpp_warning_reason.
2084 (cpp_pedwarning): Likewise.
2085 (cpp_warning_syshdr): Likewise.
2086 (cpp_errno): Convert int param to enum cpp_diagnostic_level.
2087 (cpp_errno_filename): Likewise.
2088 (cpp_error_with_line): Likewise.
2089 (cpp_warning_with_line): Convert int param to enum
2091 (cpp_pedwarning_with_line): Likewise.
2092 (cpp_warning_with_line_syshdr): Likewise.
2093 (cpp_error_at): Convert int param to enum cpp_diagnostic_level.
2094 * macro.c (create_iso_definition): Convert int to enum.
2095 (_cpp_create_definition): Likewise.
2097 2018-09-17 David Malcolm <dmalcolm@redhat.com>
2099 * include/line-map.h (range_label::get_text): Add param
2102 2018-08-30 Nathan Sidwell <nathan@acm.org>
2104 * include/line-map.h (enum lc_reason): Comment each member
2106 (struct line_maps): Fix reallocator comment.
2108 2018-08-27 David Malcolm <dmalcolm@redhat.com>
2111 * include/line-map.h (enum range_display_kind): New enum.
2112 (struct location_range): Replace field "m_show_caret_p" with
2113 "m_range_display_kind", converting from bool to the new enum.
2114 (class rich_location): Add example of line insertion fix-it hint.
2115 (rich_location::add_range): Convert param "show_caret_p" from bool
2116 to enum range_display_kind and rename to "range_display_kind",
2117 giving it a default of SHOW_RANGE_WITHOUT_CARET.
2118 (rich_location::set_range): Likewise, albeit without a default.
2119 * line-map.c (rich_location::rich_location): Update for conversion
2120 of show_caret_p to tri-state enum.
2121 (rich_location::add_range): Likewise.
2122 (rich_location::set_range): Likewise.
2124 2018-08-24 H.J. Lu <hongjiu.lu@intel.com>
2127 * line-map.c (pure_location_p): Return true if linemap_lookup
2129 (linemap_add): Set start_location to 0 if we run out of line map
2132 2018-08-20 Nathan Sidwell <nathan@acm.org>
2134 * include/cpplib.h: Fixup some whitespace.
2135 (cpp_hashnode): Reduce type to 2 bit & flags to 8.
2137 * include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete.
2139 (enum node_type): Replace NT_MACRO with NT_USER_MACRO,
2140 NT_BUILTIN_MACRO, NT_MACRO_ARG. Delete NT_ASSERTION.
2141 (NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE):
2143 (CPP_HASHNODE_VALUE_IDX): Delete.
2144 (union _cpp_hashnode_value): GTY tag from enum node_type directly.
2145 (struct cpp_hashnode): Adjust GTY desc for value field.
2146 (cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust.
2147 * directives.c (undefine_macros): Clear value.anwers, adjust flag
2149 (_cpp_test_assertion): No need to check NT_ASSERTION.
2150 (do_assert, do_unassert): Likewise.
2151 * init.c (cpp_init_special_builtins): Set type not flags.
2152 * macro.c (struct macro_arg_saved_data): Add type field.
2153 (cpp_get_token_1): Check type not NT_VOID.
2154 (_cpp_free_definition): Adjust flag clearing. Nullify
2156 (_cpp_save_parameter, _cpp_unsave_parameters): Save and restore
2158 (lex_expansion_token): Check type not flags.
2159 (_cpp_create_definition): Set type to NT_USER_MACRO.
2160 (_cpp_notify_macro_use): Adjust type checking.
2161 * pch.c (write_macdef, count_defs, write_defs, cpp_valid_state)
2162 (save_macros): Adjust node type/flag handling.
2163 * traditional.c (_cpp_scan_out_logical_line): Check type not flags.
2165 * directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
2166 * include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
2167 (cpp_fun_like_macro_p): Make inline, define.
2168 * macro.c (cpp_define_lazily): Use UCHAR_MAX.
2169 (cpp_fun_like_macro_p): Delete.
2171 * Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
2172 * include/cpp-id-data.h: Delete.
2173 * internal.h: Include cpplib.h not cpp-id-data.h.
2175 * include/cpp-id-data.h (struct answer): Delete.
2176 * include/cpplib.h (struct answer): Don't forward-declare.
2177 (enum cpp_macro_kind): Add cmk_assert.
2178 (struct cpp_macro): Union parms and next assert chain.
2179 (union _cpp_hashnode_value): 'answer' field is cpp_macro.
2180 * directives.c (parse_answer): Convert to use cpp_macro. Return
2182 (parse_assertion, find_answer, _cpp_test_assertion, cpp_do_assert)
2183 (cpp_do_unassert): Convert to use cpp_macro.
2184 * macro.c (warn_of_redefinition, _cpp_new_macro)
2185 (check_trad_stringification, cpp_macro_definition): Adjust macro
2187 * traditional.c (_cpp_replacement_text_len)
2188 (_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise.
2190 2018-08-17 Nathan Sidwell <nathan@acm.org>
2192 * include/cpplib.h (struct cpp_callbacks): Replace
2193 user_builtin_macro with user_lazy_macro.
2194 (struct cpp_macro): add lazy field.
2195 (enum cpp_builtin_type): Remove BT_FIRST_USER, BT_LAST_USER.
2196 (cpp_define_lazily): Declare.
2197 * macro.c (enter_macro_context) Use _cpp_maybe_notify_macro_use.
2198 (warn_of_redefinition): Use cpp_builtin_macro_p, directly call
2199 user_lazy_macro hook.
2200 (_cpp_new_macro): Clear lazy field.
2201 (cpp_define_lazily): Define.
2202 (_cpp_notify_macro_use): Adjust lazy definition code.
2203 (cpp_macro_definition): No need to do lazy definition here.
2204 * pch.c (write_macdef, save_macros): Likewise.
2206 * include/cpplib.h (enum cpp_macro_kind): New.
2207 (struct cpp_macro): Make body trailing array. Add kind field,
2208 delete traditional flag.
2209 * internal.h (_cpp_new_macro): Declare.
2210 (_cpp_reserve_room): New inline.
2211 (_cpp_commit_buf): Declare.
2212 (_cpp_create_trad_definition): Return new macro.
2213 * lex.c (_cpp_commit_buff): New.
2214 * macro.c (macro_real_token_count): Count backwards.
2215 (replace_args): Pointer equality not orderedness.
2216 (_cpp_save_parameter): Use _cpp_reserve_room.
2217 (alloc_expansion_token): Delete.
2218 (lex_expansion_token): Return macro pointer. Use _cpp_reserve_room.
2219 (create_iso_definition): Allocate macro itself. Adjust for
2220 different allocation ordering.
2221 (_cpp_new_macro): New.
2222 (_cpp_create_definition): Adjust for API changes.
2223 * traditional.c (push_replacement_text): Don't set traditional
2225 (save_replacement_text): Likewise.
2226 (_cpp_create_trad_definition): Allocate macro itself, Adjust for
2227 different allocation ordering.
2229 * cpp-id-data.h (uchar, UC): Move to internal.h
2230 (struct cpp_macro): Move to cpplib.h.
2231 * internal.h (uchar, UC): From cpp-id-data.h.
2232 * include/cpplib.h (struct cpp_macro): From cpp-id-data.h.
2234 2018-08-16 Nathan Sidwell <nathan@acm.org>
2236 * internal.h (_cpp_save_parameter): Take parmno, not macro.
2237 (_cpp_unsave_parameters): Declare.
2238 * macro.c (_cpp_save_parameter): Take parm number, not macro.
2239 Return true on success.
2240 (_cpp_unsave_parameters): New.
2241 (parse_params): Take parm_no and variadic pointers, not macro.
2242 Reimplement parsing logic.
2243 (create_iso_definition): Adjust parse_params changes. Call
2244 _cpp_unsave_parameters here.
2245 (_cpp_create_definition): Don't unsave params here.
2246 * traditional.c (scan_parameters): Take n_param pointer, adjust.
2247 (_cpp_create_trad_definition): Ajust scan_parameters change. Call
2248 _cpp_unsave_parameters.
2250 * include/cpplib.h (cpp_user_macro_p, cpp_builtin_macro_p)
2251 (cpp_macro_p): New inlines.
2252 * directives.c (do_pragma_poison): Use cpp_macro_p.
2253 (do_ifdef, do_ifndef): Likewise. Use _cpp_maybe_notify_macro_use.
2254 (cpp_pop_definition): Use cpp_macro_p. Move _cpp_free_definition
2255 earlier. Don't zap node directly.
2256 * expr.c (parse_defined): Use _cpp_maybe_notify_macro_use &
2258 * files.c (should_stack_file): Use cpp_macro_p.
2259 * identifiers.c (cpp_defined): Likewise.
2260 * internal.h (_cpp_mark_macro): Use cpp_user_macro_p.
2261 (_cpp_notify_macro_use): Declare.
2262 (_cpp_maybe_notify_macro_use): New inline.
2263 * lex.c (is_macro): Use cpp_macro_p.
2264 * macro.c (_cpp_warn_if_unused_macro): Use cpp_user_macro_p.
2265 (enter_macro_context): Likewise.
2266 (_cpp_create_definition): Use cpp_builtin_macro_p,
2267 cpp_user_macro_p. Move _cpp_free_definition earlier.
2268 (_cpp_notify_macro_use): New, broken out of multiple call sites.
2269 * traditional.c (fun_like_macro_p): Use cpp_builtin_macro_p.
2270 (maybe_start_funlike, _cpp_scan_out_logical_line)
2271 (push_replacement_text): Likewise.
2273 2018-08-15 David Malcolm <dmalcolm@redhat.com>
2275 * include/line-map.h (struct location_range): Add "m_label" field.
2276 (class rich_location): Add description of labels to leading
2278 (rich_location::rich_location): Add "label" param, defaulting to
2280 (rich_location::add_range): Likewise.
2281 (struct label_text): New struct.
2282 (class range_label): New abstract base class.
2283 * line-map.c (rich_location::rich_location): Add "label" param;
2285 (rich_location::add_range): Likewise.
2287 2018-08-08 Nathan Sidwell <nathan@acm.org>
2289 Make linemap::included_from a location
2291 * include/line-map.h (struct line_map_ordinary): Replace
2292 included_from map index with included_at source_location.
2293 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Delete.
2294 (LAST_SOURCE_LINE_LOCATION): Delete.
2295 (LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete.
2296 (linemap_included_from): New.
2297 (linemap_included_from_linemap): Declare.
2298 (MAIN_FILE_P): Adjust.
2299 * line-map.c (linemap_included_from_linemap): New.
2300 (lonemap_check_files_exited): Use linemap_included_at.
2301 (linemap_add): Adjust inclusion setting.
2302 (linemap_dump, linemap_dump_location): Adjust.
2303 * directives.c (do_linemarker): Use linemap_included_at.
2305 2018-08-07 Nathan Sidwell <nathan@acm.org>
2307 * line-map.c: (linemap_init): Set default allocator here.
2308 (new_linemap): Rather than here. Refactor allocation logic.
2310 2018-07-20 David Malcolm <dmalcolm@redhat.com>
2312 * include/line-map.h (rich_location::set_range): Remove redundant
2313 line_maps * parameter.
2314 * line-map.c (rich_location::set_range): Likewise.
2316 2018-07-18 Bernd Edlinger <bernd.edlinger@hotmail.de>
2319 * macro.c (enter_macro_context): Change the location info for builtin
2320 macros and _Pragma from location of the closing parenthesis to location
2321 of the macro expansion point.
2323 2018-07-17 Jason Franklin <j_fra@fastmail.us>
2324 Jakub Jelinek <jakub@redhat.com>
2326 * lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN,
2327 CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style
2328 comments is reported only once per file and guard those calls on the
2329 preceding cpp_error returning true.
2331 2018-07-03 Nathan Sidwell <nathan@acm.org>
2333 Reorg line_map data structures for better packing.
2334 * include/line-map.h (enum lc_reason): Add LC_HWM.
2335 (LINE_MAP_MAX_LOCATION): Define here.
2336 (struct line_map): Move reason field to line_map_ordinary. Adjust
2338 (struct line_map_ordinary): Reorder fields for less padding.
2339 (struct line_map_macro): Likewise.
2340 (MAP_ORDINARY_P): New.
2341 (linemap_check_ordinary, linemap_check_macro): Adjust.
2342 * line-map.c (LINE_MAP_MAX_SOURCE_LOCATION): Delete.
2343 (new_linemap): Take start_location, not reason. Adjust.
2344 (linemap_add, linemap_enter_macro): Adjust.
2345 (linemap_line_start): Likewise.
2346 (linemap_macro_expansion_map_p): Use MAP_ORDINARY_P.
2347 (linemap_macro_loc_to_spelling_point): Likewise.
2348 (linemap_macro_loc_to_def_point): Likewise.
2349 (linemap_dump): Likewise.
2351 2018-05-23 Jason Merrill <jason@redhat.com>
2353 * system.h: #include <new> earlier.
2355 2018-05-17 Jason Merrill <jason@redhat.com>
2357 * line-map.c (linemap_init): Use placement new.
2358 * system.h: #include <new>.
2360 2018-03-14 David Malcolm <dmalcolm@redhat.com>
2362 * include/line-map.h (compare): New function on linenum_type.
2364 2018-02-28 Jonathan Wakely <jwakely@redhat.com>
2366 PR preprocessor/84517
2367 * lex.c (is_macro_not_literal_suffix): New function.
2368 (lex_raw_string, lex_string): Use is_macro_not_literal_suffix to
2369 decide when to issue -Wliteral-suffix warnings.
2371 2018-02-16 Richard Biener <rguenther@suse.de>
2374 * line-map.c (linemap_init): Avoid broken value-init when compiling
2377 2018-02-15 Jason Merrill <jason@redhat.com>
2378 Jakub Jelinek <jakub@redhat.com>
2380 PR preprocessor/83063 - __VA_OPT__ and ##
2381 PR preprocessor/83708
2382 * macro.c (vaopt_state): Reorder m_last_was_paste before m_state.
2383 (vaopt_state::vaopt_state): Adjust.
2384 (vaopt_state::update_flags): Add BEGIN and END.
2385 (vaopt_state::update): Return them.
2386 (copy_paste_flag): Factor out of replace_args.
2387 (last_token_is): New.
2388 (replace_args): Handle BEGIN and END. Avoid padding there.
2389 (tokens_buff_last_token_ptr): Return NULL if no tokens.
2391 2018-01-31 Jakub Jelinek <jakub@redhat.com>
2393 PR preprocessor/69869
2394 * traditional.c (skip_macro_block_comment): Return bool, true if
2395 the macro block comment is unterminated.
2396 (copy_comment): Use return value from skip_macro_block_comment instead
2399 2018-01-27 Jakub Jelinek <jakub@redhat.com>
2401 * include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from
2402 BT_FIRST_USER + 31 to BT_FIRST_USER + 63.
2404 2018-01-18 Boris Kolpackov <boris@codesynthesis.com>
2407 * include/cpplib.h (cpp_callbacks::remap_filename): New callback.
2408 * macro.c (_cpp_builtin_macro_text): Call remap_filename for
2409 __FILE__ and __BASE_FILE__.
2411 2018-01-10 Kelvin Nilsen <kelvin@gcc.gnu.org>
2413 * lex.c (search_line_fast): Remove illegal coercion of an
2414 unaligned pointer value to vector pointer type and replace with
2415 use of __builtin_vec_vsx_ld () built-in function, which operates
2416 on unaligned pointer values.
2418 2018-01-03 Jakub Jelinek <jakub@redhat.com>
2420 Update copyright years.
2422 2017-12-20 Michael Weiser <michael.weiser@gmx.de>
2424 PR preprocessor/83492
2425 * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
2426 Fix selection of big-endian shift parameters by using
2429 2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
2431 * internal.h (maybe_print_line): Change signature.
2433 2017-12-05 Jakub Jelinek <jakub@redhat.com>
2436 * expr.c (interpret_float_suffix): Avoid memcmp.
2437 (interpret_int_suffix): Likewise. Don't check for if.
2439 2017-12-01 Jason Merrill <jason@redhat.com>
2441 PR c++/79228 - extensions hide C++14 complex literal operators
2442 * expr.c (interpret_float_suffix): Ignore 'i' in C++14 and up.
2443 (interpret_int_suffix): Likewise.
2445 2017-11-28 David Malcolm <dmalcolm@redhat.com>
2448 * include/line-map.h (LINE_MAP_MAX_COLUMN_NUMBER): Move here.
2449 * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): ...from here.
2450 (rich_location::maybe_add_fixit): Reject fix-it hints in which
2451 the start column exceeds the next column.
2453 2017-11-20 Eric Gallager <egall@gwmail.gwu.edu>
2455 PR preprocessor/81794
2456 * macro.c (check_trad_stringification): Have warning be controlled
2459 2017-11-20 David Malcolm <dmalcolm@redhat.com>
2462 * include/cpplib.h (cpp_macro_definition_location): New decl.
2463 * macro.c (cpp_macro_definition): New function.
2465 2017-11-13 Tom Tromey <tom@tromey.com>
2467 * pch.c (cpp_read_state): Set n__VA_OPT__.
2468 * macro.c (vaopt_state): New class.
2469 (_cpp_arguments_ok): Check va_opt flag.
2470 (replace_args, create_iso_definition): Use vaopt_state.
2471 * lex.c (lex_identifier_intern): Possibly issue errors for
2473 (lex_identifier): Likewise.
2474 (maybe_va_opt_error): New function.
2475 * internal.h (struct lexer_state) <va_args_ok>: Update comment.
2476 (struct spec_nodes) <n__VA_OPT__>: New field.
2477 * init.c (struct lang_flags) <va_opt>: New field.
2478 (lang_defaults): Add entries for C++2A. Update all entries for
2480 (cpp_set_lang): Initialize va_opt.
2481 * include/cpplib.h (struct cpp_options) <va_opt>: New field.
2482 * identifiers.c (_cpp_init_hashtable): Initialize n__VA_OPT__.
2484 2017-11-13 David Malcolm <dmalcolm@redhat.com>
2486 * include/line-map.h (linenum_type): Move this typedef and the
2487 comment describing column numbering to near the top of the file.
2489 2017-11-06 Mukesh Kapoor <mukesh.kapoor@oracle.com>
2492 * lex.c (lex_string): When checking for a valid macro for the
2493 warning related to -Wliteral-suffix (CPP_W_LITERAL_SUFFIX),
2494 check that the macro name does not start with an underscore
2495 before calling is_macro().
2497 2017-11-05 Tom de Vries <tom@codesourcery.com>
2500 * lex.c (BUF_APPEND): Remove semicolon after
2503 2017-10-31 David Malcolm <dmalcolm@redhat.com>
2505 * directives.c (_cpp_handle_directive): Update for renaming of
2506 cpp_error_at_richloc to cpp_error_at.
2507 * errors.c (cpp_diagnostic_at_richloc): Rename to...
2508 (cpp_diagnostic_at): ...this, dropping the location_t-based
2510 (cpp_diagnostic): Update for removal of location_t-based
2512 (cpp_error_at): Likewise.
2513 (cpp_error_at_richloc): Rename to...
2514 (cpp_error_at): ...this, and update for renaming of
2515 cpp_diagnostic_at_richloc.
2516 * include/cpplib.h (cpp_error_at_richloc): Rename to...
2517 (cpp_error_at): ...this.
2519 2017-10-30 Joseph Myers <joseph@codesourcery.com>
2521 * include/cpplib.h (enum c_lang): Add CLK_GNUC17 and CLK_STDC17.
2522 * init.c (lang_defaults): Add GNUC17 and STDC17 data.
2523 (cpp_init_builtins): Handle C17 value of __STDC_VERSION__.
2525 2017-10-10 Nathan Sidwell <nathan@acm.org>
2527 PR preprocessor/82506
2528 * macro.c (cpp_quote_string): Escape raw LFs.
2530 2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
2531 Jakub Jelinek <jakub@redhat.com>
2533 Add support for -std=c++2a.
2534 * include/cpplib.h (c_lang): Add CXX2A and GNUCXX2A.
2535 * init.c (lang_defaults): Add rows for CXX2A and GNUCXX2A.
2536 (cpp_init_builtins): Set __cplusplus to 201709L for C++2a.
2538 2017-09-15 Jakub Jelinek <jakub@redhat.com>
2540 * include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z
2541 to CLK_GNUCXX17 and CLK_CXX1Z to CLK_CXX17.
2542 * init.c (lang_defaults, cpp_init_builtins): Likewise.
2543 * expr.c (cpp_classify_number): Use C++17 instead of C++1z
2546 2017-07-07 David Malcolm <dmalcolm@redhat.com>
2549 * line-map.c (linemap_macro_loc_to_def_point): Preserve range
2550 information for macro expansions by delaying resolving ad-hoc
2551 locations until within the loop.
2553 2017-07-06 David Malcolm <dmalcolm@redhat.com>
2556 * include/line-map.h (enum location_aspect): New enum.
2557 (linemap_client_expand_location_to_spelling_point): Add
2558 enum location_aspect param.
2559 * line-map.c (rich_location::get_expanded_location): Update for
2560 new param of linemap_client_expand_location_to_spelling_point.
2561 (rich_location::maybe_add_fixit): Likewise.
2562 (fixit_hint::affects_line_p): Likewise.
2564 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2566 * line-map.c (location_adhoc_data_update): Perform addition in
2567 uintptr_t type rather than char * type. Read *data using
2568 ptrdiff_t type instead of int64_t.
2569 (get_combined_adhoc_loc): Change offset type to ptrdiff_t from
2572 2017-06-20 David Malcolm <dmalcolm@redhat.com>
2574 * include/line-map.h (class rich_location): Document that attempts
2575 to delete or replace a range *affecting* multiple lines will fail.
2576 * line-map.c (rich_location::maybe_add_fixit): Implement this
2579 2017-06-09 David Malcolm <dmalcolm@redhat.com>
2581 * include/line-map.h
2582 (rich_location::fixits_cannot_be_auto_applied): New method.
2583 (rich_location::fixits_can_be_auto_applied_p): New accessor.
2584 (rich_location::m_fixits_cannot_be_auto_applied): New field.
2585 * line-map.c (rich_location::rich_location): Initialize new field.
2587 2017-06-05 David Malcolm <dmalcolm@redhat.com>
2589 * include/cpplib.h (struct cpp_callbacks): Add "comment"
2591 * lex.c (_cpp_lex_direct): Call the comment callback if non-NULL.
2593 2017-05-02 David Malcolm <dmalcolm@redhat.com>
2595 * include/line-map.h (class rich_location): Update description of
2597 (class fixit_hint): Likewise.
2598 (fixit_hint::ends_with_newline_p): New decl.
2599 * line-map.c (rich_location::maybe_add_fixit): Support newlines
2600 in fix-it hints that are insertions of single lines at the start
2601 of a line. Don't consolidate into such fix-it hints.
2602 (fixit_hint::ends_with_newline_p): New method.
2604 2017-05-01 David Malcolm <dmalcolm@redhat.com>
2606 * include/line-map.h (source_range::intersects_line_p): Delete.
2607 (rich_location::add_fixit): Delete.
2608 (rich_location::maybe_add_fixit): New method.
2609 (class fixit_hint): Reimplement in terms of...
2610 (class fixit_replace): ...this.
2611 (class fixit_insert): Delete.
2612 * line-map.c (linemap_position_for_loc_and_offset): Drop overzealous
2613 linemap_assert_fails.
2614 (source_range::intersects_line_p): Rename to...
2615 (fixit_hint::affects_line_p): New function.
2616 (rich_location::add_fixit_insert_before): Reimplement in terms of
2617 maybe_add_fixit, moving validation there.
2618 (rich_location::add_fixit_insert_after): Likewise.
2619 (column_before_p): Delete.
2620 (rich_location::add_fixit_replace): Reimplement in terms of
2621 maybe_add_fixit, moving validation there. Convert closed input range
2623 (rich_location::add_fixit): Delete.
2624 (rich_location::maybe_add_fixit): New function.
2625 (fixit_insert::fixit_insert): Delete.
2626 (fixit_insert::~fixit_insert): Delete.
2627 (fixit_insert::affects_line_p): Delete.
2628 (fixit_insert::maybe_append_replace): Delete.
2629 (fixit_replace::fixit_replace): Rename to...
2630 (fixit_hint::fixit_hint): ...this, rewriting as necessary.
2631 (fixit_replace::~fixit_replace): Delete.
2632 (fixit_replace::affects_line_p): Delete.
2633 (fixit_replace::maybe_append_replace): Rename to...
2634 (fixit_hint::maybe_append): ...this, rewriting as necessary.
2636 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
2638 * include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment.
2639 * lex.c (search_line_fast): Likewise.
2640 * pch.h (cpp_valid_state): Likewise.
2642 2017-03-21 Andreas Schwab <schwab@suse.de>
2644 * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
2645 Convert 64-bit value to boolean before passing to
2648 2017-03-16 Jason Merrill <jason@redhat.com>
2650 * init.c (cpp_init_builtins): Update __cplusplus for C++17.
2652 2017-02-09 Gerald Pfeifer <gerald@pfeifer.com>
2654 * Makefile.in (po/$(PACKAGE).pot): Adjust bug reporting URL.
2656 2017-01-10 David Malcolm <dmalcolm@redhat.com>
2659 * line-map.c (linemap_position_for_column): When calling
2660 linemap_start_line, detect if a new linemap was created with
2661 0 column bits, and bail out early if this is the case.
2662 (linemap_position_for_loc_and_offset): Replace overzealous
2663 linemap_assert_fails with a simple conditional; use correct
2666 2017-01-07 David Malcolm <dmalcolm@redhat.com>
2669 * line-map.c (linemap_line_start): When determining if the highest
2670 column given out so far will fit into a proposed change to the
2671 current map, use the effective number of column bits, rather than
2672 the total number of column + range bits.
2674 2017-01-01 Jakub Jelinek <jakub@redhat.com>
2676 Update copyright years.
2678 2016-12-15 David Malcolm <dmalcolm@redhat.com>
2680 PR preprocessor/78680
2681 PR preprocessor/78811
2682 * lex.c (_cpp_lex_direct): Only determine the end-location of
2683 the token and build a range for non-reserved start locations.
2684 Do not do it for EOF tokens.
2686 2016-12-12 David Malcolm <dmalcolm@redhat.com>
2688 PR preprocessor/78680
2689 * lex.c (_cpp_lex_direct): Ensure line notes are processed before
2690 computing the end-point of the token.
2692 2016-11-23 Paolo Bonzini <bonzini@gnu.org>
2694 * include/cpplib.h (struct cpp_options): Add new member
2695 warn_expansion_to_defined.
2696 (CPP_W_EXPANSION_TO_DEFINED): New enum member.
2697 * expr.c (parse_defined): Warn for all uses of "defined"
2698 in macros, and tie warning to CPP_W_EXPANSION_TO_DEFINED.
2699 Make it a pedwarning instead of a warning.
2700 * system.h (HAVE_DESIGNATED_INITIALIZERS): Do not use
2701 "defined" in macros.
2703 2016-11-17 David Malcolm <dmalcolm@redhat.com>
2705 * charset.c (cpp_interpret_string_1): Skip locations from
2706 loc_reader when advancing 'p' when handling raw strings.
2708 2016-11-16 Jakub Jelinek <jakub@redhat.com>
2711 * configure.ac (ENABLE_ASSERT_CHECKING): Define if gcc configure
2712 would define that macro.
2713 * configure: Regenerated.
2714 * config.in: Regenerated.
2716 2016-11-08 Richard Earnshaw <rearnsha@arm.com>
2718 * lex.c (search_line_fast): New implementation for AArch64.
2720 2016-10-25 David Malcolm <dmalcolm@redhat.com>
2722 * files.c (destroy_cpp_file): Free file->path.
2724 2016-10-25 David Malcolm <dmalcolm@redhat.com>
2726 * include/line-map.h (line_maps::~line_maps): New dtor.
2727 (location_adhoc_data_fini): Delete decl.
2728 * line-map.c (line_maps::~line_maps): New dtor.
2729 (location_adhoc_data_fini): Delete.
2731 2016-10-21 Andris Pavenis <andris.pavenis@iki.fi>
2733 PR preprocessor/71681
2734 * files.c (remap_filename): Fix handling -remap in subdirectories.
2736 2016-10-12 Jakub Jelinek <jakub@redhat.com>
2738 * include/cpplib.h (struct cpp_options): Add
2739 cpp_warn_implicit_fallthrough.
2740 * init.c (cpp_create_reader): Initialize it to 0.
2741 * lex.c (fallthrough_comment_p): Handle different
2742 cpp_warn_implicit_fallthrough levels. Whitespace fixes.
2744 2016-10-08 Jakub Jelinek <jakub@redhat.com>
2746 * lex.c (fallthrough_comment_p): Accept Else, fallthrough.
2748 * lex.c (fallthrough_comment_p): Extend to handle more common FALLTHRU
2751 * lex.c (fallthrough_comment_p): Fix off-by-one size comparison
2753 (_cpp_lex_direct): Allow arbitrary comments in between
2754 fallthrough_comment_p comment and following token.
2756 2016-10-04 Kelvin Nilsen <kelvin@gcc.gnu.org>
2759 * lex.c (search_line_fast): Add a FALLTHROUGH comment to correct
2760 compiler error in the version of this function that is
2761 conditionally compiled when GCC_VERSION >= 4005 and both
2762 __ALTIVEC__ and __BIG_ENDIAN__ symbols are defined.
2764 2016-09-26 Marek Polacek <polacek@redhat.com>
2765 Jakub Jelinek <jakub@redhat.com>
2768 * include/cpplib.h (PREV_FALLTHROUGH): Define.
2769 * internal.h (CPP_FALLTHRU): Define.
2770 * lex.c (fallthrough_comment_p): New function.
2771 (_cpp_lex_direct): Set PREV_FALLTHROUGH on tokens succeeding a falls
2774 2016-09-23 David Malcolm <dmalcolm@redhat.com>
2776 PR preprocessor/77672
2777 * charset.c (cpp_interpret_string_1): Add a source_range for the
2778 NUL-terminator, using the location of the trailing quote of the
2781 2016-09-21 Jason Merrill <jason@redhat.com>
2783 * line-map.c (linemap_location_from_macro_definition_p): New.
2784 * line-map.h: Declare it.
2786 2016-09-15 David Malcolm <dmalcolm@redhat.com>
2788 * include/line-map.h (class rich_location): Note that newlines
2789 aren't supported in fix-it text.
2790 * line-map.c (rich_location::add_fixit_insert_before): Reject
2791 attempts to add fix-its containing newlines.
2792 (rich_location::add_fixit_replace): Likewise.
2794 2016-09-13 David Malcolm <dmalcolm@redhat.com>
2796 * include/line-map.h (class rich_location): Add description of
2797 fix-it hints to leading comment.
2798 (rich_location::add_fixit_insert): Rename both overloaded methods
2800 (rich_location::add_fixit_insert_before): ...this, updating their
2802 (rich_location::add_fixit_insert_after): Two new overloaded
2804 (rich_location::stop_supporting_fixits): New method.
2805 * line-map.c (rich_location::add_fixit_insert): Rename both
2806 overloaded methods to..
2807 (rich_location::add_fixit_insert_before): ...this, updating their
2809 (rich_location::add_fixit_insert_after): Two new methods.
2810 (rich_location::reject_impossible_fixit): Split out
2811 failure-handling into...
2812 (rich_location::stop_supporting_fixits): New method.
2814 2016-09-02 David Malcolm <dmalcolm@redhat.com>
2816 * include/line-map.h (rich_location::seen_impossible_fixit_p): New
2819 2016-08-31 David Malcolm <dmalcolm@redhat.com>
2821 * include/line-map.h (class fixit_remove): Remove stray decl.
2822 (fixit_hint::affects_line_p): Make const.
2823 (fixit_insert::affects_line_p): Likewise.
2824 (fixit_replace::affects_line_p): Likewise.
2825 * line-map.c (fixit_insert::affects_line_p): Likewise.
2826 (fixit_replace::affects_line_p): Likewise.
2828 2016-08-30 David Malcolm <dmalcolm@redhat.com>
2830 * include/line-map.h (class semi_embedded_vec): New class.
2831 (semi_embedded_vec<T, NUM_EMBEDDED>::semi_embedded_vec): New ctor.
2832 (semi_embedded_vec<T, NUM_EMBEDDED>::~semi_embedded_vec): New
2834 (semi_embedded_vec<T, NUM_EMBEDDED>::operator[]): New methods.
2835 (semi_embedded_vec<T, NUM_EMBEDDED>::push): New method.
2836 (semi_embedded_vec<T, NUM_EMBEDDED>::truncate): New method.
2837 (rich_location::get_num_locations): Reimplement in terms of
2839 (rich_location::get_range): Make non-inline.
2840 (rich_location::get_num_fixit_hints): Reimplement in terms of
2842 (rich_location::add_fixit): New function.
2843 (rich_location::MAX_RANGES): Rename to...
2844 (rich_location::STATICALLY_ALLOCATED_RANGES): ...this.
2845 (rich_location::MAX_FIXIT_HINTS): Rename to...
2846 (rich_location::STATICALLY_ALLOCATED_RANGES): ...this, and make
2848 (rich_location::m_num_ranges): Eliminate in favor of...
2849 (rich_location::m_ranges): ...this, converting from a fixed-size
2850 array to a semi_embedded_vec.
2851 (rich_location::m_num_fixit_hints): Eliminate in favor of...
2852 (rich_location::m_fixit_hints): ...this, converting from a
2853 fixed-size array to a semi_embedded_vec.
2854 * line-map.c (rich_location::rich_location): Update for above
2856 (rich_location::~rich_location): Likewise.
2857 (rich_location::get_loc): Likewise.
2858 (rich_location::get_range): New methods.
2859 (rich_location::add_range): Update for above changes.
2860 (rich_location::set_range): Likewise.
2861 (rich_location::add_fixit_insert): Likewise.
2862 (rich_location::add_fixit_replace): Likewise.
2863 (rich_location::get_last_fixit_hint): Likewise.
2864 (rich_location::reject_impossible_fixit): Likewise.
2865 (rich_location::add_fixit): New method.
2867 2016-08-30 David Malcolm <dmalcolm@redhat.com>
2869 * include/line-map.h (rich_location::add_fixit_insert): Add
2870 comments. Add overload omitting the source_location param.
2871 (rich_location::add_fixit_remove): Add comments. Add overloads
2872 omitting the range, and accepting a source_location.
2873 (rich_location::add_fixit_replace): Likewise.
2874 * line-map.c (rich_location::add_fixit_insert): Add comments. Add
2875 overload omitting the source_location param.
2876 (rich_location::add_fixit_remove): Add comments. Add overloads
2877 omitting the range, and accepting a source_location.
2878 (rich_location::add_fixit_replace): Likewise.
2880 2016-08-26 David Malcolm <dmalcolm@redhat.com>
2882 * include/line-map.h (get_pure_location): New decl.
2883 * line-map.c (get_pure_location): Move here, from gcc/input.c, adding
2884 a line_maps * param.
2885 (rich_location::add_fixit_insert): Call get_pure_location on "where".
2886 (rich_location::add_fixit_replace): Call get_pure_location on the
2889 2016-08-26 David Malcolm <dmalcolm@redhat.com>
2891 * include/line-map.h (rich_location): Eliminate unimplemented
2892 constructor based on source_range.
2893 (rich_location::get_last_fixit_hint): New method.
2894 (rich_location::reject_impossible_fixit): New method.
2895 (rich_location): Add fields m_line_table and
2896 m_seen_impossible_fixit.
2897 (fixit_hint::maybe_append_replace): New pure virtual function.
2898 (fixit_insert::maybe_append_replace): New function.
2899 (fixit_replace::maybe_append_replace): New function.
2900 * line-map.c (rich_location::rich_location): Initialize
2901 m_line_table and m_seen_impossible_fixit.
2902 (rich_location::add_fixit_insert): Call
2903 reject_impossible_fixit and bail out if true.
2904 (column_before_p): New function.
2905 (rich_location::add_fixit_replace): Call reject_impossible_fixit
2906 and bail out if true. Attempt to consolidate with neighboring
2908 (rich_location::get_last_fixit_hint): New method.
2909 (rich_location::reject_impossible_fixit): New method.
2910 (fixit_insert::maybe_append_replace): New method.
2911 (fixit_replace::maybe_append_replace): New method.
2913 2016-08-23 David Malcolm <dmalcolm@redhat.com>
2915 * include/line-map.h (source_range::from_locations): New method.
2917 2016-08-19 David Malcolm <dmalcolm@redhat.com>
2919 * include/line-map.h (fixit_hint::kind): Delete REPLACE.
2920 (class fixit_remove): Delete.
2921 * line-map.c (rich_location::add_fixit_remove): Reimplement
2922 by calling add_fixit_replace with an empty string.
2923 (fixit_remove::fixit_remove): Delete.
2924 (fixit_remove::affects_line_p): Delete.
2926 2016-08-19 Joseph Myers <joseph@codesourcery.com>
2929 * include/cpplib.h (CPP_N_FLOATN, CPP_N_FLOATNX)
2930 (CPP_N_WIDTH_FLOATN_NX, CPP_FLOATN_SHIFT, CPP_FLOATN_MAX): New
2932 * expr.c (interpret_float_suffix): Handle fN, fNx, FN and FNx
2935 2016-08-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
2937 * expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic.
2939 2016-08-18 David Malcolm <dmalcolm@redhat.com>
2941 * directives.c (directive_names): New array.
2942 (_cpp_handle_directive): Offer spelling suggestions for misspelled
2944 * errors.c (cpp_diagnostic_at_richloc): New function.
2945 (cpp_error_at_richloc): New function.
2946 * include/cpplib.h (struct cpp_callbacks): Add field
2948 (cpp_error_at_richloc): New decl.
2950 2016-08-18 Marek Polacek <polacek@redhat.com>
2953 * pch.c (write_macdef): Add CPP_FALLTHRU.
2955 2016-08-12 Marek Polacek <polacek@redhat.com>
2958 * lex.c (search_line_fast): Add FALLTHRU.
2959 (_cpp_lex_direct): Likewise.
2960 (cpp_token_val_index): Adjust fall through comment.
2961 * macro.c (parse_params): Add FALLTHRU.
2962 * pch.c (count_defs): Adjust fall through comment.
2963 (write_defs): Likewise.
2965 2016-08-06 David Malcolm <dmalcolm@redhat.com>
2968 * charset.c (_cpp_valid_ucn): Replace overzealous assert with one
2969 that allows for char_range to be non-NULL when loc_reader is NULL.
2971 2016-08-05 David Malcolm <dmalcolm@redhat.com>
2973 * charset.c (cpp_substring_ranges::cpp_substring_ranges): New
2975 (cpp_substring_ranges::~cpp_substring_ranges): New destructor.
2976 (cpp_substring_ranges::add_range): New method.
2977 (cpp_substring_ranges::add_n_ranges): New method.
2978 (_cpp_valid_ucn): Add "char_range" and "loc_reader" params; if
2979 they are non-NULL, read position information from *loc_reader
2980 and update char_range->m_finish accordingly.
2981 (convert_ucn): Add "char_range", "loc_reader", and "ranges"
2982 params. If loc_reader is non-NULL, read location information from
2983 it, and update *ranges accordingly, using char_range.
2984 Conditionalize the conversion into tbuf on tbuf being non-NULL.
2985 (convert_hex): Likewise, conditionalizing the call to
2986 emit_numeric_escape on tbuf.
2987 (convert_oct): Likewise.
2988 (convert_escape): Add params "loc_reader" and "ranges". If
2989 loc_reader is non-NULL, read location information from it, and
2990 update *ranges accordingly. Conditionalize the conversion into
2991 tbuf on tbuf being non-NULL.
2992 (cpp_interpret_string): Rename to...
2993 (cpp_interpret_string_1): ...this, adding params "loc_readers" and
2994 "out". Use "to" to conditionalize the initialization and usage of
2995 "tbuf", such as running the converter. If "loc_readers" is
2996 non-NULL, use the instances within it, reading location
2997 information from them, and passing them to convert_escape; likewise
2998 write to "out" if loc_readers is non-NULL. Check for leading
2999 quote and issue an error if it is not present. Update boundary
3000 check from "== limit" to ">= limit" to protect against erroneous
3001 location values to calls that are not parsing string literals.
3002 (cpp_interpret_string): Reimplement in terms to
3003 cpp_interpret_string_1.
3004 (noop_error_cb): New function.
3005 (cpp_interpret_string_ranges): New function.
3006 (cpp_string_location_reader::cpp_string_location_reader): New
3008 (cpp_string_location_reader::get_next): New method.
3009 * include/cpplib.h (class cpp_string_location_reader): New class.
3010 (class cpp_substring_ranges): New class.
3011 (cpp_interpret_string_ranges): New prototype.
3012 * internal.h (_cpp_valid_ucn): Add params "char_range" and
3014 * lex.c (forms_identifier_p): Pass NULL for new params to
3017 2016-08-01 Andreas Schwab <schwab@suse.de>
3019 * include/cpplib.h: Fix comment typo.
3021 2016-07-27 David Malcolm <dmalcolm@redhat.com>
3023 * include/line-map.h (source_location): Fix line numbers in
3026 2016-07-11 David Malcolm <dmalcolm@redhat.com>
3028 * include/line-map.h (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES):
3029 Move here from line-map.c.
3030 (LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise.
3031 * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): Move from
3033 (LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise.
3035 2016-06-22 David Malcolm <dmalcolm@redhat.com>
3037 * directives.c (do_include_common): Pass on "location" to
3039 * errors.c (cpp_diagnostic): Reimplement in terms of...
3040 (cpp_diagnostic_at): New function.
3041 (cpp_error_at): New function.
3042 (cpp_errno_filename): Add "loc" param and use it by using
3043 cpp_error_at rather than cpp_error.
3044 * files.c (find_file_in_dir): Add "loc" param and pass it to
3046 (_cpp_find_file): Add "loc" param. Use it to convert calls to
3047 cpp_error to cpp_error_at, and pass it to find_file_in_dir and
3049 (read_file_guts): Add "loc" param. Use it to convert calls to
3050 cpp_error to cpp_error_at. Pass it to cpp_errno_filename.
3051 (read_file): Add "loc" param. Pass it to open_file_failed and
3053 (should_stack_file): Add "loc" param. Pass it to read_file.
3054 (_cpp_stack_file): Add "loc" param. Pass it to should_stack_file.
3055 (_cpp_stack_include): Add "loc" param. Pass it to
3056 _cpp_find_file and _cpp_stack_file.
3057 (open_file_failed): Add "loc" param. Pass it to
3059 (_cpp_fake_include): Add 0 as a source_location in call to
3061 (_cpp_compare_file_date): Likewise.
3062 (cpp_push_include): Likewise for call to _cpp_stack_include.
3063 (cpp_push_default_include): Likewise.
3064 (_cpp_save_file_entries): Likewise for call to open_file_failed.
3065 (_cpp_has_header): Likewise for call to _cpp_find_file.
3066 * include/cpplib.h (cpp_errno_filename): Add source_location
3068 (cpp_error_at): New declaration.
3069 * init.c (cpp_read_main_file): Add 0 as a source_location in calls
3070 to _cpp_find_file and _cpp_stack_file.
3071 * internal.h (_cpp_find_file): Add source_location param.
3072 (_cpp_stack_file): Likewise.
3073 (_cpp_stack_include): Likewise.
3075 2016-06-22 David Malcolm <dmalcolm@redhat.com>
3077 * include/line-map.h (fixit_hint::get_start_loc): New pure virtual
3079 (fixit_hint::maybe_get_end_loc): Likewise.
3080 (fixit_insert::get_start_loc): New function, implementing
3081 fixit_hint::get_start_loc.
3082 (fixit_insert::maybe_get_end_loc): New function, implementing
3083 fixit_hint::maybe_get_end_loc.
3084 (fixit_remove::get_start_loc): New function, implementing
3085 fixit_hint::get_start_loc.
3086 (fixit_remove::maybe_get_end_loc): New function, implementing
3087 fixit_hint::maybe_get_end_loc.
3088 (fixit_replace::get_start_loc): New function, implementing
3089 fixit_hint::get_start_loc.
3090 (fixit_replace::maybe_get_end_loc): New function, implementing
3091 fixit_hint::maybe_get_end_loc.
3093 2016-06-21 John David Anglin <danglin@gcc.gnu.org>
3095 * line-map.c (location_adhoc_data_update): Use int64_t instead of
3097 (get_combined_adhoc_loc): Likewise.
3099 2016-06-01 Eduard Sanou <dhole@openmailbox.org>
3101 * include/cpplib.h (cpp_callbacks): Add get_source_date_epoch
3103 * include/cpplib.h (cpp_init_source_date_epoch): Remove prototype.
3104 * init.c (cpp_init_source_date_epoch): Remove function.
3105 * init.c (cpp_create_reader): Initialize pfile->source_date_epoch.
3106 * internal.h (cpp_reader): Extend comment about source_date_epoch.
3107 * macro.c (_cpp_builtin_macro_text): Use get_source_date_epoch
3108 callback only once, read pfile->source_date_epoch on future passes.
3109 Check that get_source_date_epoch callback is not NULL.
3111 2016-05-20 Martin Liska <mliska@suse.cz>
3113 * config.in: Regenerated.
3114 * configure: Likewise.
3115 * configure.ac: Handle --enable-valgrind-annotations.
3116 * lex.c (new_buff): Use ENABLE_VALGRIND_ANNOTATIONS instead
3117 of ENABLE_VALGRIND_CHECKING.
3118 (_cpp_free_buff): Likewise.
3120 2016-04-28 Eduard Sanou <dhole@openmailbox.org>
3121 Matthias Klose <doko@debian.org>
3123 * include/cpplib.h (cpp_init_source_date_epoch): Prototype.
3124 * init.c (cpp_init_source_date_epoch): New function.
3125 * internal.h: Added source_date_epoch variable to struct
3126 cpp_reader to store a reproducible date.
3127 * macro.c (_cpp_builtin_macro_text): Set pfile->date timestamp from
3128 pfile->source_date_epoch instead of localtime if source_date_epoch is
3129 set, to be used for __DATE__ and __TIME__ macros to help reproducible
3132 2016-04-13 Bernd Schmidt <bschmidt@redhat.com>
3134 Patch from Roger Orr <rogero@howzatt.demon.co.uk>
3135 PR preprocessor/69650
3136 * directives.c (do_linemarker): Reread map after calling
3139 2016-04-06 Richard Henderson <rth@redhat.com>
3141 PR preprocessor/61817
3142 PR preprocessor/69391
3143 * internal.h (_cpp_builtin_macro_text): Update decl.
3144 * macro.c (_cpp_builtin_macro_text): Accept location for __LINE__.
3145 (builtin_macro): Accept a second location for __LINE__.
3146 (enter_macro_context): Compute both virtual and real expansion
3147 locations for the macro.
3149 2016-03-25 Bernd Schmidt <bschmidt@redhat.com>
3152 * directives.c (do_linemarker): Test for file left but not entered
3154 * line-map.c (linemap_add): Not here.
3156 2016-03-21 Jakub Jelinek <jakub@redhat.com>
3159 * include/cpplib.h (cpp_fun_like_macro_p): New prototype.
3160 * macro.c (cpp_fun_like_macro_p): New function.
3162 2016-03-15 Richard Henderson <rth@redhat.com>
3164 * line-map.c (new_linemap): Make alloc_size a size_t.
3166 2016-03-14 Jason Merrill <jason@redhat.com>
3168 * expr.c (cpp_classify_number): Hex floats are new in C++1z.
3169 * init.c (lang_defaults): Likewise.
3171 2016-03-09 David Malcolm <dmalcolm@redhat.com>
3175 * line-map.c (linemap_macro_map_loc_unwind_toward_spelling): Move
3177 * include/line-map.h
3178 (linemap_macro_map_loc_unwind_toward_spelling): ...here,
3179 converting from static to extern.
3181 2016-03-09 David Malcolm <dmalcolm@redhat.com>
3185 * include/line-map.h (source_range::debug): Delete.
3186 (struct location_range): Update comment. Replace
3187 expanded_location fields "m_start", "m_finish", and "m_caret" with
3188 a source_location field: "m_loc".
3189 (class rich_location): Reword comment.
3190 (rich_location::get_loc): Reimplement in terms of a new overloaded
3191 variant which takes an unsigned int.
3192 (rich_location::get_loc_addr): Delete.
3193 (rich_location::add_range): Drop params "start" and "finish" in
3194 favor of param "loc". Drop overloaded variants taking a
3195 source_range or location_range *.
3196 (rich_location::lazily_expand_location): Delete in favor of...
3197 (rich_location::get_expanded_location): New decl.
3198 (rich_location::m_loc): Delete field.
3199 (rich_location::m_column_override): New field.
3200 * line-map.c (rich_location::rich_location): Drop name of
3201 line_maps * param. Update initializations for deletion of field
3202 "m_loc" and addition of field "m_column_override". Reimplement
3203 body as a call to add_range. Delete overloaded variant taking a
3205 (rich_location::get_loc): New function.
3206 (rich_location::lazily_expand_location): Delete in favor of...
3207 (rich_location::get_expanded_location): New function.
3208 (rich_location::override_column): Reimplement.
3209 (rich_location::add_range): Drop params "start" and "finish" in
3210 favor of param "loc". Eliminate location expansion in favor of
3211 simply storing loc. Drop overloaded variants taking a
3212 source_range or location_range *.
3213 (rich_location::set_range): Eliminate location expansion.
3215 2016-02-29 David Malcolm <dmalcolm@redhat.com>
3217 PR preprocessor/69985
3218 (linemap_position_for_loc_and_offset): Rename param from "offset"
3219 to "column_offset". Right-shift the column_offset by m_range_bits
3220 of the pertinent ordinary map whenever offsetting a
3221 source_location. For clarity, offset the column by the column
3222 offset, rather than the other way around.
3224 2016-02-23 David Malcolm <dmalcolm@redhat.com>
3226 PR preprocessor/69126
3227 PR preprocessor/69543
3228 * line-map.c (linemap_compare_locations): At the function top,
3229 replace inlined bodies of get_location_from_adhoc_loc with calls
3230 to get_location_from_adhoc_loc. Add a pair of calls to
3231 get_location_from_adhoc_loc at the bottom of the function, to
3232 avoid meaningless comparisons of ad-hoc and non-ad-hoc locations.
3234 2016-02-08 David Malcolm <dmalcolm@redhat.com>
3236 PR preprocessor/69664
3237 * errors.c (cpp_diagnostic_with_line): Only call
3238 rich_location::override_column if the column is non-zero.
3239 * line-map.c (rich_location::override_column): Update columns
3240 within m_ranges[0]. Add assertions to verify that doing so is
3243 2016-02-05 Jakub Jelinek <jakub@redhat.com>
3246 * charset.c (cpp_interpret_charconst): Clear *PCHARS_SEEN
3247 and *UNSIGNEDP if bailing out early due to errors.
3249 2016-01-28 Jakub Jelinek <jakub@redhat.com>
3252 * files.c (_cpp_find_file): Set file->implicit_preinclude even if
3253 included from file->implicit_preinclude header.
3255 * directives.c (destringize_and_run): Adjust prototype.
3257 2016-01-27 David Malcolm <dmalcolm@redhat.com>
3259 PR preprocessor/69126
3260 * directives.c (destringize_and_run): Add expansion_loc param; use
3261 it when handling unexpanded pragmas to fixup the locations of the
3263 (_cpp_do__Pragma): Add expansion_loc param and use it when calling
3264 destringize_and_run.
3265 * internal.h (_cpp_do__Pragma): Add expansion_loc param.
3266 * macro.c (builtin_macro): Pass expansion location of _Pragma to
3269 2016-01-14 David Malcolm <dmalcolm@redhat.com>
3271 PR preprocessor/69177
3272 * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): New
3274 (LINE_MAP_MAX_LOCATION_WITH_COLS): Add note about unit tests
3276 (can_be_stored_compactly_p): Reduce threshold from
3277 LINE_MAP_MAX_LOCATION_WITH_COLS to
3278 LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES.
3279 (get_combined_adhoc_loc): Likewise.
3280 (get_range_from_loc): Likewise.
3281 (linemap_line_start): Ensure that a new ordinary map is created
3282 when transitioning from range-packing being enabled to disabled,
3283 at the LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES threshold. Set
3284 range_bits to 0 for new ordinary maps when beyond this limit.
3285 Prevent the "increase the column bits of a freshly created map"
3286 optimization if the range bits has reduced.
3288 2016-01-08 Jakub Jelinek <jakub@redhat.com>
3291 * files.c (cpp_included_before): If IS_ADHOC_LOC (location), lookup
3292 real location from the line_table.
3294 2016-01-04 Jakub Jelinek <jakub@redhat.com>
3296 Update copyright years.
3298 2015-12-22 David Malcolm <dmalcolm@redhat.com>
3300 * line-map.c (get_combined_adhoc_loc): Remove condition
3301 on locus < RESERVED_LOCATION_COUNT when considering
3302 whether a caret == start == finish location can be
3303 simply stored as the caret location.
3305 2015-12-07 David Malcolm <dmalcolm@redhat.com>
3307 * include/line-map.h (rich_location::set_range): Add line_maps *
3308 param; convert param from source_range to source_location. Drop
3309 "overwrite_loc_p" param.
3310 * line-map.c (rich_location::set_range): Likewise, acting as if
3311 "overwrite_loc_p" were true, and getting range from the location.
3313 2015-11-20 David Malcolm <dmalcolm@redhat.com>
3316 * include/line-map.h (source_range::intersects_line_p): New
3318 (rich_location::~rich_location): New.
3319 (rich_location::add_fixit_insert): New method.
3320 (rich_location::add_fixit_remove): New method.
3321 (rich_location::add_fixit_replace): New method.
3322 (rich_location::get_num_fixit_hints): New accessor.
3323 (rich_location::get_fixit_hint): New accessor.
3324 (rich_location::MAX_FIXIT_HINTS): New constant.
3325 (rich_location::m_num_fixit_hints): New field.
3326 (rich_location::m_fixit_hints): New field.
3327 (class fixit_hint): New class.
3328 (class fixit_insert): New class.
3329 (class fixit_remove): New class.
3330 (class fixit_replace): New class.
3331 * line-map.c (source_range::intersects_line_p): New method.
3332 (rich_location::rich_location): Add initialization of
3333 m_num_fixit_hints to both ctors.
3334 (rich_location::~rich_location): New.
3335 (rich_location::add_fixit_insert): New method.
3336 (rich_location::add_fixit_remove): New method.
3337 (rich_location::add_fixit_replace): New method.
3338 (fixit_insert::fixit_insert): New.
3339 (fixit_insert::~fixit_insert): New.
3340 (fixit_insert::affects_line_p): New.
3341 (fixit_remove::fixit_remove): New.
3342 (fixit_remove::affects_line_p): New.
3343 (fixit_replace::fixit_replace): New.
3344 (fixit_replace::~fixit_replace): New.
3345 (fixit_replace::affects_line_p): New.
3347 2015-11-19 Jakub Jelinek <jakub@redhat.com>
3349 PR preprocessor/60736
3350 * include/cpplib.h (cpp_errno_filename): New prototype.
3351 * errors.c (cpp_errno): Don't handle msgid "" specially, use
3352 _(msgid) instead of msgid as argument to cpp_error.
3353 (cpp_errno_filename): New function.
3354 * files.c (read_file_guts): Use cpp_errno_filename instead of
3356 (open_file_failed): Likewise. Use file->name if file->path is NULL
3359 2015-11-13 David Malcolm <dmalcolm@redhat.com>
3361 * errors.c (cpp_diagnostic): Pass pfile->line_table to
3363 (cpp_diagnostic_with_line): Likewise.
3364 * include/cpplib.h (struct cpp_token): Update comment for src_loc
3365 to indicate that the range of the token is "baked into" the
3367 * include/line-map.h (source_location): Update the descriptive
3368 comment to reflect the packing scheme for short ranges, adding
3369 worked examples of location encoding.
3370 (struct line_map_ordinary): Drop field "column_bits" in favor
3371 of field "m_column_and_range_bits"; add field "m_range_bits".
3372 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete.
3373 (location_adhoc_data): Add source_range field.
3374 (struct line_maps): Add fields "default_range_bits",
3375 "num_optimized_ranges" and "num_unoptimized_ranges".
3376 (get_combined_adhoc_loc): Add source_range param.
3377 (get_range_from_loc): New declaration.
3378 (pure_location_p): New prototype.
3379 (COMBINE_LOCATION_DATA): Add source_range param.
3380 (SOURCE_LINE): Update for renaming of column_bits.
3381 (SOURCE_COLUMN): Likewise. Shift the column right by the map's
3383 (LAST_SOURCE_LINE_LOCATION): Update for renaming of column_bits.
3384 (linemap_position_for_line_and_column): Add line_maps * params.
3385 (rich_location::rich_location): Likewise.
3386 * lex.c (_cpp_lex_direct): Capture the range of the token, baking
3387 it into token->src_loc via a call to COMBINE_LOCATION_DATA.
3388 * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): Reduce from 1U << 17 to
3390 (location_adhoc_data_hash): Add the src_range into
3392 (location_adhoc_data_eq): Require equality of the src_range
3394 (can_be_stored_compactly_p): New function.
3395 (get_combined_adhoc_loc): Add src_range param, and store it,
3396 via a bit-packing scheme for short ranges, otherwise within the
3397 lookaside table. Remove the requirement that data is non-NULL.
3398 (get_range_from_adhoc_loc): New function.
3399 (get_range_from_loc): New function.
3400 (pure_location_p): New function.
3401 (linemap_add): Ensure that start_location has zero for the
3402 range_bits, unless we're past LINE_MAP_MAX_LOCATION_WITH_COLS.
3403 Initialize range_bits to zero. Assert that the start_location
3405 (linemap_line_start): Assert that the
3406 column_and_range_bits >= range_bits.
3407 Update determinination of whether we need to start a new map
3408 using the effective column bits, without the range bits.
3409 Use the set's default_range_bits in new maps, apart from
3410 those with column_bits == 0, which should also have 0 range_bits.
3411 Increase the column bits for new maps by the range bits.
3412 When adding lines to an existing map, use set->highest_line
3413 directly rather than offsetting highest by SOURCE_COLUMN.
3414 Add assertions to sanity-check the return value.
3415 (linemap_position_for_column): Offset to_column by range_bits.
3416 Update set->highest_location if necessary.
3417 (linemap_position_for_line_and_column): Add line_maps * param.
3418 Update the calculation to offset the column by range_bits, and
3419 conditionalize it on being <= LINE_MAP_MAX_LOCATION_WITH_COLS.
3420 Bound it by LINEMAPS_MACRO_LOWEST_LOCATION. Update
3421 set->highest_location if necessary.
3422 (linemap_position_for_loc_and_offset): Handle ad-hoc locations;
3423 pass "set" to linemap_position_for_line_and_column.
3424 (linemap_macro_map_loc_unwind_toward_spelling): Add line_maps
3425 param. Handle ad-hoc locations.
3426 (linemap_location_in_system_header_p): Pass on "set" to call to
3427 linemap_macro_map_loc_unwind_toward_spelling.
3428 (linemap_macro_loc_to_spelling_point): Retain ad-hoc locations.
3429 Pass on "set" to call to
3430 linemap_macro_map_loc_unwind_toward_spelling.
3431 (linemap_resolve_location): Retain ad-hoc locations. Pass on
3432 "set" to call to linemap_macro_map_loc_unwind_toward_spelling.
3433 (linemap_unwind_toward_expansion): Pass on "set" to call to
3434 linemap_macro_map_loc_unwind_toward_spelling.
3435 (linemap_expand_location): Extract the data pointer before
3436 extracting the location.
3437 (rich_location::rich_location): Add line_maps param; use it to
3438 extract the range from the source_location.
3439 * location-example.txt: Regenerate, showing new representation.
3441 2015-11-06 David Malcolm <dmalcolm@redhat.com>
3443 * errors.c (cpp_diagnostic): Update for change in signature
3444 of "error" callback.
3445 (cpp_diagnostic_with_line): Likewise, calling override_column
3446 on the rich_location.
3447 * include/cpplib.h (struct cpp_callbacks): Within "error"
3448 callback, convert param from source_location to rich_location *,
3449 and drop column_override param.
3450 * include/line-map.h (struct source_range): New struct.
3451 (struct location_range): New struct.
3452 (class rich_location): New class.
3453 (linemap_client_expand_location_to_spelling_point): New declaration.
3454 * line-map.c (rich_location::rich_location): New ctors.
3455 (rich_location::lazily_expand_location): New method.
3456 (rich_location::override_column): New method.
3457 (rich_location::add_range): New methods.
3458 (rich_location::set_range): New method.
3460 2015-11-06 David Malcolm <dmalcolm@redhat.com>
3462 * include/line-map.h (struct linemap_stats): Add fields
3463 "adhoc_table_size" and "adhoc_table_entries_used".
3464 * line-map.c (linemap_get_statistics): Populate above fields.
3466 2015-11-04 Mikhail Maltsev <maltsevm@gmail.com>
3468 * config.in: Regenerate.
3469 * configure: Regenerate.
3470 * configure.ac: Remove ENABLE_CHECKING.
3472 2015-11-03 Uros Bizjak <ubizjak@gmail.com>
3474 * lex.c (search_line_sse42): Correctly advance the pointer to an
3477 2015-11-02 David Malcolm <dmalcolm@redhat.com>
3479 * include/line-map.h (source_location): In the table in the
3480 descriptive comment, show UNKNOWN_LOCATION, BUILTINS_LOCATION,
3481 LINE_MAP_MAX_LOCATION_WITH_COLS, LINE_MAP_MAX_SOURCE_LOCATION.
3482 Add notes about ad-hoc values.
3484 2015-10-21 Mikhail Maltsev <maltsevm@gmail.com>
3486 * include/line-map.h: Use CHECKING_P instead of ENABLE_CHECKING.
3488 * macro.c (struct macro_arg_token_iter, set_arg_token,
3489 macro_arg_token_iter_init, macro_arg_token_iter_forward,
3490 macro_arg_token_iter_get_token, macro_arg_token_iter_get_location,
3491 alloc_expanded_arg_mem, _cpp_backup_tokens): Likewise.
3493 * config.in: Regenerate.
3494 * configure: Regenerate.
3495 * configure.ac (CHECKING_P): Define.
3496 * system.h (fancy_abort): Declare.
3498 (gcc_assert): Define. Use CHECKING_P.
3500 2015-10-13 Mikhail Maltsev <maltsevm@gmail.com>
3502 * system.h (CHECKING_P, gcc_checking_assert): Define.
3504 2015-09-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
3507 * line-map.c (linemap_position_for_loc_and_offset): Handle the
3508 case of long lines encoded in multiple maps.
3510 2015-09-07 Marek Polacek <polacek@redhat.com>
3512 * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning.
3514 2015-08-06 Yaakov Selkowitz <yselkowi@redhat.com>
3516 * configure: Regenerate.
3518 2015-07-08 Thomas Schwinge <thomas@codesourcery.com>
3520 * include/line-map.h (RESERVED_LOCATION_COUNT): Change type to
3523 2015-07-02 Paolo Carlini <paolo.carlini@oracle.com>
3525 PR preprocessor/53690
3526 * charset.c (_cpp_valid_ucn): Add cppchar_t * parameter and change
3527 return type to bool. Fix encoding of \u0000 and \U00000000 in C++.
3528 (convert_ucn): Adjust call.
3529 * lex.c (forms_identifier_p): Likewise.
3530 * internal.h (_cpp_valid_ucn): Adjust declaration.
3532 2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
3534 Implement N4197 - Adding u8 character literals
3535 * include/cpplib.h (UTF8CHAR, UTF8CHAR_USERDEF): New cpp tokens;
3536 (struct cpp_options): Add utf8_char_literals.
3537 * init.c (struct lang_flags): Add utf8_char_literals;
3538 (struct lang_flags lang_defaults): Add column for utf8_char_literals.
3539 * macro.c (stringify_arg()): Treat CPP_UTF8CHAR token;
3540 * expr.c (cpp_userdef_char_remove_type(), cpp_userdef_char_add_type()):
3541 Treat CPP_UTF8CHAR_USERDEF, CPP_UTF8CHAR tokens;
3542 (cpp_userdef_char_p()): Treat CPP_UTF8CHAR_USERDEF token;
3543 (eval_token(), _cpp_parse_expr()): Treat CPP_UTF8CHAR token.
3544 * lex.c (lex_string(), _cpp_lex_direct()): Include CPP_UTF8CHAR tokens.
3545 * charset.c (converter_for_type(), cpp_interpret_charconst()):
3546 Treat CPP_UTF8CHAR token.
3548 2015-06-30 Uros Bizjak <ubizjak@gmail.com>
3550 * lex.c (search_line_sse42) [__GCC_ASM_FLAG_OUTPUTS__]: New main
3551 loop using asm flag outputs.
3553 2015-06-08 Marek Polacek <polacek@redhat.com>
3556 * line-map.c (linemap_position_for_loc_and_offset): Remove
3557 linemap_assert_fails; reverse conditions.
3559 2015-05-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
3561 * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER
3562 LINE_MAP_MAX_LOCATION_WITH_COLS,LINE_MAP_MAX_SOURCE_LOCATION):
3564 (linemap_line_start): Use them.
3565 (linemap_position_for_column): Use them.
3567 2015-05-20 David Malcolm <dmalcolm@redhat.com>
3569 * include/line-map.h (MAP_START_LOCATION): Eliminate the non-const
3570 variant, and tweak comment for the const variant.
3571 (ORDINARY_MAP_STARTING_LINE_NUMBER): Drop the non-const variant.
3572 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
3573 (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
3574 (SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete.
3575 (ORDINARY_MAP_FILE_NAME): Drop the non-const variant.
3576 (MACRO_MAP_MACRO): Likewise.
3577 (MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
3578 (MACRO_MAP_LOCATIONS): Likewise.
3579 (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
3580 * line-map.c (linemap_add): Replace writes through macros with
3581 direct field accesses.
3582 (linemap_enter_macro): Likewise.
3583 (linemap_line_start): Likewise.
3585 2015-05-19 David Malcolm <dmalcolm@redhat.com>
3587 * directives.c (do_line): Strengthen local "map" from
3588 const line_map * to const line_map_ordinary *.
3589 (do_linemarker): Likewise.
3590 (_cpp_do_file_change): Assert that we're not dealing with
3591 a macro map. Introduce local "ord_map" via a call to
3592 linemap_check_ordinary, guarded within the check for
3593 non-NULL. Use it for typesafety.
3594 * files.c (cpp_make_system_header): Strengthen local "map" from
3595 const line_map * to const line_map_ordinary *.
3596 * include/cpplib.h (struct cpp_callbacks): Likewise for second
3597 parameter of "file_change" callback.
3598 * include/line-map.h (struct line_map): Convert from a struct
3599 containing a union to a base class.
3600 (struct line_map_ordinary): Convert to a subclass of line_map.
3601 (struct line_map_macro): Likewise.
3602 (linemap_check_ordinary): Strengthen return type from line_map *
3603 to line_map_ordinary *, and add a const-variant.
3604 (linemap_check_macro): New pair of functions.
3605 (ORDINARY_MAP_STARTING_LINE_NUMBER): Strengthen param from
3606 const line_map * to const line_map_ordinary *, eliminating call
3607 to linemap_check_ordinary. Likewise for the non-const variant.
3608 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
3609 (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
3610 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Likewise.
3611 (ORDINARY_MAP_FILE_NAME): Likewise.
3612 (MACRO_MAP_MACRO): Strengthen param from const line_map * to
3613 const line_map_macro *. Likewise for the non-const variant.
3614 (MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
3615 (MACRO_MAP_LOCATIONS): Likewise.
3616 (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
3617 (struct maps_info): Replace with...
3618 (struct maps_info_ordinary):...this and...
3619 (struct maps_info_macro): ...this.
3620 (struct line_maps): Convert fields "info_ordinary" and
3621 "info_macro" to the above new structs.
3622 (LINEMAPS_MAP_INFO): Delete both functions.
3623 (LINEMAPS_MAPS): Likewise.
3624 (LINEMAPS_ALLOCATED): Rewrite both variants to avoid using
3626 (LINEMAPS_USED): Likewise.
3627 (LINEMAPS_CACHE): Likewise.
3628 (LINEMAPS_MAP_AT): Likewise.
3629 (LINEMAPS_ORDINARY_MAPS): Strengthen return type from line_map *
3630 to line_map_ordinary *.
3631 (LINEMAPS_ORDINARY_MAP_AT): Likewise.
3632 (LINEMAPS_LAST_ORDINARY_MAP): Likewise.
3633 (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise.
3634 (LINEMAPS_MACRO_MAPS): Strengthen return type from line_map * to
3636 (LINEMAPS_MACRO_MAP_AT): Likewise.
3637 (LINEMAPS_LAST_MACRO_MAP): Likewise.
3638 (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise.
3639 (linemap_map_get_macro_name): Strengthen param from
3640 const line_map * to const line_map_macro *.
3641 (SOURCE_LINE): Strengthen first param from const line_map * to
3642 const line_map_ordinary *, removing call to
3643 linemap_check_ordinary.
3644 (SOURCE_COLUMN): Likewise.
3645 (LAST_SOURCE_LINE_LOCATION): Likewise.
3646 (LAST_SOURCE_LINE): Strengthen first param from const line_map *
3647 to const line_map_ordinary *.
3648 (LAST_SOURCE_COLUMN): Likewise.
3649 (INCLUDED_FROM): Strengthen return type from line_map * to
3650 line_map_ordinary *., and second param from const line_map *
3651 to const line_map_ordinary *, removing call to
3652 linemap_check_ordinary.
3653 (MAIN_FILE_P): Strengthen param from const line_map * to
3654 const line_map_ordinary *, removing call to
3655 linemap_check_ordinary.
3656 (linemap_position_for_line_and_column): Strengthen param from
3657 const line_map * to const line_map_ordinary *.
3658 (LINEMAP_FILE): Strengthen param from const line_map * to
3659 const line_map_ordinary *, removing call to
3660 linemap_check_ordinary.
3661 (LINEMAP_LINE): Likewise.
3662 (LINEMAP_SYSP): Likewise.
3663 (linemap_resolve_location): Strengthen final param from
3664 const line_map ** to const line_map_ordinary **.
3665 * internal.h (CPP_INCREMENT_LINE): Likewise for local "map".
3666 (linemap_enter_macro): Strengthen return type from
3667 const line_map * to const line_map_macro *.
3668 (linemap_add_macro_token): Likewise for first param.
3669 * line-map.c (linemap_check_files_exited): Strengthen local "map"
3670 from const line_map * to const line_map_ordinary *.
3671 (new_linemap): Introduce local "map_size" and use it when
3672 calculating how large the buffer should be. Rewrite based
3673 on change of info_macro and info_ordinary into distinct types.
3674 (linemap_add): Strengthen locals "map" and "from" from line_map *
3675 to line_map_ordinary *.
3676 (linemap_enter_macro): Strengthen return type from
3677 const line_map * to const line_map_macro *, and local "map" from
3678 line_map * to line_map_macro *.
3679 (linemap_add_macro_token): Strengthen param "map" from
3680 const line_map * to const line_map_macro *.
3681 (linemap_line_start): Strengthen local "map" from line_map * to
3682 line_map_ordinary *.
3683 (linemap_position_for_column): Likewise.
3684 (linemap_position_for_line_and_column): Strengthen first param
3685 from const line_map * to const line_map_ordinary *.
3686 (linemap_position_for_loc_and_offset): Strengthen local "map" from
3687 const line_map * to const line_map_ordinary *.
3688 (linemap_ordinary_map_lookup): Likewise for return type and locals
3689 "cached" and "result".
3690 (linemap_macro_map_lookup): Strengthen return type and locals
3691 "cached" and "result" from const line_map * to
3692 const line_map_macro *.
3693 (linemap_macro_map_loc_to_exp_point): Likewise for param "map".
3694 (linemap_macro_map_loc_to_def_point): Likewise.
3695 (linemap_macro_map_loc_unwind_toward_spelling): Likewise.
3696 (linemap_get_expansion_line): Strengthen local "map" from
3697 const line_map * to const line_map_ordinary *.
3698 (linemap_get_expansion_filename): Likewise.
3699 (linemap_map_get_macro_name): Strengthen param from
3700 const line_map * to const line_map_macro *.
3701 (linemap_location_in_system_header_p): Add call to
3702 linemap_check_ordinary in region guarded by
3703 !linemap_macro_expansion_map_p. Introduce local "macro_map" via
3704 linemap_check_macro in other region, using it in place of "map"
3706 (first_map_in_common_1): Add calls to linemap_check_macro.
3707 (trace_include): Strengthen param "map" from const line_map * to
3708 const line_map_ordinary *.
3709 (linemap_macro_loc_to_spelling_point): Strengthen final param from
3710 const line_map ** to const line_map_ordinary **. Replace a
3711 C-style cast with a const_cast, and add calls to
3712 linemap_check_macro and linemap_check_ordinary.
3713 (linemap_macro_loc_to_def_point): Likewise.
3714 (linemap_macro_loc_to_exp_point): Likewise.
3715 (linemap_resolve_location): Strengthen final param from
3716 const line_map ** to const line_map_ordinary **.
3717 (linemap_unwind_toward_expansion): Introduce local "macro_map" via
3718 a checked cast and use it in place of *map.
3719 (linemap_unwind_to_first_non_reserved_loc): Strengthen local
3720 "map1" from const line_map * to const line_map_ordinary *.
3721 (linemap_expand_location): Introduce local "ord_map" via a checked
3722 cast and use it in place of map.
3723 (linemap_dump): Make local "map" const. Strengthen local
3724 "includer_map" from line_map * to const line_map_ordinary *.
3725 Introduce locals "ord_map" and "macro_map" via checked casts and
3726 use them in place of "map" for typesafety.
3727 (linemap_dump_location): Strengthen local "map" from
3728 const line_map * to const line_map_ordinary *.
3729 (linemap_get_file_highest_location): Update for elimination of
3731 (linemap_get_statistics): Strengthen local "cur_map" from
3732 line_map * to const line_map_macro *. Update uses of sizeof to
3733 use the appropriate line_map subclasses.
3734 * macro.c (_cpp_warn_if_unused_macro): Add call to
3735 linemap_check_ordinary.
3736 (builtin_macro): Strengthen local "map" from const line_map * to
3737 const line_map_macro *.
3738 (enter_macro_context): Likewise.
3739 (replace_args): Likewise.
3740 (tokens_buff_put_token_to): Likewise for param "map".
3741 (tokens_buff_add_token): Likewise.
3743 2015-05-13 David Malcolm <dmalcolm@redhat.com>
3745 * include/line-map.h (source_location): Add a reference to
3746 location-example.txt to the descriptive comment.
3747 * location-example.txt: New file.
3749 2015-05-13 David Malcolm <dmalcolm@redhat.com>
3751 * include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro
3752 to a const source_location.
3753 (RESERVED_LOCATION_COUNT): Likewise.
3754 (linemap_check_ordinary): Convert from a macro to a pair of inline
3755 functions, for const/non-const arguments.
3756 (MAP_START_LOCATION): Likewise.
3757 (ORDINARY_MAP_STARTING_LINE_NUMBER): Likewise.
3758 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
3759 (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
3760 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Convert from a macro to a
3761 pair of inline functions, for const/non-const arguments, where the
3763 (SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): New function.
3764 (ORDINARY_MAP_FILE_NAME): Convert from a macro to a pair of inline
3765 functions, for const/non-const arguments.
3766 (MACRO_MAP_MACRO): Likewise.
3767 (MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
3768 (MACRO_MAP_LOCATIONS): Likewise.
3769 (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
3770 (LINEMAPS_MAP_INFO): Likewise.
3771 (LINEMAPS_MAPS): Likewise.
3772 (LINEMAPS_ALLOCATED): Likewise.
3773 (LINEMAPS_USED): Likewise.
3774 (LINEMAPS_CACHE): Likewise.
3775 (LINEMAPS_ORDINARY_CACHE): Likewise.
3776 (LINEMAPS_MACRO_CACHE): Likewise.
3777 (LINEMAPS_MAP_AT): Convert from a macro to an inline function.
3778 (LINEMAPS_LAST_MAP): Likewise.
3779 (LINEMAPS_LAST_ALLOCATED_MAP): Likewise.
3780 (LINEMAPS_ORDINARY_MAPS): Likewise.
3781 (LINEMAPS_ORDINARY_MAP_AT): Likewise.
3782 (LINEMAPS_ORDINARY_ALLOCATED): Likewise.
3783 (LINEMAPS_ORDINARY_USED): Likewise.
3784 (LINEMAPS_LAST_ORDINARY_MAP): Likewise.
3785 (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise.
3786 (LINEMAPS_MACRO_MAPS): Likewise.
3787 (LINEMAPS_MACRO_MAP_AT): Likewise.
3788 (LINEMAPS_MACRO_ALLOCATED): Likewise.
3789 (LINEMAPS_MACRO_USED): Likewise.
3790 (LINEMAPS_MACRO_LOWEST_LOCATION): Likewise.
3791 (LINEMAPS_LAST_MACRO_MAP): Likewise.
3792 (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise.
3793 (IS_ADHOC_LOC): Likewise.
3794 (COMBINE_LOCATION_DATA): Likewise.
3795 (SOURCE_LINE): Likewise.
3796 (SOURCE_COLUMN): Likewise.
3797 (LAST_SOURCE_LINE_LOCATION): Likewise.
3798 (LAST_SOURCE_LINE): Likewise.
3799 (LAST_SOURCE_COLUMN): Likewise.
3800 (LAST_SOURCE_LINE_LOCATION)
3801 (INCLUDED_FROM): Likewise.
3802 (MAIN_FILE_P): Likewise.
3803 (LINEMAP_FILE): Likewise.
3804 (LINEMAP_LINE): Likewise.
3805 (LINEMAP_SYSP): Likewise.
3806 (linemap_location_before_p): Likewise.
3807 * line-map.c (linemap_check_files_exited): Make local "map" const.
3808 (linemap_add): Use SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS.
3809 (linemap_line_start): Likewise.
3811 2015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
3813 * aclocal.m4: Regenerated with automake-1.11.6.
3815 2015-05-13 David Malcolm <dmalcolm@redhat.com>
3817 * include/line-map.h (linemap_assert): Move up within the file to
3818 before all of the map accessor macros.
3819 (linemap_assert_fails): Likewise.
3820 (linemap_check_ordinary): Likewise.
3821 (linemap_macro_expansion_map_p): Likewise.
3823 2015-05-12 David Malcolm <dmalcolm@redhat.com>
3825 * directives.c (do_line): Set seen_line_directive on line_table.
3826 (do_linemarker): Likewise.
3827 * include/line-map.h (struct line_maps): Add new field
3828 "seen_line_directive".
3830 2015-05-08 Jason Merrill <jason@redhat.com>
3832 * include/cpplib.h: Add CPP_W_CXX11_COMPAT.
3833 (struct cpp_options): Add cpp_warn_cxx11_compat.
3834 * init.c (cpp_create_reader): Initialize it.
3835 * lex.c (lex_string): Add -Wc++11-compat warning.
3837 2015-05-05 David Malcolm <dmalcolm@redhat.com>
3839 * pch.c (cpp_valid_state): Fix indentation so that it reflects the
3842 2015-05-05 David Malcolm <dmalcolm@redhat.com>
3844 * include/line-map.h: Fix comment at the top of the file.
3845 (source_location): Rewrite and expand the comment for this
3846 typedef, adding an ascii-art table to clarify how source_location
3847 values are allocated.
3848 * line-map.c: Fix comment at the top of the file.
3850 2015-04-09 Richard Biener <rguenther@suse.de>
3853 * files.c (pch_open_file): Allow main and pre-included files
3854 when trying to open a PCH.
3856 2015-04-06 Jakub Jelinek <jakub@redhat.com>
3858 PR preprocessor/61977
3859 * lex.c (cpp_peek_token): If peektok is CPP_EOF, back it up
3860 with all tokens peeked by the current function.
3862 2015-04-02 Jakub Jelinek <jakub@redhat.com>
3864 PR preprocessor/61977
3865 * lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change.
3867 2015-03-23 Jakub Jelinek <jakub@redhat.com>
3869 PR preprocessor/65238
3870 * internal.h (_cpp_scan_out_logical_line): Add third argument.
3871 * directives.c (prepare_directive_trad): Pass false to it.
3872 * traditional.c (_cpp_read_logical_line_trad,
3873 _cpp_create_trad_definition): Likewise.
3874 (struct fun_macro): Add paramc field.
3875 (fun_like_macro): New function.
3876 (maybe_start_funlike): Handle NODE_BUILTIN macros. Initialize
3877 macro->paramc field.
3878 (save_argument): Use macro->paramc instead of
3879 macro->node->value.macro->paramc.
3880 (push_replacement_text): Formatting fix.
3881 (recursive_macro): Use fun_like_macro helper.
3882 (_cpp_scan_out_logical_line): Likewise. Add BUILTIN_MACRO_ARG
3883 argument. Initialize fmacro.paramc field. Handle builtin
3884 function-like macros.
3886 2015-03-16 Edward Smith-Rowland <3dw4rd@verizon.net>
3889 * lex.c (lex_number): If a number ends with digit-seps (') skip back
3890 and let lex_string take them.
3892 2015-03-02 Markus Trippelsdorf <markus@trippelsdorf.de>
3895 * lex.c (search_line_fast): Silence ubsan errors.
3897 2015-02-03 <dodji@redhat.com>
3899 PR preprocessor/64803
3900 * internal.h (cpp_reader::top_most_macro_node): New data member.
3901 * macro.c (enter_macro_context): Pass the location of the end of
3902 the top-most invocation of the function-like macro, or the
3903 location of the expansion point of the top-most object-like macro.
3904 (cpp_get_token_1): Store the top-most macro node in the new
3905 pfile->top_most_macro_node data member.
3906 (_cpp_pop_context): Clear the new cpp_reader::top_most_macro_node
3909 2015-01-30 Szabolcs Nagy <szabolcs.nagy@arm.com>
3911 * lex.c (search_line_fast): Change __ARM_NEON__ to __ARM_NEON.
3913 2015-01-23 Marek Polacek <polacek@redhat.com>
3916 PR preprocessor/60570
3917 * directives.c (do_elif): Don't evaluate #elif conditionals
3918 when they don't need to be.
3920 2015-01-16 Jakub Jelinek <jakub@redhat.com>
3922 * expr.c (cpp_classify_number): Add N_() around ?: string
3923 literals used in cpp_error_with_line call as format string.
3925 2015-01-05 Jakub Jelinek <jakub@redhat.com>
3927 Update copyright years.
3929 2014-12-19 Jakub Jelinek <jakub@redhat.com>
3931 PR preprocessor/63831
3932 * directives.c (lex_macro_node): Remove __has_attribute__ handling.
3933 * internal.h (struct spec_node): Remove n__has_attribute__ field.
3934 (struct lexer_state): Remove in__has_attribute__ field.
3935 * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_ATTRIBUTE.
3936 * identifiers.c (_cpp_init_hashtable): Remove __has_attribute__
3938 * init.c (builtin_array): Add __has_attribute and __has_cpp_attribute.
3939 (cpp_init_special_builtins): Don't initialize __has_attribute
3940 or __has_cpp_attribute if CLK_ASM or pfile->cb.has_attribute is NULL.
3941 * traditional.c (enum ls): Remove ls_has_attribute,
3942 ls_has_attribute_close.
3943 (_cpp_scan_out_logical_line): Remove __has_attribute__ handling.
3944 * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_ATTRIBUTE.
3945 * pch.c (cpp_read_state): Remove __has_attribute__ handling.
3946 * expr.c (eval_token): Likewise.
3947 (parse_has_attribute): Removed.
3949 2014-12-11 Uros Bizjak <ubizjak@gmail.com>
3951 * directives.c (cpp_define_formatted): Use xvasprintf.
3953 2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
3955 * line-map.c (linemap_position_for_loc_and_offset): Add new
3956 linemap_assert_fails.
3958 2014-12-02 Manuel López-Ibáñez <manu@gcc.gnu.org>
3960 * include/line-map.h (linemap_assert_fails): Declare.
3961 * line-map.c (linemap_position_for_loc_and_offset): Use it.
3963 2014-12-02 Manuel López-Ibáñez <manu@gcc.gnu.org>
3965 * line-map.c (linemap_add): Fix typo.
3966 (linemap_line_start): Fix whitespace.
3968 2014-11-29 John Schmerge <jbschmerge@gmail.com>
3970 PR preprocessor/41698
3971 * charset.c (one_utf8_to_utf16): Do not produce surrogate pairs
3974 2014-11-25 Jakub Jelinek <jakub@redhat.com>
3976 PR preprocessor/60436
3977 * line-map.c (linemap_line_start): If highest is above 0x60000000
3978 and we are still tracking columns or highest is above 0x70000000,
3981 2014-11-20 Uros Bizjak <ubizjak@gmail.com>
3984 * lex.c [__i386__ || __x86_64__]: Compile special SSE functions
3985 only for (__GNUC__ >= 5 || !defined(__PIC__)).
3987 2014-11-13 Manuel López-Ibáñez <manu@gcc.gnu.org>
3989 * include/line-map.h: Include EXPR, so that unused variable warnings
3992 2014-11-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
3995 * include/line-map.h (linemap_position_for_loc_and_offset):
3997 * line-map.c (linemap_position_for_loc_and_offset): New.
3999 2014-11-11 David Malcolm <dmalcolm@redhat.com>
4001 * ChangeLog.jit: New.
4003 2014-11-10 Edward Smith-Rowland <3dw4rd@verizon.net>
4005 * include/cpplib.h (cpp_callbacks): Add has_attribute.
4006 * internal.h (lexer_state): Add in__has_attribute__.
4007 * directives.c (lex_macro_node): Prevent use of __has_attribute__
4009 * expr.c (parse_has_attribute): New function; (eval_token): Look for
4010 __has_attribute__ and route to parse_has_attribute.
4011 * identifiers.c (_cpp_init_hashtable): Initialize n__has_attribute__.
4012 * pch.c (cpp_read_state): Initialize n__has_attribute__.
4013 * traditional.c (enum ls): Add ls_has_attribute, ls_has_attribute_close;
4014 (_cpp_scan_out_logical_line): Attend to __has_attribute__.
4016 2014-11-06 Joseph Myers <joseph@codesourcery.com>
4018 * include/cpp-id-data.h (struct cpp_macro): Update comment
4019 regarding parameters.
4020 * include/cpplib.h (struct cpp_macro_arg, struct cpp_identifier):
4021 Add spelling fields.
4022 (struct cpp_token): Update comment on macro_arg.
4023 * internal.h (_cpp_save_parameter): Add extra argument.
4024 (_cpp_spell_ident_ucns): New declaration.
4025 * lex.c (lex_identifier): Add SPELLING argument. Set *SPELLING to
4026 original spelling of identifier.
4027 (_cpp_lex_direct): Update calls to lex_identifier.
4028 (_cpp_spell_ident_ucns): New function, factored out of
4030 (cpp_spell_token): Adjust FORSTRING argument semantics to return
4031 original spelling of identifiers. Use _cpp_spell_ident_ucns in
4033 (_cpp_equiv_tokens): Check spellings of identifiers and macro
4034 arguments are identical.
4035 * macro.c (macro_arg_saved_data): New structure.
4036 (paste_tokens): Use original spellings of identifiers from
4038 (_cpp_save_parameter): Add argument SPELLING. Save both canonical
4040 (parse_params): Update calls to _cpp_save_parameter.
4041 (lex_expansion_token): Save spelling of macro argument tokens.
4042 (_cpp_create_definition): Extract canonical node from saved data.
4043 (cpp_macro_definition): Use UCNs in spelling of macro name. Use
4044 original spellings of macro argument tokens and identifiers.
4045 * traditional.c (scan_parameters): Update call to
4046 _cpp_save_parameter.
4048 2014-11-05 Joseph Myers <joseph@codesourcery.com>
4050 PR preprocessor/9449
4051 * init.c (lang_defaults): Enable extended identifiers for C++ and
4052 C99-based standards.
4054 2014-10-22 Alan Modra <amodra@gmail.com>
4056 * symtab.c (ht_create): Use obstack_specify_allocation in place of
4058 * files.c (_cpp_init_files): Likewise.
4059 * init.c (cpp_create_reader): Likewise.
4060 * identifiers.c (_cpp_init_hashtable): Likewise.
4062 2014-10-14 Manuel López-Ibáñez <manu@gcc.gnu.org>
4064 * include/line-map.h (linemap_location_from_macro_expansion_p):
4065 const struct line_maps * argument.
4066 (linemap_position_for_line_and_column): const struct line_map *
4068 * line-map.c (linemap_add_macro_token): Use correct argument name
4070 (linemap_position_for_line_and_column): const struct line_map *
4072 (linemap_macro_map_loc_to_def_point): Fix comment. Make static.
4073 (linemap_location_from_macro_expansion_p): const struct line_maps *
4075 (linemap_resolve_location): Fix argument names in comment.
4077 2014-10-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
4079 * lex.c (search_line_fast): Add new version to be used for Power8
4080 and later targets when Altivec is enabled. Restrict the existing
4081 Altivec version to big-endian systems so that lvsr is not used on
4082 little endian, where it is deprecated. Remove LE-specific code
4083 from the now-BE-only version.
4085 2014-10-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
4086 Jeff Law <law@redhat.com>
4088 * charset.c (convert_no_conversion): Reallocate memory with 25%
4091 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net>
4093 Implement SD-6: SG10 Feature Test Recommendations
4094 * internal.h (lexer_state, spec_nodes): Add in__has_include__.
4095 * directives.c: Support __has_include__ builtin.
4096 * expr.c (parse_has_include): New function to parse __has_include__
4097 builtin; (eval_token()): Use it.
4098 * files.c (_cpp_has_header()): New funtion to look for header;
4099 (open_file_failed()): Not an error to not find a header file for
4101 * identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
4102 * pch.c (cpp_read_state): Lookup __has_include__.
4103 * traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
4104 __has_include__ statements.
4106 2014-09-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
4108 PR preprocessor/58893
4109 * errors.c (cpp_diagnostic): Fix possible out of bounds access.
4110 * files.c (_cpp_stack_include): Initialize src_loc for IT_CMDLINE.
4112 2014-09-24 Marek Polacek <polacek@redhat.com>
4116 * include/cpplib.h (enum cpp_ttype): Define CPP_KEYWORD.
4118 2014-09-17 Jan Hubicka <hubicka@ucw.cz>
4120 * charset.c (conversion): Rename to ...
4121 (cpp_conversion): ... this one; update.
4122 * files.c (file_hash_entry): Rename to ...
4123 (cpp_file_hash_entry): ... this one ; update.
4125 2014-09-17 Marek Polacek <polacek@redhat.com>
4128 * init.c (struct lang_flags): Remove cplusplus_comments.
4129 (cpp_set_lang): Likewise.
4130 (post_options): Likewise.
4131 * lex.c (_cpp_lex_direct): Disallow C++ style comments in C90/C94.
4133 2014-09-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
4135 * include/cpplib.h (struct cpp_options): Declare warn_normalize as
4136 int instead of enum.
4138 2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
4140 * macro.c (replace_args): Use cpp_pedwarning, cpp_warning and
4142 * include/cpplib.h: Add CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.
4143 * init.c (cpp_create_reader): Do not init to -1 here.
4144 * expr.c (num_binary_op): Use cpp_pedwarning.
4146 2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
4148 * directives.c (check_eol_1): New.
4149 (check_eol_endif_labels): New.
4150 (check_eol): Call check_eol_1.
4151 (do_else,do_endif): Call check_eol_endif_labels.
4153 2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
4155 * macro.c (warn_of_redefinition): Suppress warnings for builtins
4156 that lack the NODE_WARN flag, unless Wbuiltin-macro-redefined.
4157 (_cpp_create_definition): Use Wbuiltin-macro-redefined for
4158 builtins that lack the NODE_WARN flag.
4159 * directives.c (do_undef): Likewise.
4160 * init.c (cpp_init_special_builtins): Do not change flags
4161 depending on Wbuiltin-macro-redefined.
4163 2014-08-28 Edward Smith-Rowland <3dw4rd@verizon.net>
4165 PR cpp/23827 - standard C++ should not have hex float preprocessor
4167 * libcpp/init.c (lang_flags): Change CXX98 flag for extended numbers
4169 * libcpp/expr.c (cpp_classify_number): Weite error message for improper
4170 use of hex floating literal.
4172 2014-08-23 Edward Smith-Rowland <3dw4rd@verizon.net>
4174 * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z;
4175 Rename CLK_GNUCXX1Y, CLK_CXX1Y to CLK_GNUCXX14, CLK_CXX14;
4176 * init.c (struct lang_flags lang_defaults): Add column for trigraphs;
4177 Add rows for CLK_GNUCXX1Z, CLK_CXX1Z; (cpp_set_lang): Set trigraphs;
4178 (cpp_init_builtins): Set __cplusplus to 201402L for C++14;
4179 Set __cplusplus to 201500L for C++17.
4180 * expr.c (cpp_classify_number): Change C++1y to C++14 in binary
4181 constants error message.
4183 2014-08-20 Marek Polacek <polacek@redhat.com>
4185 * include/cpplib.h (cpp_options): Use signed char.
4186 * lex.c (_cpp_lex_direct): Don't warn in C++ mode.
4188 2014-08-19 Marek Polacek <polacek@redhat.com>
4190 * lex.c (_cpp_lex_direct): Fix a typo.
4192 2014-08-19 Marek Polacek <polacek@redhat.com>
4194 * charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat.
4195 * lex.c (_cpp_lex_direct): Likewise.
4196 * macro.c (replace_args): Likewise.
4197 (parse_params): Likewise.
4198 * include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat
4201 2014-08-10 Marek Polacek <polacek@redhat.com>
4204 * lex.c (_cpp_lex_direct): Warn when -Wc90-c99-compat is in effect.
4205 * charset.c (_cpp_valid_ucn): Likewise.
4206 * include/cpplib.h (cpp_options): Add cpp_warn_c90_c99_compat.
4207 * macro.c (replace_args): Warn when -Wc90-c99-compat is in effect.
4208 (parse_params): Likewise.
4210 2014-07-27 Marek Polacek <polacek@redhat.com>
4213 * macro.c (builtin_macro): Add location parameter. Set
4214 location of builtin macro to the expansion point.
4215 (enter_macro_context): Pass location to builtin_macro.
4217 2014-07-16 Dodji Seketeli <dodji@redhat.com>
4219 Support location tracking for built-in macro tokens
4220 * include/line-map.h (line_maps::builtin_location): New data
4222 (line_map_init): Add a new parameter to initialize the new
4223 line_maps::builtin_location data member.
4224 * line-map.c (linemap_init): Initialize the
4225 line_maps::builtin_location data member.
4226 * macro.c (builtin_macro): Create a macro map and track the token
4227 resulting from the expansion of a built-in macro.
4229 2014-07-10 Edward Smith-Rowland <3dw4rd@verizon.net>
4230 Jonathan Wakely <jwakely@redhat.com>
4232 PR preprocessor/61389
4233 * macro.c (_cpp_arguments_ok, parse_params, create_iso_definition):
4234 Warning messages mention C++11 in c++ mode and C99 in c mode.
4235 * lex.c (lex_identifier_intern, lex_identifier): Ditto
4237 2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net>
4239 PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped
4241 * lex.c (lex_raw_string ()): Do not warn about invalid suffix
4242 if skipping. (lex_string ()): Ditto.
4244 2014-06-04 Edward Smith-Rowland <3dw4rd@verizon.net>
4247 * macro.c (stringify_arg (cpp_reader *, macro_arg *)):
4248 Combine user-defined escape logic with the other string and char logic.
4250 2014-05-26 Richard Biener <rguenther@suse.de>
4252 * configure.ac: Remove long long and __int64 type checks,
4253 add check for uint64_t and fail if that wasn't found.
4254 * include/cpplib.h (cpp_num_part): Use uint64_t.
4255 * config.in: Regenerate.
4256 * configure: Likewise.
4258 2014-05-21 Marek Polacek <polacek@redhat.com>
4261 * files.c (find_file_in_dir): Add parens around &&.
4263 2014-05-20 Edward Smith-Rowland <3dw4rd@verizon.net>
4266 * macro.c (stringify_arg (cpp_reader *, macro_arg *)):
4267 Check for user-defined literal strings and user-defined literal chars
4268 to escape necessary characters.
4270 2014-05-20 Richard Biener <rguenther@suse.de>
4272 * configure.ac: Copy gcc logic of detecting a 64bit type.
4273 Remove HOST_WIDE_INT define.
4274 * include/cpplib.h: typedef cpp_num_part to a 64bit type,
4275 similar to how hwint.h does it.
4276 * config.in: Regenerate.
4277 * configure: Likewise.
4279 2014-05-09 Joey Ye <joey.ye@arm.com>
4281 * files.c (find_file_in_dir): Always try to shorten for DOS
4283 * init.c (ENABLE_CANONICAL_SYSTEM_HEADERS): Default enabled for DOS.
4285 2014-05-07 Richard Biener <rguenther@suse.de>
4287 * configure.ac: Always set need_64bit_hwint to yes.
4288 * configure: Regenerated.
4290 2014-04-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4292 * lex.c: Remove Solaris 9 reference.
4294 2014-02-24 Walter Lee <walt@tilera.com>
4296 * configure.ac: Change "tilepro" triplet to "tilepro*".
4297 * configure: Regenerate.
4299 2014-02-19 Jakub Jelinek <jakub@redhat.com>
4301 PR preprocessor/58844
4302 * macro.c (enter_macro_context): Only push
4303 macro_real_token_count (macro) tokens rather than
4304 macro->count tokens, regardless of
4305 CPP_OPTION (pfile, track-macro-expansion).
4307 2014-02-07 Jakub Jelinek <jakub@redhat.com>
4309 PR preprocessor/56824
4310 * line-map.c (get_combined_adhoc_loc, linemap_get_expansion_line,
4311 linemap_get_expansion_filename, linemap_location_in_system_header_p,
4312 linemap_location_from_macro_expansion_p,
4313 linemap_macro_loc_to_spelling_point, linemap_macro_loc_to_def_point,
4314 linemap_macro_loc_to_exp_point, linemap_expand_location): Fix
4316 (linemap_compare_locations): Look through adhoc locations for both
4319 2014-01-23 Dodji Seketeli <dodji@redhat.com>
4321 PR PR preprocessor/58580
4322 * include/line-map.h (linemap_get_file_highest_location): Declare
4324 * line-map.c (linemap_get_file_highest_location): Define it.
4326 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
4328 Update copyright years
4330 2013-12-09 Joseph Myers <joseph@codesourcery.com>
4332 PR preprocessor/55715
4333 * expr.c (num_binary_op): Implement subtraction directly rather
4334 than with negation and falling through into addition case.
4336 2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
4338 * lex.c (search_line_fast): Correct for little endian.
4340 2013-11-15 Joseph Myers <joseph@codesourcery.com>
4342 * ucnid.tab: Add C11 and C11NOSTART data.
4343 * makeucnid.c (digit): Rename enum value to N99.
4344 (C11, N11, all_languages): New enum values.
4345 (NUM_CODE_POINTS, MAX_CODE_POINT): New macros.
4346 (flags, decomp, combining_value): Use NUM_CODE_POINTS as array
4348 (decomp): Use unsigned int as element type.
4349 (all_decomp): New array.
4350 (read_ucnid): Handle C11 and C11NOSTART. Use MAX_CODE_POINT.
4351 (read_table): Use MAX_CODE_POINT. Store all decompositions in
4353 (read_derived): Use MAX_CODE_POINT.
4354 (write_table): Use NUM_CODE_POINTS. Print N99, C11 and N11
4355 flags. Print whole array variable declaration rather than just
4357 (char_id_valid, write_context_switch): New functions.
4358 (main): Call write_context_switch.
4359 * ucnid.h: Regenerate.
4360 * include/cpplib.h (struct cpp_options): Add c11_identifiers.
4361 * init.c (struct lang_flags): Add c11_identifiers.
4362 (cpp_set_lang): Set c11_identifiers option from selected language.
4363 * internal.h (struct normalize_state): Document "previous" as
4364 previous starter character.
4365 (NORMALIZE_STATE_UPDATE_IDNUM): Take character as argument.
4366 * charset.c (DIG): Rename enum value to N99.
4367 (C11, N11): New enum values.
4368 (struct ucnrange): Give name to struct. Use short for flags and
4369 unsigned int for end of range. Include ucnid.h for whole variable
4371 (ucn_valid_in_identifier): Allow for characters up to 0x10FFFF.
4372 Allow for C11 in determining valid characters and valid start
4373 characters. Use check_nfc for non-Hangul context-dependent
4374 checks. Only store starter characters in nst->previous.
4375 (_cpp_valid_ucn): Pass new argument to
4376 NORMALIZE_STATE_UPDATE_IDNUM.
4377 * lex.c (lex_identifier): Pass new argument to
4378 NORMALIZE_STATE_UPDATE_IDNUM. Call NORMALIZE_STATE_UPDATE_IDNUM
4379 after initial non-UCN part of identifier.
4380 (lex_number): Pass new argument to NORMALIZE_STATE_UPDATE_IDNUM.
4382 2013-11-15 Joseph Myers <joseph@codesourcery.com>
4384 * ucnid.tab: Mark C99 digits as [C99DIG].
4385 * makeucnid.c (read_ucnid): Handle [C99DIG].
4386 (read_table): Don't check for digit characters.
4387 * ucnid.h: Regenerate.
4389 2013-11-06 Tobias Burnus <burnus@net-b.de>
4391 * macro.c (_cpp_builtin_macro_text): Correct
4392 wording of two warnings.
4394 2013-11-05 Tobias Burnus <burnus@net-b.de>
4396 * include/cpplib.h (CPP_W_DATE_TIME): Added.
4397 (cpp_options): Add warn_date_time.
4398 * init.c (cpp_create_reader): Init it.
4399 * macro.c (_cpp_builtin_macro_text): Warn when
4400 __DATE__/__TIME__/__TIMESTAMP__ is used.
4402 2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net>
4404 Implement C++14 digit separators.
4405 * include/cpplib.h (cpp_options): Add digit_separators flag.
4406 * internal.h (DIGIT_SEP(c)): New macro.
4407 * expr.c (cpp_classify_number): Check improper placement of digit sep;
4408 (cpp_interpret_integer): Skip over digit separators.
4409 * init.c (lang_flags): Add digit_separators flag; (lang_defaults): Add
4410 digit separator flags per language; (cpp_set_lang): Set
4412 * lex.c (lex_number): Add digits separator to allowable characters for
4415 2013-10-15 David Malcolm <dmalcolm@redhat.com>
4417 * Makefile.in (PICFLAG): New.
4418 (ALL_CFLAGS): Add PICFLAG.
4419 (ALL_CXXFLAGS): Likewise.
4420 * configure.ac: Add --enable-host-shared, setting up new
4422 * configure: Regenerate.
4424 2013-08-07 Richard Earnshaw <rearnsha@arm.com>
4426 * configure.ac: Set need_64bit_hwint for all arm targets.
4427 * configure: Regenerated.
4429 2013-07-20 Jakub Jelinek <jakub@redhat.com>
4431 PR preprocessor/57620
4432 * lex.c (lex_raw_string): Undo phase1 and phase2 transformations
4433 between R" and final " rather than only in between R"del( and )del".
4435 2013-07-10 Jakub Jelinek <jakub@redhat.com>
4437 PR preprocessor/57824
4438 * lex.c (lex_raw_string): Allow reading new-lines if
4439 in_deferred_pragma or if parsing_args and there is still
4440 data in the current buffer.
4442 * include/cpplib.h (cpp_token_val_index): Change parameter type to
4444 * lex.c (cpp_token_val_index): Likewise.
4446 PR preprocessor/57757
4447 * lex.c (cpp_avoid_paste): Avoid pasting CPP_{,W,UTF8}STRING
4448 or CPP_STRING{16,32} with CPP_NAME or SPELL_LITERAL token that
4451 2013-06-28 Ed Smith-Rowland <3dw4rd@verizon.net>
4453 * lex.c (lex_raw_string(), lex_string()): Constrain suffixes treated
4454 as concatenated literal and macro to just the patterns found in
4455 inttypes.h; (is_macro()): New.
4457 2013-06-24 Dehao Chen <dehao@google.com>
4459 * files.c (_cpp_stack_include): Fix the highest_location when header
4460 file is guarded by #ifndef and is included twice.
4462 2013-04-28 Jakub Jelinek <jakub@redhat.com>
4464 N3472 binary constants
4465 * include/cpplib.h (struct cpp_options): Fix a typo in user_literals
4466 field comment. Add binary_constants field.
4467 * init.c (struct lang_flags): Add binary_constants field.
4468 (lang_defaults): Add bin_cst column to the table.
4469 (cpp_set_lang): Initialize CPP_OPTION (pfile, binary_constants).
4470 * expr.c (cpp_classify_number): Talk about C++11 instead of C++0x
4471 in diagnostics. Accept binary constants if
4472 CPP_OPTION (pfile, binary_constants) even when pedantic. Adjust
4475 2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
4477 * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
4478 * init.c (lang_defaults): Add defaults for the latter.
4479 (cpp_init_builtins): Define __cplusplus as 201300L for the latter.
4480 * lex.c (_cpp_lex_direct): Update.
4482 2013-04-03 Sebastian Huber <sebastian.huber@embedded-brains.de>
4485 * configure.ac: Require 64-bit int for arm*-*-rtems*.
4486 * configure: Regenerate.
4488 2013-03-06 Jakub Jelinek <jakub@redhat.com>
4491 * internal.h (struct cpp_buffer): Add to_free field.
4492 (_cpp_pop_file_buffer): Add third argument.
4493 * files.c (_cpp_stack_file): Set buffer->to_free.
4494 (_cpp_pop_file_buffer): Add to_free argument. Free to_free
4495 if non-NULL, and if equal to file->buffer_start, also clear
4496 file->buffer{,_start,_valid}.
4497 * directives.c (_cpp_pop_buffer): Pass buffer->to_free
4498 to _cpp_pop_file_buffer.
4500 2013-03-01 Jakub Jelinek <jakub@redhat.com>
4503 * files.c (_cpp_save_file_entries): Free result at the end.
4504 * pch.c (cpp_string_free): New function.
4505 (cpp_save_state): Use it in htab_create call.
4506 (cpp_write_pch_deps): Free ss->defs. Destroy ss->definedhash.
4508 2013-02-28 Jakub Jelinek <jakub@redhat.com>
4510 * files.c (_cpp_find_file): If returning early, before storing
4511 something to *hash_slot and *hash_slot is NULL, call htab_clear_slot
4512 on it. Access *hash_slot using void * type rather than
4513 struct file_hash_entry * to avoid aliasing issues.
4515 * configure.ac: Don't define ENABLE_CHECKING whenever
4516 --enable-checking is seen, instead use similar --enable-checking=yes
4517 vs. --enable-checking=release default as gcc/ subdir has and
4518 define ENABLE_CHECKING if ENABLE_CHECKING is defined in gcc/.
4519 Define ENABLE_VALGRIND_CHECKING if requested.
4520 * lex.c (new_buff): If ENABLE_VALGRIND_CHECKING, put _cpp_buff
4521 struct first in the allocated buffer and result->base after it.
4522 (_cpp_free_buff): If ENABLE_VALGRIND_CHECKING, free buff itself
4523 instead of buff->base.
4524 * config.in: Regenerated.
4525 * configure: Regenerated.
4527 2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net>
4530 * lex.c (lex_raw_string): Allow string literal with suffix
4531 beginning with 's' to be parsed as a C++11 user-defined literal.
4533 2013-01-14 Richard Sandiford <rdsandiford@googlemail.com>
4535 Update copyright years.
4537 2013-01-04 Paolo Carlini <paolo.carlini@oracle.com>
4539 PR c++/54526 (again)
4540 * lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.
4542 2013-01-03 Marc Glisse <marc.glisse@inria.fr>
4545 * line-map.c (get_combined_adhoc_loc): Cast from extern "C" type.
4546 (new_linemap): Likewise.
4547 (linemap_enter_macro): Likewise.
4549 2012-12-03 Jakub Jelinek <jakub@redhat.com>
4553 * files.c (read_file_guts): Allocate extra 16 bytes instead of
4554 1 byte at the end of buf. Pass size + 16 instead of size
4555 to _cpp_convert_input.
4556 * charset.c (_cpp_convert_input): Reallocate if there aren't
4557 at least 16 bytes beyond to.len in the buffer. Clear 16 bytes
4558 at to.text + to.len.
4560 2012-11-21 Steve Ellcey <sellcey@mips.com>
4563 * files.c (pch_open_file): Fix check for implicit_preinclude.
4565 2012-11-16 Simon Baldwin <simonb@google.com>
4567 * include/cpplib.h (struct cpp_options): Add canonical_system_headers.
4568 * files.c (find_file_in_dir): Call maybe_shorter_path() only if
4569 canonical_system_headers is set.
4570 * init.c (cpp_create_reader): Initialize canonical_system_headers.
4571 * configure.ac: Add new --enable-canonical-system-headers.
4572 * configure: Regenerate.
4573 * config.in: Regenerate.
4575 2012-11-09 Ed Smith-Rowland <3dw4rd@verizon.net>
4578 * include/cpplib.h (cpp_interpret_float_suffix): Add cpp_reader* arg.
4579 (cpp_interpret_int_suffix): Add cpp_reader* arg.
4580 * init.c (cpp_create_reader): Iitialize new flags.
4581 * expr.c (interpret_float_suffix): Use new flags.
4582 (cpp_interpret_float_suffix): Add cpp_reader* arg.
4583 (interpret_int_suffix): Use new flags.
4584 (cpp_interpret_int_suffix): Add cpp_reader* arg.
4585 (cpp_classify_number): Adjust calls to interpret_x_suffix.
4587 2012-10-23 Ian Bolton <ian.bolton@arm.com>
4588 Jim MacArthur <jim.macarthur@arm.com>
4589 Marcus Shawcroft <marcus.shawcroft@arm.com>
4590 Nigel Stephens <nigel.stephens@arm.com>
4591 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
4592 Richard Earnshaw <rearnsha@arm.com>
4593 Sofiane Naci <sofiane.naci@arm.com>
4594 Stephen Thomas <stephen.thomas@arm.com>
4595 Tejas Belagod <tejas.belagod@arm.com>
4596 Yufeng Zhang <yufeng.zhang@arm.com>
4598 * configure.ac: Enable AArch64.
4599 * configure: Regenerate.
4601 2012-10-23 Joseph Myers <joseph@codesourcery.com>
4603 * files.c (struct _cpp_file): Add implicit_preinclude.
4604 (pch_open_file): Allow a previously opened implicitly included
4606 (_cpp_find_file): Add implicit_preinclude argument. Free file and
4607 do not call open_file_failed if implicit_preinclude. Store
4608 implicit_preinclude value.
4609 (_cpp_stack_include, _cpp_fake_include, _cpp_compare_file_date):
4610 Update calls to _cpp_find_file.
4611 (_cpp_stack_include): Handle IT_DEFAULT.
4612 (cpp_push_default_include): New.
4613 * include/cpplib.h (cpp_push_default_include): Declare.
4614 * init.c (cpp_read_main_file): Update call to _cpp_find_file.
4615 * internal.h (enum include_type): Add IT_DEFAULT.
4616 (_cpp_find_file): Update prototype.
4618 2012-10-15 Tobias Burnus <burnus@net-b.de>
4620 * files.c (read_file_guts, _cpp_save_file_entries): Free memory
4622 * lex.c (warn_about_normalization): Ditto.
4623 * mkdeps.c (deps_save): Ditto.
4624 * pch.c (cpp_valid_state): Ditto.
4626 2012-10-04 Florian Weimer <fweimer@redhat.com>
4628 * directives.c (do_pragma_warning_or_error): New.
4629 (do_pragma_warning): New.
4630 (do_pragma_error): New.
4631 (_cpp_init_internal_pragmas): Register new pragmas.
4633 2012-09-25 Dehao Chen <dehao@google.com>
4636 * line-map.c (location_adhoc_data_hash): Fix the hash function.
4638 2012-09-25 Dehao Chen <dehao@google.com>
4641 * include/line-map.h (location_adhoc_data): Move location_adhoc_data
4643 (location_adhoc_data_map): Likewise.
4644 (line_maps): Likewise.
4645 (rebuild_location_adhoc_htab): New Function.
4646 * line-map.c (+rebuild_location_adhoc_htab): new Funcion.
4647 (get_combined_adhoc_loc): Move location_adhoc_data into GC.
4648 (location_adhoc_data_fini): Likewise.
4649 (linemap_init): Likewise.
4650 (location_adhoc_data_init): Remove Function.
4652 2012-09-19 Dehao Chen <dehao@google.com>
4654 * include/line-map.h (MAX_SOURCE_LOCATION): New value.
4655 (location_adhoc_data_fini): New.
4656 (get_combined_adhoc_loc): New.
4657 (get_data_from_adhoc_loc): New.
4658 (get_location_from_adhoc_loc): New.
4659 (location_adhoc_data_map): New.
4660 (COMBINE_LOCATION_DATA): New.
4661 (IS_ADHOC_LOC): New.
4662 (expanded_location): New field.
4663 (line_maps): New field.
4664 * line-map.c (location_adhoc_data): New.
4665 (location_adhoc_data_hash): New.
4666 (location_adhoc_data_eq): New.
4667 (location_adhoc_data_update): New.
4668 (get_combined_adhoc_loc): New.
4669 (get_data_from_adhoc_loc): New.
4670 (get_location_from_adhoc_loc): New.
4671 (location_adhoc_data_init): New.
4672 (location_adhoc_data_fini): New.
4673 (linemap_init): Initialize location_adhoc_data.
4674 (linemap_lookup): Change to use new location.
4675 (linemap_ordinary_map_lookup): Likewise.
4676 (linemap_macro_map_lookup): Likewise.
4677 (linemap_macro_map_loc_to_def_point): Likewise.
4678 (linemap_macro_map_loc_unwind_toward_spel): Likewise.
4679 (linemap_get_expansion_line): Likewise.
4680 (linemap_get_expansion_filename): Likewise.
4681 (linemap_location_in_system_header_p): Likewise.
4682 (linemap_location_from_macro_expansion_p): Likewise.
4683 (linemap_macro_loc_to_spelling_point): Likewise.
4684 (linemap_macro_loc_to_def_point): Likewise.
4685 (linemap_macro_loc_to_exp_point): Likewise.
4686 (linemap_resolve_location): Likewise.
4687 (linemap_unwind_toward_expansion): Likewise.
4688 (linemap_unwind_to_first_non_reserved_loc): Likewise.
4689 (linemap_expand_location): Likewise.
4690 (linemap_dump_location): Likewise.
4691 (linemap_line_start): Likewise.
4693 2012-05-25 Dodji Seketeli <dodji@redhat.com>
4695 PR preprocessor/53469
4696 * directives.c (do_pragma): Use the virtual location for the
4697 pragma token, instead of its spelling location.
4699 2012-08-14 Diego Novillo <dnovillo@google.com>
4701 Merge from cxx-conversion branch. Configury.
4703 * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX.
4704 * configure.ac: Likewise.
4705 * configure: Regenerate.
4707 2012-08-14 Lawrence Crowl <crowl@google.com>
4709 Merge from cxx-conversion branch. New C++ hash table.
4711 * include/symtab.h (typedef struct ht hash_table): Change the typedef
4712 name to cpp_hash_table. Update all users of the typedef.
4714 2012-07-30 Laurynas Biveinis <laurynas.biveinis@gmail.com>
4716 * include/line-map.h (line_map_macro): Use the "atomic" GTY option
4717 for the macro_locations field.
4719 2011-06-19 Uros Bizjak <ubizjak@gmail.com>
4721 * lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and
4722 __builtin_ia32_pcmpestri128 instead of asm.
4724 2012-06-04 Dimitrios Apostolou <jimis@gmx.net>
4726 * line-map.c (linemap_enter_macro): Don't zero max_column_hint in
4727 every macro. This improves performance by reducing the number of
4728 reallocations when track-macro-expansion is on.
4730 2012-06-04 Dodji Seketeli <dodji@redhat.com>
4732 PR preprocessor/53463
4733 * line-map.c (linemap_location_in_system_header_p): For built-in
4734 macro tokens, check the first expansion point location that is not
4735 for a token coming from a built-in macro.
4737 2012-05-29 Joseph Myers <joseph@codesourcery.com>
4739 * directives.c: Fix typos.
4740 * include/line-map.h: Fix typos.
4741 * line-map.c: Fix typos.
4742 * macro.c: Fix typos.
4744 2012-05-25 Dodji Seketeli <dodji@redhat.com>
4747 * lex.c (search_line_fast): Avoid unused local typedefs to simulate
4750 2012-05-29 Dodji Seketeli <dodji@redhat.com>
4752 PR preprocessor/53229
4753 * internal.h (cpp_reader::set_invocation_location): Remove.
4754 (cpp_reader::about_to_expand_macro_p): New member flag.
4755 * directives.c (do_pragma): Remove Kludge as
4756 pfile->set_invocation_location is no more.
4757 * macro.c (cpp_get_token_1): Do away with the use of
4758 cpp_reader::set_invocation_location. Just collect the macro
4759 expansion point when we are about to expand the top-most macro.
4760 Do not override cpp_reader::about_to_expand_macro_p.
4761 This fixes gcc.dg/cpp/paste12.c by making get_token_no_padding
4762 properly handle locations of expansion points.
4763 (cpp_get_token_with_location): Adjust, as
4764 cpp_reader::set_invocation_location is no more.
4765 (paste_tokens): Take a virtual location parameter for
4766 the LHS of the pasting operator. Use it in diagnostics. Update
4768 (paste_all_tokens): Tighten the assert. Propagate the location of
4769 the expansion point when no virtual locations are available.
4770 Pass the virtual location to paste_tokens.
4771 (in_macro_expansion_p): New static function.
4772 (enter_macro_context): Set the cpp_reader::about_to_expand_macro_p
4773 flag until we really start expanding the macro.
4775 2012-05-16 Dodji Seketeli <dodji@redhat.com>
4777 PR preprocessor/7263
4778 * include/cpplib.h (cpp_classify_number): Take a location
4780 * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic
4781 macros that take a location parameter.
4782 (cpp_classify_number): Take a (virtual) location parameter. Use
4783 it for diagnostics. Adjust comments.
4784 (eval_token): Take a location parameter. Pass it to
4785 cpp_classify_number and to diagnostic routines.
4786 (_cpp_parse_expr): Use virtual locations of tokens when parsing
4787 expressions. Pass a virtual location to eval_token and to
4788 diagnostic routines.
4790 2012-05-10 Tristan Gingold <gingold@adacore.com>
4792 * expr.c (interpret_float_suffix): Add a guard.
4794 2012-05-02 Dodji Seketeli <dodji@redhat.com>
4796 Properly initialize cpp_context in destringize_and_run
4797 * directives.c (destringize_and_run): Properly initialize the new
4799 * macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
4800 the initial base context, which has the same life time as the
4801 current instance of cpp_file.
4803 2012-04-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
4804 Dodji Seketeli <dodji@seketeli.org>
4807 * libcpp/files.c (maybe_shorter_path): New.
4808 (find_file_in_dir): Use it.
4810 2012-04-30 Dodji Seketeli <dodji@redhat.com>
4812 Switch -ftrack-macro-expansion=2 on by default.
4813 * init.c (cpp_create_reader): Switch -ftrack-macro-expansion=2 on
4814 by default. Add comments.
4816 Strip "<built-in>" loc from displayed expansion context
4817 * include/line-map.h (linemap_unwind_toward_expansion): Fix typo
4819 (linemap_unwind_to_first_non_reserved_loc): Declare new function.
4820 * line-map.c (linemap_unwind_to_first_non_reserved_loc): Define
4823 Fix expansion point loc for macro-like tokens
4824 * macro.c (macro_of_context): New static function.
4825 (_cpp_push_token_context, push_extended_tokens_context): If the
4826 macro argument is NULL, it means we are continuing the expansion
4827 of the current macro, if any. Update comments.
4828 (_cpp_pop_context): Re-enable expansion of the macro only when we
4829 are really out of the context of the current expansion.
4831 Fix token pasting with -ftrack-macro-expansion
4832 * macro.c (paste_all_tokens): Put the token resulting from pasting
4833 into an extended token context with -ftrack-macro-location is in
4836 Fix cpp_sys_macro_p with -ftrack-macro-expansion
4837 * macro.c (cpp_sys_macro_p): Support -ftrack-macro-expansion.
4839 2012-04-29 Dodji Seketeli <dodji@redhat.com>
4841 * lex.c (lex_raw_string): Change C++ style comments into C style
4843 (lex_string): Likewise.
4845 2012-04-27 Ollie Wild <aaw@google.com>
4847 * include/cpplib.h (struct cpp_options): Add new field,
4848 warn_literal_suffix.
4849 (CPP_W_LITERAL_SUFFIX): New enum.
4850 * init.c (cpp_create_reader): Default initialization of
4851 warn_literal_suffix.
4852 * lex.c (lex_raw_string): Treat user-defined literals which don't
4853 begin with '_' as separate tokens and produce a warning.
4854 (lex_string): Ditto.
4856 2012-04-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
4858 * line-map.c (linemap_resolve_location): Synchronize comments with
4859 those in line-map.h.
4860 * include/line-map.h (linemap_resolve_location): Fix spelling in
4863 2012-03-22 Richard Earnshaw <rearnsha@arm.com>
4865 * lex.c (search_line_fast): Provide Neon-optimized version for ARM.
4867 2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4869 * lex.c: Remove Solaris 8 reference.
4871 2012-02-14 Walter Lee <walt@tilera.com>
4873 * configure.ac: Require 64-bit hwint for tilegx and tilepro.
4874 * configure: Regenerate.
4876 2012-01-09 Richard Guenther <rguenther@suse.de>
4878 * macro.c (_cpp_builtin_macro_text): Remove unused variable map.
4880 2012-01-09 Gary Funck <gary@intrepid.com>
4882 PR preprocessor/33919
4883 * files.c (_cpp_get_file_name): New. Implement file name
4885 * internal.h (_cpp_get_file_name): New prototype.
4886 * macro.c (_cpp_builtin_macro_text): Call _cpp_get_file_name()
4887 to use pfile->main_file in lieu of traversing INCLUDED_FROM chain.
4889 2012-01-03 Olivier Hainque <hainque@adacore.com>
4891 * system.h: Prior to #define, #undef fopen and freopen unconditionally.
4893 2011-12-20 Joseph Myers <joseph@codesourcery.com>
4895 * include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11.
4896 (CLK_STDC1X): Change to CLK_STDC11.
4897 * init.c (lang_defaults): Update comments.
4898 (cpp_init_builtins): Update language tests. Use 201112L for C11
4901 2011-12-20 Andreas Schwab <schwab@linux-m68k.org>
4903 * configure: Regenerate.
4905 2011-12-19 Andreas Schwab <schwab@linux-m68k.org>
4907 * configure: Regenerate.
4909 2011-12-07 Jakub Jelinek <jakub@redhat.com>
4912 * internal.h (_cpp_init_lexer): New prototype.
4913 * init.c (init_library): Call it.
4914 * lex.c (init_vectorized_lexer): Remove constructor attribute,
4916 (HAVE_init_vectorized_lexer): Define.
4917 (_cpp_init_lexer): New function.
4919 2011-12-03 Dodji Seketeli <dodji@redhat.com>
4921 * macro.c (tokens_buff_remove_last_token)
4922 (tokens_buff_put_token_to): Add an 'inline' function specifier to
4925 2011-11-22 Diego Novillo <dnovillo@google.com>
4927 * include/line-map.h (linemap_dump): Declare.
4928 (line_table_dump): Declare.
4929 * line-map.c (linemap_dump): New.
4930 (line_table_dump): New.
4932 2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net>
4935 * expr.c (cpp_userdef_char_remove_type): Fix typo.
4937 2011-11-03 Michael Matz <matz@suse.de>
4940 * configure.ac: Check for -fno-exceptions -fno-rtti.
4941 * configure: Regenerate.
4942 * Makefile.in (NOEXCEPTION_FLAGS): New flag.
4943 (ALL_CXXFLAGS): Use it.
4945 2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
4947 * internal.h (uxstrdup, ustrchr): Return const unsigned char *.
4949 2011-11-02 Jason Merrill <jason@redhat.com>
4952 * configure.ac: Add -Wno-narrowing to warning options.
4954 2011-10-31 Jason Merrill <jason@redhat.com>
4957 * init.c (cpp_init_builtins): Set __cplusplus for C++11.
4960 * include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11,
4961 CLK_GNUCXX0X to CLK_GNUCXX11.
4963 2011-10-26 Ed Smith-Rowland <3dw4rd@verizon.net>
4965 Implement C++11 user-defined literals.
4966 * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix,
4967 cpp_userdef_string_remove_type, cpp_userdef_string_add_type,
4968 cpp_userdef_char_remove_type, cpp_userdef_char_add_type,
4969 cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New.
4970 (cpp_classify_number): Classify unrecognized tokens as user-defined
4972 * include/cpplib.h: Add new tokens for user-defined literals.
4973 * init.c: Add new preprocessor flag (cxx11).
4974 * lex.c: (lex_string, lex_raw_string): Handle user-defined literals
4975 including concatenation and promotion with suffixes.
4977 2011-10-24 Dodji Seketeli <dodji@redhat.com>
4979 * line-map.c (linemap_macro_map_lookup): Fix logic.
4981 2011-10-24 Dodji Seketeli <dodji@redhat.com>
4983 * include/line-map.h (linemap_expand_location): Take a line table
4984 parameter. Update comment.
4985 (linemap_resolve_location): Update comment.
4986 (linemap_expand_location_full): Remove.
4987 * line-map.c (linemap_resolve_location): Handle reserved
4988 locations; return a NULL map in those cases.
4989 (linemap_expand_location): If location is reserved, return a
4990 zeroed expanded location. Update comment. Take a line table to
4991 assert that the function takes non-virtual locations only.
4992 (linemap_expand_location_full): remove.
4993 (linemap_dump_location): Handle the fact that
4994 linemap_resolve_location can return NULL line maps when the
4995 location resolves to a reserved location.
4997 * line-map.c (linemap_macro_map_lookup): Fix logic.
4999 2011-10-22 Dodji Seketeli <dodji@redhat.com>
5002 * include/internal.h (_cpp_remaining_tokens_num_in_context): Take the
5003 context to act upon.
5004 * lex.c (_cpp_remaining_tokens_num_in_context): Likewise. Update
5006 (cpp_token_from_context_at): Likewise.
5007 (cpp_peek_token): Use the context to peek tokens from.
5009 2011-10-20 Dodji Seketeli <dodji@redhat.com>
5012 * lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of
5015 2011-10-18 Dodji Seketeli <dodji@redhat.com>
5018 * include/line-map.h (struct linemap_stats): Change the type of
5019 the members from size_t to long.
5020 * macro.c (macro_arg_token_iter_init): Unconditionally initialize
5023 2011-10-17 Dodji Seketeli <dodji@redhat.com>
5025 * line-map.c (linemap_macro_map_loc_to_exp_point): Avoid setting a
5026 variable without using it if ENABLE_CHECKING is not defined. Mark
5027 the LOCATION parameter as being unused.
5029 2011-10-15 Tom Tromey <tromey@redhat.com>
5030 Dodji Seketeli <dodji@redhat.com>
5032 * include/line-map.h (struct line_maps::alloced_size_for_request):
5034 * line-map.c (new_linemap): Use set->alloced_size_for_request to
5035 get the actual allocated size of line maps.
5037 2011-10-15 Tom Tromey <tromey@redhat.com>
5038 Dodji Seketeli <dodji@redhat.com>
5040 * line-map.h (struct linemap_stats): Declare new struct.
5041 (linemap_get_statistics): Declare ...
5042 * line-map.c (linemap_get_statistics): ... new function.
5043 * macro.c (num_expanded_macros_counter, num_macro_tokens_counter):
5044 Declare new counters.
5045 (enter_macro_context, replace_args): Update
5046 num_macro_tokens_counter.
5047 (cpp_get_token_1): Update num_expanded_macros_counter.
5049 2011-10-15 Tom Tromey <tromey@redhat.com>
5050 Dodji Seketeli <dodji@redhat.com>
5052 * include/cpplib.h (struct cpp_options)<debug>: New struct member.
5053 * include/line-map.h (linemap_dump_location): Declare ...
5054 * line-map.c (linemap_dump_location): ... new function.
5056 2011-10-15 Tom Tromey <tromey@redhat.com>
5057 Dodji Seketeli <dodji@redhat.com>
5059 * include/cpplib.h (struct cpp_options)<track_macro_expansion>:
5061 * internal.h (struct macro_context): New struct.
5062 (enum context_tokens_kind): New enum.
5063 (struct cpp_context)<tokens_kind>: New member of type enum
5064 context_tokens_kind.
5065 (struct cpp_context)<macro>: Remove this. Replace it with an enum
5066 of macro and macro_context.
5067 (struct cpp_context)<direct_p>: Remove.
5068 (_cpp_remaining_tokens_num_in_context): Declare new function.
5069 * directives.c (destringize_and_run): Adjust.
5070 * lex.c (_cpp_remaining_tokens_num_in_context)
5071 (_cpp_token_from_context_at): Define new functions
5072 (cpp_peek_token): Use them.
5073 * init.c (cpp_create_reader): Initialize the base context to zero.
5074 (_cpp_token_from_context_at): Define new static function.
5075 (cpp_peek_token): Use new _cpp_remaining_tokens_num_in_context and
5076 _cpp_token_from_context_at.
5077 * macro.c (struct macro_arg)<virt_locs, expanded_virt_locs>: New
5079 (enum macro_arg_token_kind): New enum.
5080 (struct macro_arg_token_iter): New struct.
5081 (maybe_adjust_loc_for_trad_cpp, push_extended_tokens_context)
5082 (alloc_expanded_arg_mem, ensure_expanded_arg_room)
5083 (delete_macro_args, set_arg_token, get_arg_token_location)
5084 (arg_token_ptr_at, macro_arg_token_iter_init)
5085 (macro_arg_token_iter_get_token)
5086 (macro_arg_token_iter_get_location, macro_arg_token_iter_forward)
5087 (expanded_token_index, tokens_buff_new, tokens_buff_count)
5088 (tokens_buff_last_token_ptr, tokens_buff_put_token_to)
5089 (tokens_buff_add_token, tokens_buff_remove_last_token)
5090 (reached_end_of_context, consume_next_token_from_context): New
5092 (cpp_get_token_1): New static function. Split and extended from
5093 cpp_get_token. Use reached_end_of_context and
5094 consume_next_token_from_context. Unify its return point. Move
5095 the location tweaking from cpp_get_token_with_location in here.
5096 (cpp_get_token): Use cpp_get_token_1
5097 (stringify_arg): Use the new arg_token_at.
5098 (paste_all_tokens): Support tokens coming from extended tokens
5100 (collect_args): Return the number of collected arguments, by
5101 parameter. Store virtual locations of tokens that constitute the
5103 (funlike_invocation_p): Return the number of collected arguments,
5105 (enter_macro_context): Add a parameter for macro expansion point.
5106 Pass it to replace_args and to the "used" cpp callback. Get the
5107 number of function-like macro arguments from funlike_invocation_p,
5108 pass it to the new delete_macro_args to free the memory used by
5109 macro args. When -ftrack-macro-expansion is in effect, for macros
5110 that have no arguments, create a macro map for the macro expansion
5111 and use it to allocate proper virtual locations for tokens
5112 resulting from the expansion. Push an extended tokens context
5113 containing the tokens resulting from macro expansion and their
5115 (replace_args): Rename the different variables named 'count' into
5116 variables with more meaningful names. Create a macro map;
5117 allocate virtual locations of tokens resulting from this
5118 expansion. Use macro_arg_token_iter to iterate over tokens of a
5119 given macro. Handle the case of the argument of
5120 -ftrack-macro-expansion being < 2. Don't free macro arguments
5121 memory resulting from expand_arg here, as these are freed by the
5122 caller of replace_arg using delete_macro_args now. Push extended
5124 (next_context, push_ptoken_context, _cpp_push_token_context)
5125 (_cpp_push_text_context): Properly initialize the context.
5126 (expand_arg): Use the new alloc_expanded_arg_mem,
5127 push_extended_tokens_context, cpp_get_token_1, and set_arg_token.
5128 (_cpp_pop_context): Really free the memory held by the context.
5129 Handle freeing memory used by extended tokens contexts.
5130 (cpp_get_token_with_location): Use cpp_get_token_1.
5131 (cpp_sys_macro_p): Adjust.
5132 (_cpp_backup_tokens): Support the new kinds of token contexts.
5133 * traditional.c (recursive_macro): Adjust.
5135 2011-10-15 Tom Tromey <tromey@redhat>
5136 Dodji Seketeli <dodji@redhat.com>
5138 * include/line-map.h (enum lc_reason)<LC_ENTER_MACRO>: New enum
5140 (MAX_SOURCE_LOCATION): New constant.
5141 (struct line_map_ordinary, struct line_map_macro): New structs.
5142 (struct line_map): Turn this into a union of the two above. Add
5144 (struct maps_info): New struct.
5145 (struct line_maps)<info_ordinary, info_macro>: Two new fields.
5146 These now carry the map information that was previously scattered
5147 in struct line_maps.
5148 (struct map_info::allocated): Fix comment.
5149 (MAP_START_LOCATION, ORDINARY_MAP_FILE_NAME)
5150 (ORDINARY_MAP_STARTING_LINE_NUMBER)
5151 (ORDINARY_MAP_INCLUDER_FILE_INDEX)
5152 (ORDINARY_MAP_IN_SYSTEM_HEADER_P)
5153 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS, MACRO_MAP_MACRO)
5154 (MACRO_MAP_NUM_MACRO_TOKENS MACRO_MAP_LOCATIONS)
5155 (MACRO_MAP_EXPANSION_POINT_LOCATION)
5156 (LOCATION_POSSIBLY_IN_MACRO_MAP_P, LINEMAPS_MAP_INFO)
5157 (LINEMAPS_MAPS, LINEMAPS_ALLOCATE, LINEMAPS_USED, LINEMAPS_CACHE)
5158 (LINEMAPS_LAST_MAP, LINEMAPS_LAST_ALLOCATED_MAP)
5159 (LINEMAPS_ORDINARY_MAPS, LINEMAPS_ORDINARY_ALLOCATED)
5160 (LINEMAPS_ORDINARY_USED, LINEMAPS_ORDINARY_CACHE)
5161 (LINEMAPS_LAST_ORDINARY_MAP, LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP)
5162 (LINEMAPS_MACRO_MAPS, LINEMAPS_MACRO_ALLOCATED)
5163 (LINEMAPS_MACRO_USED, LINEMAPS_MACRO_CACHE)
5164 (LINEMAPS_LAST_MACRO_MAP, LINEMAPS_LAST_ALLOCATED_MACRO_MAP)
5165 (LINEMAPS_MAP_AT, LINEMAPS_ORDINARY_MAP_AT)
5166 (LINEMAPS_MACRO_MAP_AT): New accessors for ordinary and macro map
5168 (linemap_check_ordinary, linemap_assert)
5169 (linemap_location_before_p): New macros.
5170 (linemap_position_for_line_and_column)
5171 (linemap_tracks_macro_expansion_locs_p, linemap_add_macro_token)
5172 (linemap_macro_expansion_map_p)
5173 (linemap_macro_map_loc_to_def_point)
5174 (linemap_macro_map_loc_unwind_once)
5175 (linemap_macro_map_loc_to_exp_point, linemap_step_out_once)
5176 (linemap_get_source_line linemap_get_source_column)
5177 (linemap_map_get_macro_name, linemap_get_file_path)
5178 (linemap_location_in_system_header_p)
5179 (linemap_location_from_macro_expansion_p): Declare new functions.
5180 (SOURCE_LINE, SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION)
5181 (LINEMAP_FILE, LINEMAP_LINE, LINEMAP_SYSP): Assert that this
5182 accessors act on ordinary maps only.
5183 (INCLUDED_FROM): Return NULL for main files; use the new
5185 (LINEMAP_POSITION_FOR_COLUMN): Use the new accessors.
5186 (struct expanded_location): Move here from gcc/input.h
5187 (linemap_resolve_location, linemap_expand_location)
5188 (linemap_expand_location_full): Declare new functions.
5189 * line-map.c: Include cpplib.h, internal.h
5190 (linemap_enter_macro, linemap_add_macro_token)
5191 (linemap_get_expansion_line, linemap_get_expansion_filename): New
5192 functions that are private to libcpp.
5193 (linemap_assert): New macro.
5194 (linemap_macro_loc_to_exp_point, linemap_macro_loc_to_exp_point)
5195 (linemap_macro_loc_unwind, linemap_macro_map_loc_to_def_point)
5196 (linemap_macro_map_loc_unwind_toward_spelling)
5197 (linemap_macro_map_loc_to_exp_point)
5198 (first_map_in_common_1, first_map_in_common): New static
5200 (new_linemap): Define new static functions. Extracted and
5202 (linemap_add): ... here. Use linemap_assert in lieu of abort
5204 (linemap_tracks_macro_expansion_locs_p)
5205 (linemap_add_macro_token, linemap_macro_expansion_map_p)
5206 (linemap_check_ordinary, linemap_macro_map_loc_to_exp_point)
5207 (linemap_macro_map_loc_to_def_point)
5208 (linemap_macro_map_loc_unwind_once)
5209 (linemap_step_out_once, linemap_map_get_index)
5210 (linemap_get_source_line,linemap_get_source_column)
5211 (linemap_get_file_path, linemap_map_get_macro_name)
5212 (linemap_location_in_system_header_p)
5213 (linemap_location_originated_from_system_header_p)
5214 (linemap_location_from_macro_expansion_p)
5215 (linemap_tracks_macro_expansion_locs_p)
5216 (linemap_resolve_location, linemap_expand_location)
5217 (linemap_expand_location_full)
5218 (linemap_tracks_macro_expansion_locs_p)
5219 (linemap_position_for_line_and_column, linemap_compare_locations):
5220 Define new public functions.
5221 (linemap_init): Initialize ordinary and macro maps information in
5223 (linemap_check_files_exited): Use the new accessors.
5224 (linemap_free): Remove this dead code.
5225 (linemap_line_start): Assert this uses an ordinary map. Adjust to
5226 use the new ordinary map accessors and data structures. Don't
5227 overflow past the lowest possible macro token's location.
5228 (linemap_position_for_column): Assert the ordinary maps of the map
5229 set are really ordinary. Use ordinary map accessors.
5230 (linemap_lookup): Keep the same logic but generalize to allow
5231 lookup of both ordinary and macro maps. Do not crash when called
5232 with an empty line table.
5233 * directives-only.c (_cpp_preprocess_dir_only): Adjust to use the
5234 new API of line-map.h.
5235 * directives.c (start_directive, do_line, do_linemarker)
5236 (do_linemarker): Likewise.
5237 * files.c (_cpp_find_file, _cpp_stack_include, open_file_failed)
5238 (make_cpp_dir, cpp_make_system_header): Likewise.
5239 * init.c (cpp_read_main_file): Likewise.
5240 * internal.h (CPP_INCREMENT_LINE): Likewise.
5241 (linemap_enter_macro, linemap_add_macro_token)
5242 (linemap_get_expansion_line, linemap_get_expansion_filename): New
5243 functions private to libcpp.
5244 * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment)
5245 (skip_line_comment, skip_whitespace, lex_raw_string)
5246 (_cpp_lex_direct): Likewise.
5247 * macro.c (_cpp_builtin_macro_text): Likewise.
5248 (_cpp_aligned_alloc): Initialize the new name member of the macro.
5249 * traditional.c (copy_comment, _cpp_scan_out_logical_line):
5251 * errors.c (cpp_diagnostic): Adjust to new linemap API.
5253 2011-08-28 Dodji Seketeli <dodji@redhat.com>
5255 * line-map.c (linemap_add): Assert that reason must not be
5256 LC_RENAME when called for the first time on a "main input file".
5258 2011-08-22 Gabriel Charette <gchare@google.com>
5260 * init.c (cpp_create_reader): Inititalize forced_token_location_p.
5261 * internal.h (struct cpp_reader): Add field forced_token_location_p.
5262 * lex.c (_cpp_lex_direct): Use forced_token_location_p.
5263 (cpp_force_token_locations): New.
5264 (cpp_stop_forcing_token_locations): New.
5266 2011-08-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5269 * init.c (cpp_init_builtins): Define __cplusplus 19971L.
5271 2011-08-18 Joseph Myers <joseph@codesourcery.com>
5273 * include/cpplib.h (struct cpp_options): Fix typo.
5275 2011-08-18 Joseph Myers <joseph@codesourcery.com>
5277 * include/cpplib.h (struct cpp_options): Add rliterals.
5278 * init.c (struct lang_flags, lang_defaults): Add rliterals.
5279 (cpp_set_lang): Set rliterals option.
5280 (cpp_init_builtins): Define __STDC_UTF_16__ and __STDC_UTF_32__.
5281 * lex.c (_cpp_lex_direct): Only accept raw strings if rliterals.
5283 2011-08-15 Gabriel Charette <gchare@google.com>
5285 * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Remove.
5286 Update all users to use linemap_position_for_column instead.
5288 2011-07-28 Gabriel Charette <gchare@google.com>
5290 * include/line-map.h (struct line_maps):
5291 Remove unused field last_listed. Update all users.
5293 2011-07-28 H.J. Lu <hongjiu.lu@intel.com>
5295 * configure.ac: Set need_64bit_hwint to yes for x86 targets.
5296 * configure: Regenerated.
5298 2011-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5300 * system.h [__cplusplus]: Wrap C function declarations in extern "C".
5302 2011-07-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5303 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5306 * configure.ac: Test AM_ICONV with CXX.
5307 * configure: Regenerate.
5308 * system.h (HAVE_DESIGNATED_INITIALIZERS): Never define for C++.
5310 2011-07-15 Dodji Seketeli <dodji@redhat.com>
5312 * directives.c (struct if_stack): Use source_location as type
5314 * include/cpplib.h (struct cpp_callbacks)<include, define, undef,
5315 indent, def_pragma, used_define, used_undef>: Properly use
5316 source_location as parameter type, rather than unsigned int.
5318 2011-07-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5321 * configure.ac (host_wide_int): Handle x86_64-*-solaris2.1[0-9]
5322 like i[34567]86-*-solaris2.1[0-9]*.
5323 * configure: Regenerate.
5325 2011-06-16 Jason Merrill <jason@redhat.com>
5328 * lex.c (lex_raw_string): Don't check for embedded NUL.
5330 2011-06-06 Dodji Seketeli <dodji@redhat.com>
5332 PR preprocessor/48532
5333 * directives.c (do_pragma): Don't forget the invocation location
5334 when parsing the pragma name of a namespaced pragma directive.
5336 2011-05-29 John Tytgat <John.Tytgat@aaug.net>
5338 * files.c (read_file_guts): Add test on non-zero value of S_ISREG.
5340 2011-05-22 Uros Bizjak <ubizjak@gmail.com>
5343 * lex.c (init_vectorized_lexer): Do not set "minimum" when __3dNOW_A__
5344 is defined. Check bit_MMXEXT and bit_CMOV to use search_line_mmx.
5346 2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>
5348 * system.h (ENUM_BITFIELD): Remove.
5350 2011-04-24 Jakub Jelinek <jakub@redhat.com>
5352 PR preprocessor/48740
5353 * lex.c (lex_raw_string): When raw string ends with
5354 ??) followed by raw prefix and ", ensure it is preprocessed
5355 with ??) rather than ??].
5357 2011-04-20 Jim Meyering <meyering@redhat.com>
5359 * files.c (destroy_cpp_file): Remove useless if-before-free.
5360 * init.c (cpp_destroy): Likewise.
5361 * macro.c (replace_args): Likewise.
5362 * pch.c (cpp_valid_state): Likewise.
5364 2011-03-25 Kai Tietz <ktietz@redhat.com>
5366 * files.c (file_hash_eq): Use filename_cmp
5368 (nonexistent_file_hash_eq): Likewise.
5369 (remap_filename): Likewise.
5370 Handle absolute DOS-path,
5371 (append_file_to_dir): Check for IS_DIR_SEPARATOR
5373 (read_name_map): Likewise.
5374 * linemap.c (linemap_add): Use filename_cmp
5376 * mkdeps.c (apply_vpath): Use filename_ncmp
5378 (deps_restore): Use filename_cmp instead of
5380 * init.c (read_original_directory): Use
5381 IS_DIR_SEPARATOR instead of checking for slash.
5383 2011-03-21 Michael Meissner <meissner@linux.vnet.ibm.com>
5385 PR preprocessor/48192
5386 * directives.c (do_ifdef): Do not consider conditional macros as
5389 * expr.c (parse_defined): Ditto.
5391 2011-03-18 Richard Henderson <rth@redhat.com>
5394 * lex.c [ALTIVEC] (search_line_fast): Require gcc version 4.5.
5396 2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
5397 Jakub Jelinek <jakub@redhat.com>
5399 PR preprocessor/39213
5400 * directives.c (end_directive): Call _cpp_remove_overlay for deferred
5401 pragmas as well in traditional mode.
5403 2010-11-17 Ian Lance Taylor <iant@google.com>
5406 * configure.ac: Use AC_USE_SYSTEM_EXTENSIONS. Remove switch of
5407 AC_LANG based on ENABLE_BUILD_WITH_CXX.
5409 2010-11-16 Kai Tietz <kai.tietz@onevision.com>
5411 PR preprocessor/17349
5412 * lex.c (save_comment): Handle in argument passing c++
5415 2010-11-02 Ian Lance Taylor <iant@google.com>
5417 * configure.ac: Use AC_SYS_LARGEFILE.
5418 * configure: Rebuild.
5419 * config.in: Rebuild.
5421 2010-10-19 Basile Starynkevitch <basile@starynkevitch.net>
5423 * line-map.h (source_location): Remove obsolete comment
5424 mentioning location_s.
5426 2010-09-29 Kai Tietz <kai.tietz@onevision.com>
5428 PR preprocessor/45362
5429 * directives.c (cpp_pop_definition): Make static.
5430 (do_pragma_push_macro): Reworked to store text
5432 (do_pragma_pop_macro): Add free text definition.
5433 (cpp_push_definition): Removed.
5434 * include/cpplib.h (cpp_push_definition): Removed.
5435 (cpp_pop_definition): Likewise.
5436 * internal.h (def_pragma_macro): Remove member 'value'
5437 and add new members 'definition', 'line',
5438 'syshdr', 'sued' and 'is_undef'.
5439 * pch.c (_cpp_restore_pushed_macros): Rework to work
5440 on text definition and store additional macro flags.
5441 (_cpp_save_pushed_macros): Likewise.
5443 2010-09-29 Joseph Myers <joseph@codesourcery.com>
5445 * include/cpplib.h (cpp_options): Rename warn_deprecated,
5446 warn_traditional, warn_long_long and pedantic.
5447 * directives.c (directive_diagnostics, _cpp_handle_directive):
5448 Update names of cpp_options members.
5449 * expr.c (cpp_classify_number, eval_token): Update names of
5450 cpp_options members.
5451 * init.c (cpp_create_reader, post_options): Update names of
5452 cpp_options members.
5453 * internal.h (CPP_PEDANTIC, CPP_WTRADITIONAL): Update names of
5454 cpp_options members.
5455 * macro.c (parse_params): Update names of cpp_options members.
5457 2010-09-15 Ian Lance Taylor <iant@google.com>
5459 * init.c: Fix type name in comment.
5461 2010-08-31 Jakub Jelinek <jakub@redhat.com>
5463 PR preprocessor/45457
5464 * expr.c (parse_defined): Call pfile->cb.user_builtin_macro hook if
5466 * directives.c (do_ifdef, do_ifndef): Likewise.
5468 2010-08-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5470 * system.h [HAVE_INTTYPES_H]: Include inttypes.h.
5472 2010-08-24 Richard Henderson <rth@redhat.com>
5475 * configure.ac (HAVE_SSE4): New check.
5476 * configure, config.in: Rebuild.
5477 * lex.c (search_line_sse42): Omit if !HAVE_SSE4.
5479 2010-08-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5481 * lex.c [__sun__ && __svr4__]: Disable init_vectorized_lexer
5482 etc. on Solaris 2/x86.
5484 2010-08-21 Richard Henderson <rth@redhat.com>
5485 Andi Kleen <ak@linux.intel.com>
5486 David S. Miller <davem@davemloft.net>
5488 * configure.ac (AC_C_BIGENDIAN, AC_TYPE_UINTPTR_T): New tests.
5489 (ssize_t): Check via AC_TYPE_SSIZE_T instead of AC_CHECK_TYPE.
5490 (ptrdiff_t): Check via AC_CHECK_TYPE.
5491 * config.in, configure: Rebuild.
5492 * system.h: Include stdint.h, if available.
5493 * lex.c (WORDS_BIGENDIAN): Provide default.
5494 (acc_char_mask_misalign, acc_char_replicate, acc_char_cmp,
5495 acc_char_index, search_line_acc_char, repl_chars, search_line_mmx,
5496 search_line_sse2, search_line_sse42, init_vectorized_lexer,
5497 search_line_fast): New.
5498 (_cpp_clean_line): Use search_line_fast. Restructure the fast
5499 loop to make it clear when we're leaving the loop. Stay in the
5500 fast loop for non-trigraph '?'.
5502 2010-06-11 Jakub Jelinek <jakub@redhat.com>
5504 * include/cpplib.h (struct cpp_callbacks): Add user_builtin_macro
5506 (enum cpp_builtin_type): Add BT_FIRST_USER and BT_LAST_USER.
5507 (cpp_macro_definition): Remove const qual from second argument.
5508 * macro.c (enter_macro_context): Call user_builtin_macro callback for
5509 NODE_BUILTIN !NODE_USED macros.
5510 (warn_of_redefinition): Likewise. Remove const qual from second
5512 (cpp_macro_definition): Likewise.
5513 * pch.c (write_macdef, save_macros): Call user_builtin_macro callback
5514 for NODE_BUILTIN !NODE_USED macros.
5516 2010-06-10 Joseph Myers <joseph@codesourcery.com>
5518 * include/cpplib.h (struct cpp_options): Remove show_column.
5519 * init.c (cpp_create_reader, post_options): Don't set show_column.
5521 2010-06-09 Joern Rennecke <joern.rennecke@embecosm.com>
5524 * configure.ac: Before using ZW_PROG_COMPILER_DEPENDENCIES for C++,
5525 check that C++ compiler works.
5526 * configure: Regenerate.
5528 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
5530 * include/symtab.h (ht_identifier_ptr): New.
5532 2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
5533 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5536 * configure.ac: Check for declaration of 'basename(char *)'.
5537 * configure: Regenerate.
5538 * config.in: Regenerate.
5540 2010-04-25 Joseph Myers <joseph@codesourcery.com>
5542 * include/cpplib.h (enum c_lang): Add CLK_GNUC1X and CLK_STDC1X.
5543 * init.c (lang_defaults): Add entries for new language variants.
5544 (cpp_init_builtins): Define __STDC_VERSION__ to 201000L for C1X
5547 2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
5550 * files.c (report_missing_guard): Test for #pragma once.
5552 2010-04-07 Simon Baldwin <simonb@google.com>
5554 * directives.c (do_diagnostic): Add warning reason argument,
5555 call appropriate error reporting function for code.
5556 (directive_diagnostics): Call specific warning functions with
5557 warning reason where appropriate.
5558 (do_error, do_warning, do_pragma_dependency): Add warning reason
5559 argument to do_diagnostic calls.
5560 * macro.c (_cpp_warn_if_unused_macro, enter_macro_context,
5561 _cpp_create_definition): Call specific warning functions with
5562 warning reason where appropriate.
5563 * Makefile.in: Add new diagnostic functions to gettext translations.
5564 * include/cpplib.h (struct cpp_callbacks): Add warning reason code
5566 (CPP_DL_WARNING, CPP_DL_WARNING_SYSHDR, CPP_DL_PEDWARN, CPP_DL_ERROR,
5567 CPP_DL_ICE, CPP_DL_NOTE, CPP_DL_FATAL): Replace macros with enums.
5568 (CPP_W_NONE, CPP_W_DEPRECATED, CPP_W_COMMENTS,
5569 CPP_W_MISSING_INCLUDE_DIRS, CPP_W_TRIGRAPHS, CPP_W_MULTICHAR,
5570 CPP_W_TRADITIONAL, CPP_W_LONG_LONG, CPP_W_ENDIF_LABELS,
5571 CPP_W_NUM_SIGN_CHANGE, CPP_W_VARIADIC_MACROS,
5572 CPP_W_BUILTIN_MACRO_REDEFINED, CPP_W_DOLLARS, CPP_W_UNDEF,
5573 CPP_W_UNUSED_MACROS, CPP_W_CXX_OPERATOR_NAMES, CPP_W_NORMALIZE,
5574 CPP_W_INVALID_PCH, CPP_W_WARNING_DIRECTIVE): New enums for cpp
5575 warning reason codes.
5576 (cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
5577 cpp_warning_with_line, cpp_pedwarning_with_line,
5578 cpp_warning_with_line_syshdr): New specific error reporting functions.
5579 * pch.c (cpp_valid_state): Call specific warning functions with
5580 warning reason where appropriate.
5581 * errors.c (cpp_diagnostic, cpp_diagnostic_with_line): New central
5582 diagnostic handlers.
5583 (cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
5584 cpp_warning_with_line, cpp_pedwarning_with_line,
5585 cpp_warning_with_line_syshdr): New specific error reporting functions.
5586 * expr.c (cpp_classify_number, eval_token, num_unary_op): Call
5587 specific warning functions with warning reason where appropriate.
5588 * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment,
5589 warn_about_normalization, lex_identifier_intern, lex_identifier,
5590 _cpp_lex_direct): Ditto.
5591 * charset.c (_cpp_valid_ucn, convert_hex, convert_escape,
5592 narrow_str_to_charconst): Ditto.
5594 2010-04-06 Jakub Jelinek <jakub@redhat.com>
5596 PR preprocessor/43642
5597 * lex.c (lex_raw_string): Change type of TYPE variable to
5600 2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5602 * aclocal.m4: Regenerate.
5604 2010-03-29 Jason Merrill <jason@redhat.com>
5606 More N3077 raw string changes
5607 * charset.c (cpp_interpret_string): Don't transform UCNs in raw
5609 * lex.c (bufring_append): Split out from...
5610 (lex_raw_string): ...here. Undo trigraph and line splicing
5611 transformations. Do process line notes in multi-line literals.
5612 (_cpp_process_line_notes): Ignore notes that were already handled.
5614 Some raw string changes from N3077
5615 * charset.c (cpp_interpret_string): Change inner delimiters to ().
5616 * lex.c (lex_raw_string): Likewise. Also disallow '\' in delimiter.
5618 2010-02-11 Jakub Jelinek <jakub@redhat.com>
5620 * init.c (read_original_filename): Don't call read_original_directory
5621 if _cpp_handle_directive returns 0.
5623 2010-01-01 Joseph Myers <joseph@codesourcery.com>
5625 PR preprocessor/41947
5626 * expr.c (cpp_classify_number): Give error for hexadecimal
5627 floating-point constant with no digits before or after point.
5629 2009-11-20 Arnaud Charlet <charlet@adacore.com>
5631 * macro.c (enter_macro_context): Call cb.used callback if defined.
5632 * directives.c (do_idef, do_ifndef): Ditto.
5633 * include/cpplib.h (struct cpp_callbacks): Add used callback.
5635 2009-11-11 Kai Tietz <kai.tietz@onevision.com>
5637 * directives.c (do_pragma_push_macro): New pragma handler.
5638 (do_pragma_pop_macro): Likewise.
5639 (_cpp_init_internal_pragmas): Add push_macro and
5640 pop_macro handler to internal pragmas.
5641 (lex_macro_node_from_str): Removed.
5642 (cpp_push_definition): Replace lex_macro_node_from_str
5643 by _cpp_lex_identifier.
5644 (cpp_pop_definition): Likewise.
5645 * internal.h (_cpp_lex_identifier): New prototype.
5646 (def_pragma_macro): New structure.
5647 (cpp_reader): New member pushed_macros.
5648 * lex.c (_cpp_lex_identifier): New function.
5649 (lex_identifier_intern): New function.
5650 * init.c (cpp_create_reader): Initialize pushed_macros
5652 (cpp_destroy): Free elements in pushed_macros member.
5653 * pch.c (_cpp_save_pushed_macros): New function.
5654 (_cpp_restore_pushed_macros): Likewise.
5655 (_cpp_restore_pushed_macros): Use _cpp_save_pushed_macros.
5656 (cpp_read_state): Use _cpp_restore_pushed_macros.
5658 2009-10-19 Jakub Jelinek <jakub@redhat.com>
5660 * charset.c (cpp_init_iconv): Initialize utf8_cset_desc.
5661 (_cpp_destroy_iconv): Destroy utf8_cset_desc, char16_cset_desc
5662 and char32_cset_desc.
5663 (converter_for_type): Handle CPP_UTF8STRING.
5664 (cpp_interpret_string): Handle CPP_UTF8STRING and raw-strings.
5665 * directives.c (get__Pragma_string): Handle CPP_UTF8STRING.
5666 (parse_include): Reject raw strings.
5667 * include/cpplib.h (CPP_UTF8STRING): New token type.
5668 * internal.h (struct cpp_reader): Add utf8_cset_desc field.
5669 * lex.c (lex_raw_string): New function.
5670 (lex_string): Handle u8 string literals, call lex_raw_string
5671 for raw string literals.
5672 (_cpp_lex_direct): Call lex_string even for u8" and {,u,U,L,u8}R"
5674 * macro.c (stringify_arg): Handle CPP_UTF8STRING.
5676 2009-10-14 Jakub Jelinek <jakub@redhat.com>
5678 PR preprocessor/41543
5679 * include/line-map.h (RESERVED_LOCATION_COUNT): Define.
5680 * line-map.c (linemap_init): Initialize highest_location and
5681 highest_line to RESERVED_LOCATION_COUNT-1 instead of 0.
5683 2009-10-09 Jason Merrill <jason@redhat.com>
5685 * charset.c (_cpp_valid_ucn): Update C++0x restrictions.
5687 2009-10-09 Neil Vachharajani <nvachhar@google.com>
5689 * directives.c (DIRECTIVE_TABLE): Remove DEPRECATED from ident and
5692 2009-09-23 Loren J. Rittle <ljrittle@acm.org>
5694 * configure.ac (AC_CHECK_HEADERS after AC_LANG(C++)): Add sys/stat.h.
5695 * configure: Rebuilt.
5697 2009-09-22 Richard Guenther <rguenther@suse.de>
5700 * files.c (pch_open_file): Disallow non-toplevel PCH inclusion.
5702 2009-09-18 Chris Demetriou <cgd@google.com>
5704 PR preprocessor/28435:
5705 * include/cpplib.h (struct cpp_options): Add new member
5706 deps.need_preprocessor_output.
5707 * files.c (open_file_failed): If preprocessor output is needed
5708 always report an error.
5710 2009-09-13 Kai Tietz <kai.tietz@onevision.com>
5712 * configure.ac: Set for i?86-w64-mingw*
5713 need_64bit_hwint to yes.
5714 * configure: Regenerated.
5716 2009-09-10 Jason Merrill <jason@redhat.com>
5718 * directives.c (cpp_define): constify.
5720 2009-09-02 Ian Lance Taylor <iant@google.com>
5722 * macro.c (stringify_arg): Escape CPP_WCHAR tokens.
5724 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5726 * configure.ac (AC_PREREQ): Bump to 2.64.
5728 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5730 * aclocal.m4: Regenerate.
5731 * config.in: Regenerate.
5732 * configure: Regenerate.
5734 2009-08-17 Tom Tromey <tromey@redhat.com>
5736 PR preprocessor/41067:
5737 * charset.c (convert_escape): Add missing ":" to error text.
5739 2009-07-27 Douglas B Rupp <rupp@gnat.com>
5741 * include/cpplib.h (INO_T_CPP): New macro.
5742 (struct cpp_dir): Use it.
5744 2009-07-20 Jerry Quinn <jlquinn@optonline.net>
5747 * configure.ac: Use = instead of == for testing
5748 ENABLE_BUILD_WITH_CXX.
5749 * configure: Rebuild.
5751 2009-07-17 Jerry Quinn <jlquinn@optonline.net>
5753 * directives.c (do_linemarker, do_line): Use CPP_STRING for
5755 * files.c (find_file_in_dir): Add cast from void* to char*.
5756 * symtab.c (ht_lookup_with_hash): Add cast from void* to char*.
5757 * Makefile.in: (WARN_CFLAGS): Use general and C-specific
5759 (CXX, CXXFLAGS, WARN_CXXFLAGS, ALL_CXXFLAGS,
5760 ENABLE_BUILD_WITH_CXX, CCDEPMODE, CXXDEPMODE, COMPILER,
5761 COMPILER_FLAGS): New.
5762 (DEPMODE): Set from CCDEPMODE or CXXDEPMODE.
5763 (COMPILE.base): Use COMPILER instead of CC. Use COMPILER_FLAGS
5764 instead of ALL_CFLAGS.
5765 * configure.ac: Invoke AC_PROG_CXX. Separate C-specific warnings
5766 from other warnings. Add -Wc++-compat to C-specific warnings.
5767 Check for --enable-build-with-cxx. Set and substitute
5768 ENABLE_BUILD_WITH_CXX. Invoke ZW_PROG_COMPILER_DEPENDENCIES
5769 according to ENABLE_BUILD_WITH_CXX. Invoke AC_LANG before
5771 * configure: Rebuild.
5772 * include/cpp-id-data.h: Remove extern "C".
5773 * include/line-map.h: Likewise.
5774 * include/mkdeps.h: Likewise.
5775 * include/symtab.h: Likewise.
5776 * internal.h: Likewise.
5778 2009-06-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5780 * directives.c (parse_include): Add location argument. Update all
5782 (parse_answer): Likewise.
5783 (do_include_common): Error with exact location.
5784 (parse_assertion): Likewise.
5786 2009-06-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
5788 * expr.c (num_div_op): Take explicit location.
5790 2009-06-17 Ian Lance Taylor <iant@google.com>
5792 * include/cpplib.h (progname): Don't declare.
5794 2009-06-12 Ian Lance Taylor <iant@google.com>
5796 * include/cpplib.h (struct cpp_options): Add
5797 warn_cxx_operator_names field.
5798 (NODE_WARN_OPERATOR): Define.
5799 (struct cpp_hashnode): Increase flags field to 10 bits, decrease
5801 * init.c (mark_named_operators): Add flags parameter.
5802 (cpp_post_options): Pick flags value to pass to
5803 mark_named_operators.
5804 * lex.c (lex_identifier): If NODE_WARN_OPERATOR is set, warn that
5805 identifier is an operator name in C++.
5807 2009-06-01 Aldy Hernandez <aldyh@redhat.com>
5809 * include/line-map.h (LAST_SOURCE_COLUMN): New.
5811 2009-06-01 Ian Lance Taylor <iant@google.com>
5813 * include/cpp-id-data.h: Add extern "C".
5814 * include/line-map.h: Likewise.
5815 * include/mkdeps.h: Likewise.
5816 * include/symtab.h: Likewise.
5817 * internal.h: Likewise.
5819 2009-05-15 Ian Lance Taylor <iant@google.com>
5821 * include/cpplib.h (enum cpp_builtin_type): Rename from enum
5822 builtin_type. Change all uses.
5824 2009-05-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5827 * directives (do_linemarker): Compensate for the increment in
5828 location that occurs when we reach the end of line.
5829 * files (_cpp_stack_include): Mention _cpp_find_file in the
5832 2009-05-10 Joseph Myers <joseph@codesourcery.com>
5834 * include/cpplib.h (enum cpp_token_fld_kind): Add
5835 CPP_TOKEN_FLD_TOKEN_NO.
5836 (struct cpp_macro_arg, struct cpp_identifier): Define.
5837 (union cpp_token_u): Use struct cpp_identifier for identifiers.
5838 Use struct cpp_macro_arg for macro arguments. Add token_no for
5839 CPP_PASTE token numbers.
5840 * directives.c (_cpp_handle_directive, lex_macro_node, do_pragma,
5841 do_pragma_poison, parse_assertion): Use val.node.node in place of
5843 * expr.c (parse_defined, eval_token): Use val.node.node in place
5845 * lex.c (cpp_ideq, _cpp_lex_direct, cpp_token_len,
5846 cpp_spell_token, cpp_output_token, _cpp_equiv_tokens,
5847 cpp_token_val_index): Use val.macro_arg.arg_no or val.token_no in
5848 place of val.arg_no. Use val.node.node in place of val.node.
5849 * macro.c (replace_args, cpp_get_token, parse_params,
5850 lex_expansion_token, create_iso_definition, cpp_macro_definition):
5851 Use val.macro_arg.arg_no or val.token_no in place of val.arg_no.
5852 Use val.node.node in place of val.node.
5854 2009-05-03 Joseph Myers <joseph@codesourcery.com>
5856 * charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte
5859 2009-04-25 Joseph Myers <joseph@codesourcery.com>
5861 PR preprocessor/39559
5862 * expr.c (cpp_interpret_integer): Use a pedwarn for decimal
5863 constants larger than intmax_t in C99 mode.
5865 2009-04-21 Taras Glek <tglek@mozilla.com>
5867 * include/cpp-id-data.h: Update GTY annotations to new syntax.
5868 * include/cpplib.h: Likewise.
5869 * include/line-map.h: Likewise.
5870 * include/symtab.h: Likewise.
5872 2009-04-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5875 * lex.c (cpp_type2name): Take a flags parameter. Call
5876 cpp_named_operator2name for named operators and cpp_digraph2name
5878 (cpp_digraph2name): New.
5879 (cpp_spell_token): Use it.
5880 (cpp_output_token): Likewise.
5881 * include/cpplib.h (cpp_type2name): Update declaration.
5882 * init.c (cpp_named_operator2name): New.
5883 * internal.h (cpp_named_operator2name): Declare.
5885 2009-04-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5888 * init.c (cpp_create_reader): Wlong_long is disabled by default.
5889 * expr.c (cpp_classify_number): Give different messages for C and
5892 2009-04-19 Joseph Myers <joseph@codesourcery.com>
5894 PR preprocessor/20078
5895 * include/cpp-id-data.h (struct cpp_macro): Add extra_tokens
5897 * include/cpplib.h (SP_DIGRAPH, SP_PREV_WHITE): Define.
5898 (struct cpp_token): Change flags to unsigned short.
5899 * lex.c (_cpp_lex_direct): Initialize arg_no for CPP_PASTE tokens.
5900 (_cpp_equiv_tokens): Check arg_no for CPP_PASTE tokens.
5901 (cpp_token_val_index): Return CPP_TOKEN_FLD_ARG_NO for CPP_PASTE
5903 * macro.c (macro_real_token_count): New.
5904 (enter_macro_context, replace_args): Use macro_real_token_count.
5905 (create_iso_definition): Record whitespace surrounding and digraph
5906 spelling of # and ## tokens using SP_PREV_WHITE and SP_DIGRAPH.
5907 Set extra_tokens and save CPP_PASTE tokens with arg_no set for
5908 multiple consecutive ## tokens.
5909 (_cpp_create_definition): Initialize extra_tokens.
5910 (cpp_macro_definition): Use macro_real_token_count.
5912 2009-04-18 Joseph Myers <joseph@codesourcery.com>
5914 * directives.c (parse_include): Pass true to check_eol.
5916 2009-04-18 Joseph Myers <joseph@codesourcery.com>
5918 PR preprocessor/39646
5919 * include/line-map.h (enum lc_reason): Add LC_RENAME_VERBATIM.
5920 * line-map.c (linemap_add): Handle LC_RENAME_VERBATIM.
5921 * directives.c (do_line, do_linemarker): Use LC_RENAME_VERBATIM in
5924 2009-04-18 Joseph Myers <joseph@codesourcery.com>
5926 PR preprocessor/39647
5927 * directives.c (check_eol): Add parameter expand.
5928 (do_undef, parse_include, do_line, do_linemarker, do_ident,
5929 do_pragma_once, do_pragma_system_header, do_ifdef, do_ifndef,
5930 do_else, do_endif, do_assert, do_unassert): All callers changed.
5931 Pass true from do_line, false elsewhere.
5933 2009-04-12 Joseph Myers <joseph@codesourcery.com>
5935 PR preprocessor/31869
5936 * macro.c (stringify_arg): Handle NULL source token in padding
5937 token where previous padding token did not have source token with
5938 preceding whitespace.
5940 2009-04-09 Jakub Jelinek <jakub@redhat.com>
5942 * Makefile.in: Change copyright header to refer to version
5943 3 of the GNU General Public License and to point readers at the
5944 COPYING3 file and the FSF's license web page.
5945 * charset.c: Likewise.
5946 * directives-only.c: Likewise.
5947 * directives.c: Likewise.
5948 * errors.c: Likewise.
5950 * files.c: Likewise.
5951 * identifiers.c: Likewise.
5952 * include/cpp-id-data.h: Likewise.
5953 * include/cpplib.h: Likewise.
5954 * include/line-map.h: Likewise.
5955 * include/mkdeps.h: Likewise.
5956 * include/symtab.h: Likewise.
5958 * internal.h: Likewise.
5960 * line-map.c: Likewise.
5961 * macro.c: Likewise.
5962 * makeucnid.c: Likewise.
5963 * mkdeps.c: Likewise.
5965 * symtab.c: Likewise.
5966 * system.h: Likewise.
5967 * traditional.c: Likewise.
5968 * ucnid.tab: Likewise.
5969 * ucnid.h: Regenerate.
5971 2009-04-01 Janis Johnson <janis187@us.ibm.com>
5974 * include/cpplib.h (CPP_N_DEFAULT): Define.
5975 * expr.c (interpret_float_suffix): Recognize d or D for double,
5976 return new value for default.
5977 (cpp_classify_number): Issue pedwarn for use of d or D in suffix.
5980 * expr.c (interpret_float_suffix): Reject invalid suffix that uses
5981 letters from decimal float and fixed-point suffixes.
5983 2009-03-31 Joseph Myers <joseph@codesourcery.com>
5985 PR preprocessor/15638
5986 * files.c (_cpp_find_file): Call open_file_failed after diagnosing
5988 (open_file_failed): Make error for missing file fatal.
5989 * include/cpplib.h (CPP_DL_FATAL): Define.
5991 2009-03-30 Sergiy Vyshnevetskiy <serg@vostok.net>
5993 PR preprocessor/31932:
5994 * internal.h: Don't mention HAVE_ICONV_H.
5995 * configure, config.in: Rebuild.
5996 * configure.ac: Don't check for iconv.h.
5998 2009-03-30 Tom Tromey <tromey@redhat.com>
6000 PR preprocessor/39512:
6001 * line-map.c (linemap_init): Initialize 'reallocator' field.
6003 2009-03-30 Jakub Jelinek <jakub@redhat.com>
6006 * macro.c (cpp_get_token): If macro_to_expand returns NULL
6007 and used some tokens, add CPP_PADDING before next token.
6009 2009-03-29 Joseph Myers <joseph@codesourcery.com>
6011 PR preprocessor/34695
6012 * makedepend.c: Remove.
6013 * Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove.
6014 (all, clean, TAGS_SOURCES, include): Remove makedepend handling.
6015 * directives.c (cpp_errors): Remove.
6016 * errors.c (print_location, _cpp_begin_message, v_message):
6018 (cpp_error, cpp_error_with_line): Always use error callback.
6019 (cpp_error, cpp_error_with_line, cpp_errno): Return bool.
6020 * include/cpplib.h (cpp_options): Remove pedantic_errors,
6021 inhibit_warnings, warn_system_headers, inhibit_errors,
6022 warnings_are_errors, client_diagnostic.
6023 (cpp_callbacks): Add extra arguments to error callback; make it
6025 (cpp_finish): Return void.
6026 (cpp_destroy): Remove inaccurate comment about return value.
6027 (cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove.
6028 (CPP_DL_NOTE): Define.
6029 * include/line-map.h (linemap_print_containing_files): Remove.
6030 * init.c (cpp_finish): Do not check for or return number of
6032 * internal.h (cpp_reader): Remove errors field.
6033 * line-map.c (linemap_print_containing_files): Remove.
6034 * macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message
6035 about previous definition. Only emit it if previous diagnostic
6038 2009-03-28 Joseph Myers <joseph@codesourcery.com>
6040 * Makefile.in (po/$(PACKAGE).pot): Use $(mkinstalldirs) not
6043 2009-03-18 Jakub Jelinek <jakub@redhat.com>
6045 * include/cpplib.h (struct cpp_dir): Reorder fields for 64-bit hosts.
6047 2009-02-21 Joseph Myers <joseph@codesourcery.com>
6049 * lex.c (lex_string): Return a CPP_LESS token for missing '>' in a
6051 (_cpp_lex_direct): Handle this.
6053 2009-02-15 Richard Guenther <rguenther@suse.de>
6057 2009-02-13 Richard Guenther <rguenther@suse.de>
6059 * configure.ac: Enable LFS.
6060 * configure: Re-generate.
6061 * config.in: Likewise.
6063 2009-01-05 Ben Elliston <bje@au.ibm.com>
6065 * Makefile.in (.po.gmo): Use mkinstalldirs, not test -d || mkdir.
6066 (.po.pox): Likewise.
6067 (po/$(PACKAGE).pot): Likewise.
6069 2008-12-10 Alexandre Oliva <aoliva@redhat.com>
6072 * pch.c (cpp_valid_state): Improve message for poisoned symbols.
6073 Allow for differences in __GCC_HAVE_DWARF2_CFI_ASM.
6075 2008-11-29 Joseph Myers <joseph@codesourcery.com>
6077 * lex.c (cpp_token_len): Use 6 as default length.
6079 2008-10-31 Manuel López-Ibáñez <manu@gcc.gnu.org>
6081 * expr.c (struct op): Add location.
6082 (_cpp_parse_expr): Propagate locations throught the stack
6085 (check_promotion): Use explicit location in errors.
6087 2008-10-05 Matthew Gingell <gingell@adacore.com>
6088 Arnaud Charlet <charlet@adacore.com>
6090 * include/cpplib.h (cpp_comments, cpp_comment_table): New structs.
6091 (cpp_get_comments): New function.
6092 * internal.h (struct cpp_reader): Add comments field.
6093 * init.c (cpp_destroy): Free comments.
6094 * lex.c (store_comment, cpp_get_comments): New functions.
6095 (comments): New struct.
6096 (save_comment): Store comments in comments struct.
6098 2008-09-18 Simon Baldwin <simonb@google.com>
6100 * include/cpplib.h (struct cpp_options): Add new boolean flag
6101 warn_builtin_macro_redefined.
6102 * init.c (cpp_create_reader): Initialize warn_builtin_macro_redefined.
6103 * (struct builtin_operator): Split out from previous struct builtin,
6104 enhance extra const correctness.
6105 * (struct builtin_macro): Split out from previous struct builtin, add
6106 new always_warn_if_redefined flag, enhance const correctness.
6107 * (mark_named_operators): Use struct builtin_operator.
6108 * (cpp_init_special_builtins): Use struct builtin_macro, add NODE_WARN
6109 to builtins selectively.
6110 * macro.c (warn_of_redefinition): Return false if a builtin macro
6111 is not flagged with NODE_WARN.
6113 2008-07-31 Jakub Jelinek <jakub@redhat.com>
6115 PR preprocessor/36649
6116 * files.c (struct report_missing_guard_data): New type.
6117 (report_missing_guard): Put paths into an array instead of printing
6118 them right away. Return 1 rather than 0.
6119 (report_missing_guard_cmp): New function.
6120 (_cpp_report_missing_guards): Sort and print paths gathered by
6121 report_missing_guard callback.
6123 2008-07-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
6126 * directives.c (strtolinenum): Handle overflow.
6127 (do_line): Give a warning if line number overflowed.
6128 (do_linemarker): Update call to strtolinenum.
6130 2008-07-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
6132 * include/line-map.h (linenum_type): New typedef.
6133 (struct line_map): Use it.
6134 (SOURCE_LINE): Second arguments is a LOCATION not a LINE.
6135 (SOURCE_COLUMN): Likewise.
6136 * macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store
6137 source_location values in a variable of type linenum_type.
6138 * directives.c (struct if_stack): Use linenum_type.
6139 (strtoul_for_line): Rename as strtolinenum.
6140 (do_line): Use linenum_type.
6141 (do_linemarker): Use linenum_type and strtolinenum.
6142 (_cpp_do_file_change): Use linenum_t.
6143 * line-map.c (linemap_add): Likewise.
6144 (linemap_line_start): Likewise.
6145 * traditional.c (struct fun_macro): 'line' is a source_location.
6146 * errors.c (print_location): Use linenum_type.
6147 * directives-only.c (_cpp_preprocess_dir_only): Likewise.
6148 * internal.h (CPP_INCREMENT_LINE): Likewise.
6149 * lex.c (_cpp_skip_block_comment): Use source_location.
6151 2008-07-14 Ben Elliston <bje@au.ibm.com>
6153 * include/cpplib.h (NODE_CONDITIONAL): New.
6154 (struct cpp_callbacks): New macro_to_expand field.
6155 (struct cpp_hashnode): Adjust size of flags and type fields.
6156 (cpp_peek_token): Prototype.
6157 * lex.c (cpp_peek_token): New function.
6158 (_cpp_temp_token): Protect pre-existing lookaheads.
6159 * macro.c (cpp_get_token): Expand any conditional macros.
6160 (_cpp_backup_tokens_direct): New.
6161 (_cpp_backup_tokens): Call _cpp_backup_tokens_direct.
6162 (warn_of_redefinition): Silently allow redefined conditional
6164 (_cpp_create_definition): Remove the conditional flag when a user
6165 defines one of the conditional macros.
6166 * internal.h (_cpp_backup_tokens_direct): New prototype.
6168 2008-06-13 Andrew Haley <aph@redhat.com>
6170 PR preprocessor/33305
6171 * macro.c (replace_args): Print a warning for empty macro
6172 arguments in C89 and C++.
6174 2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6176 * Makefile.in ($(srcdir)/aclocal.m4): Update dependencies.
6177 * configure: Regenerate.
6179 2008-06-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6181 * Makefile.in (datarootdir): New variable.
6183 2008-06-12 H.J. Lu <hongjiu.lu@intel.com>
6185 PR preprocessor/36479
6186 * charset.c (cpp_interpret_string_notranslate): Also set
6187 narrow_cset_desc.width.
6189 2008-06-07 Joseph Myers <joseph@codesourcery.com>
6191 * configure.ac (parisc*64*-*-*): Remove.
6192 * configure: Regenerate.
6194 2008-05-30 Tom Tromey <tromey@redhat.com>
6196 PR preprocessor/36320:
6197 * internal.h (_cpp_parse_expr): Update.
6198 * expr.c (_cpp_parse_expr): Add 'is_if' argument. Update error
6200 * directives.c (do_if): Update.
6201 (do_elif): Require expression if processing group.
6203 2008-05-30 Danny Smith <dannysmith@users.sourceforge.net>
6205 * include/cpplib.h (struct cpp_dir): Add new field, canonical_name.
6207 2008-05-21 Tom Tromey <tromey@redhat.com>
6209 PR preprocessor/27777:
6210 * lex.c (cpp_output_line_to_string): New function.
6211 * internal.h (_cpp_begin_message): Don't declare.
6212 * errors.c (_cpp_begin_message): Now static.
6213 * include/cpplib.h (cpp_output_line_to_string): Declare.
6214 * directives.c (do_diagnostic): Rewrote. Use
6215 cpp_output_line_to_string. Don't use _cpp_begin_message.
6217 2008-05-21 Tom Tromey <tromey@redhat.com>
6219 * include/symtab.h (HT_ALLOCED): Remove.
6220 (ht_purge): Declare.
6221 * symtab.c (DELETED): New define.
6222 (ht_lookup): Update comment.
6223 (ht_lookup_with_hash): Handle deleted entries. Remove HT_ALLOCED
6224 code. Use subobject allocator for strings, if it exists.
6225 (ht_expand): Handle deleted entries.
6226 (ht_forall): Likewise.
6227 (ht_purge): New function.
6228 (ht_dump_statistics): Print deletion statistics.
6230 2008-05-13 Tom Tromey <tromey@redhat.com>
6232 PR preprocessor/22168:
6233 * include/cpplib.h (struct cpp_options) <objc>: Update
6235 * expr.c (eval_token): Warn for use of assertions.
6236 * directives.c (directive_diagnostics): Warn about extensions.
6237 (DEPRECATED): New define.
6238 (DIRECTIVE_TABLE): Use it.
6240 2008-05-06 Tom Tromey <tromey@redhat.com>
6242 PR preprocessor/35313, PR preprocessor/36088:
6243 * expr.c (optab) <QUERY, COMMA>: Set precedence to 4.
6244 (reduce) <case CPP_QUERY>: Special case CPP_COMMA and CPP_COLON.
6246 2008-05-04 David S. Miller <davem@davemloft.net>
6248 * configure.ac (sparc*-*-*): Always set need_64bit_hwint to yes.
6249 * configure: Regenerate.
6251 2008-04-22 Daniel Franke <franke.daniel@gmail.com>
6253 * include/cpplib.h (cpp_define_formatted): New.
6254 * directives.c (cpp_define_formatted): New.
6256 2008-04-21 Tom Tromey <tromey@redhat.com>
6259 * charset.c (_cpp_convert_input): Add buffer_start argument.
6260 Ignore UTF-8 BOM if seen.
6261 * internal.h (_cpp_convert_input): Add argument.
6262 * files.c (struct _cpp_file) <buffer_start>: New field.
6263 (destroy_cpp_file): Free buffer_start, not buffer.
6264 (_cpp_pop_file_buffer): Likewise.
6265 (read_file_guts): Update.
6267 2008-04-18 Kris Van Hees <kris.van.hees@oracle.com>
6269 * include/cpp-id-data.h (UC): Was U, conflicts with U"..." literal.
6270 * include/cpplib.h (CHAR16, CHAR32, STRING16, STRING32): New tokens.
6271 (struct cpp_options): Added uliterals.
6272 (cpp_interpret_string): Update prototype.
6273 (cpp_interpret_string_notranslate): Idem.
6274 * charset.c (init_iconv_desc): New width member in cset_converter.
6275 (cpp_init_iconv): Add support for char{16,32}_cset_desc.
6276 (convert_ucn): Idem.
6277 (emit_numeric_escape): Idem.
6278 (convert_hex): Idem.
6279 (convert_oct): Idem.
6280 (convert_escape): Idem.
6281 (converter_for_type): New function.
6282 (cpp_interpret_string): Use converter_for_type, support u and U prefix.
6283 (cpp_interpret_string_notranslate): Match changed prototype.
6284 (wide_str_to_charconst): Use converter_for_type.
6285 (cpp_interpret_charconst): Add support for CPP_CHAR{16,32}.
6286 * directives.c (linemarker_dir): Macro U changed to UC.
6287 (parse_include): Idem.
6288 (register_pragma_1): Idem.
6289 (restore_registered_pragmas): Idem.
6290 (get__Pragma_string): Support CPP_STRING{16,32}.
6291 * expr.c (eval_token): Support CPP_CHAR{16,32}.
6292 * init.c (struct lang_flags): Added uliterals.
6293 (lang_defaults): Idem.
6294 * internal.h (struct cset_converter) <width>: New field.
6295 (struct cpp_reader) <char16_cset_desc>: Idem.
6296 (struct cpp_reader) <char32_cset_desc>: Idem.
6297 * lex.c (digraph_spellings): Macro U changed to UC.
6299 (lex_string): Add support for u'...', U'...', u"..." and U"...".
6300 (_cpp_lex_direct): Idem.
6301 * macro.c (_cpp_builtin_macro_text): Macro U changed to UC.
6302 (stringify_arg): Support CPP_CHAR{16,32} and CPP_STRING{16,32}.
6304 2008-04-18 Paolo Bonzini <bonzini@gnu.org>
6307 * aclocal.m4: Regenerate.
6308 * configure: Regenerate.
6310 2008-04-17 Tom Tromey <tromey@redhat.com>
6313 * errors.c (cpp_error): Don't reference a token before the start
6316 2008-04-16 Tom Tromey <tromey@redhat.com>
6318 * Makefile.in (TAGS_SOURCES): New variable.
6321 2008-04-11 Kaz Kojima <kkojima@gcc.gnu.org>
6323 * configure.ac: (need_64bit_hwint): Need 64bit hwint for sh-*-*
6325 * configure: Rebuilt.
6327 2008-04-02 Joseph Myers <joseph@codesourcery.com>
6329 * include/cpplib.h (struct cpp_callbacks): Add used_define,
6330 used_undef and before_define.
6331 (NODE_USED): Define.
6332 * directives.c (do_define, do_undef, undefine_macros, do_ifdef,
6333 do_ifndef, cpp_pop_definition): Handle new flag and use new
6335 * expr.c (parse_defined): Handle new flag and use new callbacks.
6336 * macro.c (enter_macro_context, _cpp_free_definition): Handle new
6337 flag and use new callbacks.
6339 2008-04-01 Jakub Jelinek <jakub@redhat.com>
6342 * files.c (struct _cpp_file): Remove pch field.
6343 (pch_open_file): Don't set file->pch, just file->pchname.
6344 (should_stack_file): After pfile->cb.read_pch call
6345 free pchname and clear pchname, don't close file->fd.
6346 Test file->pchname instead of file->pch. Don't close fd after cb.
6347 (_cpp_stack_include): Test file->pchname instead of file->pch.
6349 2008-03-28 Tom Tromey <tromey@redhat.com>
6351 * Makefile.in (POSTCOMPILE): New variable.
6354 2008-03-13 Tom Tromey <tromey@redhat.com>
6357 * directives.c (destringize_and_run): Set pfile->directive.
6359 2008-03-06 Markus Milleder <markus.milleder@generali.at>
6361 PR preprocessor/35458
6362 * mkdeps.c (munge): Quote '#' with a '\'.
6364 2008-02-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6366 PR preprocessor/35379
6367 * mkdeps.c (deps_write): Ensure the first target always appears
6368 in the first column, without leading backslash newline. Avoid
6369 some more extra whitespace.
6371 2008-02-25 Thiemo Seufer <ths@mips.com>
6373 * Makefile.in ($(srcdir)/config.in): Depend on configure.ac.
6375 2008-02-19 Tom Tromey <tromey@redhat.com>
6377 * traditional.c (lex_identifier): Use CPP_HASHNODE.
6378 * lex.c (lex_identifier): Use CPP_HASHNODE.
6379 * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Wrap in
6381 * identifiers.c (alloc_node): Change return type.
6382 (_cpp_init_hashtable): Don't cast 'alloc_node'.
6383 (proxy_assertion_broken): New declaration.
6384 (cpp_forall_identifiers): Move comment.
6385 * line-map.c (linemap_add): Comment fix.
6386 (linemap_line_start): Indentation fix.
6388 2008-01-25 Jakub Jelinek <jakub@redhat.com>
6390 PR preprocessor/34692
6391 * macro.c (collect_args): Add pragma_buff argument. Push
6392 CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather
6393 than into arguments. Reset prevent_expansion and parsing_args
6394 state at CPP_PRAGMA_EOL/CPP_EOF.
6395 (funlike_invocation_p): Add pragma_buff argument, pass it through
6397 (enter_macro_context): Add result argument. Adjust
6398 funlike_invocation_p caller. Emit all deferred pragma tokens
6399 gathered during collect_args before the expansion, add a padding
6400 token. Return 2 instead of 1 if any pragma tokens were prepended.
6401 (cpp_get_token): If enter_macro_context returns 2, don't return
6402 a padding token, instead cycle to grab CPP_PRAGMA token.
6403 * directives.c (_cpp_handle_directive): If was_parsing_args
6404 in deferred pragma, leave parsing_args and prevent_expansion as is.
6406 2008-01-22 Tom Tromey <tromey@redhat.com>
6409 * macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and
6410 __STDC_CONSTANT_MACROS.
6412 2008-01-07 Fred Fish <fnf@specifix.com>
6414 PR preprocessor/30363
6415 * traditional.c (replace_args_and_push): Add local variable
6416 cxtquote, calculate the replacement text size assuming a
6417 worst case of every input character quoted with backslash,
6418 and properly handle output quoting of quote characters in
6419 actual arguments used in function-like macros.
6421 2008-01-03 Tom Tromey <tromey@redhat.com>
6423 PR preprocessor/34602
6424 * directives.c (do_line): Don't try to spell EOF token.
6425 (do_linemarker): Add comment.
6427 2007-12-11 DJ Delorie <dj@redhat.com>
6429 * charset.c (convert_using_iconv): Close out any shift states,
6430 returning to the initial state.
6432 2007-12-06 Tom Tromey <tromey@redhat.com>
6435 * internal.h (struct cpp_reader) <file_hash_entries>: Changed
6437 <file_hash_entries_allocated, file_hash_entries_used>: Removed.
6438 * files.c (FILE_HASH_POOL_SIZE): New macro.
6439 (struct file_hash_entry_pool): New.
6440 (destroy_all_cpp_files): New function.
6441 (allocate_file_hash_entries): Allocate a file_hash_entry_pool.
6442 (new_file_hash_entry): Update.
6443 (free_file_hash_entries): New function.
6444 (_cpp_cleanup_files): Call free_file_hash_entries and
6445 destroy_all_cpp_files.
6446 (cpp_clear_file_cache): New function.
6447 * include/cpplib.h (cpp_clear_file_cache): Declare.
6449 2007-12-03 Tom Tromey <tromey@redhat.com>
6451 PR preprocessor/34288
6452 * configure.ac, config.in: Rebuilt.
6453 * configure.ac: Check for ssize_t.
6455 2007-11-30 Tom Tromey <tromey@redhat.com>
6457 PR preprocessor/32868
6458 * macro.c (_cpp_create_definition): Special case
6459 __STDC_FORMAT_MACROS.
6461 2007-11-16 Michael Matz <matz@suse.de>
6463 * files.c (search_path_head): Fix check for absolute paths.
6465 2007-11-11 Tom Tromey <tromey@redhat.com>
6468 * include/cpplib.h (cpp_included_before): Declare.
6469 * files.c (struct file_hash_entry) <location>: New field.
6470 (_cpp_find_file): Initialize new field.
6471 (make_cpp_dir): Likewise.
6472 (cpp_included_before): New function.
6474 2007-11-01 Tom Tromey <tromey@redhat.com>
6476 PR preprocessor/30805
6477 * macro.c (paste_tokens): Handle padding token.
6478 (paste_tokens): Don't abort unless padding has PASTE_LEFT flag.
6480 2007-10-31 Tom Tromey <tromey@redhat.com>
6482 PR preprocessor/30786
6483 * macro.c (builtin_macro): Return result of _cpp_do__Pragma.
6484 * directives.c (_cpp_do__Pragma): Return error status.
6485 * internal.h (_cpp_do__Pragma): Update.
6486 * directives.c (get__Pragma_string): Back up if EOF seen.
6488 2007-09-06 Tom Tromey <tromey@redhat.com>
6490 * internal.h (struct cpp_reader) <invocation_location>: New
6492 (struct cpp_reader) <set_invocation_location>: Likewise.
6493 * init.c (cpp_set_line_map): New function.
6494 * line-map.c (linemap_add): Use linemap's allocator.
6495 * include/line-map.h (GTY): Define.
6496 (line_map_realloc): New typedef.
6497 (struct line_map): Mark with GTY.
6498 (struct line_maps): Likewise.
6499 (struct line_maps) <maps>: Likewise.
6500 (struct line_maps) <reallocator>: New field.
6501 * include/symtab.h (GTY): Conditionally define.
6502 * include/cpplib.h (cpp_set_line_map): Declare.
6503 (cpp_get_token_with_location): Declare.
6504 * macro.c (cpp_get_token): Set invocation_location on the reader.
6505 (cpp_get_token_with_location): New function.
6507 2007-08-30 Chao-ying Fu <fu@mips.com>
6509 * expr.c (interpret_float_suffix): Support hr, r, lr, llr, uhr, ur,
6510 ulr, ullr, hk, k, lk, llk, uhk, uk, ulk, ullk.
6511 (cpp_classify_number): Support decimal fixed-point constants without
6513 Warn about fixed-point constants when -pedantic.
6514 * include/cpplib.h (CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE): Change
6515 comments to support fixed-point values.
6516 (CPP_N_FRACT, CPP_N_ACCUM): Define.
6518 2007-08-18 Tom Tromey <tromey@redhat.com>
6520 PR preprocessor/32974
6521 * directives.c (parse_include): Don't check for EOL when
6522 processing #pragma dependency.
6524 2007-07-30 Ollie Wild <aaw@google.com>
6526 * directives-only.c: New file.
6527 * internal.h (struct _cpp_dir_only_callbacks): New.
6528 (_cpp_preprocess_dir_only): New function.
6529 * directives.c (_cpp_handle_directive): Check directives_only before
6530 disabling execution of indented directives.
6531 * files.c (_cpp_stack_file): Add directives_only check.
6532 * include/cpplib.h (struct cpp_options): Add directives_only.
6533 (cpp_init_special_builtins): New function.
6534 * init.c (cpp_init_special_builtins): New function.
6535 (cpp_init_builtins): Move builtin_array initialization to
6536 cpp_init_special_builtins.
6537 (post_options): Check directives_only before setting
6538 pfile->state.prevent_expansion = 1.
6539 * macro.c (_cpp_builtin_macro_text): Print an error if __COUNTER__
6540 is expanded inside a directive while -fdirectives-only is enabled.
6541 * Makefile.in (libcpp_a_OBJS): Add directives-only.o.
6542 (libcpp_a_SOURCES): Add directives-only.c.
6544 2007-07-04 Uros Bizjak <ubizjak@gmail.com>
6546 * traditional.c (_cpp_scan_out_logical_line): Initialize
6547 fmacro.args, fmacro.node, fmacro.offset, fmacro.line and
6548 fmacro.args to prevent 'may be used uninitialized' warning.
6550 2007-07-03 Uros Bizjak <ubizjak@gmail.com>
6552 * include/cpplib.h (CPP_N_WIDTH_MD, CPP_N_MD_W, CPP_N_MD_Q):
6554 * expr.c (interpret_float_suffix): Process 'w', 'W', 'q' and 'Q'
6555 suffixes. Return CPP_N_MD_W for 'w' or 'W' suffixes and CPP_N_MD_Q
6556 for 'q' or 'Q' suffixes.
6558 2007-06-17 Danny Smith <dannysmith@users.sourceforge.net
6560 * files.c (open_file): Correct typo.
6562 2007-06-16 Vladimir Prus <vladimir@codesourcery.com>
6564 * files.c (open_file): Prevent the call
6565 for stat from overwriting errno.
6567 2007-06-09 Vladimir Prus <vladimir@codesourcery.com>
6569 * files.c (open_file): Account for the
6570 fact that on windows, opening a directory gives
6573 2007-06-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
6575 PR preprocessor/23479
6576 * expr.c (cpp_classify_number): Implement 0b-prefixed binary
6578 (append_digit): Likewise.
6579 * include/cpplib.h: Add CPP_N_BINARY, to be used for 0b-prefixed
6580 binary integer constants.
6582 2007-05-31 Dave Korn <dave.korn@artimi.com>
6584 PR preprocessor/14331
6585 * lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.
6587 2007-05-24 Ollie Wild <aaw@google.com>
6589 * macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
6590 * pch.c (cpp_write_pch_deps): Save __COUNTER__ state.
6591 (cpp_write_pch_state): Save __COUNTER__ state.
6592 (cpp_valid_state): Check valid __COUNTER__ state.
6593 (cpp_read_state): Read new __COUNTER__ state.
6594 * include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator.
6595 * init.c (builtin_array): Add __COUNTER__/BT_COUNTER.
6596 * internal.h (struct cpp_reader): Add counter member.
6598 2007-05-23 Simon Martin <simartin@users.sourceforge.net>
6600 PR preprocessor/20077
6601 * macro.c (create_iso_definition): Fixed the method to determine
6602 whether the token-pasting operator appears at the beginning or the end
6605 2007-05-21 Ian Lance Taylor <iant@google.com>
6607 * internal.h (struct cpp_reader): Add new fields:
6608 nonexistent_file_hash and nonexistent_file_ob.
6609 * files.c: Include "obstack.h".
6610 (find_file_in_dir): Before trying to open the file, look up the
6611 path name in the hash table of nonexistent files. After failing
6612 to open the file, add the path name to the hash table.
6613 (_cpp_find_file): Cache the results of looking up the file name
6614 starting with the quote and bracket chain heads, if we can.
6615 (nonexistent_file_hash_eq): New static function.
6616 (_cpp_init_files): Initialize pfile->nonexistent_file_hash and
6617 pfile->nonexistent_file_ob.
6618 (_cpp_cleanup_files): Free pfile->nonexistent_file_hash and
6619 pfile->nonexistent_file_ob.
6621 2007-05-14 Janis Johnson <janis187@us.ibm.com>
6623 * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
6626 * expr.c (interpret_float_suffix): Check for invalid suffix.
6628 2007-05-02 Eric Christopher <echristo@apple.com>
6630 * expr.c (num_div_op): Don't overflow if the result is
6633 2007-05-02 Tom Tromey <tromey@redhat.com>
6635 PR preprocessor/28709
6636 * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.
6638 2007-03-30 Michael Meissner <michael.meissner@amd.com>
6640 * directives.c (lex_macro_node_from_str): Fix alloca call to be
6643 2007-03-30 Richard Henderson <rth@redhat.com>
6645 * directives.c (lex_macro_node_from_str): New.
6646 (cpp_push_definition, cpp_pop_definition): New.
6647 * include/cpplib.h (cpp_push_definition, cpp_pop_definition): Declare.
6649 2007-03-01 Brooks Moses <brooks.moses@codesourcery.com>
6651 * Makefile.in: Add dummy install-pdf target.
6653 2007-01-30 Tom Tromey <tromey@redhat.com>
6655 PR preprocessor/30468
6656 * mkdeps.c (apply_vpath): Strip successive '/'s if we stripped
6659 2007-01-30 Tom Tromey <tromey@redhat.com>
6661 PR preprocessor/29966
6662 * macro.c (lex_expansion_token): Save and restore cpp_reader's
6664 (_cpp_create_definition): Don't restore cur_token here.
6665 * lex.c (_cpp_lex_token): Added assertion.
6667 2007-01-27 Tom Tromey <tromey@redhat.com>
6669 * configure: Rebuilt.
6671 2007-01-12 Tom Tromey <tromey@redhat.com>
6673 PR preprocessor/28227
6674 * directives.c (lex_macro_node): Added 'is_def_or_undef'
6676 (do_define): Update.
6679 (do_ifndef): Update.
6681 2007-01-11 Paolo Bonzini <bonzini@gnu.org>
6683 * configure: Regenerate.
6685 2007-01-11 Paolo Bonzini <bonzini@gnu.org>
6687 * configure: Regenerate.
6689 2007-01-04 Tom Tromey <tromey@redhat.com>
6691 PR preprocessor/28165
6692 * internal.h (cpp_in_primary_file): New function.
6693 * directives.c (do_include_next): Use cpp_in_primary_file.
6694 (do_pragma_once): Likewise.
6695 (do_pragma_system_header): Likewise.
6697 2006-12-29 Ian Lance Taylor <iant@google.com>
6699 * lex.c (_cpp_clean_line): Add uses of __builtin_expect. Don't
6700 look backward at the end of the line unless we saw a backslash.
6702 2006-12-29 Jakub Jelinek <jakub@redhat.com>
6704 PR preprocessor/29612
6705 * directives.c (do_linemarker): Set pfile->buffer->sysp always, not
6706 only when new_sysp is non-zero.
6708 2006-12-28 Tom Tromey <tromey@redhat.com>
6710 PR preprocessor/30001
6711 * charset.c (_cpp_convert_input): Check that to.len is greater
6714 2006-11-20 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
6716 * configure.ac (need_64bit_hwint): Need 64bit hwint for SPU.
6717 * configure: Rebuilt.
6719 2006-11-01 Douglas Gregor <doug.gregor@gmail.com>
6721 * include/cpplib.h (enum c_lang): Add CLK_GNUCXX0X and CLK_CXX0X
6722 for experimental C++0x mode.
6723 * init.c (lang_defaults): Add defaults for C++0x modes. C++0x has
6724 adopted the preprocessor changes introduced in C99.
6726 2006-10-29 Joseph Myers <joseph@codesourcery.com>
6728 * configure.ac (need_64bit_hwint): Set for i[34567]86-*-linux*
6729 depending on --enable-targets=all.
6730 * configure: Regenerate.
6732 2006-10-12 Jakub Jelinek <jakub@redhat.com>
6734 PR preprocessor/28709
6735 * macro.c (paste_tokens): Do error reporting here, use BUF with the
6736 spelled LHS token as opposed to spelling it again.
6737 (paste_all_tokens): Don't report errors here, just break on failure.
6739 2006-10-10 Brooks Moses <bmoses@stanford.edu>
6741 * Makefile.in: Added empty "pdf" target.
6743 2006-09-22 Geoffrey Keating <geoffk@apple.com>
6745 * configure.ac: Make need_64_bit_hwint case for x86-darwin
6746 match exactly the glob in gcc/config.gcc.
6747 * configure: Regenerate.
6749 2006-09-13 Joseph S. Myers <joseph@codesourcery.com>
6752 PR preprocessor/14634
6753 * lex.c (lex_string): Pedwarn for unterminated literals.
6755 2006-09-08 Eric Christopher <echristo@apple.com>
6757 * configure.ac: Add 64-bit HWI support for i?86-darwin.
6759 2006-08-14 Steve Ellcey <sje@cup.hp.com>
6763 * include/cpplib.h: Remove <?, >?, <?=, and >?= tokens.
6764 (CPP_LAST_EQ): Change.
6765 (CPP_LAST_PUNCTUATOR): Change.
6766 * expr.c (cpp_operator): Remove MIN and MAX.
6767 (reduce): Remove CPP_MIN and CPP_MAX.
6768 (num_binary_op): Ditto.
6769 * lex.c (_cpp_lex_direct): Ditto.
6770 (cpp_avoid_paste): Remove ? as legal symbol after > or <.
6772 2006-06-09 Jakub Jelinek <jakub@redhat.com>
6774 PR preprocessor/27746
6775 * directives.c (do_pragma): Handle pragma with valid namespace
6776 and invalid name coming from macro expansion.
6777 * directives.c (destringize_and_run): Initialize next field in
6782 * directives.c (destringize_and_run): Set NO_EXPAND on the
6785 * macro.c (_cpp_backup_tokens): Fix comment typo.
6787 2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
6789 * Makefile.in (CATALOGS): Add po/ prefix.
6790 * configure: Regenerated.
6792 2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
6794 * Makefile.in: Add install-html target. Add install-html to .PHONY
6796 2006-02-17 Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com>
6798 * macro.c (_cpp_builtin_macro_text): Handle BT_TIMESTAMP.
6799 * files.c (_cpp_get_file_stat): New function.
6800 * include/cpplib.h (builtin_type): Add BT_TIMESTAMP.
6801 * init.c (builtin_array): Add support for __TIMESTAMP__/BT_TIMESTAMP.
6802 * internal.h (_cpp_get_file_stat): Prototype.
6803 (struct cpp_buffer): Add timestamp.
6805 2006-01-23 Jakub Jelinek <jakub@redhat.com>
6807 PR preprocessor/25717
6808 * init.c (cpp_init_builtins): If __STDC__ will not change value
6809 between system headers and other sources, define it as a normal
6810 macro rather than a builtin.
6811 * macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check
6812 cpp_in_system_header condition.
6814 2006-01-05 Paolo Bonzini <bonzini@gnu.org>
6816 * Makefile.in: Use -MMD instead of -MD.
6818 2006-01-04 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
6819 Richard Henderson <rth@redhat.com>
6821 Merge from gomp branch:
6822 * directives.c (struct pragma_entry): Add is_deferred. Add ident
6823 entry to value union.
6824 (end_directive): Don't eat the line if in_deferred_pragma.
6825 (run_directive): Remove pragma hacks.
6826 (insert_pragma_entry): Remove.
6827 (new_pragma_entry): New.
6828 (register_pragma_1): Split out of register_pragma. Only handle
6829 the lookup tree and return the new entry.
6830 (cpp_register_pragma): Fill in the pragma entry here.
6831 (cpp_register_deferred_pragma): New.
6832 (register_pragma_internal): New.
6833 (_cpp_init_internal_pragmas): Use register_pragma_internal.
6834 (do_pragma): Allow pragma expansion after namespace. For deferred
6835 pragmas, don't slurp the line into a string.
6836 (destringize_and_run): Save tokens for deferred pragmas.
6837 (cpp_handle_deferred_pragma): Remove.
6838 * macro.c (builtin_macro): Remove pragma token hack.
6839 (_cpp_push_token_context): Rename from push_token_context and export.
6840 * internal.h (struct lexer_state): Add pragma_allow_expansion.
6841 (_cpp_push_token_context): Declare.
6842 * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return
6843 a token. Update the line number correctly if so.
6844 (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens.
6845 (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas.
6846 * include/cpplib.h (PRAGMA_EOL): New.
6847 (CPP_TOKEN_FLD_PRAGMA): New.
6848 (struct cpp_token): Add val.pragma.
6849 (struct cpp_options): Remove defer_pragmas.
6850 (cpp_handle_deferred_pragma): Remove.
6851 (cpp_register_deferred_pragma): Declare.
6853 2006-01-01 Jakub Jelinek <jakub@redhat.com>
6856 * directives.c (do_pragma): If pragma line ends with multi-line
6857 block comment, end the saved deferred pragma string before that
6858 comment. Handle embedded '\0' chars on the pragma line.
6860 2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
6863 * include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure.
6865 2005-12-07 Jon Grimm <jgrimm2@us.ibm.com>
6866 Ben Elliston <bje@au.ibm.com>
6868 * include/cpplib.h (CPP_N_DFLOAT): New.
6869 * expr.c (interpret_float_suffix): Identify df, dd, and dl
6870 suffixes as decimal floating point constants.
6871 (cpp_classify_number): Disallow hexadecimal DFP constants.
6873 2005-11-14 Gerald Pfeifer <gerald@pfeifer.com>
6874 Ian Lance Taylor <ian@airs.com>
6876 * include/cpplib.h (struct cpp_callbacks): Annotate error with
6877 ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0).
6879 2005-11-09 Per Bothner <per@bothner.com>
6880 Uros Bizjak <uros@kss-loka.si>
6883 * init.c (read_original_filename): Temporarily set
6884 state.in_directive before calling _cpp_lex_direct for
6887 2005-11-03 James E Wilson <wilson@specifix.com>
6889 PR preprocessor/24202
6890 * files.c (_cpp_pop_file_buffer): Set buffer_valid to false.
6892 2005-11-04 Joseph S. Myers <joseph@codesourcery.com>
6894 * include/cpplib.h (struct cpp_callbacks): Make error take
6896 * errors.c (cpp_error): Update call to callback.
6898 2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
6900 PR preprocessor/22042
6901 * macro.c (_cpp_builtin_macro_text): Lower the needed max
6903 (cpp_quote_string): Don't octalify non printable
6906 2005-11-03 Joseph S. Myers <joseph@codesourcery.com>
6909 * include/cpplib.h (struct cpp_options): Add client_diagnostic.
6910 (struct cpp_callbacks): Add error.
6911 * errors.c (cpp_error): If client_diagnostic, use error callback.
6912 * charset.c (convert_escape): Don't use %03o in diagnostic.
6914 2005-10-21 James E Wilson <wilson@specifix.com>
6916 PR preprocessor/15220
6917 * files.c (_cpp_find_file): New parameter angle_brackets. Fix all
6918 callers. Pass to open_file_failed.
6919 (open_file_failed): New parameter angle_brackets. Fix all callers.
6920 Use in print_dep assignment.
6921 * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file.
6922 * internal.h (_cpp_find_file): Add new parm to declaration.
6924 2005-10-08 Kazu Hirata <kazu@codesourcery.com>
6926 * configure.ac: Require 64-bit int for arm*-*-*eabi*.
6927 * configure: Regenerate.
6929 2005-10-04 Ian Lance Taylor <ian@airs.com>
6931 PR preprocessor/13726
6932 * directives.c (check_eol_return_comments): New static function.
6933 (parse_include): Add buf parameter. Change all callers.
6934 (do_include_common): If not discard comments, turn on
6935 save_comments. Pass collected comments to include callback.
6936 * include/cpplib.h (struct cpp_callbacks): Add new parameter to
6937 include callback: cpp_token list.
6939 2005-09-20 Joseph S. Myers <joseph@codesourcery.com>
6941 * include/cpplib.h (struct cpp_options): Add extended_identifiers.
6942 * init.c (struct lang_flags, lang_defaults): Add
6943 extended_identifiers.
6944 (cpp_set_lang): Use it.
6945 * lex.c (forms_identifier_p): Check extended_identifiers.
6947 2005-08-30 Jakub Jelinek <jakub@redhat.com>
6949 PR preprocessor/20348
6950 PR preprocessor/20356
6951 * files.c (_cpp_find_file, search_cache): Revert 2004-06-26 and
6954 2005-07-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
6956 * configure.ac (ACX_PROG_CC_WARNING_OPTS): add
6957 -Wmissing-format-attribute.
6959 * configure: Regenerate.
6961 2005-06-29 Kelley Cook <kcook@gcc.gnu.org>
6963 * all files: Update FSF address in copyright headers.
6964 * makeucnid.c (write_copyright): Update outputted FSF address.
6966 2005-06-13 Zack Weinberg <zack@codesourcery.com>
6968 * configure.ac: Invoke ZW_CREATE_DEPDIR and
6969 ZW_PROG_COMPILER_DEPENDENCIES.
6970 * aclocal.m4, configure: Regenerate.
6971 * Makefile.in (DEPMODE, DEPDIR, depcomp, COMPILE.base, COMPILE):
6973 (distclean): Clean up $(DEPDIR) and its contents.
6974 (.c.o): Use $(COMPILE).
6975 Include $(DEPDIR)/*.Po for most object->header dependencies.
6977 2005-05-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
6979 * configure.ac: Check declarations for asprintf and vasprintf.
6980 * config.in: Regenerate.
6981 * configure: Likewise.
6983 * charset.c (conversion_loop): Use XRESIZEVEC.
6984 (convert_no_conversion): Likewise.
6985 (convert_using_iconv): Likewise.
6986 (init_iconv_desc): Cast return value of alloca.
6987 (cpp_host_to_exec_charset): Use XNEWVEC.
6988 (emit_numeric_escape): Use XRESIZEVEC.
6989 (cpp_interpret_string): Use XNEWVEC.
6990 (cpp_interpret_string): Use XRESIZEVEC.
6991 (_cpp_interpret_identifier): Cast return value of alloca.
6992 (_cpp_convert_input): Use XNEWVEC and XRESIZEVEC.
6993 * directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC.
6994 (parse_include): Use XNEWVEC.
6995 (insert_pragma_entry): Rename local variable "new" to
6997 (save_registered_pragmas): Cast return value of xmemdup.
6998 (destringize_and_run): Same for alloca.
6999 (parse_assertion): Likewise.
7000 (do_assert): Cast allocated storage to proper type.
7001 (cpp_define): Likewise.
7002 (_cpp_define_builtin): Likewise.
7003 (cpp_undef): Likewise.
7004 (handle_assertion): Likewise.
7005 (cpp_push_buffer): Rename local variable "new" to "new_buffer".
7006 * expr.c (CPP_UPLUS): Cast value to type cpp_ttype.
7007 (CPP_UMINUS): Likewise.
7008 (struct cpp_operator): Rename from struct operator.
7009 (_cpp_expand_op_stack): Use XRESIZEVEC.
7010 * files.c (pch_open_file): Use XNEWVEC.
7011 (pch_open_file): Use XRESIZEVEC.
7012 (read_file_guts): Use XNEWVEC and XRESIZEVEC.
7013 (dir_name_of_file): Use XNEWVEC.
7014 (make_cpp_file): Use XCNEW.
7015 (make_cpp_dir): Likewise.
7016 (allocate_file_hash_entries): USE XNEWVEC.
7017 (cpp_included): Cast return value of htab_find_with_hash.
7018 (append_file_to_dir): Use XNEWVEC.
7019 (read_filename_string): Likewise. Use XRESIZEVEC too.
7020 (read_name_map): Cast return value of alloca. Use XRESIZEVEC.
7021 (remap_filename): Use XNEWVEC.
7022 (struct pchf_entry): Move definition out of struct pchf_data.
7023 (_cpp_save_file_entries): Use XCNEWVAR.
7024 (_cpp_read_file_entries): Use XNEWVAR.
7025 * identifiers.c (alloc_node): Use XOBNEW.
7026 * init.c (cpp_create_reader): Use XCNEW.
7027 (cpp_init_builtins): Cast of b->value to enum builtin_type.
7028 (read_original_directory): Cast return value of alloca.
7029 * lex.c (add_line_note): Use XRESIZEVEC.
7030 (warn_about_normalization): Use XNEWVEC.
7031 (_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype).
7032 (new_buff): Use XNEWVEC.
7033 * line-map.c (linemap_add): Use XRESIZEVEC.
7034 * macro.c (builtin_macro): Cast return value of alloca.
7035 (paste_tokens): Likewise.
7036 (expand_arg): Use XNEWVEC and XRESIZEVEC.
7037 (_cpp_save_parameter): Use XRESIZEVEC.
7038 (create_iso_definition): Cast allocated storage to proper type.
7039 (_cpp_create_definition): Likewise.
7040 (cpp_macro_definition): Use XRESIZEVEC.
7041 * makedepend.c (add_clm): Use XNEW.
7042 (add_dir): Likewise.
7043 * mkdeps.c (munge): Use XNEWVEC.
7044 (deps_init): Use XCNEW.
7045 (deps_add_target): Use XRESIZEVEC.
7046 (deps_add_default_target): Cast return value of alloca.
7047 (deps_add_dep): Use XRESIZEVEC.
7048 (deps_add_vpath): Likewise. Use XNEWVEC too.
7049 (deps_restore): Likewise.
7050 * pch.c (save_idents): Use XNEW and XNEWVEC.
7051 (cpp_save_state): Use XNEW.
7052 (count_defs): Cast return value of htab_find.
7053 (write_defs): Likewise.
7054 (cpp_write_pch_deps): Use XNEWVEC.
7055 (collect_ht_nodes): Use XRESIZEVEC.
7056 (cpp_valid_state): Use XNEWVEC.
7057 (save_macros): Use XRESIZEVEC. Cast return value of xmemdup.
7058 * symtab.c (ht_create): Use XCNEW.
7059 (ht_lookup_with_hash): Cast return value of obstack_copy0.
7060 (ht_expand): Use XCNEWVEC.
7061 * system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus.
7062 (bool): Do not define if __cplusplus.
7064 2005-05-12 Zack Weinberg <zack@codesourcery.com>
7066 * directives.c (#sccs table entry): Mark IN_I, consistent with #ident.
7067 (do_sccs): Delete function definition, #define to do_ident.
7068 (do_ident): Don't hardwire directive name.
7070 2005-05-12 Ryota Kunisawa <kunisawa@access.co.jp>
7073 * configure: Regenerate.
7075 2005-04-27 Andris Pavenis <pavenis@latnet.lv>
7077 * files.c: Include io.h for DJGPP to get prototype of setmode.
7079 2005-04-19 Per Bothner <per@bothner.com>
7081 PR preprocessor/20907
7082 * line-map.c (linemap_line_start): Fix bug when we need to increse
7083 column_bits but can re-use the current line_map.
7085 2005-04-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
7087 * system.h (fopen, fdopen, freopen): Define these to the unlocked
7088 libiberty functions.
7090 2005-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
7092 * configure.ac (libcpp_UNLOCKED_FUNCS): New.
7093 (AC_CHECK_FUNCS, AC_CHECK_DECLS): Check for libcpp_UNLOCKED_FUNCS.
7094 * system.h (putchar, getc, getchar, clearerr, feof, fileno,
7095 fflush, fgetc, fgets, ferror, fread): Redefine to the associated
7097 (fwrite_unlocked): Fix prototype.
7099 * configure, config.in: Regenerate.
7101 2005-04-05 Jakub Jelinek <jakub@redhat.com>
7103 PR preprocessor/19475
7104 * macro.c (create_iso_definition): For < ISO C99, don't
7105 pedwarn if there is no whitespace between macro name and its
7106 replacement, but the replacement starts with a basic character
7109 2005-03-28 Andreas Jaeger <aj@suse.de>
7111 * lex.c (warn_about_normalization): Cast field width to int to
7114 2005-03-19 Joseph S. Myers <joseph@codesourcery.com>
7116 * configure.ac: Consistently use solaris2.1[0-9]* instead of
7118 * configure: Regenerate.
7120 2005-03-15 Geoffrey Keating <geoffk@apple.com>
7122 * charset.c (_cpp_valid_ucn): In identifiers, reject a partial
7123 UCN rather than printing an error.
7125 2005-03-14 Geoffrey Keating <geoffk@apple.com>
7127 * lex.c (forms_identifier_p): Disable UCNs in C89 mode.
7129 2005-03-14 Geoffrey Keating <geoffk@apple.com>
7131 * init.c (cpp_create_reader): Default warn_normalize to normalized_C.
7132 * charset.c: Update for new format of ucnid.h.
7133 (ucn_valid_in_identifier): Update for new format of ucnid.h.
7134 Add NST parameter, and update it; update callers.
7135 (cpp_valid_ucn): Add NST parameter, update callers. Replace abort
7137 (convert_ucn): Pass normalize_state to cpp_valid_ucn.
7138 * internal.h (struct normalize_state): New.
7139 (INITIAL_NORMALIZE_STATE): New.
7140 (NORMALIZE_STATE_RESULT): New.
7141 (NORMALIZE_STATE_UPDATE_IDNUM): New.
7142 (_cpp_valid_ucn): New.
7143 * lex.c (warn_about_normalization): New.
7144 (forms_identifier_p): Add normalize_state parameter, update callers.
7145 (lex_identifier): Add normalize_state parameter, update callers. Keep
7147 (lex_number): Likewise.
7148 (_cpp_lex_direct): Pass normalize_state to subroutines. Check
7149 it with warn_about_normalization.
7153 * ucnid.tab: Make appropriate for input to makeucnid.c. Remove
7154 comments about obsolete version of C++.
7155 * include/cpplib.h (enum cpp_normalize_level): New.
7156 (struct cpp_options): Add warn_normalize field.
7158 2005-03-11 Geoffrey Keating <geoffk@apple.com>
7160 * directives.c (glue_header_name): Update call to cpp_spell_token.
7161 * internal.h (_cpp_interpret_identifier): New.
7162 * charset.c (_cpp_interpret_identifier): New.
7163 (_cpp_valid_ucn): Allow UCN version of '$'.
7164 * lex.c (lex_identifier): Add extra parameter to indicate if initial
7165 character was '$' or '\'. Support identifiers with UCNs.
7166 (forms_identifier_p): Allow UCNs.
7167 (_cpp_lex_direct): Pass extra parameter to lex_identifier.
7169 (cpp_spell_token): Add FORSTRING parameter. Use it.
7170 (cpp_token_as_text): Update call to cpp_spell_token.
7171 (cpp_output_token): Write UCNs back out.
7172 (stringify_arg): Update call to cpp_spell_token.
7173 (paste_tokens): Likewise.
7174 (cpp_macro_definition): Likewise.
7175 * macro.c (stringify_arg): Likewise.
7176 (paste_tokens): Likewise.
7177 (cpp_macro_definition): Likewise.
7178 * include/cpplib.h: Add parameter to cpp_spell_token.
7180 2005-03-04 Jakub Jelinek <jakub@redhat.com>
7184 * macro.c (replace_args, cpp_get_token): Copy whole
7185 cpp_token_u instead of just cpp_string field from it.
7187 2005-02-28 Devang Patel <dpatel@apple.com>
7189 * directives.c (do_line): Save sysp early before line table is
7192 2005-02-20 Zack Weinberg <zack@codesourcery.com>
7195 * charset.c (LAST_POSSIBLY_BASIC_SOURCE_CHAR): New helper macro.
7196 (cpp_host_to_exec_charset): New function.
7197 * include/cpplib.h: Declare cpp_host_to_exec_charset.
7199 2005-02-19 Devang Patel <dpatel@apple.com>
7201 * charset.c (_cpp_convert_input): Check '\r' before inserting
7204 2005-02-15 Eric Christopher <echristo@redhat.com>
7206 PR preprocessor/19077
7207 * macro.c (cpp_macro_definition): Move handling of whitespace
7208 to PREV_WHITE conditional. Remove overloading of len
7211 2005-02-14 Kazu Hirata <kazu@cs.umass.edu>
7213 * directives.c, files.c, init.c, internal.h, macro.c, pch.c,
7214 traditional.c: Update copyright.
7216 2005-02-14 Paolo Bonzini <bonzini@gnu.org>
7219 * configure.ac: Check for declaration of basename and getopt.
7220 * config.in: Regenerate.
7221 * configure: Regenerate.
7222 * internal.h (ustrcspn): New.
7223 * macro.c (create_iso_definition): Fix allocation of memory.
7224 (padding_token): Add cast to remove const-ness.
7225 * pch.c (cpp_read_state): Use ustrcspn.
7227 2005-02-08 Mike Stump <mrs@apple.com>
7229 * files.c (pchf_adder): Remove.
7230 (struct pchf_adder_info): Likewise.
7231 (_cpp_save_file_entries): Write out all files so that #import works.
7233 2005-01-23 Joseph S. Myers <joseph@codesourcery.com>
7235 * configure: Regenerate.
7237 2005-01-11 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
7239 * include/cpplib.h (c_lang): Fix comment to say cpp_create_reader.
7241 * include/cpplib.h: Also update copyright years.
7243 2005-01-03 Geoffrey Keating <geoffk@apple.com>
7245 * files.c (_cpp_find_file): Add files found by search_path_exhausted
7246 to the list of all files.
7248 2005-01-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
7250 * internal.h: Update references to Cpp lib filenames.
7251 * directives.c: Likewise.
7253 * macro.c: Likewise.
7254 * traditional.c: Likewise.
7256 2004-12-15 Eric Botcazou <ebotcazou@libertysurf.fr>
7258 PR preprocessor/15167
7259 * files.c (destroy_cpp_file): New function.
7260 (should_stack_file): Make a new file if the
7261 compared file is still stacked.
7263 2004-11-28 Nathanael Nerode <neroden@gcc.gnu.org>
7265 PR preprocessor/17610
7266 * directives.c (do_include_common): Error out if an empty filename
7267 is given for #include (or #include_next or #import).
7269 2004-11-27 Roger Sayle <roger@eyesopen.com>
7270 Zack Weinberg <zack@codesourcery.com>
7272 * internal.h: Replace all uses of uchar with unsigned char.
7273 * include/cpp-id-data.h: Likewise. Guard typedef of uchar
7274 with !IN_GCC, so uchar is only defined whilst building libcpp.
7276 2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
7278 * aclocal.m4: Regenerate.
7280 2004-11-24 Roger Sayle <roger@eyesopen.com>
7282 PR preprocessor/15824
7283 * configure.ac: Correct HAVE_UCHAR test to #include <sys/types.h>
7284 directly, instead of the non-existant "system.h" and "ansidecl.h".
7285 * configure: Regenerate.
7287 2004-11-23 Daniel Jacobowitz <dan@codesourcery.com>
7288 Joseph Myers <joseph@codesourcery.com>
7290 * internal.h (struct lexer_state): Add in_deferred_pragma.
7291 * directives.c (struct pragma_entry): Add allow_expansion.
7292 (insert_pragma_entry): Take allow_expansion flag.
7293 (register_pragma): Likewise.
7294 (cpp_register_pragma): Likewise.
7295 (_cpp_init_internal_pragmas): Update calls to cpp_register_pragma.
7296 (do_pragma): Honor allow_expansion.
7297 (cpp_handle_deferred_pragma): Set in_deferred_pragma.
7298 * include/cpplib.h (cpp_register_pragma): Update prototype.
7300 2004-11-18 Daniel Jacobowitz <dan@codesourcery.com>
7301 Mark Mitchell <mark@codesourcery.com>
7303 * configure.ac (i[34567]86-*-solaris2.1[0-9]*): Set
7304 need_64bit_hwint=yes.
7305 * configure: Regenerate.
7307 2004-11-09 Joseph S. Myers <joseph@codesourcery.com>
7309 * Makefile.in ($(PACKAGE).pot): New rule. Depend on
7311 (po/$(PACKAGE).pot): Use ":" instead of "," in --keyword
7312 arguments. Add keywords _, N_, SYNTAX_ERROR and SYNTAX_ERROR2.
7313 Remove local srcdir path from generated file.
7315 2004-11-04 Zack Weinberg <zack@codesourcery.com>
7316 Gerald Pfeifer <gerald@pfeifer.com>
7318 * internal.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H
7321 2004-10-27 Zack Weinberg <zack@codesourcery.com>
7324 * directives.c (do_pragma): Do not defer pragmas which are unknown.
7325 (cpp_handle_deferred_pragma): Add cast to silence warning.
7327 2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk>
7329 * errors.c (_cpp_begin_message): Print "error: " for errors.
7331 2004-10-10 Andreas Jaeger <aj@suse.de>
7333 * makedepend.c: Include mkdeps.h for prototype of deps_add_vpath.
7334 * Makefile.in (makedepend.o): Add dependency on mkdeps.h.
7336 2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
7338 * pch.c (cpp_write_pch_state): Remove variable z as it is not
7340 (cpp_read_state): Remove unused variables, m, d and mac_count.
7342 2004-09-29 Per Bothner <per@bothner.com>
7344 * directives.c (cpp_handle_deferred_pragma): Save, clear and restore
7345 cb.line_change. Otherwise do_pragma will call the line_change
7346 call-back with a meaningless line number.
7348 2004-09-24 Zack Weinberg <zack@codesourcery.com>
7350 * configure.ac: Move AC_PROG_MAKE_SET, AC_PROG_INSTALL to
7351 programs cluster. Use ACX_PROG_CC_WARNING_OPTS,
7352 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC, ACX_PROG_CC_WARNINGS_ARE_ERRORS.
7353 * aclocal.m4, configure: Regenerate.
7354 * init.c: Include localedir.h.
7355 * Makefile.in (WARN_CFLAGS, ALL_CFLAGS): New variables.
7357 (.c.o): Use $(ALL_CFLAGS).
7358 (localedir.h, localedir.hs): New rules.
7359 (clean): Use rm -rf to remove directories.
7360 (distclean): Also delete localedir.h and localedir.hs.
7361 (init.o): Update dependencies.
7363 2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
7365 * Makefile.in (aclocal.m4): Update dependencies.
7366 * configure.ac (AC_CONFIG_MACRO_DIR): New.
7367 * aclocal.m4, configure: Regenerate.
7369 2004-09-17 Zack Weinberg <zack@codesourcery.com>
7371 * charset.c (_cpp_destroy_iconv, emit_numeric_escape)
7372 (_cpp_convert_input, _cpp_default_encoding): Add comments.
7373 Some other comments in this file also tweaked.
7375 * directives.c (do_pragma): Save current buffer position
7376 before lexing the pragma keywords; don't call
7377 _cpp_backup_tokens in the defer_pragmas case.
7379 2004-09-15 Per Bothner <per@bothner.com>
7381 * include/line-map.h (line_map_start): Add parameter names so
7382 preceding comment makes sense.
7383 (linemap_add): Remove from comment mention of non-existing parameter.
7385 2004-09-09 Matt Austern <austern@apple.com>
7386 Zack Weinberg <zack@codesourcery.com>
7388 * include/cpplib.h (TTYPE_TABLE): Remove CPP_ and SPELL_
7389 prefixes throughout. Add entry for PRAGMA. Remove
7390 unnecessary "= 0" from EQ.
7391 (enum cpp_ttype): Adjust OP and TK definitions to restore
7392 prefixes, via token-paste.
7393 (CPP_LAST_EQ, CPP_FIRST_DIGRAPH, CPP_LAST_PUNCTUATOR, CPP_LAST_CPP_OP):
7394 Change from #defines to additional cpp_ttype enumerators.
7395 (struct cpp_options): Add defer_pragmas.
7396 (cpp_handle_deferred_pragma): Prototype new interface.
7398 * internal.h (struct cpp_reader): Add directive_result.
7399 * directives.c (struct pragma_entry): Add is_internal field;
7400 give boolean fields type bool.
7401 (start_directive): Initialize pfile->directive_result.type.
7402 (_cpp_do__Pragma): Likewise.
7403 (run_directive): Do not crash if pfile->buffer->prev is NULL.
7404 (insert_pragma_entry): Add 'internal' argument; set new->is_internal
7406 (register_pragma): New static function, bulk of former
7407 cpp_register_pragma here; add 'internal' argument, pass along
7408 to insert_pragma_entry.
7409 (cpp_register_pragma): Now a wrapper around register_pragma which
7410 always passes false for 'internal' argument.
7411 (_cpp_init_internal_pragmas): Call register_pragma directly, passing
7412 true for 'internal'.
7413 (do_pragma): If CPP_OPTION (pfile, defer_pragmas) and this isn't
7414 an internal pragma, save text till the end of the line as a CPP_PRAGMA
7415 token instead of executing the pragma.
7416 (cpp_handle_deferred_pragma): New interface.
7417 * lex.c (token_spellings): Adjust OP and TK definitions to
7418 match changes to cpplib.h.
7419 (_cpp_lex_token): Check for a directive-result token and
7420 return it if present.
7421 (cpp_token_val_index): Handle CPP_PRAGMA.
7422 * macro.c (cpp_builtin_macro_text): Correct comment.
7423 (builtin_macro): Handle directive-result tokens from _cpp_do__Pragma.
7425 2004-09-06 Serge Belyshev <belyshev@lubercy.com>
7427 PR preprocessor/14699
7428 * symtab.c (ht_dump_statistics): Change type of sum_of_squares
7429 from size_t to double.
7431 2004-08-28 Andreas Schwab <schwab@suse.de>
7432 Andreas Jaeger <aj@suse.de>
7434 * configure.ac: Set PACKAGE correctly.
7435 * configure: Regenerated.
7437 2004-08-25 Paolo Bonzini <bonzini@gnu.org>
7439 * Makefile.in: Add back top_builddir.
7441 2004-08-25 Paolo Bonzini <bonzini@gnu.org>
7443 * configure.ac: Replace Automake macro invocations
7444 with manual Autoconf checks and substitutions.
7445 * configure: Regenerate.
7446 * aclocal.m4: Regenerate.
7447 * config.in: Regenerate.
7448 * Makefile.am: Removed.
7449 * Makefile.in: Heavy simplification and reorganization.
7451 2004-08-09 Mark Mitchell <mark@codesourcery.com>
7453 * configure.ac (arm*-*-eabi*): New target.
7454 (arm*-*-symbianelf*): Likewise.
7455 * configure: Regenerated.
7457 2004-07-24 Bernardo Innocenti <bernie@develer.com>
7459 * internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Remove.
7460 * directives.c: Use XNEW-family macros from libiberty.
7462 * macro.c: Likewise.
7463 * cpplib.h (cpp_deps_style): Export enum with name.
7465 2004-07-23 Matthias Klose <doko@debian.org>
7467 * init.c (init_library): Use PACKAGE for the text domain.
7469 2004-07-16 Andris Pavenis <pavenis@latnet.lv>
7471 PR preprocessor/16366
7472 * internal.h (struct cpp_reader): New field dir_hash.
7473 * files.c (make_cpp_dir): Use dir_hash, not file_hash.
7474 (_cpp_init_files, _cpp_cleanup_files): Update for new field.
7476 2004-07-04 Neil Booth <neil@duron.akihabara.co.uk>
7478 PR preprocessor/16192
7479 PR preprocessor/15913
7480 PR preprocessor/15572
7481 * expr.c (_cpp_parse_expr): Handle remaining cases where an
7482 expression is missing.
7483 * init.c (post_options): Traditional cpp doesn't do // comments.
7485 2004-06-30 Per Bothner <per@bothner.com>
7487 * include/line-map.h (fileline): Remove old typedef.
7488 * internal.h (struct cpp_reader): Use source_location typedef instead.
7490 2004-06-26 Zack Weinberg <zack@codesourcery.com>
7492 Partially revert patch of 2004-06-05.
7493 * files.c (search_cache): Remove pfile argument. Don't check
7494 for file that would be found by "" or <> search here...
7495 (_cpp_find_file): ...do it here, before calling find_file_in_dir.
7496 Do not apply directory-of-current-file correction to files
7497 found by this check. Rearrange code slightly.
7499 2004-06-21 Geoffrey Keating <geoffk@apple.com>
7501 * files.c (should_stack_file): Correct swapped parameters to call
7503 * pch.c (cpp_valid_state): Handle -fpreprocessed.
7505 2004-06-15 Paolo Bonzini <bonzini@gnu.org>
7507 * Makefile.in: Regenerate with automake 1.8.5.
7508 * aclocal.m4: Likewise.
7509 * configure: Regenerate.
7511 2004-06-11 Zack Weinberg <zack@codesourcery.com>
7513 * configure.ac: Don't invoke ACX_HEADER_STDBOOL.
7514 * configure, config.in: Regenerate.
7515 * system.h: Unconditionally define bool as unsigned char,
7516 BOOL_BITFIELD as unsigned int.
7517 * .cvsignore: New file.
7519 2004-06-09 Geoffrey Keating <geoffk@apple.com>
7521 * traditional.c (push_replacement_text): Set macro->traditional.
7522 (save_replacement_text): Likewise.
7523 * pch.c (cpp_write_pch_state): Don't write list of defined macros.
7524 (struct save_macro_item): Delete.
7525 (struct save_macro_data): Use a character array not the previous
7527 (save_macros): Save macro as text not as internal structures.
7528 (cpp_prepare_state): Update for changes to save_macro_data.
7529 (cpp_read_state): Don't read macros defined in PCH. Restore
7531 * macro.c (create_iso_definition): Honour alloc_subobject.
7532 Clear traditional flag.
7533 (_cpp_create_definition): Honour alloc_subobject.
7534 * lex.c (cpp_token_val_index): New.
7535 * internal.h: Include cpp-id-data.h.
7536 (uchar): Move definition to cpp-id-data.h.
7538 (cpp_macro): Likewise.
7539 * directives.c (struct answer): Move to cpp-id-data.h.
7540 (do_assert): Honour alloc_subobject.
7542 * include/symtab.h (struct ht): Add field 'alloc_subobject'.
7543 * include/cpplib.h (struct cpp_string): Add GTY marker.
7544 (enum cpp_token_fld_kind): New.
7545 (struct cpp_token): Add GTY markers.
7546 (cpp_token_val_index): Prototype.
7547 (CPP_HASHNODE_VALUE_IDX): New.
7548 (struct cpp_hashnode): Don't skip fields of 'value' when marking.
7549 * include/cpp-id-data.h: New file.
7551 2004-06-09 Paolo Bonzini <bonzini@gnu.org>
7553 * Makefile.am (all-local): New.
7554 * Makefile.in: Regenerate.
7556 2004-06-06 Roger Sayle <roger@eyesopen.com>
7558 * Makefile.am (LIBICONV): Declare.
7559 (makedepend_LDADD): Use LIBICONV.
7560 * Makefile.in: Regenerate.
7562 2004-06-05 Andrew Pinski <pinskia@physics.uc.edu>
7564 * Makefile.am (LIBINTL): Declare
7565 (makedepend_LDADD): Use LIBINTL.
7566 * Makefile.in: Regenerate.
7568 2004-06-05 Zack Weinberg <zack@codesourcery.com>
7570 * Makefile.am: Add makedepend.
7571 * Makefile.in, aclocal.m4: Regenerate.
7572 * charset.c: Insert a space to avoid a warning.
7573 * directives.c: Include mkdeps.h.
7574 (_cpp_handle_directive): Reenable macro expander if appropriate.
7575 (undefine_macros): Inline body of _cpp_free_definition for speed.
7576 Do not call undef callback or _cpp_warn_if_unused_macro.
7577 (cpp_get_deps): New interface.
7578 * files.c (search_cache): Add pfile argument. Check for file
7579 that would be found by "" or <> search here...
7580 (_cpp_find_file): ...not here. Correct recorded start_dir of
7581 files found by directory-of-current-file search that would be
7582 found by "" or <> search.
7583 * init.c (cpp_add_dependency_target): Delete.
7584 * internal.h (struct lexer_state): Add discarding_output flag.
7585 * lex.c (lex_identifier): Compute hash function while scanning.
7586 * macro.c (cpp_scan_nooutput): Disable macro expansion outside
7588 * makedepend.c: New file.
7589 * mkdeps.c (struct deps): Add vpath vector.
7590 (apply_vpath, deps_add_vpath): New function.
7591 (deps_free): Free vpath vector.
7592 (deps_add_dep, deps_add_target): Use apply_vpath.
7593 * symtab.c (calc_hash): Use HT_HASHSTEP and HT_FINISH.
7594 (ht_lookup_with_hash): New function.
7595 * cpplib.h, mkdeps.h: Update prototypes.
7596 * symtab.h: Update prototypes.
7597 (HT_HASHSTEP, HT_FINISH): New macros.
7599 2004-05-29 Geoffrey Keating <geoffk@apple.com>
7601 * symtab.c (ht_create): Set entries_owned.
7602 (ht_destroy): Honour entries_owned.
7603 (ht_expand): Likewise.
7605 * include/symtab.h (struct ht): New field 'entries_owned'
7606 (ht_load): New prototype.
7608 2004-05-26 Paolo Bonzini <bonzini@gnu.org>
7611 * configure.ac: Fix m4 quoting when picking
7612 the size of HOST_WIDE_INT.
7613 * configure: Regenerate.
7615 2004-05-25 Paolo Bonzini <bonzini@gnu.org>
7617 * Makefile.am: the correct directory for
7618 gettext include files is given by @INCINTL@.
7619 * Makefile.in: Regenerate.
7621 2004-05-24 Paolo Bonzini <bonzini@gnu.org>
7623 * system.h [!ENABLE_NLS]: dgettext takes two
7626 2004-05-23 Paolo Bonzini <bonzini@gnu.org>
7628 Moved libcpp from the gcc subdirectory to the toplevel.
7629 * Makefile.am: New file.
7630 * Makefile.in: Regenerate.
7631 * configure.ac: New file.
7632 * configure: Regenerate.
7633 * config.in: Regenerate.
7634 * charset.c: Moved from gcc/cppcharset.c. Add note about
7635 brokenness of input charset detection. Adjust for change
7636 in name of cppucnid.h.
7637 * errors.c: Moved from gcc/cpperror.c. Do not include intl.h.
7638 * expr.c: Moved from gcc/cppexp.c.
7639 * files.c: Moved from gcc/cppfiles.c. Do not include intl.h.
7640 Remove #define of O_BINARY, it is in system.h.
7641 * identifiers.c: Moved from gcc/cpphash.c.
7642 * internal.h: Moved from gcc/cpphash.h. Change header
7643 guard name. All other files adjusted to match name change.
7644 * init.c: Moved from gcc/cppinit.c.
7645 (init_library) [ENABLE_NLS]: Call bindtextdomain.
7646 * lex.c: Moved from gcc/cpplex.c.
7647 * directives.c: Moved from gcc/cpplib.c.
7648 * macro.c: Moved from gcc/cppmacro.c.
7649 * pch.c: Moved from gcc/cpppch.c. Do not include intl.h.
7650 * traditional.c: Moved from gcc/cpptrad.c.
7651 * ucnid.h: Moved from gcc/cppucnid.h. Change header
7653 * ucnid.pl: Moved from gcc/cppucnid.pl.
7654 * ucnid.tab: Moved from gcc/cppucnid.tab. Change header
7656 * symtab.c: Moved from gcc/hashtable.c.
7657 * line-map.c: Moved from gcc. Do not include intl.h.
7658 * mkdeps.c: Moved from gcc.
7659 * system.h: New file.
7660 * include/cpplib.h: Moved from gcc. Change header guard name.
7661 * include/line-map.h: Moved from gcc. Change header guard name.
7662 * include/mkdeps.h: Moved from gcc. Change header guard name.
7663 * include/symtab.h: Moved from gcc/hashtable.h. Change header
7666 Copyright (C) 2004-2023 Free Software Foundation, Inc.
7668 Copying and distribution of this file, with or without modification,
7669 are permitted in any medium without royalty provided the copyright
7670 notice and this notice are preserved.