1 2023-07-19 Lewis Hyatt <lhyatt@gmail.com>
4 * lex.cc (identifier_diagnostics_on_lex): New function refactoring
6 (lex_identifier_intern): Use the new function.
7 (lex_identifier): Don't run identifier diagnostics here, rather let
8 the call site do it when needed.
9 (_cpp_lex_direct): Adjust the call sites of lex_identifier ()
11 (struct scan_id_result): New struct.
12 (scan_cur_identifier): New function.
13 (create_literal2): New function.
14 (lit_accum::create_literal2): New function.
15 (is_macro): Folded into new function...
16 (maybe_ignore_udl_macro_suffix): ...here.
17 (is_macro_not_literal_suffix): Folded likewise.
18 (lex_raw_string): Handle UTF-8 in UDL suffix via
19 scan_cur_identifier ().
20 (lex_string): Likewise.
22 2023-07-06 Thomas Schwinge <thomas@codesourcery.com>
24 * include/symtab.h (struct ht_identifier): Document different
27 2023-06-23 Marek Polacek <polacek@redhat.com>
29 * include/cpplib.h (c_lang): Add CXX26 and GNUCXX26.
30 * init.cc (lang_defaults): Add rows for CXX26 and GNUCXX26.
31 (cpp_init_builtins): Set __cplusplus to 202400L for C++26.
32 Set __cplusplus to 202302L for C++23.
34 2023-06-23 Ben Boeckel <me@benboeckel.net>
36 * charset.cc: Allow `UCS_LIMIT` in UTF-8 strings.
38 2023-06-22 David Malcolm <dmalcolm@redhat.com>
40 * charset.cc (get_cppchar_property): New function template, based
42 (cpp_wcwidth): ...this function. Rework to use the above.
43 Include "combining-chars.inc".
44 (cpp_is_combining_char): New function
45 Include "printable-chars.inc".
46 (cpp_is_printable_char): New function
47 * combining-chars.inc: New file, generated by
48 contrib/unicode/gen-combining-chars.py.
49 * include/cpplib.h (cpp_is_combining_char): New function decl.
50 (cpp_is_printable_char): New function decl.
51 * printable-chars.inc: New file, generated by
52 contrib/unicode/gen-printable-chars.py.
54 2023-06-20 Lewis Hyatt <lhyatt@gmail.com>
57 * macro.cc (_cpp_create_definition): Add location argument.
58 * internal.h (_cpp_create_definition): Adjust prototype.
59 * directives.cc (do_define): Pass new location argument to
60 _cpp_create_definition.
61 (do_undef): Stop passing inferior location to cpp_warning_with_line;
62 the default from cpp_warning is better.
63 (cpp_pop_definition): Pass new location argument to
64 _cpp_create_definition.
65 * pch.cc (cpp_read_state): Likewise.
67 2023-06-19 Ben Boeckel <ben.boeckel@kitware.com>
69 * charset.cc: Reject encodings of codepoints above 0x10FFFF.
70 UTF-16 does not support such codepoints and therefore all
71 Unicode rejects such values.
73 2023-06-15 Marek Polacek <polacek@redhat.com>
75 * configure.ac (--enable-host-shared): Don't set PICFLAG here.
76 (--enable-host-pie): New check. Set PICFLAG after this check.
77 * configure: Regenerate.
79 2023-06-15 Jakub Jelinek <jakub@redhat.com>
82 * files.cc (struct _cpp_file): Add deferred_error bitfield.
83 (_cpp_find_file): When finding a file in cache with deferred_error
84 set in _cpp_FFK_NORMAL mode, call open_file_failed and clear the flag.
85 Set deferred_error in _cpp_FFK_HAS_INCLUDE mode if open_file_failed
88 2023-04-30 Jeff Law <jlaw@ventanamicro>
91 2023-04-30 Longjun Luo <luolongjuna@gmail.com>
93 * init.cc (builtin_array): Do not always warn for a redefinition
96 2023-04-30 Longjun Luo <luolongjuna@gmail.com>
98 * init.cc (builtin_array): Do not always warn for a redefinition
101 2023-03-25 David Malcolm <dmalcolm@redhat.com>
104 * charset.cc (cpp_valid_utf8_p): New function.
105 * include/cpplib.h (cpp_valid_utf8_p): New prototype.
107 2023-03-16 Jakub Jelinek <jakub@redhat.com>
109 * makeucnid.cc (write_copyright): Update Unicode copyright years
111 * makeuname2c.cc (write_copyright): Likewise.
112 * ucnid.h: Regenerated.
113 * uname2c.h: Regenerated.
115 2023-03-13 Lewis Hyatt <lhyatt@gmail.com>
117 PR preprocessor/67046
118 * directives.cc (_cpp_do__Pragma): Increment pfile->keep_tokens to
119 ensure the returned string token is valid.
121 2023-03-13 Lewis Hyatt <lhyatt@gmail.com>
123 * generated_cpp_wcwidth.h: Regenerated for Unicode 15.
125 2022-12-07 Joseph Myers <joseph@codesourcery.com>
127 * init.cc (lang_defaults): Enable va_opt for STDC2X.
128 * lex.cc (maybe_va_opt_error): Adjust diagnostic message for C.
129 * macro.cc (_cpp_arguments_ok): Update comment.
131 2022-11-23 Marek Polacek <polacek@redhat.com>
134 2022-11-23 Marek Polacek <polacek@redhat.com>
136 * configure.ac (--enable-host-shared): Don't set PICFLAG here.
137 (--enable-host-pie): New check. Set PICFLAG after this check.
138 * configure: Regenerate.
140 2022-11-23 Marek Polacek <polacek@redhat.com>
142 * configure.ac (--enable-host-shared): Don't set PICFLAG here.
143 (--enable-host-pie): New check. Set PICFLAG after this check.
144 * configure: Regenerate.
146 2022-11-21 Lewis Hyatt <lhyatt@gmail.com>
148 * directives.cc (do_pragma): Fix memory leak in token buffer. Fix
149 unwanted paste between two tokens.
151 2022-11-21 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
153 * files.cc: Ensure pattern matches before use.
155 2022-11-21 Martin Liska <mliska@suse.cz>
157 * config.in: Re-configure.
159 2022-11-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
161 PR preprocessor/107691
162 * configure.ac: Add valgrind header checks.
163 * configure: Regenerate.
165 2022-11-18 Richard Purdie <richard.purdie@linuxfoundation.org>
167 * macro.cc (_cpp_builtin_macro_text): Don't remap filenames within
170 2022-11-05 Lewis Hyatt <lhyatt@gmail.com>
172 PR preprocessor/55971
173 * lex.cc (get_fresh_line_impl): New function refactoring the code
175 (_cpp_get_fresh_line): ...here.
176 (lex_raw_string): Use the new version of get_fresh_line_impl() to
177 support raw strings containing new lines when processing a directive.
179 2022-11-04 Jakub Jelinek <jakub@redhat.com>
181 * makeuname2c.cc (struct generated): Update from Unicode 15.0.0
183 * ucnid.h: Regenerated for Unicode 15.0.0.
184 * uname2c.h: Likewise.
186 2022-10-19 Lewis Hyatt <lhyatt@gmail.com>
188 * include/cpplib.h (struct cpp_string): Use new "string_length" GTY.
189 * include/symtab.h (struct ht_identifier): Likewise.
191 2022-10-14 Joseph Myers <joseph@codesourcery.com>
193 * charset.cc (ucn_valid_in_identifier): Check xid_identifiers not
194 cplusplus to determine whether to use CXX23 and NXX23 flags.
195 * include/cpplib.h (struct cpp_options): Add xid_identifiers.
196 * init.cc (struct lang_flags, lang_defaults): Add xid_identifiers.
197 (cpp_set_lang): Set xid_identifiers.
198 * lex.cc (warn_about_normalization): Add parameter identifier.
199 Only pedwarn about non-NFC for identifiers, not pp-numbers.
200 (_cpp_lex_direct): Update calls to warn_about_normalization.
202 2022-10-14 Jakub Jelinek <jakub@redhat.com>
204 * include/cpplib.h (CPP_N_BFLOAT16): Define.
205 * expr.cc (interpret_float_suffix): Handle bf16 and BF16 suffixes for
208 2022-09-28 Eugene Rozenfeld <erozen@microsoft.com>
210 * include/line-map.h: Add discriminator to location_adhoc_data.
211 (get_combined_adhoc_loc): Add discriminator parameter.
212 (get_discriminator_from_adhoc_loc): Add external declaration.
213 (get_discriminator_from_loc): Add external declaration.
214 (COMBINE_LOCATION_DATA): Add discriminator parameter.
215 * lex.cc (get_location_for_byte_range_in_cur_line) Pass 0 discriminator
216 in a call to COMBINE_LOCATION_DATA.
217 (warn_about_normalization): Pass 0 discriminator in a call to
218 COMBINE_LOCATION_DATA.
219 (_cpp_lex_direct): Pass 0 discriminator in a call to
220 COMBINE_LOCATION_DATA.
221 * line-map.cc (location_adhoc_data_hash): Use discriminator compute
222 location_adhoc_data hash.
223 (location_adhoc_data_eq): Use discriminator when comparing
225 (can_be_stored_compactly_p): Check discriminator to determine
227 (get_combined_adhoc_loc): Add discriminator parameter.
228 (get_discriminator_from_adhoc_loc): New function to get the discriminator
229 from an ad-hoc location.
230 (get_discriminator_from_loc): New function to get the discriminator
233 2022-09-27 Jakub Jelinek <jakub@redhat.com>
237 * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
238 {f,F}{32,64,128}x suffixes for C++.
240 2022-09-08 Lewis Hyatt <lhyatt@gmail.com>
242 * line-map.cc (location_adhoc_data_update): Remove reliance on
244 (get_combined_adhoc_loc): Likewise.
245 (rebuild_location_adhoc_htab): Fix issue where the htab was not
248 2022-09-07 Joseph Myers <joseph@codesourcery.com>
250 * include/cpplib.h (struct cpp_options): Add true_false.
251 * expr.cc (eval_token): Check true_false not cplusplus to
252 determine whether to handle true and false keywords.
253 * init.cc (struct lang_flags): Add true_false.
254 (lang_defaults): Update.
255 (cpp_set_lang): Set true_false.
257 2022-09-07 Jakub Jelinek <jakub@redhat.com>
259 * include/cpplib.h (struct cpp_options): Add cpp_warn_unicode member.
260 (enum cpp_warning_reason): Add CPP_W_UNICODE.
261 * init.cc (cpp_create_reader): Initialize cpp_warn_unicode.
262 * charset.cc (_cpp_valid_ucn): In possible identifier contexts, don't
263 handle \u{ or \N{ specially in -std=c* modes except -std=c++2{3,b}.
264 In possible identifier contexts, don't emit an error and punt
265 if \N isn't followed by {, or if \N{} surrounds some lower case
266 letters or _. In possible identifier contexts when not C++23, don't
267 emit an error but warning about unknown character names and treat as
268 separate tokens. When treating as separate tokens \u{ or \N{, emit
271 2022-09-05 Joseph Myers <joseph@codesourcery.com>
273 * init.cc (lang_defaults): Disable trigraphs for C2x.
275 2022-09-02 David Malcolm <dmalcolm@redhat.com>
278 * include/cpplib.h (BOL): Move macro to 1 << 12 since it is
279 not used by C/C++'s unsigned char token flags.
280 (DECIMAL_INT): New, using 1 << 6, so that it is visible as
281 part of C/C++'s 8 bits of token flags.
283 2022-09-01 Jakub Jelinek <jakub@redhat.com>
286 * include/cpplib.h (struct cpp_options): Implement C++23
287 P2295R6 - Support for UTF-8 as a portable source file encoding.
288 Add cpp_warn_invalid_utf8 and cpp_input_charset_explicit fields.
289 (enum cpp_warning_reason): Add CPP_W_INVALID_UTF8 enumerator.
290 * init.cc (cpp_create_reader): Initialize cpp_warn_invalid_utf8
291 and cpp_input_charset_explicit.
292 * charset.cc (_cpp_valid_utf8): Adjust function comment.
293 * lex.cc (UCS_LIMIT): Define.
294 (utf8_continuation): New const variable.
295 (utf8_signifier): Move earlier in the file.
296 (_cpp_warn_invalid_utf8, _cpp_handle_multibyte_utf8): New functions.
297 (_cpp_skip_block_comment): Handle -Winvalid-utf8 warning.
298 (skip_line_comment): Likewise.
299 (lex_raw_string, lex_string): Likewise.
300 (_cpp_lex_direct): Likewise.
302 2022-08-31 Jakub Jelinek <jakub@redhat.com>
304 PR preprocessor/106778
305 * makeuname2c.cc (write_nodes): Reverse order of && operands in
308 2022-08-26 Jakub Jelinek <jakub@redhat.com>
311 * charset.cc (wide_str_to_charconst): Implement P2362R3 - Remove
312 non-encodable wide character literals and multicharacter. For
313 C++23 use CPP_DL_ERROR instead of CPP_DL_WARNING for
314 "character constant too long for its type" diagnostics on CPP_WCHAR
317 2022-08-26 Jakub Jelinek <jakub@redhat.com>
320 * charset.cc: Implement C++23 P2071R2 - Named universal character
321 escapes. Include uname2c.h.
322 (hangul_syllables, hangul_count): New variables.
323 (struct uname2c_data): New type.
324 (_cpp_uname2c, _cpp_uname2c_uax44_lm2): New functions.
325 (_cpp_valid_ucn): Use them. Handle named universal character escapes.
326 (convert_ucn): Adjust comment.
327 (convert_escape): Call convert_ucn even for \N.
328 (_cpp_interpret_identifier): Handle named universal character escapes.
329 * lex.cc (get_bidi_ucn): Fix up function comment formatting.
330 (get_bidi_named): New function.
331 (forms_identifier_p, lex_string): Handle named universal character
333 * makeuname2c.cc: New file. Small parts copied from makeucnid.cc.
334 * uname2c.h: New generated file.
336 2022-08-24 Jakub Jelinek <jakub@redhat.com>
339 * init.cc: Implement C++23 P2437R1 - Support for #warning.
340 (lang_defaults): Set warning_directive for GNUCXX23 and CXX23.
341 * directives.cc (directive_diagnostics): Use different wording of
342 #warning pedwarn for C++.
344 2022-08-20 Jakub Jelinek <jakub@redhat.com>
347 * include/cpplib.h (struct cpp_options): Implement
348 P2290R3 - Delimited escape sequences. Add delimite_escape_seqs
350 * init.cc (struct lang_flags): Likewise.
351 (lang_defaults): Add delim column.
352 (cpp_set_lang): Copy over delimite_escape_seqs.
353 * charset.cc (extend_char_range): New function.
354 (_cpp_valid_ucn): Use it. Handle delimited escape sequences.
355 (convert_hex): Likewise.
356 (convert_oct): Likewise.
357 (convert_ucn): Use extend_char_range.
358 (convert_escape): Call convert_oct even for \o.
359 (_cpp_interpret_identifier): Handle delimited escape sequences.
360 * lex.cc (get_bidi_ucn_1): Likewise. Add end argument, fill it in.
361 (get_bidi_ucn): Adjust get_bidi_ucn_1 caller. Use end argument to
364 2022-08-18 Joseph Myers <joseph@codesourcery.com>
366 * include/cpplib.h (struct cpp_options): Add warning_directive.
367 * init.cc (struct lang_flags, lang_defaults): Add
369 * directives.cc (DIRECTIVE_TABLE): Mark #warning as STDC2X not
371 (directive_diagnostics): Diagnose #warning with -Wc11-c2x-compat,
372 or with -pedantic for a standard not supporting #warning.
374 2022-08-16 Tom Honermann <tom@honermann.net>
377 * include/cpplib.h (cpp_warning_reason): Add CPP_W_CXX20_COMPAT.
378 * init.cc (cpp_create_reader): Add cpp_warn_cxx20_compat.
380 2022-08-08 Tom Honermann <tom@honermann.net>
382 PR preprocessor/106426
383 * charset.cc (narrow_str_to_charconst): Set signedness of CPP_UTF8CHAR
384 literals based on unsigned_utf8char.
385 * include/cpplib.h (cpp_options): Add unsigned_utf8char.
386 * init.cc (cpp_create_reader): Initialize unsigned_utf8char.
388 2022-07-15 Jonathan Wakely <jwakely@redhat.com>
390 * include/line-map.h (label_text::take_or_copy): Remove.
391 (label_text::moved_from): Rename to release.
392 (label_text::m_buffer, label_text::m_owned): Make private.
393 (label_text::get, label_text::is_owned): New accessors.
395 2022-07-13 Marek Polacek <polacek@redhat.com>
397 PR preprocessor/106272
398 * include/line-map.h (class label_text): Don't std::move in a return
401 2022-07-10 Lewis Hyatt <lhyatt@gmail.com>
403 PR preprocessor/97498
404 * directives.cc (destringize_and_run): Override the location of
405 the CPP_PRAGMA token from a _Pragma directive to the location of
406 the expansion point, as is done for the tokens lexed from it.
408 2022-07-07 David Malcolm <dmalcolm@redhat.com>
410 * include/line-map.h: Include <utility>.
411 (class label_text): Delete maybe_free method in favor of a
412 destructor. Add move ctor and assignment operator. Add deletion
413 of the copy ctor and copy-assignment operator. Rename field
414 m_caller_owned to m_owned. Add std::move where necessary; add
415 moved_from member function.
417 2022-06-28 Lewis Hyatt <lhyatt@gmail.com>
419 * ucnid.h: Regenerated for Unicode 14.0.
421 2022-06-26 Lewis Hyatt <lhyatt@gmail.com>
423 * generated_cpp_wcwidth.h: Generated from updated Unicode data files.
425 2022-05-29 Jakub Jelinek <jakub@redhat.com>
427 PR preprocessor/105732
428 * expr.cc (_cpp_parse_expr): Handle CPP_PADDING by just another
431 2022-05-20 David Malcolm <dmalcolm@redhat.com>
433 * lex.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and
436 2022-02-11 Joseph Myers <joseph@codesourcery.com>
438 * Makefile.in (po/$(PACKAGE).pot): Also handle cpp_warning_at,
439 cpp_pedwarning_at and cpp_error_at.
441 2022-02-01 Jakub Jelinek <jakub@redhat.com>
443 PR preprocessor/104147
444 * macro.cc (funlike_invocation_p): For padding prefer a token
445 with val.source non-NULL especially if it has PREV_WHITE set
446 on val.source->flags. Add gcc_assert that CPP_PADDING tokens
447 don't have PREV_WHITE set in flags.
449 2022-02-01 Jakub Jelinek <jakub@redhat.com>
451 * directives.cc (destringize_and_run): Push &pfile->avoid_paste
452 instead of a copy of pfile->directive_result for the CPP_PADDING
455 2022-01-24 Marek Polacek <polacek@redhat.com>
457 PR preprocessor/104030
458 * include/cpplib.h (enum cpp_bidirectional_level): Add
459 bidirectional_ucn. Set values explicitly.
460 * internal.h (cpp_reader): Adjust warn_bidi_p.
461 * lex.cc (maybe_warn_bidi_on_close): Don't warn about UCNs
462 unless UCN checking is on.
463 (maybe_warn_bidi_on_char): Likewise.
465 2022-01-18 Richard Biener <rguenther@suse.de>
467 * include/line-map.h (class line_maps): Re-arrange fields
469 (class rich_location): Likewise.
470 * line-map.cc (rich_location::rich_location): Adjust.
472 2022-01-17 Martin Liska <mliska@suse.cz>
474 * Makefile.in: Rename .c names to .cc.
476 2022-01-17 Martin Liska <mliska@suse.cz>
478 * Makefile.in: Rename .c names to .cc.
479 * charset.cc (convert_escape): Likewise.
480 * directives.cc (directive_diagnostics): Likewise.
481 (_cpp_handle_directive): Likewise.
482 (lex_macro_node): Likewise.
483 * include/cpplib.h (struct _cpp_file): Likewise.
484 (PURE_ZERO): Likewise.
485 (cpp_defined): Likewise.
486 (cpp_error_at): Likewise.
487 (cpp_forall_identifiers): Likewise.
488 (cpp_compare_macros): Likewise.
489 (cpp_get_converted_source): Likewise.
490 (cpp_read_state): Likewise.
491 (cpp_directive_only_process): Likewise.
492 (struct cpp_decoded_char): Likewise.
493 * include/line-map.h (enum lc_reason): Likewise.
494 (enum location_aspect): Likewise.
495 * include/mkdeps.h: Likewise.
496 * init.cc (cpp_destroy): Likewise.
497 (cpp_finish): Likewise.
498 * internal.h (struct cpp_reader): Likewise.
499 (_cpp_defined_macro_p): Likewise.
500 (_cpp_backup_tokens_direct): Likewise.
501 (_cpp_destroy_hashtable): Likewise.
502 (_cpp_has_header): Likewise.
503 (_cpp_expand_op_stack): Likewise.
504 (_cpp_commit_buff): Likewise.
505 (_cpp_restore_special_builtin): Likewise.
506 (_cpp_bracket_include): Likewise.
507 (_cpp_replacement_text_len): Likewise.
509 * line-map.cc (linemap_macro_loc_to_exp_point): Likewise.
510 (linemap_check_files_exited): Likewise.
511 (line_map_new_raw): Likewise.
512 * traditional.cc (enum ls): Likewise.
514 2022-01-17 Martin Liska <mliska@suse.cz>
516 * charset.c: Moved to...
517 * charset.cc: ...here.
518 * directives.c: Moved to...
519 * directives.cc: ...here.
520 * errors.c: Moved to...
521 * errors.cc: ...here.
522 * expr.c: Moved to...
524 * files.c: Moved to...
526 * identifiers.c: Moved to...
527 * identifiers.cc: ...here.
528 * init.c: Moved to...
532 * line-map.c: Moved to...
533 * line-map.cc: ...here.
534 * macro.c: Moved to...
536 * makeucnid.c: Moved to...
537 * makeucnid.cc: ...here.
538 * mkdeps.c: Moved to...
539 * mkdeps.cc: ...here.
542 * symtab.c: Moved to...
543 * symtab.cc: ...here.
544 * traditional.c: Moved to...
545 * traditional.cc: ...here.
547 2022-01-15 Martin Sebor <msebor@redhat.com>
549 * files.c (_cpp_find_file): Substitute a valid pointer for
550 an invalid one to avoid -Wuse-after-free.
552 2022-01-12 Clément Chigot <clement.chigot@atos.net>
554 * configure.ac: Check sizeof ino_t and dev_t.
555 * config.in: Regenerate.
556 * configure: Regenerate.
557 * include/cpplib.h (INO_T_CPP): Change for AIX.
558 (DEV_T_CPP): New macro.
559 (struct cpp_dir): Use it.
561 2021-12-30 Jakub Jelinek <jakub@redhat.com>
563 PR preprocessor/89971
564 * macro.c (replace_args): For ##__VA_OPT__, if __VA_OPT__ expands
565 to no tokens at all, drop PASTE_LEFT flag from the previous token.
567 2021-12-04 Jakub Jelinek <jakub@redhat.com>
569 PR preprocessor/102432
570 * lex.c (_cpp_lex_direct): If buffer->need_line while
571 pfile->state.in_deferred_pragma, return CPP_PRAGMA_EOL token instead
572 of assertion failure.
574 2021-12-03 Jakub Jelinek <jakub@redhat.com>
577 * include/line-map.h (class line_maps): Add GTY((callback)) to
578 reallocator and round_alloc_size members.
580 2021-12-01 Jakub Jelinek <jakub@redhat.com>
583 * init.c (struct lang_flags): Remove cxx23_identifiers.
584 (lang_defaults): Remove cxx23_identifiers initializers.
585 (cpp_set_lang): Don't copy cxx23_identifiers.
586 * include/cpplib.h (struct cpp_options): Adjust comment about
587 c11_identifiers. Remove cxx23_identifiers field.
588 * lex.c (warn_about_normalization): Use cplusplus instead of
590 * charset.c (ucn_valid_in_identifier): Likewise.
592 2021-12-01 Jakub Jelinek <jakub@redhat.com>
594 PR preprocessor/103415
595 * macro.c (stringify_arg): Remove va_opt argument and va_opt handling.
596 (paste_tokens): On successful paste or in PREV_WHITE and
597 PREV_FALLTHROUGH flags from the *plhs token to the new token.
598 (replace_args): Adjust stringify_arg callers. For #__VA_OPT__,
599 perform token pasting in a separate loop before stringify_arg call.
601 2021-11-30 Richard Biener <rguenther@suse.de>
603 * charset.c (convert_escape): Remove unreachable break.
605 2021-11-30 Jakub Jelinek <jakub@redhat.com>
608 * init.c (lang_defaults): Enable cxx23_identifiers for
609 -std={gnu,c}++{11,14,17,20} too.
611 2021-11-29 Eric Gallager <egallager@gcc.gnu.org>
614 * Makefile.in: Use ETAGS variable in TAGS target.
615 * configure: Regenerate.
616 * configure.ac: Allow ETAGS variable to be overridden.
618 2021-11-23 Christophe Lyon <christophe.lyon@foss.st.com>
620 PR preprocessor/103355
621 * system.h (ATTR_LIKELY): Fix definition.
623 2021-11-23 Marek Polacek <polacek@redhat.com>
624 Jonathan Wakely <jwakely@redhat.com>
626 PR preprocessor/103355
627 * lex.c: Use ATTR_LIKELY instead of [[likely]].
628 * system.h (ATTR_LIKELY): Define.
630 2021-11-22 Jakub Jelinek <jakub@redhat.com>
631 Tobias Burnus <tobias@codesourcery.com>
633 PR preprocessor/103165
634 * internal.h (struct lexer_state): Add ignore__Pragma field.
635 * macro.c (builtin_macro): Don't interpret _Pragma if
636 pfile->state.ignore__Pragma.
637 (expand_arg): Temporarily set pfile->state.ignore__Pragma to 1.
639 2021-11-17 David Malcolm <dmalcolm@redhat.com>
641 PR preprocessor/103026
642 * lex.c (struct bidi::context): New.
643 (bidi::vec): Convert to a vec of context rather than unsigned
645 (bidi::ctx_at): Rename to...
646 (bidi::pop_kind_at): ...this and reimplement for above change.
647 (bidi::current_ctx): Update for change to vec.
648 (bidi::current_ctx_ucn_p): Likewise.
649 (bidi::current_ctx_loc): New.
650 (bidi::on_char): Update for usage of context struct. Add "loc"
651 param and pass it when pushing contexts.
652 (get_location_for_byte_range_in_cur_line): New.
653 (get_bidi_utf8): Rename to...
654 (get_bidi_utf8_1): ...this, reintroducing...
655 (get_bidi_utf8): ...as a wrapper, setting *OUT when the result is
657 (get_bidi_ucn): Rename to...
658 (get_bidi_ucn_1): ...this, reintroducing...
659 (get_bidi_ucn): ...as a wrapper, setting *OUT when the result is
661 (class unpaired_bidi_rich_location): New.
662 (maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when
663 reporting on unpaired bidi chars. Split into singular vs plural
665 (maybe_warn_bidi_on_char): Pass in a location_t rather than a
666 const uchar * and use it when emitting warnings, and when calling
668 (_cpp_skip_block_comment): Capture location when kind is not NONE
669 and pass it to maybe_warn_bidi_on_char.
670 (skip_line_comment): Likewise.
671 (forms_identifier_p): Likewise.
672 (lex_raw_string): Likewise.
673 (lex_string): Likewise.
675 2021-11-17 David Malcolm <dmalcolm@redhat.com>
677 PR preprocessor/103026
678 * lex.c (maybe_warn_bidi_on_close): Use a rich_location
679 and call set_escape_on_output (true) on it.
680 (maybe_warn_bidi_on_char): Likewise.
682 2021-11-17 Jakub Jelinek <jakub@redhat.com>
684 PR preprocessor/103130
685 * lex.c (cpp_directive_only_process): Treat even \*/ as end of block
688 2021-11-17 Marek Polacek <polacek@redhat.com>
690 PR preprocessor/103026
691 * include/cpplib.h (enum cpp_bidirectional_level): New.
692 (struct cpp_options): Add cpp_warn_bidirectional.
693 (enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL.
694 * internal.h (struct cpp_reader): Add warn_bidi_p member
696 * init.c (cpp_create_reader): Set cpp_warn_bidirectional.
697 * lex.c (bidi): New namespace.
698 (get_bidi_utf8): New function.
699 (get_bidi_ucn): Likewise.
700 (maybe_warn_bidi_on_close): Likewise.
701 (maybe_warn_bidi_on_char): Likewise.
702 (_cpp_skip_block_comment): Implement warning about bidirectional
704 (skip_line_comment): Likewise.
705 (forms_identifier_p): Likewise.
706 (lex_identifier): Likewise.
707 (lex_string): Likewise.
708 (lex_raw_string): Likewise.
710 2021-11-01 David Malcolm <dmalcolm@redhat.com>
712 * charset.c (convert_escape): Use encoding_rich_location when
713 complaining about nonprintable unknown escape sequences.
714 (cpp_display_width_computation::::cpp_display_width_computation):
715 Pass in policy rather than tabstop.
716 (cpp_display_width_computation::process_next_codepoint): Add "out"
717 param and populate *out if non-NULL.
718 (cpp_display_width_computation::advance_display_cols): Pass NULL
719 to process_next_codepoint.
720 (cpp_byte_column_to_display_column): Pass in policy rather than
721 tabstop. Pass NULL to process_next_codepoint.
722 (cpp_display_column_to_byte_column): Pass in policy rather than
724 * errors.c (cpp_diagnostic_get_current_location): New function,
725 splitting out the logic from...
726 (cpp_diagnostic): ...here.
727 (cpp_warning_at): New function.
728 (cpp_pedwarning_at): New function.
729 * include/cpplib.h (cpp_warning_at): New decl for rich_location.
730 (cpp_pedwarning_at): Likewise.
731 (struct cpp_decoded_char): New.
732 (struct cpp_char_column_policy): New.
733 (cpp_display_width_computation::cpp_display_width_computation):
734 Replace "tabstop" param with "policy".
735 (cpp_display_width_computation::process_next_codepoint): Add "out"
737 (cpp_display_width_computation::m_tabstop): Replace with...
738 (cpp_display_width_computation::m_policy): ...this.
739 (cpp_byte_column_to_display_column): Replace "tabstop" param with
741 (cpp_display_width): Likewise.
742 (cpp_display_column_to_byte_column): Likewise.
743 * include/line-map.h (rich_location::escape_on_output_p): New.
744 (rich_location::set_escape_on_output): New.
745 (rich_location::m_escape_on_output): New.
746 * internal.h (cpp_diagnostic_get_current_location): New decl.
747 (class encoding_rich_location): New.
748 * lex.c (skip_whitespace): Use encoding_rich_location when
749 complaining about null characters.
750 (warn_about_normalization): Generate a source range when
751 complaining about improperly normalized tokens, rather than just a
752 point, and use encoding_rich_location so that the source code
753 is escaped on printing.
754 * line-map.c (rich_location::rich_location): Initialize
757 2021-10-29 Tobias Burnus <tobias@codesourcery.com>
760 * directives.c (destringize_and_run): Add PRAGMA_OP to the
761 CPP_PRAGMA token's flags to mark is as coming from _Pragma.
762 * include/cpplib.h (PRAGMA_OP): #define, to be used with token flags.
763 * macro.c (collect_args): Only handle CPP_PRAGMA special if PRAGMA_OP
766 2021-10-22 Eric Gallager <egallager@gcc.gnu.org>
769 * Makefile.in: Add dummy install-dvi target.
771 2021-10-18 Martin Liska <mliska@suse.cz>
773 * charset.c (convert_oct): Remove unused but set variable.
775 2021-10-06 Jakub Jelinek <jakub@redhat.com>
777 * init.c (lang_defaults): Implement P2334R1, enable elifdef for
778 -std=c++23 and -std=gnu++23.
779 * directives.c (_cpp_handle_directive): Support elifdef/elifndef if
780 either CPP_OPTION (pfile, elifdef) or !CPP_OPTION (pfile, std).
781 (do_elif): For older non-std modes if pedantic pedwarn about
782 #elifdef/#elifndef directives that change behavior.
784 2021-09-01 Jakub Jelinek <jakub@redhat.com>
787 * include/cpplib.h (struct cpp_options): Add cxx23_identifiers.
788 * charset.c (CXX23, NXX23): New enumerators.
789 (CID, NFC, NKC, CTX): Renumber.
790 (ucn_valid_in_identifier): Implement P1949R7 - use CXX23 and
791 NXX23 flags for cxx23_identifiers. For start character in
792 non-pedantic mode, allow characters that are allowed as start
793 characters in any of the supported language modes, rather than
794 disallowing characters allowed only as non-start characters in
795 current mode but for characters from other language modes allowing
796 them even if they are never allowed at start.
797 * init.c (struct lang_flags): Add cxx23_identifiers.
798 (lang_defaults): Add cxx23_identifiers column.
799 (cpp_set_lang): Initialize CPP_OPTION (pfile, cxx23_identifiers).
800 * lex.c (warn_about_normalization): If cxx23_identifiers, use
801 cpp_pedwarning_with_line instead of cpp_warning_with_line for
802 "is not in NFC" diagnostics.
803 * makeucnid.c: Adjust usage comment.
804 (CXX23, NXX23): New enumerators.
805 (all_languages): Add CXX23.
806 (not_NFC, not_NFKC, maybe_not_NFC): Renumber.
807 (read_derivedcore): New function.
808 (write_table): Print also CXX23 and NXX23 columns.
809 (main): Require 5 arguments instead of 4, call read_derivedcore.
810 * ucnid.h: Regenerated using Unicode 13.0.0 files.
812 2021-09-01 Jason Merrill <jason@redhat.com>
814 * macro.c (replace_args): When __VA_OPT__ is on the LHS of ##,
815 remove trailing avoid_paste tokens.
817 2021-09-01 Jakub Jelinek <jakub@redhat.com>
819 PR preprocessor/101488
820 * macro.c (replace_args): Fix up handling of CPP_PADDING tokens at the
821 start or end of __VA_OPT__ arguments when preceeded or followed by ##.
823 2021-08-31 Martin Sebor <msebor@redhat.com>
825 * include/line-map.h (class rich_location): Disable copying and
828 2021-08-25 Lewis Hyatt <lhyatt@gmail.com>
831 * charset.c (init_iconv_desc): Adapt to permit PFILE argument to
833 (_cpp_convert_input): Likewise. Also move UTF-8 BOM logic to...
834 (cpp_check_utf8_bom): ...here. New function.
835 (cpp_input_conversion_is_trivial): New function.
836 * files.c (read_file_guts): Allow PFILE argument to be NULL. Add
837 INPUT_CHARSET argument as an alternate source of this information.
838 (read_file): Pass the new argument to read_file_guts.
839 (cpp_get_converted_source): New function.
840 * include/cpplib.h (struct cpp_converted_source): Declare.
841 (cpp_get_converted_source): Declare.
842 (cpp_input_conversion_is_trivial): Declare.
843 (cpp_check_utf8_bom): Declare.
845 2021-08-17 Jakub Jelinek <jakub@redhat.com>
847 * macro.c (vaopt_state): Add m_stringify member.
848 (vaopt_state::vaopt_state): Initialize it.
849 (vaopt_state::update): Overwrite it.
850 (vaopt_state::stringify): New method.
851 (stringify_arg): Replace arg argument with first, count arguments
852 and add va_opt argument. Use first instead of arg->first and
853 count instead of arg->count, for va_opt add paste_tokens handling.
854 (paste_tokens): Fix up len calculation. Don't spell rhs twice,
855 instead use %.*s to supply lhs and rhs spelling lengths. Don't call
856 _cpp_backup_tokens here.
857 (paste_all_tokens): Call it here instead.
858 (replace_args): Adjust stringify_arg caller. For vaopt_state::END
859 if stringify is true handle __VA_OPT__ stringification.
860 (create_iso_definition): Handle # __VA_OPT__ similarly to # macro_arg.
862 2021-08-12 Jakub Jelinek <jakub@redhat.com>
864 PR preprocessor/101638
865 * macro.c (cpp_sys_macro_p): Return true instead of
866 crashing on builtin macros.
868 2021-08-05 Jakub Jelinek <jakub@redhat.com>
871 * ucnid.h: Regenerated using Unicode 13.0.0 files.
873 2021-08-05 Jakub Jelinek <jakub@redhat.com>
876 * makeucnid.c (write_table): Fix computation of last_combine.
877 * ucnid.h: Regenerated using Unicode 6.3.0 files.
879 2021-06-16 Jason Merrill <jason@redhat.com>
882 PR preprocessor/96391
883 * line-map.c (linemap_compare_locations): Only use comparison with
884 LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort.
886 2021-05-20 Christophe Lyon <christophe.lyon@linaro.org>
887 Torbjörn Svensson <torbjorn.svensson@st.com>
890 * include/cpplib.h (cpp_builtin_type): Add BT_FILE_NAME entry.
891 * init.c (builtin_array): Likewise.
892 * macro.c (_cpp_builtin_macro_text): Add support for BT_FILE_NAME.
894 2021-05-20 Jakub Jelinek <jakub@redhat.com>
896 PR preprocessor/100646
897 * lex.c (cpp_directive_only_process): Treat end of file as termination
898 for !is_block comments.
900 2021-05-12 Jakub Jelinek <jakub@redhat.com>
902 PR preprocessor/100392
903 * lex.c (cpp_directive_only_process): If buffer doesn't end with '\n',
904 add buffer->rlimit[0] character to the printed range and
905 CPP_INCREMENT_LINE and increment line_count.
907 2021-05-11 Joseph Myers <joseph@codesourcery.com>
909 * include/cpplib.h (struct cpp_options): Add elifdef.
910 * init.c (struct lang_flags): Add elifdef.
911 (lang_defaults): Update to include elifdef initializers.
912 (cpp_set_lang): Set elifdef for pfile based on language.
913 * directives.c (STDC2X, ELIFDEF): New macros.
914 (EXTENSION): Increase value to 3.
915 (DIRECTIVE_TABLE): Add #elifdef and #elifndef.
916 (_cpp_handle_directive): Do not treat ELIFDEF directives as
917 directives for language versions without the #elifdef feature.
918 (do_elif): Handle #elifdef and #elifndef.
919 (do_elifdef, do_elifndef): New functions.
921 2021-05-11 Joseph Myers <joseph@codesourcery.com>
923 * lex.c (cpp_avoid_paste): Do not allow pasting CPP_NUMBER with
926 2021-05-11 Joseph Myers <joseph@codesourcery.com>
928 * init.c (lang_defaults): Enable digit separators for GNUC2X and
931 2021-05-07 Jakub Jelinek <jakub@redhat.com>
934 * lex.c (cpp_avoid_paste): Handle token1 CPP_PRAGMA like CPP_NAME.
936 2021-05-06 Joseph Myers <joseph@codesourcery.com>
939 PR preprocessor/97604
940 * lex.c (lex_number): Reject adjacent digit separators here. Do
941 not allow digit separators before '.' or an exponent with sign.
942 * expr.c (cpp_classify_number): Do not check for adjacent digit
945 2021-05-03 H.J. Lu <hjl.tools@gmail.com>
948 * configure: Regenerated.
950 2021-04-29 Joseph Myers <joseph@codesourcery.com>
952 PR preprocessor/82359
953 * directives.c (strtolinenum): Handle digit separators.
955 2021-04-19 Richard Biener <rguenther@suse.de>
957 PR preprocessor/100142
958 * line-map.c (linemap_position_for_loc_and_offset): Revert
959 unintended s/column_offset/column/ change.
961 2021-04-13 Nathan Sidwell <nathan@acm.org>
963 PR preprocessor/99446
964 * line-map.c (line-map.c): Do not advance to linemaps for
967 2021-04-13 Eric Botcazou <ebotcazou@adacore.com>
969 * include/line-map.h (IS_MACRO_LOC): Delete.
970 * line-map.c (linemap_location_from_macro_expansion_p): Test
971 LINEMAPS_MACRO_LOWEST_LOCATION of the linemap.
973 2021-03-02 David Malcolm <dmalcolm@redhat.com>
976 * line-map.c (rich_location::maybe_add_fixit): Reject fix-it hints
979 2021-02-24 Nathan Sidwell <nathan@acm.org>
985 2021-02-24 Nathan Sidwell <nathan@acm.org>
988 * init.c (read_original_filename): Expunge all evidence of the
991 2021-02-18 Nathan Sidwell <nathan@acm.org>
994 * include/cpplib.h (cpp_find_header_unit): Rename to ...
995 (cpp_probe_header_unit): ... this.
996 * internal.h (_cp_find_header_unit): Declare.
997 * files.c (cpp_find_header_unit): Break apart to ..
998 (test_header_unit): ... this, and ...
999 (_cpp_find_header_unit): ... and, or and ...
1000 (cpp_probe_header_unit): ... this.
1001 * macro.c (cpp_get_token_1): Call _cpp_find_header_unit.
1003 2021-02-16 Nathan Sidwell <nathan@acm.org>
1005 * files.c (_cpp_stack_file): Make buffers end in unread \n.
1007 2021-02-10 David Malcolm <dmalcolm@redhat.com>
1009 PR preprocessor/96391
1010 * line-map.c (linemap_compare_locations): Require that
1011 the location be <= LINE_MAP_MAX_LOCATION_WITH_COLS when
1012 treating locations as coming from the same macro expansion.
1014 2021-02-04 Jakub Jelinek <jakub@redhat.com>
1016 * expr.c (cpp_classify_number): Use make_signed_t<size_t> instead of
1017 make_signed<size_t>::type in the diagnostics.
1019 2021-02-03 Jakub Jelinek <jakub@redhat.com>
1021 PR preprocessor/98882
1022 * lex.c (cpp_directive_only_process): Don't assert that rlimit[-1]
1023 is a newline, instead assert that rlimit[0] is either newline or
1024 carriage return. When seeing '\\' followed by '\r', check limit
1025 before accessing pos[1].
1027 2021-02-03 Ed Smith-Rowland <3dw4rd@verizon.net>
1029 * expr.c (interpret_int_suffix): Detect 'z' integer suffix.
1030 (cpp_classify_number): Compat warning for use of 'z' suffix.
1031 * include/cpplib.h (struct cpp_options): New flag.
1032 (enum cpp_warning_reason): New flag.
1033 (CPP_N_USERDEF): Comment C++0x -> C++11.
1034 (CPP_N_SIZE_T): New flag for cpp_classify_number.
1035 * init.c (cpp_set_lang): Initialize new flag.
1037 2021-01-27 liuhongt <hongtao.liu@intel.com>
1040 * lex.c (search_line_sse2): Replace builtins with == operator.
1042 2021-01-26 Paul Fee <paul.f.fee@gmail.com>
1044 * include/cpplib.h (c_lang): Add CXX23 and GNUCXX23.
1045 * init.c (lang_defaults): Add rows for CXX23 and GNUCXX23.
1046 (cpp_init_builtins): Set __cplusplus to 202100L for C++23.
1048 2021-01-15 Nathan Sidwell <nathan@acm.org>
1050 PR preprocessor/95253
1051 * mkdeps.c (munge): Do not escape ':'.
1053 2020-12-14 Nathan Sidwell <nathan@acm.org>
1055 * include/cpplib.h (struct cpp_macro): Add imported_p field.
1056 (struct cpp_hashnode): Tweak deferred field documentation.
1057 * macro.c (_cpp_new_macro): Clear new field.
1058 (cpp_get_deferred_macro, get_deferred_or_lazy_macro): Assert
1061 2020-12-10 Jason Merrill <jason@redhat.com>
1063 * init.c (cpp_init_builtins): Update __cplusplus for C++20.
1065 2020-12-01 JeanHeyd Meneide <phdofthehouse@gmail.com>
1067 * charset.c (init_iconv_desc): Initialize "to" and "from" fields.
1068 * directives.c (cpp_get_narrow_charset_name): New function.
1069 (cpp_get_wide_charset_name): Likewise.
1070 * include/cpplib.h (cpp_get_narrow_charset_name): Prototype.
1071 (cpp_get_wide_charset_name): Likewise.
1072 * internal.h (cset_converter): Add "to" and "from" fields.
1074 2020-11-27 Joseph Myers <joseph@codesourcery.com>
1076 PR preprocessor/97602
1077 * directives.c (strtolinenum): Check for overflow before it
1078 occurs. Correct comment.
1080 2020-11-24 Nathan Sidwell <nathan@acm.org>
1082 * include/cpplib.h (struct cpp_hashnode): Add deferred field.
1083 (cpp_set_deferred_macro): Define.
1084 (cpp_get_deferred_macro): Declare.
1085 (cpp_macro_definition): Reformat, add overload.
1086 (cpp_macro_definition_location): Deal with deferred macro.
1087 (cpp_alloc_token_string, cpp_compare_macro): Declare.
1088 * internal.h (_cpp_notify_macro_use): Return bool
1089 (_cpp_maybe_notify_macro_use): Likewise.
1090 * directives.c (do_undef): Check macro is not undef before
1092 (do_ifdef, do_ifndef): Deal with deferred macro.
1093 * expr.c (parse_defined): Likewise.
1094 * lex.c (cpp_allocate_token_string): Break out of ...
1095 (create_literal): ... here. Call it.
1096 (cpp_maybe_module_directive): Deal with deferred macro.
1097 * macro.c (cpp_get_token_1): Deal with deferred macro.
1098 (warn_of_redefinition): Deal with deferred macro.
1099 (compare_macros): Rename to ...
1100 (cpp_compare_macro): ... here. Make extern.
1101 (cpp_get_deferred_macro): New.
1102 (_cpp_notify_macro_use): Deal with deferred macro, return bool
1103 indicating definedness.
1104 (cpp_macro_definition): Deal with deferred macro.
1106 2020-11-19 Nathan Sidwell <nathan@acm.org>
1108 * include/cpplib.h (enum cpp_main_search): New.
1109 (struct cpp_options): Add main_search field.
1110 (cpp_main_loc): Declare.
1111 (cpp_retrofit_as_include): Declare.
1112 * internal.h (struct cpp_reader): Add main_loc field.
1113 (_cpp_in_main_source_file): Not main if main is a header.
1114 * init.c (cpp_read_main_file): Use main_search option to locate
1115 main file. Set main_loc
1116 * files.c (cpp_retrofit_as_include): New.
1118 2020-11-19 Nathan Sidwell <nathan@acm.org>
1120 * internal.h (cpp_in_system_header): Rename to ...
1121 (_cpp_in_system_header): ... here.
1122 (cpp_in_primary_file): Rename to ...
1123 (_cpp_in_main_source_file): ... here. Compare main_file equality
1124 and check main_search value.
1125 * lex.c (maybe_va_opt_error, _cpp_lex_direct): Adjust for rename.
1126 * macro.c (_cpp_builtin_macro_text): Likewise.
1127 (replace_args): Likewise.
1128 * directives.c (do_include_next): Likewise.
1129 (do_pragma_once, do_pragma_system_header): Likewise.
1130 * files.c (struct _cpp_file): Delete main_file field.
1131 (pch_open): Check pfile->main_file equality.
1132 (make_cpp_file): Drop cpp_reader parm, don't set main_file.
1133 (_cpp_find_file): Adjust.
1134 (_cpp_stack_file): Check pfile->main_file equality.
1135 (struct report_missing_guard_data): Add cpp_reader field.
1136 (report_missing_guard): Check pfile->main_file equality.
1137 (_cpp_report_missing_guards): Adjust.
1139 2020-11-18 Nathan Sidwell <nathan@acm.org>
1141 * include/cpplib.h (struct cpp_options): Add module_directives
1143 (NODE_MODULE): New node flag.
1144 (struct cpp_hashnode): Make rid-code a bitfield, increase bits in
1145 flags and swap with type field.
1146 * init.c (post_options): Create module-directive identifier nodes.
1147 * internal.h (struct lexer_state): Add directive_file_token &
1148 n_modules fields. Add module node enumerator.
1149 * lex.c (cpp_maybe_module_directive): New.
1150 (_cpp_lex_token): Call it.
1151 (cpp_output_token): Add '"' around CPP_HEADER_NAME token.
1152 (do_peek_ident, do_peek_module): New.
1153 (cpp_directives_only): Detect module-directive lines.
1154 * macro.c (cpp_get_token_1): Deal with directive_file_token
1157 2020-11-18 Nathan Sidwell <nathan@acm.org>
1159 * files.c (struct _cpp_file): Add header_unit field.
1160 (_cpp_stack_file): Add header unit support.
1161 (cpp_find_header_unit): New.
1162 * include/cpplib.h (cpp_find_header_unit): Declare.
1164 2020-11-18 Nathan Sidwell <nathan@acm.org>
1166 * include/cpplib.h (struct cpp_options): Add modules to
1168 * include/mkdeps.h (deps_add_module_target): Declare.
1169 (deps_add_module_dep): Declare.
1170 * mkdeps.c (class mkdeps): Add modules, module_name, cmi_name,
1171 is_header_unit fields. Adjust cdtors.
1172 (deps_add_module_target, deps_add_module_dep): New.
1173 (make_write): Write module dependencies, if enabled.
1175 2020-11-17 Nathan Sidwell <nathan@acm.org>
1177 * include/cpplib.h (struct cpp_callbacks): Add
1178 user_deferred_macro & translate_include.
1180 2020-11-17 Nathan Sidwell <nathan@acm.org>
1182 * include/line-map.h (enum lc_reason): Add LC_MODULE.
1183 (MAP_MODULE_P): New.
1184 (line_map_new_raw): Declare.
1185 (linemap_enter_macro): Move declaration from internal.h
1186 (linemap_module_loc, linemap_module_reparent)
1187 (linemap_module_restore): Declare.
1188 (linemap_lookup_macro_indec): Declare.
1189 * internal.h (linemap_enter_macro): Moved to line-map.h.
1190 * line-map.c (linemap_new_raw): New, broken out of ...
1191 (new_linemap): ... here. Call it.
1192 (LAST_SOURCE_LINE_LOCATION): New.
1193 (liemap_module_loc, linemap_module_reparent)
1194 (linemap_module_restore): New.
1195 (linemap_lookup_macro_index): New, broken out of ...
1196 (linemap_macro_map_lookup): ... here. Call it.
1197 (linemap_dump): Add module dump.
1199 2020-11-17 Nathan Sidwell <nathan@acm.org>
1201 PR preprocessor/97858
1202 * mkdeps.c (munge): Drop varadic args, we only ever use one.
1204 2020-11-13 Joseph Myers <joseph@codesourcery.com>
1206 * expr.c (cpp_classify_number): Update diagnostic for binary
1207 constants for C. Also diagnose binary constants for
1209 * init.c (lang_defaults): Enable binary constants for GNUC2X and
1212 2020-11-13 Piotr H. Dabrowski <phd@phd.re>
1215 * include/cpplib.h: Added cpp_define_unused(), cpp_define_formatted_unused()
1216 * directives.c: Likewise.
1218 2020-11-12 Joseph Myers <joseph@codesourcery.com>
1220 * include/cpplib.h (struct cpp_callbacks): Add bool argument to
1222 (enum cpp_builtin_type): Add BT_HAS_STD_ATTRIBUTE.
1223 * init.c (builtin_array): Add __has_c_attribute.
1224 (cpp_init_special_builtins): Handle BT_HAS_STD_ATTRIBUTE.
1225 * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_STD_ATTRIBUTE.
1226 Update call to has_attribute for BT_HAS_ATTRIBUTE.
1227 * traditional.c (fun_like_macro): Handle BT_HAS_STD_ATTRIBUTE.
1229 2020-11-12 Nicholas Guriev <guriev-ns@ya.ru>
1232 * files.c (_cpp_find_file): Use CPP_DL_NOTE not CPP_DL_ERROR in call to
1235 2020-11-07 Lewis Hyatt <lhyatt@gmail.com>
1237 * generated_cpp_wcwidth.h: Regenerated from Unicode 13.0.0 data.
1239 2020-11-06 Nathan Sidwell <nathan@acm.org>
1241 * include/cpplib.h (enum class CPP_time_kind): New.
1242 (cpp_get_date): Declare.
1243 * internal.h (struct cpp_reader): Replace source_date_epoch with
1244 time_stamp and time_stamp_kind.
1245 * init.c (cpp_create_reader): Initialize them.
1246 * macro.c (_cpp_builtin_macro_text): Use cpp_get_date.
1247 (cpp_get_date): Broken out from _cpp_builtin_macro_text and
1250 2020-11-03 Nathan Sidwell <nathan@acm.org>
1252 * lex.c (cpp_peek_token): Do not peek past CPP_PRAGMA.
1253 (_cpp_lex_direct): Handle EOF in pragma when setting need_line,
1254 not when needing a line.
1256 2020-11-03 Nathan Sidwell <nathan@acm.org>
1258 * lex.c (_cpp_clean_line): Fix DOS off-by-one error.
1260 2020-11-03 Nathan Sidwell <nathan@acm.org>
1262 * init.c (cpp_read_main_file): Use cpp_get_deps result.
1264 2020-11-03 Nathan Sidwell <nathan@acm.org>
1266 * include/mkdeps.h: Include cpplib.h
1267 (deps_write): Adjust first parm type.
1268 * mkdeps.c: Include internal.h
1269 (make_write): Adjust first parm type. Check phony option
1271 (deps_write): Adjust first parm type.
1272 * init.c (cpp_read_main_file): Use get_deps.
1273 * directives.c (cpp_get_deps): Check option before initializing.
1275 2020-11-02 Nathan Sidwell <nathan@acm.org>
1277 * internal.h (_cpp_notify_macro_use): Add location parm.
1278 (_cpp_maybe_notify_macro_use): Likewise.
1279 * directives.c (_cpp_do_file_change): Check we've not changed file
1280 when optimizing a rewind.
1281 (do_ifdef): Pass location to _cpp_maybe_notify_macro_use.
1282 (do_ifndef): Likewise. Delete obsolete comment about powerpc.
1283 * expr.c (parse_defined): Pass location to
1284 _cpp_maybe_notify_macro_use.
1285 * macro.c (enter_macro_context): Likewise.
1286 (warn_of_redefinition): Break out helper function. Call it.
1287 (compare_macros): New function broken out of warn_of_redefinition.
1288 (_cpp_new_macro): Zero all fields.
1289 (_cpp_notify_macro_use): Add location parameter.
1291 2020-10-20 Nathan Sidwell <nathan@acm.org>
1293 * lex.c (_cpp_lex_direct): Do not complete EOF processing when
1295 * macro.c (collect_args): Do not unwind fake EOF.
1296 (funlike_invocation_p): Do not unwind fake EOF.
1297 (cpp_context): Replace abort with gcc_assert.
1299 2020-10-19 Nathan Sidwell <nathan@acm.org>
1301 * internal.h (struct cpp_reader): Rename 'eof' field to 'endarg'.
1302 * init.c (cpp_create_reader): Adjust.
1303 * macro.c (collect_args): Use endarg for separator. Always rewind
1306 2020-10-08 Nathan Sidwell <nathan@acm.org>
1308 * internal.h (enum include_type): Rename IT_MAIN_INJECT to
1310 * init.c (cpp_read_main_file): If there is no line marker, adjust
1311 the initial line marker.
1312 (read_original_filename): Return bool, peek the buffer directly
1313 before trying to tokenize.
1314 (read_original_directory): Likewise. Directly prod the string
1316 * files.c (_cpp_stack_file): Adjust for IT_PRE_MAIN change.
1318 2020-09-26 Jakub Jelinek <jakub@redhat.com>
1321 * lex.c (search_line_fast): Only use _ARCH_PWR8 Altivec version
1324 2020-09-17 Patrick Palka <ppalka@redhat.com>
1327 * include/line-map.h (first_map_in_common): Declare.
1328 * line-map.c (first_map_in_common): Remove static.
1330 2020-09-07 Martin Storsjö <martin@martin.st>
1332 * files.c (remap_filename): Make a strchr return value pointer
1335 2020-07-30 H.J. Lu <hjl.tools@gmail.com>
1338 * configure: Regenerated.
1340 2020-07-29 Tiziano Müller <tiziano.mueller@chem.uzh.ch>
1342 * init.c (builtin_array): Add xref comment.
1343 * traditional.c (fun_like_macro): Add HAS_INCLUDE codes.
1345 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1347 PR preprocessor/96323
1348 * lex.c (lex_raw_string): For c == '\n' don't continue after reporting
1349 an prefix delimiter error.
1351 2020-07-28 Nathan Sidwell <nathan@acm.org>
1353 * init.c (cpp_read_main_file): Always use the last map for
1356 2020-07-20 Nathan Sidwell <nathan@acm.org>
1358 * line-map.c (linemap_add): Simplify column overflow calculation.
1359 Add comment about range and column bit init.
1360 (linemap_ordinary_map_lookup): Refactor for RAII
1361 (linemap_macro_map_lookup): Likewise.
1363 2020-07-14 Lewis Hyatt <lhyatt@gmail.com>
1365 PR preprocessor/49973
1367 * include/cpplib.h (struct cpp_options): Removed support for -ftabstop,
1368 which is now handled by diagnostic_context.
1369 (class cpp_display_width_computation): New class.
1370 (cpp_byte_column_to_display_column): Add optional tabstop argument.
1371 (cpp_display_width): Likewise.
1372 (cpp_display_column_to_byte_column): Likewise.
1374 (cpp_display_width_computation::cpp_display_width_computation): New
1376 (cpp_display_width_computation::advance_display_cols): Likewise.
1377 (compute_next_display_width): Removed and implemented this
1378 functionality in a new function...
1379 (cpp_display_width_computation::process_next_codepoint): ...here.
1380 (cpp_byte_column_to_display_column): Added tabstop argument.
1381 Reimplemented in terms of class cpp_display_width_computation.
1382 (cpp_display_column_to_byte_column): Likewise.
1383 * init.c (cpp_create_reader): Remove handling of -ftabstop, which is now
1384 handled by diagnostic_context.
1386 2020-07-07 Nathan Sidwell <nathan@acm.org>
1388 * directives.c (do_linemarker): Optimize rewinding to line zero.
1389 * files.c (_cpp_stack_file): Start on line zero when about to inject
1391 (cpp_push_include, cpp_push_default_include): Use highest_line as
1393 * include/cpplib.h (cpp_read_main_file): Add injecting parm.
1394 * init.c (cpp_read_main_file): Likewise, inform _cpp_stack_file.
1395 * internal.h (enum include_type): Add IT_MAIN_INJECT.
1397 2020-05-29 H.J. Lu <hjl.tools@gmail.com>
1400 * configure: Regenerated.
1402 2020-05-23 David Edelsohn <dje.gcc@gmail.com>
1404 * Makefile.in (AR): Substitute @AR@.
1405 * configure.ac (CHECK_PROG AR): New.
1406 * configure: Regenerate.
1408 2020-05-20 Nathan Sidwell <nathan@acm.org>
1410 * internal.h (typedef _cpp_file): Delete, unnecessary in C++.
1411 (enum _cpp_find_file_kind): New.
1412 (_cpp_find_file): Use it, not 3 bools.
1413 * files.c (_cpp_find_file): Use _cpp_find_file_kind enum, not
1415 (cpp_make_system_header): Break overly long line.
1416 (_cpp_stack_include, _cpp_fake_include)
1417 (_cpp_do_file_change, _cpp_compare_file_date, _cpp_has_header): Adjust.
1418 * init.c (cpp_read_main): Adjust _cpp_find_file call.
1420 2020-05-18 Nathan Sidwell <nathan@acm.org>
1422 * include/cpplib.h (cpp_get_otions, cpp_get_callbacks)
1423 (cpp_get_deps): Mark as PURE.
1424 * include/line-map.h (get_combined_adhoc_loc)
1425 (get_location_from_adhoc_loc, get_pure_location): Reformat decls.
1426 * internal.h (struct lexer_state): Clarify comment.
1427 * system.h: Remove now-unneeded bool hackery.
1428 * files.c (_cpp_find_file): Store LOC not highest_location.
1430 PR preprocessor/95149
1431 * lex.c (struct lit_accum): New.
1432 (bufring_append): Replace by lit_accum::append.
1433 (lex_raw_string): Reimplement, using fragments of the old version.
1434 (lex_string): Adjust lex_raw_string call.
1436 PR preprocessor/95182
1437 * macro.c (collect_args): Preserve EOFif we fell out of the main
1439 (cpp_get_token_1): Reformat a couple of short lines.
1441 2020-05-14 H.J. Lu <hongjiu.lu@intel.com>
1443 * configure: Regenerated.
1445 2020-05-13 Jason Merrill <jason@redhat.com>
1447 * include/cpplib.h (enum c_lang): Change CXX2A to CXX20.
1448 * init.c, lex.c: Adjust.
1450 2020-05-12 Nathan Sidwell <nathan@acm.org>
1452 EOF location is at end of file
1453 PR preprocessor/95013
1454 * lex.c (lex_raw_string): Process line notes before incrementing.
1455 Correct incrementing condition. Adjust for new
1456 _cpp_get_fresh_line EOF behaviour.
1457 (_cpp_get_fresh_line): Do not pop buffer at EOF, increment line
1459 (_cpp_lex_direct): Adjust for new _cpp_get_fresh_line behaviour.
1460 (cpp_directive_only_process): Assert we got a fresh line.
1461 * traditional.c (_cpp_read_logical_line_trad): Adjust for new
1462 _cpp_get_fresh_line behaviour.
1464 2020-05-12 H.J. Lu <hongjiu.lu@intel.com>
1466 * Makefile.in (CET_HOST_FLAGS): New.
1467 (COMPILER): Add $(CET_HOST_FLAGS).
1468 * configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and
1469 AC_SUBST(CET_HOST_FLAGS). Clear CET_HOST_FLAGS if jit isn't
1471 * aclocal.m4: Regenerated.
1472 * configure: Likewise.
1474 2020-05-08 Nathan Sidwell <nathan@acm.org>
1476 Reimplement directives only processing, support raw literals.
1477 * directives-only.c: Delete.
1478 * Makefile.in (libcpp_a_OBJS, libcpp_a_SOURCES): Remove it.
1479 * include/cpplib.h (enum CPP_DO_task): New enum.
1480 (cpp_directive_only_preprocess): Declare.
1481 * internal.h (_cpp_dir_only_callbacks): Delete.
1482 (_cpp_preprocess_dir_only): Delete.
1483 * lex.c (do_peek_backslask, do_peek_next, do_peek_prev): New.
1484 (cpp_directives_only_process): New implementation.
1486 2020-02-14 Jakub Jelinek <jakub@redhat.com>
1488 Partially implement P1042R1: __VA_OPT__ wording clarifications
1489 PR preprocessor/92319
1490 * macro.c (expand_arg): Move declarations before vaopt_state
1492 (class vaopt_state): Move enum update_type definition earlier. Remove
1493 m_allowed member, add m_arg and m_update members.
1494 (vaopt_state::vaopt_state): Change last argument from bool any_args
1495 to macro_arg *arg, initialize m_arg and m_update instead of m_allowed.
1496 (vaopt_state::update): When bumping m_state from 1 to 2 and m_update
1497 is ERROR, determine if __VA_ARGS__ expansion has any non-CPP_PADDING
1498 tokens and set m_update to INCLUDE if it has any, DROP otherwise.
1499 Return m_update instead of m_allowed ? INCLUDE : DROP in m_state >= 2.
1500 (replace_args, create_iso_definition): Adjust last argument to
1503 2020-02-05 Martin Sebor <msebor@redhat.com>
1505 * include/cpplib.h (cpp_builtin_type): Remove trailing comma to
1506 avoid pedantic warnings in C++ 98 mode.
1508 2020-02-04 Jakub Jelinek <jakub@redhat.com>
1510 * macro.c (builtin_has_include): Diagnose __has_include* use outside
1511 of preprocessing directives.
1513 PR preprocessor/93545
1514 * macro.c (cpp_get_token_no_padding): New function.
1515 (builtin_has_include): Use it instead of cpp_get_token. Don't check
1518 2020-02-01 Andrew Burgess <andrew.burgess@embecosm.com>
1520 * configure: Regenerate.
1522 2020-01-28 Nathan Sidwell <nathan@acm.org>
1524 PR preprocessor/93452
1525 * internal.h (struct spec_nodes): Drop n__has_include{,_next}.
1526 * directives.c (lex_macro_node): Don't check __has_include redef.
1527 * expr.c (eval_token): Drop __has_include eval.
1528 (parse_has_include): Move to ...
1529 * macro.c (builtin_has_include): ... here.
1530 (_cpp_builtin_macro_text): Eval __has_include{,_next}.
1531 * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_INCLUDE{,_NEXT}.
1532 * init.c (builtin_array): Add them.
1533 (cpp_init_builtins): Drop __has_include{,_next} init here ...
1534 * pch.c (cpp_read_state): ... and here.
1535 * traditional.c (enum ls): Drop has_include states ...
1536 (_cpp_scan_out_logical_line): ... and here.
1538 2020-01-27 Andrew Burgess <andrew.burgess@embecosm.com>
1540 * configure: Regenerate.
1542 2020-01-24 Nathan Sidwell <nathan@acm.org>
1544 * expr.c (parse_has_include): Remove bogus controlling macro code.
1546 2020-01-20 Nathan Sidwell <nathan@acm.org>
1548 PR preprocessor/80005
1549 * include/cpplib.h (BT_HAS_ATTRIBUTE): Fix comment.
1550 * internal.h (struct lexer_state): Delete in__has_include field.
1551 (struct spec_nodes): Rename n__has_include{,_next}__ fields.
1552 (_cpp_defined_macro_p): New.
1553 (_cpp_find_file): Add has_include parm.
1554 * directives.c (lex_macro_node): Combine defined,
1555 __has_inline{,_next} checking.
1556 (do_ifdef, do_ifndef): Use _cpp_defined_macro_p.
1557 (_cpp_init_directives): Refactor.
1558 * expr.c (parse_defined): Use _cpp_defined_macro_p.
1559 (eval_token): Adjust parse_has_include calls.
1560 (parse_has_include): Add OP parameter. Reimplement.
1561 * files.c (_cpp_find_file): Add HAS_INCLUDE parm. Use it to
1562 inhibit error message.
1563 (_cpp_stack_include): Adjust _cpp_find_file call.
1564 (_cpp_fake_include, _cpp_compare_file_date): Likewise.
1565 (open_file_failed): Remove in__has_include check.
1566 (_cpp_has_header): Adjust _cpp_find_file call.
1567 * identifiers.c (_cpp_init_hashtable): Don't init
1568 __has_include{,_next} here ...
1569 * init.c (cpp_init_builtins): ... init them here. Define as
1571 (cpp_read_main_file): Adjust _cpp_find_file call.
1572 * pch.c (cpp_read_state): Adjust __has_include{,_next} access.
1573 * traditional.c (_cpp_scan_out_locgical_line): Likewise.
1575 PR preprocessor/93306
1576 * expr.c (parse_has_include): Refactor. Check skip_eval before
1579 2020-01-10 David Malcolm <dmalcolm@redhat.com>
1581 * include/line-map.h (class diagnostic_path): New forward decl.
1582 (rich_location::get_path): New accessor.
1583 (rich_location::set_path): New function.
1584 (rich_location::m_path): New field.
1585 * line-map.c (rich_location::rich_location): Initialize m_path.
1587 2020-01-01 Jakub Jelinek <jakub@redhat.com>
1589 Update copyright years.
1591 2019-12-18 David Malcolm <dmalcolm@redhat.com>
1593 PR preprocessor/92982
1595 (cpp_string_location_reader::cpp_string_location_reader): Delete
1596 initialization of m_line_table.
1597 * include/cpplib.h (cpp_string_location_reader::m_line_table):
1598 Delete unused member.
1600 2019-12-14 Jakub Jelinek <jakub@redhat.com>
1602 PR preprocessor/92919
1603 * charset.c (wide_str_to_charconst): If str contains just the
1604 NUL terminator, punt quietly.
1606 2019-12-09 David Malcolm <dmalcolm@redhat.com>
1608 * include/line-map.h (label_text::label_text): Make private.
1609 (label_text::borrow): New.
1610 (label_text::take): New.
1611 (label_text::take_or_copy): New.
1613 2019-12-09 Lewis Hyatt <lhyatt@gmail.com>
1615 PR preprocessor/49973
1616 * generated_cpp_wcwidth.h: New file generated by
1617 ../contrib/unicode/gen_wcwidth.py, supports new cpp_wcwidth function.
1618 * charset.c (compute_next_display_width): New function to help
1619 implement display columns.
1620 (cpp_byte_column_to_display_column): Likewise.
1621 (cpp_display_column_to_byte_column): Likewise.
1622 (cpp_wcwidth): Likewise.
1623 * include/cpplib.h (cpp_byte_column_to_display_column): Declare.
1624 (cpp_display_column_to_byte_column): Declare.
1625 (cpp_wcwidth): Declare.
1626 (cpp_display_width): New function.
1628 2019-11-14 Joseph Myers <joseph@codesourcery.com>
1630 * charset.c (narrow_str_to_charconst): Make CPP_UTF8CHAR constants
1632 * init.c (lang_defaults): Set utf8_char_literals for GNUC2X and
1635 2019-11-07 Jakub Jelinek <jakub@redhat.com>
1637 PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs
1638 * charset.c (narrow_str_to_charconst): Add TYPE argument. For
1639 CPP_UTF8CHAR diagnose whenever number of chars is > 1, using
1640 CPP_DL_ERROR instead of CPP_DL_WARNING.
1641 (wide_str_to_charconst): For CPP_CHAR16 or CPP_CHAR32, use
1642 CPP_DL_ERROR instead of CPP_DL_WARNING when multiple char16_t
1643 or char32_t chars are needed.
1644 (cpp_interpret_charconst): Adjust narrow_str_to_charconst caller.
1646 2019-11-05 Tim van Deurzen <tim@kompiler.org>
1648 * cpplib.h: Add spaceship operator for C++.
1649 * lex.c: Implement conditional lexing of spaceship operator for C++20.
1651 2019-10-31 Jakub Jelinek <jakub@redhat.com>
1653 PR preprocessor/92296
1654 * internal.h (struct def_pragma_macro): Add is_builtin bitfield.
1655 (_cpp_restore_special_builtin): Declare.
1656 * init.c (_cpp_restore_special_builtin): New function.
1657 * directives.c (do_pragma_push_macro): For NT_BUILTIN_MACRO
1658 set is_builtin and don't try to grab definition.
1659 (cpp_pop_definition): Use _cpp_restore_special_builtin to restore
1662 2019-10-15 Nathan Sidwell <nathan@acm.org>
1664 * include/line-map.h (struct maps_info_ordinary): Make cache
1666 (struct maps_info_macro): Likewise.
1667 (LINEMAPS_CACHE): Remove non-ref accessor. Constify ref accessor.
1668 (LINEMAPS_ORDINARY_CACHE, LINEMAPS_MACRO_CACHE): Likewise.
1669 (LINEMAPS_ORDINARY_MAP_AT, LINEMAPS_MACRO_MAP_AT): Use
1670 LINEMAPS_USED and LINEMAPS_MAP_AT.
1671 (linemap_lookup): Constify line_map arg.
1672 linemap.c (linemap_ordinary_map_lookup, linemap_macro_map_lookup):
1673 Constify line_map arg.
1675 2019-10-11 Joseph Myers <joseph@codesourcery.com>
1677 * include/cpplib.h (struct cpp_options): Add dfp_constants and
1678 cpp_warn_c11_c2x_compat.
1679 (enum cpp_warning_reason): Add CPP_W_C11_C2X_COMPAT.
1680 * init.c (struct lang_flags): Add dfp_constants.
1681 (lang_defaults): Set dfp_constants to 1 for GNUC2X and STDC2X and
1682 0 for other languages.
1683 (cpp_set_lang): Set dfp_constants from language.
1684 (cpp_create_reader): Set cpp_warn_c11_c2x_compat to -1.
1685 * expr.c (interpret_float_suffix): Mention DFP constants as C2X in
1687 (cpp_classify_number): Do not diagnose DFP constants for languages
1688 setting dfp_constants, unless cpp_warn_c11_c2x_compat.
1690 2019-10-04 Nathan Sidwell <nathan@acm.org>
1692 PR preprocessor/91991
1693 * line-map.c (linemap_line_start): Clear max_column_hint if we run
1696 2019-10-02 Richard Biener <rguenther@suse.de>
1698 * internal.h (enum include_type): Remove trailing comma.
1700 2019-10-02 Joseph Myers <joseph@codesourcery.com>
1702 * include/cpplib.h (struct cpp_options): Add member scope.
1703 * init.c (struct lang_flags, lang_defaults): Likewise.
1704 (cpp_set_lang): Set scope member of pfile.
1705 * lex.c (_cpp_lex_direct): Test CPP_OPTION (pfile, scope) not
1706 CPP_OPTION (pfile, cplusplus) for creating CPP_SCOPE tokens.
1708 2019-09-26 Eric Botcazou <ebotcazou@adacore.com>
1710 * charset.c (UCS_LIMIT): New macro.
1711 (ucn_valid_in_identifier): Use it instead of a hardcoded constant.
1712 (_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than
1713 UCS_LIMIT outside of identifiers in C and in C++2a or later.
1715 2019-09-19 Lewis Hyatt <lhyatt@gmail.com>
1718 * charset.c (_cpp_valid_utf8): New function to help lex UTF-8 tokens.
1719 * internal.h (_cpp_valid_utf8): Declare.
1720 * lex.c (forms_identifier_p): Use it to recognize UTF-8 identifiers.
1721 (_cpp_lex_direct): Handle UTF-8 in identifiers and CPP_OTHER tokens.
1722 Do all work in "default" case to avoid slowing down typical code paths.
1723 Also handle $ and UCN in the default case for consistency.
1725 2019-08-30 Nathan Sidwell <nathan@acm.org>
1727 New # semantics for popping to "" name.
1729 * directives.c (do_linemarker): Popping to "" name means get the
1730 name from the include stack..
1732 2019-09-05 Nathan Sidwell <nathan@acm.org>
1734 PR preprocessor/91639
1735 * directives.c (do_include_common): Tell lexer we're a #include.
1736 * files.c (_cpp_stack_file): Lexer will have always incremented.
1737 * internal.h (struct cpp_context): Extend in_directive's
1739 * lex.c (_cpp_lex_direct): Increment line for final \n when lexing
1740 for an ISO #include.
1741 * line-map.c (linemap_line_start): Remember if we overflowed.
1743 2019-09-03 Ulrich Weigand <uweigand@de.ibm.com>
1745 * directives.c: Remove references to spu from comments.
1748 2019-08-29 Nathan Sidwell <nathan@acm.org>
1750 * internal.h (enum include_type): Add IT_MAIN, IT_DIRECTIVE_HWM,
1752 (_cpp_stack_file): Take include_type, not a bool.
1753 * files.c (_cpp_find_file): Refactor to not hide an if inside a
1755 (should_stack_file): Break apart to ...
1756 (is_known_idempotent_file, has_unique_contents): ... these.
1757 (_cpp_stack_file): Replace IMPORT boolean with include_type enum.
1758 Refactor to use new predicates. Do linemap compensation here ...
1759 (_cpp_stack_include): ... not here.
1760 * init.c (cpp_read_main_file): Pass IT_MAIN to _cpp_stack_file.
1762 2019-08-28 Nathan Sidwell <nathan@acm.org>
1764 * directives-only.c (_cpp_preprocess_dir_only): Use false, not
1765 zero for _cpp_handle_directive call.
1766 * directives.c (_cpp_handle_directive): Indented is bool.
1767 * files.c (struct _cpp_file): Make bools 1 bit bitfields.
1768 * internal.h (enum include_type): Reformat and comment.
1769 (struct cpp_buffer): Make flags 1 bit bitfields.
1770 (_cpp_handle_directive): Indented is bool.
1772 2019-07-09 Martin Sebor <msebor@redhat.com>
1774 * include/line-map.h: Change class-key from class to struct and vice
1775 versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.
1778 2019-07-03 Martin Liska <mliska@suse.cz>
1780 * line-map.c (linemap_get_expansion_filename): Remove
1782 * mkdeps.c (make_write): Likewise.
1784 2019-07-02 qing zhao <qing.zhao@oracle.com>
1786 PR preprocessor/90581
1787 * directives.c (do_include_common): Replace CPP_STACK_MAX with
1788 CPP_OPTION (pfile, max_include_depth).
1789 * include/cpplib.h (struct cpp_options): Add new field
1791 * init.c (cpp_create_reader): Initiate new field max_include_depth.
1792 * internal.h: Delete CPP_STACK_MAX.
1794 2019-06-26 Nathan Sidwell <nathan@acm.org>
1796 PR preprocessor/90927
1797 * mkdeps.c (mkdeps::vec::operator[]): Add non-const variant.
1798 (deps_add_target): Deal with out of order unquoted targets.
1800 2019-05-19 Andrew Pinski <apinski@marvell.com>
1803 * lex.c (cpp_token_val_index <case SPELL_OPERATOR>): If tok->flags
1804 has NAMED_OP set, then return CPP_TOKEN_FLD_NODE.
1806 2019-05-14 Martin Liska <mliska@suse.cz>
1808 PR preprocessor/90382
1809 * line-map.c (first_map_in_common_1): Handle ADHOC
1812 2019-05-14 Martin Liska <mliska@suse.cz>
1814 PR preprocessor/90382
1815 * include/line-map.h (get_data_from_adhoc_loc): Add const to
1817 (get_location_from_adhoc_loc): Likewise.
1818 * line-map.c(get_data_from_adhoc_loc): Add const to
1820 (get_location_from_adhoc_loc): Likewise.
1821 (get_combined_adhoc_loc): Use get_location_from_adhoc_loc
1822 (or get_data_from_adhoc_loc).
1823 (get_range_from_adhoc_loc): Likewise.
1824 (get_pure_location): Likewise.
1825 (linemap_position_for_loc_and_offset): Likewise.
1826 (linemap_lookup): Likewise.
1827 (linemap_ordinary_map_lookup): Likewise.
1828 (linemap_macro_map_lookup): Likewise.
1829 (linemap_get_expansion_line): Likewise.
1830 (linemap_get_expansion_filename): Likewise.
1831 (linemap_location_in_system_header_p): Likewise.
1832 (linemap_location_from_macro_expansion_p): Likewise.
1833 (linemap_macro_loc_to_exp_point): Likewise.
1834 (linemap_resolve_location): Likewise.
1835 (linemap_unwind_toward_expansion): Likewise.
1836 (linemap_unwind_to_first_non_reserved_loc): Likewise.
1837 (linemap_expand_location): Likewise.
1838 (linemap_dump_location): Likewise.
1840 2019-05-07 Nathan Sidwell <nathan@acm.org>
1842 * files.c (_cpp_stack_file): Empty filenames aren't dependencies.
1843 * mkdeps.c (deps_add_dep): Assert not empty.
1845 * include/mkdeps.h (deps_write): Add PHONY arg.
1846 (deps_phony_targets): Delete.
1847 * init.c (cpp_finish): Just call deps_write.
1848 * mkdeps.c (struct mkdeps): Add local vector class. Reimplement
1850 (munge): Munge to static buffer.
1851 (apply_vpath): Adjust vector handling.
1852 (deps_init, deps_free): Use new, delete.
1853 (deps_add_target): Do not munge here. Record quoting low water mark.
1854 (deps_add_dep): Do not munge here.
1855 (deps_add_vpath): Adjust vector handling.
1856 (make_write_name): New. Munge on demand here.
1857 (make_write_vec): New.
1858 (deps_phony_targets): Delete.
1860 (deps_write): Forward to deps_Write.
1861 (deps_save, deps_restore): Adjust vector handling.
1863 2019-05-06 Nathan Sidwell <nathan@acm.org>
1865 * include/mkdeps.h: Rename struct deps to struct mkdeps.
1866 * mkdeps.c: Likewise.
1867 * include/cpplib.h (cpp_get_deps): Rename return type..
1868 * directives.c (cpp_get_deps): Likewise.
1869 * internal.h (struct cpp_reader): Rename deps field type.
1871 2019-04-03 Jonathan Wakely <jwakely@redhat.com>
1873 * files.c (search_path_exhausted): Fix typo in comment.
1875 2019-02-26 Martin Liska <mliska@suse.cz>
1877 * symtab.c (ht_dump_statistics): Make
1878 horizontal alignment for statistics.
1880 2019-02-20 David Malcolm <dmalcolm@redhat.com>
1883 * include/line-map.h (linenum_arith_t): New typedef.
1886 2019-02-18 Martin Liska <mliska@suse.cz>
1889 * line-map.c (linemap_line_start): Use 1UL in order
1892 2019-02-11 Martin Liska <mliska@suse.cz>
1895 * line-map.c (linemap_line_start): Don't reuse the existing line
1896 map if the line offset is sufficiently large to cause overflow
1897 when computing location_t values.
1899 2019-01-26 Jakub Jelinek <jakub@redhat.com>
1901 PR preprocessor/88974
1902 * directives.c (SEEN_EOL): Move macro to ...
1903 * internal.h (SEEN_EOL): ... here.
1904 * expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL ().
1906 2019-01-01 Jakub Jelinek <jakub@redhat.com>
1908 Update copyright years.
1910 2018-11-27 Mike Gulick <mgulick@mathworks.com>
1912 PR preprocessor/83173
1913 * location-example.txt: Update example -fdump-internal-locations
1916 2018-11-27 Mike Gulick <mgulick@mathworks.com>
1918 PR preprocessor/83173
1919 * files.c (_cpp_stack_include): Check if
1920 line_table->highest_location is past current line before
1923 2018-11-13 David Malcolm <dmalcolm@redhat.com>
1925 * charset.c: Replace "source_location" with "location_t".
1926 * directives-only.c: Likewise.
1927 * directives.c: Likewise.
1928 * errors.c: Likewise.
1930 * files.c: Likewise.
1931 * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to
1933 * include/line-map.h: Likewise.
1935 * internal.h: Likewise.
1937 * line-map.c: Likewise.
1938 * location-example.txt: Likewise.
1939 * macro.c: Likewise.
1941 * traditional.c: Likewise.
1943 2018-11-07 Hafiz Abid Qadeer <abidh@codesourcery.com>
1945 * configure: Regenerated.
1947 2018-11-05 Martin Liska <mliska@suse.cz>
1949 * symtab.c (ht_dump_statistics): Replace %zu with %lu format.
1951 2018-11-05 Martin Liska <mliska@suse.cz>
1953 * symtab.c (ht_dump_statistics): Fix format and
1954 pass missing argument.
1956 2018-11-05 Martin Liska <mliska@suse.cz>
1958 * symtab.c (ht_dump_statistics): Make dump conditional
1959 based on alloc_subobject.
1961 2018-10-31 Joseph Myers <joseph@codesourcery.com>
1964 * configure.ac: Remove AC_PREREQ. Use AC_LANG_SOURCE.
1965 * aclocal.m4, config.in, configure: Regenerate.
1967 2018-10-31 Nathan Sidwell <nathan@acm.org>
1969 * internal.h (struct cpp_reader): Rename forced_token_location_p
1970 to forced_token_location and drop its pointerness.
1971 * include/cpplib.h (cpp_force_token_locations): Take location, not
1973 * init.c (cpp_create_reader): Adjust.
1974 * lex.c (cpp_read_main_file):
1976 * directives.c (do_include_common): Commonize cleanup path.
1977 (_cpp_pop_buffer): Fix leak.
1979 * include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New
1981 (IS_ADHOC_LOC): Move earlier.
1982 (MAP_ORDINARY_P): Use IS_ORDINARY_LOC.
1983 * line-map.c (linemap_location_from_macro_expansion_p): Use
1986 * include/cpplib.h (cpp_macro_definition_location): Make inline.
1987 * macro.c (warn_of_redefinition): Fix comments, examine macro
1989 (cpp_macro_definition_location): Don't define here.
1991 * include/cpplib.h (HT_NODE): Don't cast NODE.
1992 (NODE_LEN, NODE_NAME): Use HT_NODE.
1994 * directives.c (DIRECTIVE_TABLE): Drop historical frequency
1996 * files.c (_cpp_stack_file): Fix indentation.
1998 2018-10-17 Joseph Myers <joseph@codesourcery.com>
2000 * include/cpplib.h (enum c_lang): Add CLK_GNUC2X and CLK_STDC2X.
2001 * init.c (lang_defaults): Add GNUC2X and STDC2X entries.
2002 (cpp_init_builtins): Define __STDC_VERSION__ to 202000L for C2X.
2004 2018-10-11 David Malcolm <dmalcolm@redhat.com>
2006 * macro.c (_cpp_arguments_ok): If the argument count is wrong, add
2007 a note showing the definition of the macro.
2009 2018-10-11 Nathan Sidwell <nathan@acm.org>
2011 * include/line-map.h (LINEMAPS_MACRO_LOWEST_LOCATION): Fix
2013 * line-map.c (linemap_enter_macro): Use RAII. Clear all of the
2016 2018-10-09 David Malcolm <dmalcolm@redhat.com>
2018 * charset.c (noop_error_cb): Rename to...
2019 (noop_diagnostic_cb): ...this, converting params to enums.
2020 (cpp_interpret_string_ranges): Update for renaming and enums.
2021 * directives.c (check_eol_1): Convert reason to enum.
2022 (do_diagnostic): Convert code and reason to enum.
2023 (do_error): Use CPP_W_NONE rather than 0.
2024 (do_pragma_dependency): Likewise.
2025 * errors.c (cpp_diagnostic_at): Convert level and reason to enums.
2026 Update for renaming.
2027 (cpp_diagnostic): Convert level and reason to enums.
2028 (cpp_error): Convert level to enum.
2029 (cpp_warning): Convert reason to enums.
2030 (cpp_pedwarning): Likewise.
2031 (cpp_warning_syshdr): Likewise.
2032 (cpp_diagnostic_with_line): Convert level and reason to enums.
2033 Update for renaming.
2034 (cpp_error_with_line): Convert level to enum.
2035 (cpp_warning_with_line): Convert reason to enums.
2036 (cpp_pedwarning_with_line): Likewise.
2037 (cpp_warning_with_line_syshdr): Likewise.
2038 (cpp_error_at): Convert level to enum.
2039 (cpp_errno): Likewise.
2040 (cpp_errno_filename): Likewise.
2041 * include/cpplib.h (enum cpp_diagnostic_level): Name this enum,
2042 and move to before struct cpp_callbacks.
2043 (enum cpp_warning_reason): Likewise.
2044 (cpp_callbacks::diagnostic): Convert params from int to enums.
2045 (cpp_error): Convert int param to enum cpp_diagnostic_level.
2046 (cpp_warning): Convert int param to enum cpp_warning_reason.
2047 (cpp_pedwarning): Likewise.
2048 (cpp_warning_syshdr): Likewise.
2049 (cpp_errno): Convert int param to enum cpp_diagnostic_level.
2050 (cpp_errno_filename): Likewise.
2051 (cpp_error_with_line): Likewise.
2052 (cpp_warning_with_line): Convert int param to enum
2054 (cpp_pedwarning_with_line): Likewise.
2055 (cpp_warning_with_line_syshdr): Likewise.
2056 (cpp_error_at): Convert int param to enum cpp_diagnostic_level.
2057 * macro.c (create_iso_definition): Convert int to enum.
2058 (_cpp_create_definition): Likewise.
2060 2018-09-17 David Malcolm <dmalcolm@redhat.com>
2062 * include/line-map.h (range_label::get_text): Add param
2065 2018-08-30 Nathan Sidwell <nathan@acm.org>
2067 * include/line-map.h (enum lc_reason): Comment each member
2069 (struct line_maps): Fix reallocator comment.
2071 2018-08-27 David Malcolm <dmalcolm@redhat.com>
2074 * include/line-map.h (enum range_display_kind): New enum.
2075 (struct location_range): Replace field "m_show_caret_p" with
2076 "m_range_display_kind", converting from bool to the new enum.
2077 (class rich_location): Add example of line insertion fix-it hint.
2078 (rich_location::add_range): Convert param "show_caret_p" from bool
2079 to enum range_display_kind and rename to "range_display_kind",
2080 giving it a default of SHOW_RANGE_WITHOUT_CARET.
2081 (rich_location::set_range): Likewise, albeit without a default.
2082 * line-map.c (rich_location::rich_location): Update for conversion
2083 of show_caret_p to tri-state enum.
2084 (rich_location::add_range): Likewise.
2085 (rich_location::set_range): Likewise.
2087 2018-08-24 H.J. Lu <hongjiu.lu@intel.com>
2090 * line-map.c (pure_location_p): Return true if linemap_lookup
2092 (linemap_add): Set start_location to 0 if we run out of line map
2095 2018-08-20 Nathan Sidwell <nathan@acm.org>
2097 * include/cpplib.h: Fixup some whitespace.
2098 (cpp_hashnode): Reduce type to 2 bit & flags to 8.
2100 * include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete.
2102 (enum node_type): Replace NT_MACRO with NT_USER_MACRO,
2103 NT_BUILTIN_MACRO, NT_MACRO_ARG. Delete NT_ASSERTION.
2104 (NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE):
2106 (CPP_HASHNODE_VALUE_IDX): Delete.
2107 (union _cpp_hashnode_value): GTY tag from enum node_type directly.
2108 (struct cpp_hashnode): Adjust GTY desc for value field.
2109 (cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust.
2110 * directives.c (undefine_macros): Clear value.anwers, adjust flag
2112 (_cpp_test_assertion): No need to check NT_ASSERTION.
2113 (do_assert, do_unassert): Likewise.
2114 * init.c (cpp_init_special_builtins): Set type not flags.
2115 * macro.c (struct macro_arg_saved_data): Add type field.
2116 (cpp_get_token_1): Check type not NT_VOID.
2117 (_cpp_free_definition): Adjust flag clearing. Nullify
2119 (_cpp_save_parameter, _cpp_unsave_parameters): Save and restore
2121 (lex_expansion_token): Check type not flags.
2122 (_cpp_create_definition): Set type to NT_USER_MACRO.
2123 (_cpp_notify_macro_use): Adjust type checking.
2124 * pch.c (write_macdef, count_defs, write_defs, cpp_valid_state)
2125 (save_macros): Adjust node type/flag handling.
2126 * traditional.c (_cpp_scan_out_logical_line): Check type not flags.
2128 * directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
2129 * include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
2130 (cpp_fun_like_macro_p): Make inline, define.
2131 * macro.c (cpp_define_lazily): Use UCHAR_MAX.
2132 (cpp_fun_like_macro_p): Delete.
2134 * Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
2135 * include/cpp-id-data.h: Delete.
2136 * internal.h: Include cpplib.h not cpp-id-data.h.
2138 * include/cpp-id-data.h (struct answer): Delete.
2139 * include/cpplib.h (struct answer): Don't forward-declare.
2140 (enum cpp_macro_kind): Add cmk_assert.
2141 (struct cpp_macro): Union parms and next assert chain.
2142 (union _cpp_hashnode_value): 'answer' field is cpp_macro.
2143 * directives.c (parse_answer): Convert to use cpp_macro. Return
2145 (parse_assertion, find_answer, _cpp_test_assertion, cpp_do_assert)
2146 (cpp_do_unassert): Convert to use cpp_macro.
2147 * macro.c (warn_of_redefinition, _cpp_new_macro)
2148 (check_trad_stringification, cpp_macro_definition): Adjust macro
2150 * traditional.c (_cpp_replacement_text_len)
2151 (_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise.
2153 2018-08-17 Nathan Sidwell <nathan@acm.org>
2155 * include/cpplib.h (struct cpp_callbacks): Replace
2156 user_builtin_macro with user_lazy_macro.
2157 (struct cpp_macro): add lazy field.
2158 (enum cpp_builtin_type): Remove BT_FIRST_USER, BT_LAST_USER.
2159 (cpp_define_lazily): Declare.
2160 * macro.c (enter_macro_context) Use _cpp_maybe_notify_macro_use.
2161 (warn_of_redefinition): Use cpp_builtin_macro_p, directly call
2162 user_lazy_macro hook.
2163 (_cpp_new_macro): Clear lazy field.
2164 (cpp_define_lazily): Define.
2165 (_cpp_notify_macro_use): Adjust lazy definition code.
2166 (cpp_macro_definition): No need to do lazy definition here.
2167 * pch.c (write_macdef, save_macros): Likewise.
2169 * include/cpplib.h (enum cpp_macro_kind): New.
2170 (struct cpp_macro): Make body trailing array. Add kind field,
2171 delete traditional flag.
2172 * internal.h (_cpp_new_macro): Declare.
2173 (_cpp_reserve_room): New inline.
2174 (_cpp_commit_buf): Declare.
2175 (_cpp_create_trad_definition): Return new macro.
2176 * lex.c (_cpp_commit_buff): New.
2177 * macro.c (macro_real_token_count): Count backwards.
2178 (replace_args): Pointer equality not orderedness.
2179 (_cpp_save_parameter): Use _cpp_reserve_room.
2180 (alloc_expansion_token): Delete.
2181 (lex_expansion_token): Return macro pointer. Use _cpp_reserve_room.
2182 (create_iso_definition): Allocate macro itself. Adjust for
2183 different allocation ordering.
2184 (_cpp_new_macro): New.
2185 (_cpp_create_definition): Adjust for API changes.
2186 * traditional.c (push_replacement_text): Don't set traditional
2188 (save_replacement_text): Likewise.
2189 (_cpp_create_trad_definition): Allocate macro itself, Adjust for
2190 different allocation ordering.
2192 * cpp-id-data.h (uchar, UC): Move to internal.h
2193 (struct cpp_macro): Move to cpplib.h.
2194 * internal.h (uchar, UC): From cpp-id-data.h.
2195 * include/cpplib.h (struct cpp_macro): From cpp-id-data.h.
2197 2018-08-16 Nathan Sidwell <nathan@acm.org>
2199 * internal.h (_cpp_save_parameter): Take parmno, not macro.
2200 (_cpp_unsave_parameters): Declare.
2201 * macro.c (_cpp_save_parameter): Take parm number, not macro.
2202 Return true on success.
2203 (_cpp_unsave_parameters): New.
2204 (parse_params): Take parm_no and variadic pointers, not macro.
2205 Reimplement parsing logic.
2206 (create_iso_definition): Adjust parse_params changes. Call
2207 _cpp_unsave_parameters here.
2208 (_cpp_create_definition): Don't unsave params here.
2209 * traditional.c (scan_parameters): Take n_param pointer, adjust.
2210 (_cpp_create_trad_definition): Ajust scan_parameters change. Call
2211 _cpp_unsave_parameters.
2213 * include/cpplib.h (cpp_user_macro_p, cpp_builtin_macro_p)
2214 (cpp_macro_p): New inlines.
2215 * directives.c (do_pragma_poison): Use cpp_macro_p.
2216 (do_ifdef, do_ifndef): Likewise. Use _cpp_maybe_notify_macro_use.
2217 (cpp_pop_definition): Use cpp_macro_p. Move _cpp_free_definition
2218 earlier. Don't zap node directly.
2219 * expr.c (parse_defined): Use _cpp_maybe_notify_macro_use &
2221 * files.c (should_stack_file): Use cpp_macro_p.
2222 * identifiers.c (cpp_defined): Likewise.
2223 * internal.h (_cpp_mark_macro): Use cpp_user_macro_p.
2224 (_cpp_notify_macro_use): Declare.
2225 (_cpp_maybe_notify_macro_use): New inline.
2226 * lex.c (is_macro): Use cpp_macro_p.
2227 * macro.c (_cpp_warn_if_unused_macro): Use cpp_user_macro_p.
2228 (enter_macro_context): Likewise.
2229 (_cpp_create_definition): Use cpp_builtin_macro_p,
2230 cpp_user_macro_p. Move _cpp_free_definition earlier.
2231 (_cpp_notify_macro_use): New, broken out of multiple call sites.
2232 * traditional.c (fun_like_macro_p): Use cpp_builtin_macro_p.
2233 (maybe_start_funlike, _cpp_scan_out_logical_line)
2234 (push_replacement_text): Likewise.
2236 2018-08-15 David Malcolm <dmalcolm@redhat.com>
2238 * include/line-map.h (struct location_range): Add "m_label" field.
2239 (class rich_location): Add description of labels to leading
2241 (rich_location::rich_location): Add "label" param, defaulting to
2243 (rich_location::add_range): Likewise.
2244 (struct label_text): New struct.
2245 (class range_label): New abstract base class.
2246 * line-map.c (rich_location::rich_location): Add "label" param;
2248 (rich_location::add_range): Likewise.
2250 2018-08-08 Nathan Sidwell <nathan@acm.org>
2252 Make linemap::included_from a location
2254 * include/line-map.h (struct line_map_ordinary): Replace
2255 included_from map index with included_at source_location.
2256 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Delete.
2257 (LAST_SOURCE_LINE_LOCATION): Delete.
2258 (LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete.
2259 (linemap_included_from): New.
2260 (linemap_included_from_linemap): Declare.
2261 (MAIN_FILE_P): Adjust.
2262 * line-map.c (linemap_included_from_linemap): New.
2263 (lonemap_check_files_exited): Use linemap_included_at.
2264 (linemap_add): Adjust inclusion setting.
2265 (linemap_dump, linemap_dump_location): Adjust.
2266 * directives.c (do_linemarker): Use linemap_included_at.
2268 2018-08-07 Nathan Sidwell <nathan@acm.org>
2270 * line-map.c: (linemap_init): Set default allocator here.
2271 (new_linemap): Rather than here. Refactor allocation logic.
2273 2018-07-20 David Malcolm <dmalcolm@redhat.com>
2275 * include/line-map.h (rich_location::set_range): Remove redundant
2276 line_maps * parameter.
2277 * line-map.c (rich_location::set_range): Likewise.
2279 2018-07-18 Bernd Edlinger <bernd.edlinger@hotmail.de>
2282 * macro.c (enter_macro_context): Change the location info for builtin
2283 macros and _Pragma from location of the closing parenthesis to location
2284 of the macro expansion point.
2286 2018-07-17 Jason Franklin <j_fra@fastmail.us>
2287 Jakub Jelinek <jakub@redhat.com>
2289 * lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN,
2290 CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style
2291 comments is reported only once per file and guard those calls on the
2292 preceding cpp_error returning true.
2294 2018-07-03 Nathan Sidwell <nathan@acm.org>
2296 Reorg line_map data structures for better packing.
2297 * include/line-map.h (enum lc_reason): Add LC_HWM.
2298 (LINE_MAP_MAX_LOCATION): Define here.
2299 (struct line_map): Move reason field to line_map_ordinary. Adjust
2301 (struct line_map_ordinary): Reorder fields for less padding.
2302 (struct line_map_macro): Likewise.
2303 (MAP_ORDINARY_P): New.
2304 (linemap_check_ordinary, linemap_check_macro): Adjust.
2305 * line-map.c (LINE_MAP_MAX_SOURCE_LOCATION): Delete.
2306 (new_linemap): Take start_location, not reason. Adjust.
2307 (linemap_add, linemap_enter_macro): Adjust.
2308 (linemap_line_start): Likewise.
2309 (linemap_macro_expansion_map_p): Use MAP_ORDINARY_P.
2310 (linemap_macro_loc_to_spelling_point): Likewise.
2311 (linemap_macro_loc_to_def_point): Likewise.
2312 (linemap_dump): Likewise.
2314 2018-05-23 Jason Merrill <jason@redhat.com>
2316 * system.h: #include <new> earlier.
2318 2018-05-17 Jason Merrill <jason@redhat.com>
2320 * line-map.c (linemap_init): Use placement new.
2321 * system.h: #include <new>.
2323 2018-03-14 David Malcolm <dmalcolm@redhat.com>
2325 * include/line-map.h (compare): New function on linenum_type.
2327 2018-02-28 Jonathan Wakely <jwakely@redhat.com>
2329 PR preprocessor/84517
2330 * lex.c (is_macro_not_literal_suffix): New function.
2331 (lex_raw_string, lex_string): Use is_macro_not_literal_suffix to
2332 decide when to issue -Wliteral-suffix warnings.
2334 2018-02-16 Richard Biener <rguenther@suse.de>
2337 * line-map.c (linemap_init): Avoid broken value-init when compiling
2340 2018-02-15 Jason Merrill <jason@redhat.com>
2341 Jakub Jelinek <jakub@redhat.com>
2343 PR preprocessor/83063 - __VA_OPT__ and ##
2344 PR preprocessor/83708
2345 * macro.c (vaopt_state): Reorder m_last_was_paste before m_state.
2346 (vaopt_state::vaopt_state): Adjust.
2347 (vaopt_state::update_flags): Add BEGIN and END.
2348 (vaopt_state::update): Return them.
2349 (copy_paste_flag): Factor out of replace_args.
2350 (last_token_is): New.
2351 (replace_args): Handle BEGIN and END. Avoid padding there.
2352 (tokens_buff_last_token_ptr): Return NULL if no tokens.
2354 2018-01-31 Jakub Jelinek <jakub@redhat.com>
2356 PR preprocessor/69869
2357 * traditional.c (skip_macro_block_comment): Return bool, true if
2358 the macro block comment is unterminated.
2359 (copy_comment): Use return value from skip_macro_block_comment instead
2362 2018-01-27 Jakub Jelinek <jakub@redhat.com>
2364 * include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from
2365 BT_FIRST_USER + 31 to BT_FIRST_USER + 63.
2367 2018-01-18 Boris Kolpackov <boris@codesynthesis.com>
2370 * include/cpplib.h (cpp_callbacks::remap_filename): New callback.
2371 * macro.c (_cpp_builtin_macro_text): Call remap_filename for
2372 __FILE__ and __BASE_FILE__.
2374 2018-01-10 Kelvin Nilsen <kelvin@gcc.gnu.org>
2376 * lex.c (search_line_fast): Remove illegal coercion of an
2377 unaligned pointer value to vector pointer type and replace with
2378 use of __builtin_vec_vsx_ld () built-in function, which operates
2379 on unaligned pointer values.
2381 2018-01-03 Jakub Jelinek <jakub@redhat.com>
2383 Update copyright years.
2385 2017-12-20 Michael Weiser <michael.weiser@gmx.de>
2387 PR preprocessor/83492
2388 * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
2389 Fix selection of big-endian shift parameters by using
2392 2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
2394 * internal.h (maybe_print_line): Change signature.
2396 2017-12-05 Jakub Jelinek <jakub@redhat.com>
2399 * expr.c (interpret_float_suffix): Avoid memcmp.
2400 (interpret_int_suffix): Likewise. Don't check for if.
2402 2017-12-01 Jason Merrill <jason@redhat.com>
2404 PR c++/79228 - extensions hide C++14 complex literal operators
2405 * expr.c (interpret_float_suffix): Ignore 'i' in C++14 and up.
2406 (interpret_int_suffix): Likewise.
2408 2017-11-28 David Malcolm <dmalcolm@redhat.com>
2411 * include/line-map.h (LINE_MAP_MAX_COLUMN_NUMBER): Move here.
2412 * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): ...from here.
2413 (rich_location::maybe_add_fixit): Reject fix-it hints in which
2414 the start column exceeds the next column.
2416 2017-11-20 Eric Gallager <egall@gwmail.gwu.edu>
2418 PR preprocessor/81794
2419 * macro.c (check_trad_stringification): Have warning be controlled
2422 2017-11-20 David Malcolm <dmalcolm@redhat.com>
2425 * include/cpplib.h (cpp_macro_definition_location): New decl.
2426 * macro.c (cpp_macro_definition): New function.
2428 2017-11-13 Tom Tromey <tom@tromey.com>
2430 * pch.c (cpp_read_state): Set n__VA_OPT__.
2431 * macro.c (vaopt_state): New class.
2432 (_cpp_arguments_ok): Check va_opt flag.
2433 (replace_args, create_iso_definition): Use vaopt_state.
2434 * lex.c (lex_identifier_intern): Possibly issue errors for
2436 (lex_identifier): Likewise.
2437 (maybe_va_opt_error): New function.
2438 * internal.h (struct lexer_state) <va_args_ok>: Update comment.
2439 (struct spec_nodes) <n__VA_OPT__>: New field.
2440 * init.c (struct lang_flags) <va_opt>: New field.
2441 (lang_defaults): Add entries for C++2A. Update all entries for
2443 (cpp_set_lang): Initialize va_opt.
2444 * include/cpplib.h (struct cpp_options) <va_opt>: New field.
2445 * identifiers.c (_cpp_init_hashtable): Initialize n__VA_OPT__.
2447 2017-11-13 David Malcolm <dmalcolm@redhat.com>
2449 * include/line-map.h (linenum_type): Move this typedef and the
2450 comment describing column numbering to near the top of the file.
2452 2017-11-06 Mukesh Kapoor <mukesh.kapoor@oracle.com>
2455 * lex.c (lex_string): When checking for a valid macro for the
2456 warning related to -Wliteral-suffix (CPP_W_LITERAL_SUFFIX),
2457 check that the macro name does not start with an underscore
2458 before calling is_macro().
2460 2017-11-05 Tom de Vries <tom@codesourcery.com>
2463 * lex.c (BUF_APPEND): Remove semicolon after
2466 2017-10-31 David Malcolm <dmalcolm@redhat.com>
2468 * directives.c (_cpp_handle_directive): Update for renaming of
2469 cpp_error_at_richloc to cpp_error_at.
2470 * errors.c (cpp_diagnostic_at_richloc): Rename to...
2471 (cpp_diagnostic_at): ...this, dropping the location_t-based
2473 (cpp_diagnostic): Update for removal of location_t-based
2475 (cpp_error_at): Likewise.
2476 (cpp_error_at_richloc): Rename to...
2477 (cpp_error_at): ...this, and update for renaming of
2478 cpp_diagnostic_at_richloc.
2479 * include/cpplib.h (cpp_error_at_richloc): Rename to...
2480 (cpp_error_at): ...this.
2482 2017-10-30 Joseph Myers <joseph@codesourcery.com>
2484 * include/cpplib.h (enum c_lang): Add CLK_GNUC17 and CLK_STDC17.
2485 * init.c (lang_defaults): Add GNUC17 and STDC17 data.
2486 (cpp_init_builtins): Handle C17 value of __STDC_VERSION__.
2488 2017-10-10 Nathan Sidwell <nathan@acm.org>
2490 PR preprocessor/82506
2491 * macro.c (cpp_quote_string): Escape raw LFs.
2493 2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
2494 Jakub Jelinek <jakub@redhat.com>
2496 Add support for -std=c++2a.
2497 * include/cpplib.h (c_lang): Add CXX2A and GNUCXX2A.
2498 * init.c (lang_defaults): Add rows for CXX2A and GNUCXX2A.
2499 (cpp_init_builtins): Set __cplusplus to 201709L for C++2a.
2501 2017-09-15 Jakub Jelinek <jakub@redhat.com>
2503 * include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z
2504 to CLK_GNUCXX17 and CLK_CXX1Z to CLK_CXX17.
2505 * init.c (lang_defaults, cpp_init_builtins): Likewise.
2506 * expr.c (cpp_classify_number): Use C++17 instead of C++1z
2509 2017-07-07 David Malcolm <dmalcolm@redhat.com>
2512 * line-map.c (linemap_macro_loc_to_def_point): Preserve range
2513 information for macro expansions by delaying resolving ad-hoc
2514 locations until within the loop.
2516 2017-07-06 David Malcolm <dmalcolm@redhat.com>
2519 * include/line-map.h (enum location_aspect): New enum.
2520 (linemap_client_expand_location_to_spelling_point): Add
2521 enum location_aspect param.
2522 * line-map.c (rich_location::get_expanded_location): Update for
2523 new param of linemap_client_expand_location_to_spelling_point.
2524 (rich_location::maybe_add_fixit): Likewise.
2525 (fixit_hint::affects_line_p): Likewise.
2527 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2529 * line-map.c (location_adhoc_data_update): Perform addition in
2530 uintptr_t type rather than char * type. Read *data using
2531 ptrdiff_t type instead of int64_t.
2532 (get_combined_adhoc_loc): Change offset type to ptrdiff_t from
2535 2017-06-20 David Malcolm <dmalcolm@redhat.com>
2537 * include/line-map.h (class rich_location): Document that attempts
2538 to delete or replace a range *affecting* multiple lines will fail.
2539 * line-map.c (rich_location::maybe_add_fixit): Implement this
2542 2017-06-09 David Malcolm <dmalcolm@redhat.com>
2544 * include/line-map.h
2545 (rich_location::fixits_cannot_be_auto_applied): New method.
2546 (rich_location::fixits_can_be_auto_applied_p): New accessor.
2547 (rich_location::m_fixits_cannot_be_auto_applied): New field.
2548 * line-map.c (rich_location::rich_location): Initialize new field.
2550 2017-06-05 David Malcolm <dmalcolm@redhat.com>
2552 * include/cpplib.h (struct cpp_callbacks): Add "comment"
2554 * lex.c (_cpp_lex_direct): Call the comment callback if non-NULL.
2556 2017-05-02 David Malcolm <dmalcolm@redhat.com>
2558 * include/line-map.h (class rich_location): Update description of
2560 (class fixit_hint): Likewise.
2561 (fixit_hint::ends_with_newline_p): New decl.
2562 * line-map.c (rich_location::maybe_add_fixit): Support newlines
2563 in fix-it hints that are insertions of single lines at the start
2564 of a line. Don't consolidate into such fix-it hints.
2565 (fixit_hint::ends_with_newline_p): New method.
2567 2017-05-01 David Malcolm <dmalcolm@redhat.com>
2569 * include/line-map.h (source_range::intersects_line_p): Delete.
2570 (rich_location::add_fixit): Delete.
2571 (rich_location::maybe_add_fixit): New method.
2572 (class fixit_hint): Reimplement in terms of...
2573 (class fixit_replace): ...this.
2574 (class fixit_insert): Delete.
2575 * line-map.c (linemap_position_for_loc_and_offset): Drop overzealous
2576 linemap_assert_fails.
2577 (source_range::intersects_line_p): Rename to...
2578 (fixit_hint::affects_line_p): New function.
2579 (rich_location::add_fixit_insert_before): Reimplement in terms of
2580 maybe_add_fixit, moving validation there.
2581 (rich_location::add_fixit_insert_after): Likewise.
2582 (column_before_p): Delete.
2583 (rich_location::add_fixit_replace): Reimplement in terms of
2584 maybe_add_fixit, moving validation there. Convert closed input range
2586 (rich_location::add_fixit): Delete.
2587 (rich_location::maybe_add_fixit): New function.
2588 (fixit_insert::fixit_insert): Delete.
2589 (fixit_insert::~fixit_insert): Delete.
2590 (fixit_insert::affects_line_p): Delete.
2591 (fixit_insert::maybe_append_replace): Delete.
2592 (fixit_replace::fixit_replace): Rename to...
2593 (fixit_hint::fixit_hint): ...this, rewriting as necessary.
2594 (fixit_replace::~fixit_replace): Delete.
2595 (fixit_replace::affects_line_p): Delete.
2596 (fixit_replace::maybe_append_replace): Rename to...
2597 (fixit_hint::maybe_append): ...this, rewriting as necessary.
2599 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
2601 * include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment.
2602 * lex.c (search_line_fast): Likewise.
2603 * pch.h (cpp_valid_state): Likewise.
2605 2017-03-21 Andreas Schwab <schwab@suse.de>
2607 * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
2608 Convert 64-bit value to boolean before passing to
2611 2017-03-16 Jason Merrill <jason@redhat.com>
2613 * init.c (cpp_init_builtins): Update __cplusplus for C++17.
2615 2017-02-09 Gerald Pfeifer <gerald@pfeifer.com>
2617 * Makefile.in (po/$(PACKAGE).pot): Adjust bug reporting URL.
2619 2017-01-10 David Malcolm <dmalcolm@redhat.com>
2622 * line-map.c (linemap_position_for_column): When calling
2623 linemap_start_line, detect if a new linemap was created with
2624 0 column bits, and bail out early if this is the case.
2625 (linemap_position_for_loc_and_offset): Replace overzealous
2626 linemap_assert_fails with a simple conditional; use correct
2629 2017-01-07 David Malcolm <dmalcolm@redhat.com>
2632 * line-map.c (linemap_line_start): When determining if the highest
2633 column given out so far will fit into a proposed change to the
2634 current map, use the effective number of column bits, rather than
2635 the total number of column + range bits.
2637 2017-01-01 Jakub Jelinek <jakub@redhat.com>
2639 Update copyright years.
2641 2016-12-15 David Malcolm <dmalcolm@redhat.com>
2643 PR preprocessor/78680
2644 PR preprocessor/78811
2645 * lex.c (_cpp_lex_direct): Only determine the end-location of
2646 the token and build a range for non-reserved start locations.
2647 Do not do it for EOF tokens.
2649 2016-12-12 David Malcolm <dmalcolm@redhat.com>
2651 PR preprocessor/78680
2652 * lex.c (_cpp_lex_direct): Ensure line notes are processed before
2653 computing the end-point of the token.
2655 2016-11-23 Paolo Bonzini <bonzini@gnu.org>
2657 * include/cpplib.h (struct cpp_options): Add new member
2658 warn_expansion_to_defined.
2659 (CPP_W_EXPANSION_TO_DEFINED): New enum member.
2660 * expr.c (parse_defined): Warn for all uses of "defined"
2661 in macros, and tie warning to CPP_W_EXPANSION_TO_DEFINED.
2662 Make it a pedwarning instead of a warning.
2663 * system.h (HAVE_DESIGNATED_INITIALIZERS): Do not use
2664 "defined" in macros.
2666 2016-11-17 David Malcolm <dmalcolm@redhat.com>
2668 * charset.c (cpp_interpret_string_1): Skip locations from
2669 loc_reader when advancing 'p' when handling raw strings.
2671 2016-11-16 Jakub Jelinek <jakub@redhat.com>
2674 * configure.ac (ENABLE_ASSERT_CHECKING): Define if gcc configure
2675 would define that macro.
2676 * configure: Regenerated.
2677 * config.in: Regenerated.
2679 2016-11-08 Richard Earnshaw <rearnsha@arm.com>
2681 * lex.c (search_line_fast): New implementation for AArch64.
2683 2016-10-25 David Malcolm <dmalcolm@redhat.com>
2685 * files.c (destroy_cpp_file): Free file->path.
2687 2016-10-25 David Malcolm <dmalcolm@redhat.com>
2689 * include/line-map.h (line_maps::~line_maps): New dtor.
2690 (location_adhoc_data_fini): Delete decl.
2691 * line-map.c (line_maps::~line_maps): New dtor.
2692 (location_adhoc_data_fini): Delete.
2694 2016-10-21 Andris Pavenis <andris.pavenis@iki.fi>
2696 PR preprocessor/71681
2697 * files.c (remap_filename): Fix handling -remap in subdirectories.
2699 2016-10-12 Jakub Jelinek <jakub@redhat.com>
2701 * include/cpplib.h (struct cpp_options): Add
2702 cpp_warn_implicit_fallthrough.
2703 * init.c (cpp_create_reader): Initialize it to 0.
2704 * lex.c (fallthrough_comment_p): Handle different
2705 cpp_warn_implicit_fallthrough levels. Whitespace fixes.
2707 2016-10-08 Jakub Jelinek <jakub@redhat.com>
2709 * lex.c (fallthrough_comment_p): Accept Else, fallthrough.
2711 * lex.c (fallthrough_comment_p): Extend to handle more common FALLTHRU
2714 * lex.c (fallthrough_comment_p): Fix off-by-one size comparison
2716 (_cpp_lex_direct): Allow arbitrary comments in between
2717 fallthrough_comment_p comment and following token.
2719 2016-10-04 Kelvin Nilsen <kelvin@gcc.gnu.org>
2722 * lex.c (search_line_fast): Add a FALLTHROUGH comment to correct
2723 compiler error in the version of this function that is
2724 conditionally compiled when GCC_VERSION >= 4005 and both
2725 __ALTIVEC__ and __BIG_ENDIAN__ symbols are defined.
2727 2016-09-26 Marek Polacek <polacek@redhat.com>
2728 Jakub Jelinek <jakub@redhat.com>
2731 * include/cpplib.h (PREV_FALLTHROUGH): Define.
2732 * internal.h (CPP_FALLTHRU): Define.
2733 * lex.c (fallthrough_comment_p): New function.
2734 (_cpp_lex_direct): Set PREV_FALLTHROUGH on tokens succeeding a falls
2737 2016-09-23 David Malcolm <dmalcolm@redhat.com>
2739 PR preprocessor/77672
2740 * charset.c (cpp_interpret_string_1): Add a source_range for the
2741 NUL-terminator, using the location of the trailing quote of the
2744 2016-09-21 Jason Merrill <jason@redhat.com>
2746 * line-map.c (linemap_location_from_macro_definition_p): New.
2747 * line-map.h: Declare it.
2749 2016-09-15 David Malcolm <dmalcolm@redhat.com>
2751 * include/line-map.h (class rich_location): Note that newlines
2752 aren't supported in fix-it text.
2753 * line-map.c (rich_location::add_fixit_insert_before): Reject
2754 attempts to add fix-its containing newlines.
2755 (rich_location::add_fixit_replace): Likewise.
2757 2016-09-13 David Malcolm <dmalcolm@redhat.com>
2759 * include/line-map.h (class rich_location): Add description of
2760 fix-it hints to leading comment.
2761 (rich_location::add_fixit_insert): Rename both overloaded methods
2763 (rich_location::add_fixit_insert_before): ...this, updating their
2765 (rich_location::add_fixit_insert_after): Two new overloaded
2767 (rich_location::stop_supporting_fixits): New method.
2768 * line-map.c (rich_location::add_fixit_insert): Rename both
2769 overloaded methods to..
2770 (rich_location::add_fixit_insert_before): ...this, updating their
2772 (rich_location::add_fixit_insert_after): Two new methods.
2773 (rich_location::reject_impossible_fixit): Split out
2774 failure-handling into...
2775 (rich_location::stop_supporting_fixits): New method.
2777 2016-09-02 David Malcolm <dmalcolm@redhat.com>
2779 * include/line-map.h (rich_location::seen_impossible_fixit_p): New
2782 2016-08-31 David Malcolm <dmalcolm@redhat.com>
2784 * include/line-map.h (class fixit_remove): Remove stray decl.
2785 (fixit_hint::affects_line_p): Make const.
2786 (fixit_insert::affects_line_p): Likewise.
2787 (fixit_replace::affects_line_p): Likewise.
2788 * line-map.c (fixit_insert::affects_line_p): Likewise.
2789 (fixit_replace::affects_line_p): Likewise.
2791 2016-08-30 David Malcolm <dmalcolm@redhat.com>
2793 * include/line-map.h (class semi_embedded_vec): New class.
2794 (semi_embedded_vec<T, NUM_EMBEDDED>::semi_embedded_vec): New ctor.
2795 (semi_embedded_vec<T, NUM_EMBEDDED>::~semi_embedded_vec): New
2797 (semi_embedded_vec<T, NUM_EMBEDDED>::operator[]): New methods.
2798 (semi_embedded_vec<T, NUM_EMBEDDED>::push): New method.
2799 (semi_embedded_vec<T, NUM_EMBEDDED>::truncate): New method.
2800 (rich_location::get_num_locations): Reimplement in terms of
2802 (rich_location::get_range): Make non-inline.
2803 (rich_location::get_num_fixit_hints): Reimplement in terms of
2805 (rich_location::add_fixit): New function.
2806 (rich_location::MAX_RANGES): Rename to...
2807 (rich_location::STATICALLY_ALLOCATED_RANGES): ...this.
2808 (rich_location::MAX_FIXIT_HINTS): Rename to...
2809 (rich_location::STATICALLY_ALLOCATED_RANGES): ...this, and make
2811 (rich_location::m_num_ranges): Eliminate in favor of...
2812 (rich_location::m_ranges): ...this, converting from a fixed-size
2813 array to a semi_embedded_vec.
2814 (rich_location::m_num_fixit_hints): Eliminate in favor of...
2815 (rich_location::m_fixit_hints): ...this, converting from a
2816 fixed-size array to a semi_embedded_vec.
2817 * line-map.c (rich_location::rich_location): Update for above
2819 (rich_location::~rich_location): Likewise.
2820 (rich_location::get_loc): Likewise.
2821 (rich_location::get_range): New methods.
2822 (rich_location::add_range): Update for above changes.
2823 (rich_location::set_range): Likewise.
2824 (rich_location::add_fixit_insert): Likewise.
2825 (rich_location::add_fixit_replace): Likewise.
2826 (rich_location::get_last_fixit_hint): Likewise.
2827 (rich_location::reject_impossible_fixit): Likewise.
2828 (rich_location::add_fixit): New method.
2830 2016-08-30 David Malcolm <dmalcolm@redhat.com>
2832 * include/line-map.h (rich_location::add_fixit_insert): Add
2833 comments. Add overload omitting the source_location param.
2834 (rich_location::add_fixit_remove): Add comments. Add overloads
2835 omitting the range, and accepting a source_location.
2836 (rich_location::add_fixit_replace): Likewise.
2837 * line-map.c (rich_location::add_fixit_insert): Add comments. Add
2838 overload omitting the source_location param.
2839 (rich_location::add_fixit_remove): Add comments. Add overloads
2840 omitting the range, and accepting a source_location.
2841 (rich_location::add_fixit_replace): Likewise.
2843 2016-08-26 David Malcolm <dmalcolm@redhat.com>
2845 * include/line-map.h (get_pure_location): New decl.
2846 * line-map.c (get_pure_location): Move here, from gcc/input.c, adding
2847 a line_maps * param.
2848 (rich_location::add_fixit_insert): Call get_pure_location on "where".
2849 (rich_location::add_fixit_replace): Call get_pure_location on the
2852 2016-08-26 David Malcolm <dmalcolm@redhat.com>
2854 * include/line-map.h (rich_location): Eliminate unimplemented
2855 constructor based on source_range.
2856 (rich_location::get_last_fixit_hint): New method.
2857 (rich_location::reject_impossible_fixit): New method.
2858 (rich_location): Add fields m_line_table and
2859 m_seen_impossible_fixit.
2860 (fixit_hint::maybe_append_replace): New pure virtual function.
2861 (fixit_insert::maybe_append_replace): New function.
2862 (fixit_replace::maybe_append_replace): New function.
2863 * line-map.c (rich_location::rich_location): Initialize
2864 m_line_table and m_seen_impossible_fixit.
2865 (rich_location::add_fixit_insert): Call
2866 reject_impossible_fixit and bail out if true.
2867 (column_before_p): New function.
2868 (rich_location::add_fixit_replace): Call reject_impossible_fixit
2869 and bail out if true. Attempt to consolidate with neighboring
2871 (rich_location::get_last_fixit_hint): New method.
2872 (rich_location::reject_impossible_fixit): New method.
2873 (fixit_insert::maybe_append_replace): New method.
2874 (fixit_replace::maybe_append_replace): New method.
2876 2016-08-23 David Malcolm <dmalcolm@redhat.com>
2878 * include/line-map.h (source_range::from_locations): New method.
2880 2016-08-19 David Malcolm <dmalcolm@redhat.com>
2882 * include/line-map.h (fixit_hint::kind): Delete REPLACE.
2883 (class fixit_remove): Delete.
2884 * line-map.c (rich_location::add_fixit_remove): Reimplement
2885 by calling add_fixit_replace with an empty string.
2886 (fixit_remove::fixit_remove): Delete.
2887 (fixit_remove::affects_line_p): Delete.
2889 2016-08-19 Joseph Myers <joseph@codesourcery.com>
2892 * include/cpplib.h (CPP_N_FLOATN, CPP_N_FLOATNX)
2893 (CPP_N_WIDTH_FLOATN_NX, CPP_FLOATN_SHIFT, CPP_FLOATN_MAX): New
2895 * expr.c (interpret_float_suffix): Handle fN, fNx, FN and FNx
2898 2016-08-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
2900 * expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic.
2902 2016-08-18 David Malcolm <dmalcolm@redhat.com>
2904 * directives.c (directive_names): New array.
2905 (_cpp_handle_directive): Offer spelling suggestions for misspelled
2907 * errors.c (cpp_diagnostic_at_richloc): New function.
2908 (cpp_error_at_richloc): New function.
2909 * include/cpplib.h (struct cpp_callbacks): Add field
2911 (cpp_error_at_richloc): New decl.
2913 2016-08-18 Marek Polacek <polacek@redhat.com>
2916 * pch.c (write_macdef): Add CPP_FALLTHRU.
2918 2016-08-12 Marek Polacek <polacek@redhat.com>
2921 * lex.c (search_line_fast): Add FALLTHRU.
2922 (_cpp_lex_direct): Likewise.
2923 (cpp_token_val_index): Adjust fall through comment.
2924 * macro.c (parse_params): Add FALLTHRU.
2925 * pch.c (count_defs): Adjust fall through comment.
2926 (write_defs): Likewise.
2928 2016-08-06 David Malcolm <dmalcolm@redhat.com>
2931 * charset.c (_cpp_valid_ucn): Replace overzealous assert with one
2932 that allows for char_range to be non-NULL when loc_reader is NULL.
2934 2016-08-05 David Malcolm <dmalcolm@redhat.com>
2936 * charset.c (cpp_substring_ranges::cpp_substring_ranges): New
2938 (cpp_substring_ranges::~cpp_substring_ranges): New destructor.
2939 (cpp_substring_ranges::add_range): New method.
2940 (cpp_substring_ranges::add_n_ranges): New method.
2941 (_cpp_valid_ucn): Add "char_range" and "loc_reader" params; if
2942 they are non-NULL, read position information from *loc_reader
2943 and update char_range->m_finish accordingly.
2944 (convert_ucn): Add "char_range", "loc_reader", and "ranges"
2945 params. If loc_reader is non-NULL, read location information from
2946 it, and update *ranges accordingly, using char_range.
2947 Conditionalize the conversion into tbuf on tbuf being non-NULL.
2948 (convert_hex): Likewise, conditionalizing the call to
2949 emit_numeric_escape on tbuf.
2950 (convert_oct): Likewise.
2951 (convert_escape): Add params "loc_reader" and "ranges". If
2952 loc_reader is non-NULL, read location information from it, and
2953 update *ranges accordingly. Conditionalize the conversion into
2954 tbuf on tbuf being non-NULL.
2955 (cpp_interpret_string): Rename to...
2956 (cpp_interpret_string_1): ...this, adding params "loc_readers" and
2957 "out". Use "to" to conditionalize the initialization and usage of
2958 "tbuf", such as running the converter. If "loc_readers" is
2959 non-NULL, use the instances within it, reading location
2960 information from them, and passing them to convert_escape; likewise
2961 write to "out" if loc_readers is non-NULL. Check for leading
2962 quote and issue an error if it is not present. Update boundary
2963 check from "== limit" to ">= limit" to protect against erroneous
2964 location values to calls that are not parsing string literals.
2965 (cpp_interpret_string): Reimplement in terms to
2966 cpp_interpret_string_1.
2967 (noop_error_cb): New function.
2968 (cpp_interpret_string_ranges): New function.
2969 (cpp_string_location_reader::cpp_string_location_reader): New
2971 (cpp_string_location_reader::get_next): New method.
2972 * include/cpplib.h (class cpp_string_location_reader): New class.
2973 (class cpp_substring_ranges): New class.
2974 (cpp_interpret_string_ranges): New prototype.
2975 * internal.h (_cpp_valid_ucn): Add params "char_range" and
2977 * lex.c (forms_identifier_p): Pass NULL for new params to
2980 2016-08-01 Andreas Schwab <schwab@suse.de>
2982 * include/cpplib.h: Fix comment typo.
2984 2016-07-27 David Malcolm <dmalcolm@redhat.com>
2986 * include/line-map.h (source_location): Fix line numbers in
2989 2016-07-11 David Malcolm <dmalcolm@redhat.com>
2991 * include/line-map.h (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES):
2992 Move here from line-map.c.
2993 (LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise.
2994 * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): Move from
2996 (LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise.
2998 2016-06-22 David Malcolm <dmalcolm@redhat.com>
3000 * directives.c (do_include_common): Pass on "location" to
3002 * errors.c (cpp_diagnostic): Reimplement in terms of...
3003 (cpp_diagnostic_at): New function.
3004 (cpp_error_at): New function.
3005 (cpp_errno_filename): Add "loc" param and use it by using
3006 cpp_error_at rather than cpp_error.
3007 * files.c (find_file_in_dir): Add "loc" param and pass it to
3009 (_cpp_find_file): Add "loc" param. Use it to convert calls to
3010 cpp_error to cpp_error_at, and pass it to find_file_in_dir and
3012 (read_file_guts): Add "loc" param. Use it to convert calls to
3013 cpp_error to cpp_error_at. Pass it to cpp_errno_filename.
3014 (read_file): Add "loc" param. Pass it to open_file_failed and
3016 (should_stack_file): Add "loc" param. Pass it to read_file.
3017 (_cpp_stack_file): Add "loc" param. Pass it to should_stack_file.
3018 (_cpp_stack_include): Add "loc" param. Pass it to
3019 _cpp_find_file and _cpp_stack_file.
3020 (open_file_failed): Add "loc" param. Pass it to
3022 (_cpp_fake_include): Add 0 as a source_location in call to
3024 (_cpp_compare_file_date): Likewise.
3025 (cpp_push_include): Likewise for call to _cpp_stack_include.
3026 (cpp_push_default_include): Likewise.
3027 (_cpp_save_file_entries): Likewise for call to open_file_failed.
3028 (_cpp_has_header): Likewise for call to _cpp_find_file.
3029 * include/cpplib.h (cpp_errno_filename): Add source_location
3031 (cpp_error_at): New declaration.
3032 * init.c (cpp_read_main_file): Add 0 as a source_location in calls
3033 to _cpp_find_file and _cpp_stack_file.
3034 * internal.h (_cpp_find_file): Add source_location param.
3035 (_cpp_stack_file): Likewise.
3036 (_cpp_stack_include): Likewise.
3038 2016-06-22 David Malcolm <dmalcolm@redhat.com>
3040 * include/line-map.h (fixit_hint::get_start_loc): New pure virtual
3042 (fixit_hint::maybe_get_end_loc): Likewise.
3043 (fixit_insert::get_start_loc): New function, implementing
3044 fixit_hint::get_start_loc.
3045 (fixit_insert::maybe_get_end_loc): New function, implementing
3046 fixit_hint::maybe_get_end_loc.
3047 (fixit_remove::get_start_loc): New function, implementing
3048 fixit_hint::get_start_loc.
3049 (fixit_remove::maybe_get_end_loc): New function, implementing
3050 fixit_hint::maybe_get_end_loc.
3051 (fixit_replace::get_start_loc): New function, implementing
3052 fixit_hint::get_start_loc.
3053 (fixit_replace::maybe_get_end_loc): New function, implementing
3054 fixit_hint::maybe_get_end_loc.
3056 2016-06-21 John David Anglin <danglin@gcc.gnu.org>
3058 * line-map.c (location_adhoc_data_update): Use int64_t instead of
3060 (get_combined_adhoc_loc): Likewise.
3062 2016-06-01 Eduard Sanou <dhole@openmailbox.org>
3064 * include/cpplib.h (cpp_callbacks): Add get_source_date_epoch
3066 * include/cpplib.h (cpp_init_source_date_epoch): Remove prototype.
3067 * init.c (cpp_init_source_date_epoch): Remove function.
3068 * init.c (cpp_create_reader): Initialize pfile->source_date_epoch.
3069 * internal.h (cpp_reader): Extend comment about source_date_epoch.
3070 * macro.c (_cpp_builtin_macro_text): Use get_source_date_epoch
3071 callback only once, read pfile->source_date_epoch on future passes.
3072 Check that get_source_date_epoch callback is not NULL.
3074 2016-05-20 Martin Liska <mliska@suse.cz>
3076 * config.in: Regenerated.
3077 * configure: Likewise.
3078 * configure.ac: Handle --enable-valgrind-annotations.
3079 * lex.c (new_buff): Use ENABLE_VALGRIND_ANNOTATIONS instead
3080 of ENABLE_VALGRIND_CHECKING.
3081 (_cpp_free_buff): Likewise.
3083 2016-04-28 Eduard Sanou <dhole@openmailbox.org>
3084 Matthias Klose <doko@debian.org>
3086 * include/cpplib.h (cpp_init_source_date_epoch): Prototype.
3087 * init.c (cpp_init_source_date_epoch): New function.
3088 * internal.h: Added source_date_epoch variable to struct
3089 cpp_reader to store a reproducible date.
3090 * macro.c (_cpp_builtin_macro_text): Set pfile->date timestamp from
3091 pfile->source_date_epoch instead of localtime if source_date_epoch is
3092 set, to be used for __DATE__ and __TIME__ macros to help reproducible
3095 2016-04-13 Bernd Schmidt <bschmidt@redhat.com>
3097 Patch from Roger Orr <rogero@howzatt.demon.co.uk>
3098 PR preprocessor/69650
3099 * directives.c (do_linemarker): Reread map after calling
3102 2016-04-06 Richard Henderson <rth@redhat.com>
3104 PR preprocessor/61817
3105 PR preprocessor/69391
3106 * internal.h (_cpp_builtin_macro_text): Update decl.
3107 * macro.c (_cpp_builtin_macro_text): Accept location for __LINE__.
3108 (builtin_macro): Accept a second location for __LINE__.
3109 (enter_macro_context): Compute both virtual and real expansion
3110 locations for the macro.
3112 2016-03-25 Bernd Schmidt <bschmidt@redhat.com>
3115 * directives.c (do_linemarker): Test for file left but not entered
3117 * line-map.c (linemap_add): Not here.
3119 2016-03-21 Jakub Jelinek <jakub@redhat.com>
3122 * include/cpplib.h (cpp_fun_like_macro_p): New prototype.
3123 * macro.c (cpp_fun_like_macro_p): New function.
3125 2016-03-15 Richard Henderson <rth@redhat.com>
3127 * line-map.c (new_linemap): Make alloc_size a size_t.
3129 2016-03-14 Jason Merrill <jason@redhat.com>
3131 * expr.c (cpp_classify_number): Hex floats are new in C++1z.
3132 * init.c (lang_defaults): Likewise.
3134 2016-03-09 David Malcolm <dmalcolm@redhat.com>
3138 * line-map.c (linemap_macro_map_loc_unwind_toward_spelling): Move
3140 * include/line-map.h
3141 (linemap_macro_map_loc_unwind_toward_spelling): ...here,
3142 converting from static to extern.
3144 2016-03-09 David Malcolm <dmalcolm@redhat.com>
3148 * include/line-map.h (source_range::debug): Delete.
3149 (struct location_range): Update comment. Replace
3150 expanded_location fields "m_start", "m_finish", and "m_caret" with
3151 a source_location field: "m_loc".
3152 (class rich_location): Reword comment.
3153 (rich_location::get_loc): Reimplement in terms of a new overloaded
3154 variant which takes an unsigned int.
3155 (rich_location::get_loc_addr): Delete.
3156 (rich_location::add_range): Drop params "start" and "finish" in
3157 favor of param "loc". Drop overloaded variants taking a
3158 source_range or location_range *.
3159 (rich_location::lazily_expand_location): Delete in favor of...
3160 (rich_location::get_expanded_location): New decl.
3161 (rich_location::m_loc): Delete field.
3162 (rich_location::m_column_override): New field.
3163 * line-map.c (rich_location::rich_location): Drop name of
3164 line_maps * param. Update initializations for deletion of field
3165 "m_loc" and addition of field "m_column_override". Reimplement
3166 body as a call to add_range. Delete overloaded variant taking a
3168 (rich_location::get_loc): New function.
3169 (rich_location::lazily_expand_location): Delete in favor of...
3170 (rich_location::get_expanded_location): New function.
3171 (rich_location::override_column): Reimplement.
3172 (rich_location::add_range): Drop params "start" and "finish" in
3173 favor of param "loc". Eliminate location expansion in favor of
3174 simply storing loc. Drop overloaded variants taking a
3175 source_range or location_range *.
3176 (rich_location::set_range): Eliminate location expansion.
3178 2016-02-29 David Malcolm <dmalcolm@redhat.com>
3180 PR preprocessor/69985
3181 (linemap_position_for_loc_and_offset): Rename param from "offset"
3182 to "column_offset". Right-shift the column_offset by m_range_bits
3183 of the pertinent ordinary map whenever offsetting a
3184 source_location. For clarity, offset the column by the column
3185 offset, rather than the other way around.
3187 2016-02-23 David Malcolm <dmalcolm@redhat.com>
3189 PR preprocessor/69126
3190 PR preprocessor/69543
3191 * line-map.c (linemap_compare_locations): At the function top,
3192 replace inlined bodies of get_location_from_adhoc_loc with calls
3193 to get_location_from_adhoc_loc. Add a pair of calls to
3194 get_location_from_adhoc_loc at the bottom of the function, to
3195 avoid meaningless comparisons of ad-hoc and non-ad-hoc locations.
3197 2016-02-08 David Malcolm <dmalcolm@redhat.com>
3199 PR preprocessor/69664
3200 * errors.c (cpp_diagnostic_with_line): Only call
3201 rich_location::override_column if the column is non-zero.
3202 * line-map.c (rich_location::override_column): Update columns
3203 within m_ranges[0]. Add assertions to verify that doing so is
3206 2016-02-05 Jakub Jelinek <jakub@redhat.com>
3209 * charset.c (cpp_interpret_charconst): Clear *PCHARS_SEEN
3210 and *UNSIGNEDP if bailing out early due to errors.
3212 2016-01-28 Jakub Jelinek <jakub@redhat.com>
3215 * files.c (_cpp_find_file): Set file->implicit_preinclude even if
3216 included from file->implicit_preinclude header.
3218 * directives.c (destringize_and_run): Adjust prototype.
3220 2016-01-27 David Malcolm <dmalcolm@redhat.com>
3222 PR preprocessor/69126
3223 * directives.c (destringize_and_run): Add expansion_loc param; use
3224 it when handling unexpanded pragmas to fixup the locations of the
3226 (_cpp_do__Pragma): Add expansion_loc param and use it when calling
3227 destringize_and_run.
3228 * internal.h (_cpp_do__Pragma): Add expansion_loc param.
3229 * macro.c (builtin_macro): Pass expansion location of _Pragma to
3232 2016-01-14 David Malcolm <dmalcolm@redhat.com>
3234 PR preprocessor/69177
3235 * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): New
3237 (LINE_MAP_MAX_LOCATION_WITH_COLS): Add note about unit tests
3239 (can_be_stored_compactly_p): Reduce threshold from
3240 LINE_MAP_MAX_LOCATION_WITH_COLS to
3241 LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES.
3242 (get_combined_adhoc_loc): Likewise.
3243 (get_range_from_loc): Likewise.
3244 (linemap_line_start): Ensure that a new ordinary map is created
3245 when transitioning from range-packing being enabled to disabled,
3246 at the LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES threshold. Set
3247 range_bits to 0 for new ordinary maps when beyond this limit.
3248 Prevent the "increase the column bits of a freshly created map"
3249 optimization if the range bits has reduced.
3251 2016-01-08 Jakub Jelinek <jakub@redhat.com>
3254 * files.c (cpp_included_before): If IS_ADHOC_LOC (location), lookup
3255 real location from the line_table.
3257 2016-01-04 Jakub Jelinek <jakub@redhat.com>
3259 Update copyright years.
3261 2015-12-22 David Malcolm <dmalcolm@redhat.com>
3263 * line-map.c (get_combined_adhoc_loc): Remove condition
3264 on locus < RESERVED_LOCATION_COUNT when considering
3265 whether a caret == start == finish location can be
3266 simply stored as the caret location.
3268 2015-12-07 David Malcolm <dmalcolm@redhat.com>
3270 * include/line-map.h (rich_location::set_range): Add line_maps *
3271 param; convert param from source_range to source_location. Drop
3272 "overwrite_loc_p" param.
3273 * line-map.c (rich_location::set_range): Likewise, acting as if
3274 "overwrite_loc_p" were true, and getting range from the location.
3276 2015-11-20 David Malcolm <dmalcolm@redhat.com>
3279 * include/line-map.h (source_range::intersects_line_p): New
3281 (rich_location::~rich_location): New.
3282 (rich_location::add_fixit_insert): New method.
3283 (rich_location::add_fixit_remove): New method.
3284 (rich_location::add_fixit_replace): New method.
3285 (rich_location::get_num_fixit_hints): New accessor.
3286 (rich_location::get_fixit_hint): New accessor.
3287 (rich_location::MAX_FIXIT_HINTS): New constant.
3288 (rich_location::m_num_fixit_hints): New field.
3289 (rich_location::m_fixit_hints): New field.
3290 (class fixit_hint): New class.
3291 (class fixit_insert): New class.
3292 (class fixit_remove): New class.
3293 (class fixit_replace): New class.
3294 * line-map.c (source_range::intersects_line_p): New method.
3295 (rich_location::rich_location): Add initialization of
3296 m_num_fixit_hints to both ctors.
3297 (rich_location::~rich_location): New.
3298 (rich_location::add_fixit_insert): New method.
3299 (rich_location::add_fixit_remove): New method.
3300 (rich_location::add_fixit_replace): New method.
3301 (fixit_insert::fixit_insert): New.
3302 (fixit_insert::~fixit_insert): New.
3303 (fixit_insert::affects_line_p): New.
3304 (fixit_remove::fixit_remove): New.
3305 (fixit_remove::affects_line_p): New.
3306 (fixit_replace::fixit_replace): New.
3307 (fixit_replace::~fixit_replace): New.
3308 (fixit_replace::affects_line_p): New.
3310 2015-11-19 Jakub Jelinek <jakub@redhat.com>
3312 PR preprocessor/60736
3313 * include/cpplib.h (cpp_errno_filename): New prototype.
3314 * errors.c (cpp_errno): Don't handle msgid "" specially, use
3315 _(msgid) instead of msgid as argument to cpp_error.
3316 (cpp_errno_filename): New function.
3317 * files.c (read_file_guts): Use cpp_errno_filename instead of
3319 (open_file_failed): Likewise. Use file->name if file->path is NULL
3322 2015-11-13 David Malcolm <dmalcolm@redhat.com>
3324 * errors.c (cpp_diagnostic): Pass pfile->line_table to
3326 (cpp_diagnostic_with_line): Likewise.
3327 * include/cpplib.h (struct cpp_token): Update comment for src_loc
3328 to indicate that the range of the token is "baked into" the
3330 * include/line-map.h (source_location): Update the descriptive
3331 comment to reflect the packing scheme for short ranges, adding
3332 worked examples of location encoding.
3333 (struct line_map_ordinary): Drop field "column_bits" in favor
3334 of field "m_column_and_range_bits"; add field "m_range_bits".
3335 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete.
3336 (location_adhoc_data): Add source_range field.
3337 (struct line_maps): Add fields "default_range_bits",
3338 "num_optimized_ranges" and "num_unoptimized_ranges".
3339 (get_combined_adhoc_loc): Add source_range param.
3340 (get_range_from_loc): New declaration.
3341 (pure_location_p): New prototype.
3342 (COMBINE_LOCATION_DATA): Add source_range param.
3343 (SOURCE_LINE): Update for renaming of column_bits.
3344 (SOURCE_COLUMN): Likewise. Shift the column right by the map's
3346 (LAST_SOURCE_LINE_LOCATION): Update for renaming of column_bits.
3347 (linemap_position_for_line_and_column): Add line_maps * params.
3348 (rich_location::rich_location): Likewise.
3349 * lex.c (_cpp_lex_direct): Capture the range of the token, baking
3350 it into token->src_loc via a call to COMBINE_LOCATION_DATA.
3351 * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): Reduce from 1U << 17 to
3353 (location_adhoc_data_hash): Add the src_range into
3355 (location_adhoc_data_eq): Require equality of the src_range
3357 (can_be_stored_compactly_p): New function.
3358 (get_combined_adhoc_loc): Add src_range param, and store it,
3359 via a bit-packing scheme for short ranges, otherwise within the
3360 lookaside table. Remove the requirement that data is non-NULL.
3361 (get_range_from_adhoc_loc): New function.
3362 (get_range_from_loc): New function.
3363 (pure_location_p): New function.
3364 (linemap_add): Ensure that start_location has zero for the
3365 range_bits, unless we're past LINE_MAP_MAX_LOCATION_WITH_COLS.
3366 Initialize range_bits to zero. Assert that the start_location
3368 (linemap_line_start): Assert that the
3369 column_and_range_bits >= range_bits.
3370 Update determinination of whether we need to start a new map
3371 using the effective column bits, without the range bits.
3372 Use the set's default_range_bits in new maps, apart from
3373 those with column_bits == 0, which should also have 0 range_bits.
3374 Increase the column bits for new maps by the range bits.
3375 When adding lines to an existing map, use set->highest_line
3376 directly rather than offsetting highest by SOURCE_COLUMN.
3377 Add assertions to sanity-check the return value.
3378 (linemap_position_for_column): Offset to_column by range_bits.
3379 Update set->highest_location if necessary.
3380 (linemap_position_for_line_and_column): Add line_maps * param.
3381 Update the calculation to offset the column by range_bits, and
3382 conditionalize it on being <= LINE_MAP_MAX_LOCATION_WITH_COLS.
3383 Bound it by LINEMAPS_MACRO_LOWEST_LOCATION. Update
3384 set->highest_location if necessary.
3385 (linemap_position_for_loc_and_offset): Handle ad-hoc locations;
3386 pass "set" to linemap_position_for_line_and_column.
3387 (linemap_macro_map_loc_unwind_toward_spelling): Add line_maps
3388 param. Handle ad-hoc locations.
3389 (linemap_location_in_system_header_p): Pass on "set" to call to
3390 linemap_macro_map_loc_unwind_toward_spelling.
3391 (linemap_macro_loc_to_spelling_point): Retain ad-hoc locations.
3392 Pass on "set" to call to
3393 linemap_macro_map_loc_unwind_toward_spelling.
3394 (linemap_resolve_location): Retain ad-hoc locations. Pass on
3395 "set" to call to linemap_macro_map_loc_unwind_toward_spelling.
3396 (linemap_unwind_toward_expansion): Pass on "set" to call to
3397 linemap_macro_map_loc_unwind_toward_spelling.
3398 (linemap_expand_location): Extract the data pointer before
3399 extracting the location.
3400 (rich_location::rich_location): Add line_maps param; use it to
3401 extract the range from the source_location.
3402 * location-example.txt: Regenerate, showing new representation.
3404 2015-11-06 David Malcolm <dmalcolm@redhat.com>
3406 * errors.c (cpp_diagnostic): Update for change in signature
3407 of "error" callback.
3408 (cpp_diagnostic_with_line): Likewise, calling override_column
3409 on the rich_location.
3410 * include/cpplib.h (struct cpp_callbacks): Within "error"
3411 callback, convert param from source_location to rich_location *,
3412 and drop column_override param.
3413 * include/line-map.h (struct source_range): New struct.
3414 (struct location_range): New struct.
3415 (class rich_location): New class.
3416 (linemap_client_expand_location_to_spelling_point): New declaration.
3417 * line-map.c (rich_location::rich_location): New ctors.
3418 (rich_location::lazily_expand_location): New method.
3419 (rich_location::override_column): New method.
3420 (rich_location::add_range): New methods.
3421 (rich_location::set_range): New method.
3423 2015-11-06 David Malcolm <dmalcolm@redhat.com>
3425 * include/line-map.h (struct linemap_stats): Add fields
3426 "adhoc_table_size" and "adhoc_table_entries_used".
3427 * line-map.c (linemap_get_statistics): Populate above fields.
3429 2015-11-04 Mikhail Maltsev <maltsevm@gmail.com>
3431 * config.in: Regenerate.
3432 * configure: Regenerate.
3433 * configure.ac: Remove ENABLE_CHECKING.
3435 2015-11-03 Uros Bizjak <ubizjak@gmail.com>
3437 * lex.c (search_line_sse42): Correctly advance the pointer to an
3440 2015-11-02 David Malcolm <dmalcolm@redhat.com>
3442 * include/line-map.h (source_location): In the table in the
3443 descriptive comment, show UNKNOWN_LOCATION, BUILTINS_LOCATION,
3444 LINE_MAP_MAX_LOCATION_WITH_COLS, LINE_MAP_MAX_SOURCE_LOCATION.
3445 Add notes about ad-hoc values.
3447 2015-10-21 Mikhail Maltsev <maltsevm@gmail.com>
3449 * include/line-map.h: Use CHECKING_P instead of ENABLE_CHECKING.
3451 * macro.c (struct macro_arg_token_iter, set_arg_token,
3452 macro_arg_token_iter_init, macro_arg_token_iter_forward,
3453 macro_arg_token_iter_get_token, macro_arg_token_iter_get_location,
3454 alloc_expanded_arg_mem, _cpp_backup_tokens): Likewise.
3456 * config.in: Regenerate.
3457 * configure: Regenerate.
3458 * configure.ac (CHECKING_P): Define.
3459 * system.h (fancy_abort): Declare.
3461 (gcc_assert): Define. Use CHECKING_P.
3463 2015-10-13 Mikhail Maltsev <maltsevm@gmail.com>
3465 * system.h (CHECKING_P, gcc_checking_assert): Define.
3467 2015-09-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
3470 * line-map.c (linemap_position_for_loc_and_offset): Handle the
3471 case of long lines encoded in multiple maps.
3473 2015-09-07 Marek Polacek <polacek@redhat.com>
3475 * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning.
3477 2015-08-06 Yaakov Selkowitz <yselkowi@redhat.com>
3479 * configure: Regenerate.
3481 2015-07-08 Thomas Schwinge <thomas@codesourcery.com>
3483 * include/line-map.h (RESERVED_LOCATION_COUNT): Change type to
3486 2015-07-02 Paolo Carlini <paolo.carlini@oracle.com>
3488 PR preprocessor/53690
3489 * charset.c (_cpp_valid_ucn): Add cppchar_t * parameter and change
3490 return type to bool. Fix encoding of \u0000 and \U00000000 in C++.
3491 (convert_ucn): Adjust call.
3492 * lex.c (forms_identifier_p): Likewise.
3493 * internal.h (_cpp_valid_ucn): Adjust declaration.
3495 2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
3497 Implement N4197 - Adding u8 character literals
3498 * include/cpplib.h (UTF8CHAR, UTF8CHAR_USERDEF): New cpp tokens;
3499 (struct cpp_options): Add utf8_char_literals.
3500 * init.c (struct lang_flags): Add utf8_char_literals;
3501 (struct lang_flags lang_defaults): Add column for utf8_char_literals.
3502 * macro.c (stringify_arg()): Treat CPP_UTF8CHAR token;
3503 * expr.c (cpp_userdef_char_remove_type(), cpp_userdef_char_add_type()):
3504 Treat CPP_UTF8CHAR_USERDEF, CPP_UTF8CHAR tokens;
3505 (cpp_userdef_char_p()): Treat CPP_UTF8CHAR_USERDEF token;
3506 (eval_token(), _cpp_parse_expr()): Treat CPP_UTF8CHAR token.
3507 * lex.c (lex_string(), _cpp_lex_direct()): Include CPP_UTF8CHAR tokens.
3508 * charset.c (converter_for_type(), cpp_interpret_charconst()):
3509 Treat CPP_UTF8CHAR token.
3511 2015-06-30 Uros Bizjak <ubizjak@gmail.com>
3513 * lex.c (search_line_sse42) [__GCC_ASM_FLAG_OUTPUTS__]: New main
3514 loop using asm flag outputs.
3516 2015-06-08 Marek Polacek <polacek@redhat.com>
3519 * line-map.c (linemap_position_for_loc_and_offset): Remove
3520 linemap_assert_fails; reverse conditions.
3522 2015-05-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
3524 * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER
3525 LINE_MAP_MAX_LOCATION_WITH_COLS,LINE_MAP_MAX_SOURCE_LOCATION):
3527 (linemap_line_start): Use them.
3528 (linemap_position_for_column): Use them.
3530 2015-05-20 David Malcolm <dmalcolm@redhat.com>
3532 * include/line-map.h (MAP_START_LOCATION): Eliminate the non-const
3533 variant, and tweak comment for the const variant.
3534 (ORDINARY_MAP_STARTING_LINE_NUMBER): Drop the non-const variant.
3535 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
3536 (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
3537 (SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete.
3538 (ORDINARY_MAP_FILE_NAME): Drop the non-const variant.
3539 (MACRO_MAP_MACRO): Likewise.
3540 (MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
3541 (MACRO_MAP_LOCATIONS): Likewise.
3542 (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
3543 * line-map.c (linemap_add): Replace writes through macros with
3544 direct field accesses.
3545 (linemap_enter_macro): Likewise.
3546 (linemap_line_start): Likewise.
3548 2015-05-19 David Malcolm <dmalcolm@redhat.com>
3550 * directives.c (do_line): Strengthen local "map" from
3551 const line_map * to const line_map_ordinary *.
3552 (do_linemarker): Likewise.
3553 (_cpp_do_file_change): Assert that we're not dealing with
3554 a macro map. Introduce local "ord_map" via a call to
3555 linemap_check_ordinary, guarded within the check for
3556 non-NULL. Use it for typesafety.
3557 * files.c (cpp_make_system_header): Strengthen local "map" from
3558 const line_map * to const line_map_ordinary *.
3559 * include/cpplib.h (struct cpp_callbacks): Likewise for second
3560 parameter of "file_change" callback.
3561 * include/line-map.h (struct line_map): Convert from a struct
3562 containing a union to a base class.
3563 (struct line_map_ordinary): Convert to a subclass of line_map.
3564 (struct line_map_macro): Likewise.
3565 (linemap_check_ordinary): Strengthen return type from line_map *
3566 to line_map_ordinary *, and add a const-variant.
3567 (linemap_check_macro): New pair of functions.
3568 (ORDINARY_MAP_STARTING_LINE_NUMBER): Strengthen param from
3569 const line_map * to const line_map_ordinary *, eliminating call
3570 to linemap_check_ordinary. Likewise for the non-const variant.
3571 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
3572 (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
3573 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Likewise.
3574 (ORDINARY_MAP_FILE_NAME): Likewise.
3575 (MACRO_MAP_MACRO): Strengthen param from const line_map * to
3576 const line_map_macro *. Likewise for the non-const variant.
3577 (MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
3578 (MACRO_MAP_LOCATIONS): Likewise.
3579 (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
3580 (struct maps_info): Replace with...
3581 (struct maps_info_ordinary):...this and...
3582 (struct maps_info_macro): ...this.
3583 (struct line_maps): Convert fields "info_ordinary" and
3584 "info_macro" to the above new structs.
3585 (LINEMAPS_MAP_INFO): Delete both functions.
3586 (LINEMAPS_MAPS): Likewise.
3587 (LINEMAPS_ALLOCATED): Rewrite both variants to avoid using
3589 (LINEMAPS_USED): Likewise.
3590 (LINEMAPS_CACHE): Likewise.
3591 (LINEMAPS_MAP_AT): Likewise.
3592 (LINEMAPS_ORDINARY_MAPS): Strengthen return type from line_map *
3593 to line_map_ordinary *.
3594 (LINEMAPS_ORDINARY_MAP_AT): Likewise.
3595 (LINEMAPS_LAST_ORDINARY_MAP): Likewise.
3596 (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise.
3597 (LINEMAPS_MACRO_MAPS): Strengthen return type from line_map * to
3599 (LINEMAPS_MACRO_MAP_AT): Likewise.
3600 (LINEMAPS_LAST_MACRO_MAP): Likewise.
3601 (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise.
3602 (linemap_map_get_macro_name): Strengthen param from
3603 const line_map * to const line_map_macro *.
3604 (SOURCE_LINE): Strengthen first param from const line_map * to
3605 const line_map_ordinary *, removing call to
3606 linemap_check_ordinary.
3607 (SOURCE_COLUMN): Likewise.
3608 (LAST_SOURCE_LINE_LOCATION): Likewise.
3609 (LAST_SOURCE_LINE): Strengthen first param from const line_map *
3610 to const line_map_ordinary *.
3611 (LAST_SOURCE_COLUMN): Likewise.
3612 (INCLUDED_FROM): Strengthen return type from line_map * to
3613 line_map_ordinary *., and second param from const line_map *
3614 to const line_map_ordinary *, removing call to
3615 linemap_check_ordinary.
3616 (MAIN_FILE_P): Strengthen param from const line_map * to
3617 const line_map_ordinary *, removing call to
3618 linemap_check_ordinary.
3619 (linemap_position_for_line_and_column): Strengthen param from
3620 const line_map * to const line_map_ordinary *.
3621 (LINEMAP_FILE): Strengthen param from const line_map * to
3622 const line_map_ordinary *, removing call to
3623 linemap_check_ordinary.
3624 (LINEMAP_LINE): Likewise.
3625 (LINEMAP_SYSP): Likewise.
3626 (linemap_resolve_location): Strengthen final param from
3627 const line_map ** to const line_map_ordinary **.
3628 * internal.h (CPP_INCREMENT_LINE): Likewise for local "map".
3629 (linemap_enter_macro): Strengthen return type from
3630 const line_map * to const line_map_macro *.
3631 (linemap_add_macro_token): Likewise for first param.
3632 * line-map.c (linemap_check_files_exited): Strengthen local "map"
3633 from const line_map * to const line_map_ordinary *.
3634 (new_linemap): Introduce local "map_size" and use it when
3635 calculating how large the buffer should be. Rewrite based
3636 on change of info_macro and info_ordinary into distinct types.
3637 (linemap_add): Strengthen locals "map" and "from" from line_map *
3638 to line_map_ordinary *.
3639 (linemap_enter_macro): Strengthen return type from
3640 const line_map * to const line_map_macro *, and local "map" from
3641 line_map * to line_map_macro *.
3642 (linemap_add_macro_token): Strengthen param "map" from
3643 const line_map * to const line_map_macro *.
3644 (linemap_line_start): Strengthen local "map" from line_map * to
3645 line_map_ordinary *.
3646 (linemap_position_for_column): Likewise.
3647 (linemap_position_for_line_and_column): Strengthen first param
3648 from const line_map * to const line_map_ordinary *.
3649 (linemap_position_for_loc_and_offset): Strengthen local "map" from
3650 const line_map * to const line_map_ordinary *.
3651 (linemap_ordinary_map_lookup): Likewise for return type and locals
3652 "cached" and "result".
3653 (linemap_macro_map_lookup): Strengthen return type and locals
3654 "cached" and "result" from const line_map * to
3655 const line_map_macro *.
3656 (linemap_macro_map_loc_to_exp_point): Likewise for param "map".
3657 (linemap_macro_map_loc_to_def_point): Likewise.
3658 (linemap_macro_map_loc_unwind_toward_spelling): Likewise.
3659 (linemap_get_expansion_line): Strengthen local "map" from
3660 const line_map * to const line_map_ordinary *.
3661 (linemap_get_expansion_filename): Likewise.
3662 (linemap_map_get_macro_name): Strengthen param from
3663 const line_map * to const line_map_macro *.
3664 (linemap_location_in_system_header_p): Add call to
3665 linemap_check_ordinary in region guarded by
3666 !linemap_macro_expansion_map_p. Introduce local "macro_map" via
3667 linemap_check_macro in other region, using it in place of "map"
3669 (first_map_in_common_1): Add calls to linemap_check_macro.
3670 (trace_include): Strengthen param "map" from const line_map * to
3671 const line_map_ordinary *.
3672 (linemap_macro_loc_to_spelling_point): Strengthen final param from
3673 const line_map ** to const line_map_ordinary **. Replace a
3674 C-style cast with a const_cast, and add calls to
3675 linemap_check_macro and linemap_check_ordinary.
3676 (linemap_macro_loc_to_def_point): Likewise.
3677 (linemap_macro_loc_to_exp_point): Likewise.
3678 (linemap_resolve_location): Strengthen final param from
3679 const line_map ** to const line_map_ordinary **.
3680 (linemap_unwind_toward_expansion): Introduce local "macro_map" via
3681 a checked cast and use it in place of *map.
3682 (linemap_unwind_to_first_non_reserved_loc): Strengthen local
3683 "map1" from const line_map * to const line_map_ordinary *.
3684 (linemap_expand_location): Introduce local "ord_map" via a checked
3685 cast and use it in place of map.
3686 (linemap_dump): Make local "map" const. Strengthen local
3687 "includer_map" from line_map * to const line_map_ordinary *.
3688 Introduce locals "ord_map" and "macro_map" via checked casts and
3689 use them in place of "map" for typesafety.
3690 (linemap_dump_location): Strengthen local "map" from
3691 const line_map * to const line_map_ordinary *.
3692 (linemap_get_file_highest_location): Update for elimination of
3694 (linemap_get_statistics): Strengthen local "cur_map" from
3695 line_map * to const line_map_macro *. Update uses of sizeof to
3696 use the appropriate line_map subclasses.
3697 * macro.c (_cpp_warn_if_unused_macro): Add call to
3698 linemap_check_ordinary.
3699 (builtin_macro): Strengthen local "map" from const line_map * to
3700 const line_map_macro *.
3701 (enter_macro_context): Likewise.
3702 (replace_args): Likewise.
3703 (tokens_buff_put_token_to): Likewise for param "map".
3704 (tokens_buff_add_token): Likewise.
3706 2015-05-13 David Malcolm <dmalcolm@redhat.com>
3708 * include/line-map.h (source_location): Add a reference to
3709 location-example.txt to the descriptive comment.
3710 * location-example.txt: New file.
3712 2015-05-13 David Malcolm <dmalcolm@redhat.com>
3714 * include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro
3715 to a const source_location.
3716 (RESERVED_LOCATION_COUNT): Likewise.
3717 (linemap_check_ordinary): Convert from a macro to a pair of inline
3718 functions, for const/non-const arguments.
3719 (MAP_START_LOCATION): Likewise.
3720 (ORDINARY_MAP_STARTING_LINE_NUMBER): Likewise.
3721 (ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
3722 (ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
3723 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Convert from a macro to a
3724 pair of inline functions, for const/non-const arguments, where the
3726 (SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): New function.
3727 (ORDINARY_MAP_FILE_NAME): Convert from a macro to a pair of inline
3728 functions, for const/non-const arguments.
3729 (MACRO_MAP_MACRO): Likewise.
3730 (MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
3731 (MACRO_MAP_LOCATIONS): Likewise.
3732 (MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
3733 (LINEMAPS_MAP_INFO): Likewise.
3734 (LINEMAPS_MAPS): Likewise.
3735 (LINEMAPS_ALLOCATED): Likewise.
3736 (LINEMAPS_USED): Likewise.
3737 (LINEMAPS_CACHE): Likewise.
3738 (LINEMAPS_ORDINARY_CACHE): Likewise.
3739 (LINEMAPS_MACRO_CACHE): Likewise.
3740 (LINEMAPS_MAP_AT): Convert from a macro to an inline function.
3741 (LINEMAPS_LAST_MAP): Likewise.
3742 (LINEMAPS_LAST_ALLOCATED_MAP): Likewise.
3743 (LINEMAPS_ORDINARY_MAPS): Likewise.
3744 (LINEMAPS_ORDINARY_MAP_AT): Likewise.
3745 (LINEMAPS_ORDINARY_ALLOCATED): Likewise.
3746 (LINEMAPS_ORDINARY_USED): Likewise.
3747 (LINEMAPS_LAST_ORDINARY_MAP): Likewise.
3748 (LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise.
3749 (LINEMAPS_MACRO_MAPS): Likewise.
3750 (LINEMAPS_MACRO_MAP_AT): Likewise.
3751 (LINEMAPS_MACRO_ALLOCATED): Likewise.
3752 (LINEMAPS_MACRO_USED): Likewise.
3753 (LINEMAPS_MACRO_LOWEST_LOCATION): Likewise.
3754 (LINEMAPS_LAST_MACRO_MAP): Likewise.
3755 (LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise.
3756 (IS_ADHOC_LOC): Likewise.
3757 (COMBINE_LOCATION_DATA): Likewise.
3758 (SOURCE_LINE): Likewise.
3759 (SOURCE_COLUMN): Likewise.
3760 (LAST_SOURCE_LINE_LOCATION): Likewise.
3761 (LAST_SOURCE_LINE): Likewise.
3762 (LAST_SOURCE_COLUMN): Likewise.
3763 (LAST_SOURCE_LINE_LOCATION)
3764 (INCLUDED_FROM): Likewise.
3765 (MAIN_FILE_P): Likewise.
3766 (LINEMAP_FILE): Likewise.
3767 (LINEMAP_LINE): Likewise.
3768 (LINEMAP_SYSP): Likewise.
3769 (linemap_location_before_p): Likewise.
3770 * line-map.c (linemap_check_files_exited): Make local "map" const.
3771 (linemap_add): Use SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS.
3772 (linemap_line_start): Likewise.
3774 2015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
3776 * aclocal.m4: Regenerated with automake-1.11.6.
3778 2015-05-13 David Malcolm <dmalcolm@redhat.com>
3780 * include/line-map.h (linemap_assert): Move up within the file to
3781 before all of the map accessor macros.
3782 (linemap_assert_fails): Likewise.
3783 (linemap_check_ordinary): Likewise.
3784 (linemap_macro_expansion_map_p): Likewise.
3786 2015-05-12 David Malcolm <dmalcolm@redhat.com>
3788 * directives.c (do_line): Set seen_line_directive on line_table.
3789 (do_linemarker): Likewise.
3790 * include/line-map.h (struct line_maps): Add new field
3791 "seen_line_directive".
3793 2015-05-08 Jason Merrill <jason@redhat.com>
3795 * include/cpplib.h: Add CPP_W_CXX11_COMPAT.
3796 (struct cpp_options): Add cpp_warn_cxx11_compat.
3797 * init.c (cpp_create_reader): Initialize it.
3798 * lex.c (lex_string): Add -Wc++11-compat warning.
3800 2015-05-05 David Malcolm <dmalcolm@redhat.com>
3802 * pch.c (cpp_valid_state): Fix indentation so that it reflects the
3805 2015-05-05 David Malcolm <dmalcolm@redhat.com>
3807 * include/line-map.h: Fix comment at the top of the file.
3808 (source_location): Rewrite and expand the comment for this
3809 typedef, adding an ascii-art table to clarify how source_location
3810 values are allocated.
3811 * line-map.c: Fix comment at the top of the file.
3813 2015-04-09 Richard Biener <rguenther@suse.de>
3816 * files.c (pch_open_file): Allow main and pre-included files
3817 when trying to open a PCH.
3819 2015-04-06 Jakub Jelinek <jakub@redhat.com>
3821 PR preprocessor/61977
3822 * lex.c (cpp_peek_token): If peektok is CPP_EOF, back it up
3823 with all tokens peeked by the current function.
3825 2015-04-02 Jakub Jelinek <jakub@redhat.com>
3827 PR preprocessor/61977
3828 * lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change.
3830 2015-03-23 Jakub Jelinek <jakub@redhat.com>
3832 PR preprocessor/65238
3833 * internal.h (_cpp_scan_out_logical_line): Add third argument.
3834 * directives.c (prepare_directive_trad): Pass false to it.
3835 * traditional.c (_cpp_read_logical_line_trad,
3836 _cpp_create_trad_definition): Likewise.
3837 (struct fun_macro): Add paramc field.
3838 (fun_like_macro): New function.
3839 (maybe_start_funlike): Handle NODE_BUILTIN macros. Initialize
3840 macro->paramc field.
3841 (save_argument): Use macro->paramc instead of
3842 macro->node->value.macro->paramc.
3843 (push_replacement_text): Formatting fix.
3844 (recursive_macro): Use fun_like_macro helper.
3845 (_cpp_scan_out_logical_line): Likewise. Add BUILTIN_MACRO_ARG
3846 argument. Initialize fmacro.paramc field. Handle builtin
3847 function-like macros.
3849 2015-03-16 Edward Smith-Rowland <3dw4rd@verizon.net>
3852 * lex.c (lex_number): If a number ends with digit-seps (') skip back
3853 and let lex_string take them.
3855 2015-03-02 Markus Trippelsdorf <markus@trippelsdorf.de>
3858 * lex.c (search_line_fast): Silence ubsan errors.
3860 2015-02-03 <dodji@redhat.com>
3862 PR preprocessor/64803
3863 * internal.h (cpp_reader::top_most_macro_node): New data member.
3864 * macro.c (enter_macro_context): Pass the location of the end of
3865 the top-most invocation of the function-like macro, or the
3866 location of the expansion point of the top-most object-like macro.
3867 (cpp_get_token_1): Store the top-most macro node in the new
3868 pfile->top_most_macro_node data member.
3869 (_cpp_pop_context): Clear the new cpp_reader::top_most_macro_node
3872 2015-01-30 Szabolcs Nagy <szabolcs.nagy@arm.com>
3874 * lex.c (search_line_fast): Change __ARM_NEON__ to __ARM_NEON.
3876 2015-01-23 Marek Polacek <polacek@redhat.com>
3879 PR preprocessor/60570
3880 * directives.c (do_elif): Don't evaluate #elif conditionals
3881 when they don't need to be.
3883 2015-01-16 Jakub Jelinek <jakub@redhat.com>
3885 * expr.c (cpp_classify_number): Add N_() around ?: string
3886 literals used in cpp_error_with_line call as format string.
3888 2015-01-05 Jakub Jelinek <jakub@redhat.com>
3890 Update copyright years.
3892 2014-12-19 Jakub Jelinek <jakub@redhat.com>
3894 PR preprocessor/63831
3895 * directives.c (lex_macro_node): Remove __has_attribute__ handling.
3896 * internal.h (struct spec_node): Remove n__has_attribute__ field.
3897 (struct lexer_state): Remove in__has_attribute__ field.
3898 * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_ATTRIBUTE.
3899 * identifiers.c (_cpp_init_hashtable): Remove __has_attribute__
3901 * init.c (builtin_array): Add __has_attribute and __has_cpp_attribute.
3902 (cpp_init_special_builtins): Don't initialize __has_attribute
3903 or __has_cpp_attribute if CLK_ASM or pfile->cb.has_attribute is NULL.
3904 * traditional.c (enum ls): Remove ls_has_attribute,
3905 ls_has_attribute_close.
3906 (_cpp_scan_out_logical_line): Remove __has_attribute__ handling.
3907 * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_ATTRIBUTE.
3908 * pch.c (cpp_read_state): Remove __has_attribute__ handling.
3909 * expr.c (eval_token): Likewise.
3910 (parse_has_attribute): Removed.
3912 2014-12-11 Uros Bizjak <ubizjak@gmail.com>
3914 * directives.c (cpp_define_formatted): Use xvasprintf.
3916 2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
3918 * line-map.c (linemap_position_for_loc_and_offset): Add new
3919 linemap_assert_fails.
3921 2014-12-02 Manuel López-Ibáñez <manu@gcc.gnu.org>
3923 * include/line-map.h (linemap_assert_fails): Declare.
3924 * line-map.c (linemap_position_for_loc_and_offset): Use it.
3926 2014-12-02 Manuel López-Ibáñez <manu@gcc.gnu.org>
3928 * line-map.c (linemap_add): Fix typo.
3929 (linemap_line_start): Fix whitespace.
3931 2014-11-29 John Schmerge <jbschmerge@gmail.com>
3933 PR preprocessor/41698
3934 * charset.c (one_utf8_to_utf16): Do not produce surrogate pairs
3937 2014-11-25 Jakub Jelinek <jakub@redhat.com>
3939 PR preprocessor/60436
3940 * line-map.c (linemap_line_start): If highest is above 0x60000000
3941 and we are still tracking columns or highest is above 0x70000000,
3944 2014-11-20 Uros Bizjak <ubizjak@gmail.com>
3947 * lex.c [__i386__ || __x86_64__]: Compile special SSE functions
3948 only for (__GNUC__ >= 5 || !defined(__PIC__)).
3950 2014-11-13 Manuel López-Ibáñez <manu@gcc.gnu.org>
3952 * include/line-map.h: Include EXPR, so that unused variable warnings
3955 2014-11-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
3958 * include/line-map.h (linemap_position_for_loc_and_offset):
3960 * line-map.c (linemap_position_for_loc_and_offset): New.
3962 2014-11-11 David Malcolm <dmalcolm@redhat.com>
3964 * ChangeLog.jit: New.
3966 2014-11-10 Edward Smith-Rowland <3dw4rd@verizon.net>
3968 * include/cpplib.h (cpp_callbacks): Add has_attribute.
3969 * internal.h (lexer_state): Add in__has_attribute__.
3970 * directives.c (lex_macro_node): Prevent use of __has_attribute__
3972 * expr.c (parse_has_attribute): New function; (eval_token): Look for
3973 __has_attribute__ and route to parse_has_attribute.
3974 * identifiers.c (_cpp_init_hashtable): Initialize n__has_attribute__.
3975 * pch.c (cpp_read_state): Initialize n__has_attribute__.
3976 * traditional.c (enum ls): Add ls_has_attribute, ls_has_attribute_close;
3977 (_cpp_scan_out_logical_line): Attend to __has_attribute__.
3979 2014-11-06 Joseph Myers <joseph@codesourcery.com>
3981 * include/cpp-id-data.h (struct cpp_macro): Update comment
3982 regarding parameters.
3983 * include/cpplib.h (struct cpp_macro_arg, struct cpp_identifier):
3984 Add spelling fields.
3985 (struct cpp_token): Update comment on macro_arg.
3986 * internal.h (_cpp_save_parameter): Add extra argument.
3987 (_cpp_spell_ident_ucns): New declaration.
3988 * lex.c (lex_identifier): Add SPELLING argument. Set *SPELLING to
3989 original spelling of identifier.
3990 (_cpp_lex_direct): Update calls to lex_identifier.
3991 (_cpp_spell_ident_ucns): New function, factored out of
3993 (cpp_spell_token): Adjust FORSTRING argument semantics to return
3994 original spelling of identifiers. Use _cpp_spell_ident_ucns in
3996 (_cpp_equiv_tokens): Check spellings of identifiers and macro
3997 arguments are identical.
3998 * macro.c (macro_arg_saved_data): New structure.
3999 (paste_tokens): Use original spellings of identifiers from
4001 (_cpp_save_parameter): Add argument SPELLING. Save both canonical
4003 (parse_params): Update calls to _cpp_save_parameter.
4004 (lex_expansion_token): Save spelling of macro argument tokens.
4005 (_cpp_create_definition): Extract canonical node from saved data.
4006 (cpp_macro_definition): Use UCNs in spelling of macro name. Use
4007 original spellings of macro argument tokens and identifiers.
4008 * traditional.c (scan_parameters): Update call to
4009 _cpp_save_parameter.
4011 2014-11-05 Joseph Myers <joseph@codesourcery.com>
4013 PR preprocessor/9449
4014 * init.c (lang_defaults): Enable extended identifiers for C++ and
4015 C99-based standards.
4017 2014-10-22 Alan Modra <amodra@gmail.com>
4019 * symtab.c (ht_create): Use obstack_specify_allocation in place of
4021 * files.c (_cpp_init_files): Likewise.
4022 * init.c (cpp_create_reader): Likewise.
4023 * identifiers.c (_cpp_init_hashtable): Likewise.
4025 2014-10-14 Manuel López-Ibáñez <manu@gcc.gnu.org>
4027 * include/line-map.h (linemap_location_from_macro_expansion_p):
4028 const struct line_maps * argument.
4029 (linemap_position_for_line_and_column): const struct line_map *
4031 * line-map.c (linemap_add_macro_token): Use correct argument name
4033 (linemap_position_for_line_and_column): const struct line_map *
4035 (linemap_macro_map_loc_to_def_point): Fix comment. Make static.
4036 (linemap_location_from_macro_expansion_p): const struct line_maps *
4038 (linemap_resolve_location): Fix argument names in comment.
4040 2014-10-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
4042 * lex.c (search_line_fast): Add new version to be used for Power8
4043 and later targets when Altivec is enabled. Restrict the existing
4044 Altivec version to big-endian systems so that lvsr is not used on
4045 little endian, where it is deprecated. Remove LE-specific code
4046 from the now-BE-only version.
4048 2014-10-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
4049 Jeff Law <law@redhat.com>
4051 * charset.c (convert_no_conversion): Reallocate memory with 25%
4054 2014-10-01 Edward Smith-Rowland <3dw4rd@verizon.net>
4056 Implement SD-6: SG10 Feature Test Recommendations
4057 * internal.h (lexer_state, spec_nodes): Add in__has_include__.
4058 * directives.c: Support __has_include__ builtin.
4059 * expr.c (parse_has_include): New function to parse __has_include__
4060 builtin; (eval_token()): Use it.
4061 * files.c (_cpp_has_header()): New funtion to look for header;
4062 (open_file_failed()): Not an error to not find a header file for
4064 * identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
4065 * pch.c (cpp_read_state): Lookup __has_include__.
4066 * traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
4067 __has_include__ statements.
4069 2014-09-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
4071 PR preprocessor/58893
4072 * errors.c (cpp_diagnostic): Fix possible out of bounds access.
4073 * files.c (_cpp_stack_include): Initialize src_loc for IT_CMDLINE.
4075 2014-09-24 Marek Polacek <polacek@redhat.com>
4079 * include/cpplib.h (enum cpp_ttype): Define CPP_KEYWORD.
4081 2014-09-17 Jan Hubicka <hubicka@ucw.cz>
4083 * charset.c (conversion): Rename to ...
4084 (cpp_conversion): ... this one; update.
4085 * files.c (file_hash_entry): Rename to ...
4086 (cpp_file_hash_entry): ... this one ; update.
4088 2014-09-17 Marek Polacek <polacek@redhat.com>
4091 * init.c (struct lang_flags): Remove cplusplus_comments.
4092 (cpp_set_lang): Likewise.
4093 (post_options): Likewise.
4094 * lex.c (_cpp_lex_direct): Disallow C++ style comments in C90/C94.
4096 2014-09-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
4098 * include/cpplib.h (struct cpp_options): Declare warn_normalize as
4099 int instead of enum.
4101 2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
4103 * macro.c (replace_args): Use cpp_pedwarning, cpp_warning and
4105 * include/cpplib.h: Add CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.
4106 * init.c (cpp_create_reader): Do not init to -1 here.
4107 * expr.c (num_binary_op): Use cpp_pedwarning.
4109 2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
4111 * directives.c (check_eol_1): New.
4112 (check_eol_endif_labels): New.
4113 (check_eol): Call check_eol_1.
4114 (do_else,do_endif): Call check_eol_endif_labels.
4116 2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
4118 * macro.c (warn_of_redefinition): Suppress warnings for builtins
4119 that lack the NODE_WARN flag, unless Wbuiltin-macro-redefined.
4120 (_cpp_create_definition): Use Wbuiltin-macro-redefined for
4121 builtins that lack the NODE_WARN flag.
4122 * directives.c (do_undef): Likewise.
4123 * init.c (cpp_init_special_builtins): Do not change flags
4124 depending on Wbuiltin-macro-redefined.
4126 2014-08-28 Edward Smith-Rowland <3dw4rd@verizon.net>
4128 PR cpp/23827 - standard C++ should not have hex float preprocessor
4130 * libcpp/init.c (lang_flags): Change CXX98 flag for extended numbers
4132 * libcpp/expr.c (cpp_classify_number): Weite error message for improper
4133 use of hex floating literal.
4135 2014-08-23 Edward Smith-Rowland <3dw4rd@verizon.net>
4137 * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z;
4138 Rename CLK_GNUCXX1Y, CLK_CXX1Y to CLK_GNUCXX14, CLK_CXX14;
4139 * init.c (struct lang_flags lang_defaults): Add column for trigraphs;
4140 Add rows for CLK_GNUCXX1Z, CLK_CXX1Z; (cpp_set_lang): Set trigraphs;
4141 (cpp_init_builtins): Set __cplusplus to 201402L for C++14;
4142 Set __cplusplus to 201500L for C++17.
4143 * expr.c (cpp_classify_number): Change C++1y to C++14 in binary
4144 constants error message.
4146 2014-08-20 Marek Polacek <polacek@redhat.com>
4148 * include/cpplib.h (cpp_options): Use signed char.
4149 * lex.c (_cpp_lex_direct): Don't warn in C++ mode.
4151 2014-08-19 Marek Polacek <polacek@redhat.com>
4153 * lex.c (_cpp_lex_direct): Fix a typo.
4155 2014-08-19 Marek Polacek <polacek@redhat.com>
4157 * charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat.
4158 * lex.c (_cpp_lex_direct): Likewise.
4159 * macro.c (replace_args): Likewise.
4160 (parse_params): Likewise.
4161 * include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat
4164 2014-08-10 Marek Polacek <polacek@redhat.com>
4167 * lex.c (_cpp_lex_direct): Warn when -Wc90-c99-compat is in effect.
4168 * charset.c (_cpp_valid_ucn): Likewise.
4169 * include/cpplib.h (cpp_options): Add cpp_warn_c90_c99_compat.
4170 * macro.c (replace_args): Warn when -Wc90-c99-compat is in effect.
4171 (parse_params): Likewise.
4173 2014-07-27 Marek Polacek <polacek@redhat.com>
4176 * macro.c (builtin_macro): Add location parameter. Set
4177 location of builtin macro to the expansion point.
4178 (enter_macro_context): Pass location to builtin_macro.
4180 2014-07-16 Dodji Seketeli <dodji@redhat.com>
4182 Support location tracking for built-in macro tokens
4183 * include/line-map.h (line_maps::builtin_location): New data
4185 (line_map_init): Add a new parameter to initialize the new
4186 line_maps::builtin_location data member.
4187 * line-map.c (linemap_init): Initialize the
4188 line_maps::builtin_location data member.
4189 * macro.c (builtin_macro): Create a macro map and track the token
4190 resulting from the expansion of a built-in macro.
4192 2014-07-10 Edward Smith-Rowland <3dw4rd@verizon.net>
4193 Jonathan Wakely <jwakely@redhat.com>
4195 PR preprocessor/61389
4196 * macro.c (_cpp_arguments_ok, parse_params, create_iso_definition):
4197 Warning messages mention C++11 in c++ mode and C99 in c mode.
4198 * lex.c (lex_identifier_intern, lex_identifier): Ditto
4200 2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net>
4202 PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped
4204 * lex.c (lex_raw_string ()): Do not warn about invalid suffix
4205 if skipping. (lex_string ()): Ditto.
4207 2014-06-04 Edward Smith-Rowland <3dw4rd@verizon.net>
4210 * macro.c (stringify_arg (cpp_reader *, macro_arg *)):
4211 Combine user-defined escape logic with the other string and char logic.
4213 2014-05-26 Richard Biener <rguenther@suse.de>
4215 * configure.ac: Remove long long and __int64 type checks,
4216 add check for uint64_t and fail if that wasn't found.
4217 * include/cpplib.h (cpp_num_part): Use uint64_t.
4218 * config.in: Regenerate.
4219 * configure: Likewise.
4221 2014-05-21 Marek Polacek <polacek@redhat.com>
4224 * files.c (find_file_in_dir): Add parens around &&.
4226 2014-05-20 Edward Smith-Rowland <3dw4rd@verizon.net>
4229 * macro.c (stringify_arg (cpp_reader *, macro_arg *)):
4230 Check for user-defined literal strings and user-defined literal chars
4231 to escape necessary characters.
4233 2014-05-20 Richard Biener <rguenther@suse.de>
4235 * configure.ac: Copy gcc logic of detecting a 64bit type.
4236 Remove HOST_WIDE_INT define.
4237 * include/cpplib.h: typedef cpp_num_part to a 64bit type,
4238 similar to how hwint.h does it.
4239 * config.in: Regenerate.
4240 * configure: Likewise.
4242 2014-05-09 Joey Ye <joey.ye@arm.com>
4244 * files.c (find_file_in_dir): Always try to shorten for DOS
4246 * init.c (ENABLE_CANONICAL_SYSTEM_HEADERS): Default enabled for DOS.
4248 2014-05-07 Richard Biener <rguenther@suse.de>
4250 * configure.ac: Always set need_64bit_hwint to yes.
4251 * configure: Regenerated.
4253 2014-04-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4255 * lex.c: Remove Solaris 9 reference.
4257 2014-02-24 Walter Lee <walt@tilera.com>
4259 * configure.ac: Change "tilepro" triplet to "tilepro*".
4260 * configure: Regenerate.
4262 2014-02-19 Jakub Jelinek <jakub@redhat.com>
4264 PR preprocessor/58844
4265 * macro.c (enter_macro_context): Only push
4266 macro_real_token_count (macro) tokens rather than
4267 macro->count tokens, regardless of
4268 CPP_OPTION (pfile, track-macro-expansion).
4270 2014-02-07 Jakub Jelinek <jakub@redhat.com>
4272 PR preprocessor/56824
4273 * line-map.c (get_combined_adhoc_loc, linemap_get_expansion_line,
4274 linemap_get_expansion_filename, linemap_location_in_system_header_p,
4275 linemap_location_from_macro_expansion_p,
4276 linemap_macro_loc_to_spelling_point, linemap_macro_loc_to_def_point,
4277 linemap_macro_loc_to_exp_point, linemap_expand_location): Fix
4279 (linemap_compare_locations): Look through adhoc locations for both
4282 2014-01-23 Dodji Seketeli <dodji@redhat.com>
4284 PR PR preprocessor/58580
4285 * include/line-map.h (linemap_get_file_highest_location): Declare
4287 * line-map.c (linemap_get_file_highest_location): Define it.
4289 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
4291 Update copyright years
4293 2013-12-09 Joseph Myers <joseph@codesourcery.com>
4295 PR preprocessor/55715
4296 * expr.c (num_binary_op): Implement subtraction directly rather
4297 than with negation and falling through into addition case.
4299 2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
4301 * lex.c (search_line_fast): Correct for little endian.
4303 2013-11-15 Joseph Myers <joseph@codesourcery.com>
4305 * ucnid.tab: Add C11 and C11NOSTART data.
4306 * makeucnid.c (digit): Rename enum value to N99.
4307 (C11, N11, all_languages): New enum values.
4308 (NUM_CODE_POINTS, MAX_CODE_POINT): New macros.
4309 (flags, decomp, combining_value): Use NUM_CODE_POINTS as array
4311 (decomp): Use unsigned int as element type.
4312 (all_decomp): New array.
4313 (read_ucnid): Handle C11 and C11NOSTART. Use MAX_CODE_POINT.
4314 (read_table): Use MAX_CODE_POINT. Store all decompositions in
4316 (read_derived): Use MAX_CODE_POINT.
4317 (write_table): Use NUM_CODE_POINTS. Print N99, C11 and N11
4318 flags. Print whole array variable declaration rather than just
4320 (char_id_valid, write_context_switch): New functions.
4321 (main): Call write_context_switch.
4322 * ucnid.h: Regenerate.
4323 * include/cpplib.h (struct cpp_options): Add c11_identifiers.
4324 * init.c (struct lang_flags): Add c11_identifiers.
4325 (cpp_set_lang): Set c11_identifiers option from selected language.
4326 * internal.h (struct normalize_state): Document "previous" as
4327 previous starter character.
4328 (NORMALIZE_STATE_UPDATE_IDNUM): Take character as argument.
4329 * charset.c (DIG): Rename enum value to N99.
4330 (C11, N11): New enum values.
4331 (struct ucnrange): Give name to struct. Use short for flags and
4332 unsigned int for end of range. Include ucnid.h for whole variable
4334 (ucn_valid_in_identifier): Allow for characters up to 0x10FFFF.
4335 Allow for C11 in determining valid characters and valid start
4336 characters. Use check_nfc for non-Hangul context-dependent
4337 checks. Only store starter characters in nst->previous.
4338 (_cpp_valid_ucn): Pass new argument to
4339 NORMALIZE_STATE_UPDATE_IDNUM.
4340 * lex.c (lex_identifier): Pass new argument to
4341 NORMALIZE_STATE_UPDATE_IDNUM. Call NORMALIZE_STATE_UPDATE_IDNUM
4342 after initial non-UCN part of identifier.
4343 (lex_number): Pass new argument to NORMALIZE_STATE_UPDATE_IDNUM.
4345 2013-11-15 Joseph Myers <joseph@codesourcery.com>
4347 * ucnid.tab: Mark C99 digits as [C99DIG].
4348 * makeucnid.c (read_ucnid): Handle [C99DIG].
4349 (read_table): Don't check for digit characters.
4350 * ucnid.h: Regenerate.
4352 2013-11-06 Tobias Burnus <burnus@net-b.de>
4354 * macro.c (_cpp_builtin_macro_text): Correct
4355 wording of two warnings.
4357 2013-11-05 Tobias Burnus <burnus@net-b.de>
4359 * include/cpplib.h (CPP_W_DATE_TIME): Added.
4360 (cpp_options): Add warn_date_time.
4361 * init.c (cpp_create_reader): Init it.
4362 * macro.c (_cpp_builtin_macro_text): Warn when
4363 __DATE__/__TIME__/__TIMESTAMP__ is used.
4365 2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net>
4367 Implement C++14 digit separators.
4368 * include/cpplib.h (cpp_options): Add digit_separators flag.
4369 * internal.h (DIGIT_SEP(c)): New macro.
4370 * expr.c (cpp_classify_number): Check improper placement of digit sep;
4371 (cpp_interpret_integer): Skip over digit separators.
4372 * init.c (lang_flags): Add digit_separators flag; (lang_defaults): Add
4373 digit separator flags per language; (cpp_set_lang): Set
4375 * lex.c (lex_number): Add digits separator to allowable characters for
4378 2013-10-15 David Malcolm <dmalcolm@redhat.com>
4380 * Makefile.in (PICFLAG): New.
4381 (ALL_CFLAGS): Add PICFLAG.
4382 (ALL_CXXFLAGS): Likewise.
4383 * configure.ac: Add --enable-host-shared, setting up new
4385 * configure: Regenerate.
4387 2013-08-07 Richard Earnshaw <rearnsha@arm.com>
4389 * configure.ac: Set need_64bit_hwint for all arm targets.
4390 * configure: Regenerated.
4392 2013-07-20 Jakub Jelinek <jakub@redhat.com>
4394 PR preprocessor/57620
4395 * lex.c (lex_raw_string): Undo phase1 and phase2 transformations
4396 between R" and final " rather than only in between R"del( and )del".
4398 2013-07-10 Jakub Jelinek <jakub@redhat.com>
4400 PR preprocessor/57824
4401 * lex.c (lex_raw_string): Allow reading new-lines if
4402 in_deferred_pragma or if parsing_args and there is still
4403 data in the current buffer.
4405 * include/cpplib.h (cpp_token_val_index): Change parameter type to
4407 * lex.c (cpp_token_val_index): Likewise.
4409 PR preprocessor/57757
4410 * lex.c (cpp_avoid_paste): Avoid pasting CPP_{,W,UTF8}STRING
4411 or CPP_STRING{16,32} with CPP_NAME or SPELL_LITERAL token that
4414 2013-06-28 Ed Smith-Rowland <3dw4rd@verizon.net>
4416 * lex.c (lex_raw_string(), lex_string()): Constrain suffixes treated
4417 as concatenated literal and macro to just the patterns found in
4418 inttypes.h; (is_macro()): New.
4420 2013-06-24 Dehao Chen <dehao@google.com>
4422 * files.c (_cpp_stack_include): Fix the highest_location when header
4423 file is guarded by #ifndef and is included twice.
4425 2013-04-28 Jakub Jelinek <jakub@redhat.com>
4427 N3472 binary constants
4428 * include/cpplib.h (struct cpp_options): Fix a typo in user_literals
4429 field comment. Add binary_constants field.
4430 * init.c (struct lang_flags): Add binary_constants field.
4431 (lang_defaults): Add bin_cst column to the table.
4432 (cpp_set_lang): Initialize CPP_OPTION (pfile, binary_constants).
4433 * expr.c (cpp_classify_number): Talk about C++11 instead of C++0x
4434 in diagnostics. Accept binary constants if
4435 CPP_OPTION (pfile, binary_constants) even when pedantic. Adjust
4438 2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
4440 * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
4441 * init.c (lang_defaults): Add defaults for the latter.
4442 (cpp_init_builtins): Define __cplusplus as 201300L for the latter.
4443 * lex.c (_cpp_lex_direct): Update.
4445 2013-04-03 Sebastian Huber <sebastian.huber@embedded-brains.de>
4448 * configure.ac: Require 64-bit int for arm*-*-rtems*.
4449 * configure: Regenerate.
4451 2013-03-06 Jakub Jelinek <jakub@redhat.com>
4454 * internal.h (struct cpp_buffer): Add to_free field.
4455 (_cpp_pop_file_buffer): Add third argument.
4456 * files.c (_cpp_stack_file): Set buffer->to_free.
4457 (_cpp_pop_file_buffer): Add to_free argument. Free to_free
4458 if non-NULL, and if equal to file->buffer_start, also clear
4459 file->buffer{,_start,_valid}.
4460 * directives.c (_cpp_pop_buffer): Pass buffer->to_free
4461 to _cpp_pop_file_buffer.
4463 2013-03-01 Jakub Jelinek <jakub@redhat.com>
4466 * files.c (_cpp_save_file_entries): Free result at the end.
4467 * pch.c (cpp_string_free): New function.
4468 (cpp_save_state): Use it in htab_create call.
4469 (cpp_write_pch_deps): Free ss->defs. Destroy ss->definedhash.
4471 2013-02-28 Jakub Jelinek <jakub@redhat.com>
4473 * files.c (_cpp_find_file): If returning early, before storing
4474 something to *hash_slot and *hash_slot is NULL, call htab_clear_slot
4475 on it. Access *hash_slot using void * type rather than
4476 struct file_hash_entry * to avoid aliasing issues.
4478 * configure.ac: Don't define ENABLE_CHECKING whenever
4479 --enable-checking is seen, instead use similar --enable-checking=yes
4480 vs. --enable-checking=release default as gcc/ subdir has and
4481 define ENABLE_CHECKING if ENABLE_CHECKING is defined in gcc/.
4482 Define ENABLE_VALGRIND_CHECKING if requested.
4483 * lex.c (new_buff): If ENABLE_VALGRIND_CHECKING, put _cpp_buff
4484 struct first in the allocated buffer and result->base after it.
4485 (_cpp_free_buff): If ENABLE_VALGRIND_CHECKING, free buff itself
4486 instead of buff->base.
4487 * config.in: Regenerated.
4488 * configure: Regenerated.
4490 2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net>
4493 * lex.c (lex_raw_string): Allow string literal with suffix
4494 beginning with 's' to be parsed as a C++11 user-defined literal.
4496 2013-01-14 Richard Sandiford <rdsandiford@googlemail.com>
4498 Update copyright years.
4500 2013-01-04 Paolo Carlini <paolo.carlini@oracle.com>
4502 PR c++/54526 (again)
4503 * lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.
4505 2013-01-03 Marc Glisse <marc.glisse@inria.fr>
4508 * line-map.c (get_combined_adhoc_loc): Cast from extern "C" type.
4509 (new_linemap): Likewise.
4510 (linemap_enter_macro): Likewise.
4512 2012-12-03 Jakub Jelinek <jakub@redhat.com>
4516 * files.c (read_file_guts): Allocate extra 16 bytes instead of
4517 1 byte at the end of buf. Pass size + 16 instead of size
4518 to _cpp_convert_input.
4519 * charset.c (_cpp_convert_input): Reallocate if there aren't
4520 at least 16 bytes beyond to.len in the buffer. Clear 16 bytes
4521 at to.text + to.len.
4523 2012-11-21 Steve Ellcey <sellcey@mips.com>
4526 * files.c (pch_open_file): Fix check for implicit_preinclude.
4528 2012-11-16 Simon Baldwin <simonb@google.com>
4530 * include/cpplib.h (struct cpp_options): Add canonical_system_headers.
4531 * files.c (find_file_in_dir): Call maybe_shorter_path() only if
4532 canonical_system_headers is set.
4533 * init.c (cpp_create_reader): Initialize canonical_system_headers.
4534 * configure.ac: Add new --enable-canonical-system-headers.
4535 * configure: Regenerate.
4536 * config.in: Regenerate.
4538 2012-11-09 Ed Smith-Rowland <3dw4rd@verizon.net>
4541 * include/cpplib.h (cpp_interpret_float_suffix): Add cpp_reader* arg.
4542 (cpp_interpret_int_suffix): Add cpp_reader* arg.
4543 * init.c (cpp_create_reader): Iitialize new flags.
4544 * expr.c (interpret_float_suffix): Use new flags.
4545 (cpp_interpret_float_suffix): Add cpp_reader* arg.
4546 (interpret_int_suffix): Use new flags.
4547 (cpp_interpret_int_suffix): Add cpp_reader* arg.
4548 (cpp_classify_number): Adjust calls to interpret_x_suffix.
4550 2012-10-23 Ian Bolton <ian.bolton@arm.com>
4551 Jim MacArthur <jim.macarthur@arm.com>
4552 Marcus Shawcroft <marcus.shawcroft@arm.com>
4553 Nigel Stephens <nigel.stephens@arm.com>
4554 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
4555 Richard Earnshaw <rearnsha@arm.com>
4556 Sofiane Naci <sofiane.naci@arm.com>
4557 Stephen Thomas <stephen.thomas@arm.com>
4558 Tejas Belagod <tejas.belagod@arm.com>
4559 Yufeng Zhang <yufeng.zhang@arm.com>
4561 * configure.ac: Enable AArch64.
4562 * configure: Regenerate.
4564 2012-10-23 Joseph Myers <joseph@codesourcery.com>
4566 * files.c (struct _cpp_file): Add implicit_preinclude.
4567 (pch_open_file): Allow a previously opened implicitly included
4569 (_cpp_find_file): Add implicit_preinclude argument. Free file and
4570 do not call open_file_failed if implicit_preinclude. Store
4571 implicit_preinclude value.
4572 (_cpp_stack_include, _cpp_fake_include, _cpp_compare_file_date):
4573 Update calls to _cpp_find_file.
4574 (_cpp_stack_include): Handle IT_DEFAULT.
4575 (cpp_push_default_include): New.
4576 * include/cpplib.h (cpp_push_default_include): Declare.
4577 * init.c (cpp_read_main_file): Update call to _cpp_find_file.
4578 * internal.h (enum include_type): Add IT_DEFAULT.
4579 (_cpp_find_file): Update prototype.
4581 2012-10-15 Tobias Burnus <burnus@net-b.de>
4583 * files.c (read_file_guts, _cpp_save_file_entries): Free memory
4585 * lex.c (warn_about_normalization): Ditto.
4586 * mkdeps.c (deps_save): Ditto.
4587 * pch.c (cpp_valid_state): Ditto.
4589 2012-10-04 Florian Weimer <fweimer@redhat.com>
4591 * directives.c (do_pragma_warning_or_error): New.
4592 (do_pragma_warning): New.
4593 (do_pragma_error): New.
4594 (_cpp_init_internal_pragmas): Register new pragmas.
4596 2012-09-25 Dehao Chen <dehao@google.com>
4599 * line-map.c (location_adhoc_data_hash): Fix the hash function.
4601 2012-09-25 Dehao Chen <dehao@google.com>
4604 * include/line-map.h (location_adhoc_data): Move location_adhoc_data
4606 (location_adhoc_data_map): Likewise.
4607 (line_maps): Likewise.
4608 (rebuild_location_adhoc_htab): New Function.
4609 * line-map.c (+rebuild_location_adhoc_htab): new Funcion.
4610 (get_combined_adhoc_loc): Move location_adhoc_data into GC.
4611 (location_adhoc_data_fini): Likewise.
4612 (linemap_init): Likewise.
4613 (location_adhoc_data_init): Remove Function.
4615 2012-09-19 Dehao Chen <dehao@google.com>
4617 * include/line-map.h (MAX_SOURCE_LOCATION): New value.
4618 (location_adhoc_data_fini): New.
4619 (get_combined_adhoc_loc): New.
4620 (get_data_from_adhoc_loc): New.
4621 (get_location_from_adhoc_loc): New.
4622 (location_adhoc_data_map): New.
4623 (COMBINE_LOCATION_DATA): New.
4624 (IS_ADHOC_LOC): New.
4625 (expanded_location): New field.
4626 (line_maps): New field.
4627 * line-map.c (location_adhoc_data): New.
4628 (location_adhoc_data_hash): New.
4629 (location_adhoc_data_eq): New.
4630 (location_adhoc_data_update): New.
4631 (get_combined_adhoc_loc): New.
4632 (get_data_from_adhoc_loc): New.
4633 (get_location_from_adhoc_loc): New.
4634 (location_adhoc_data_init): New.
4635 (location_adhoc_data_fini): New.
4636 (linemap_init): Initialize location_adhoc_data.
4637 (linemap_lookup): Change to use new location.
4638 (linemap_ordinary_map_lookup): Likewise.
4639 (linemap_macro_map_lookup): Likewise.
4640 (linemap_macro_map_loc_to_def_point): Likewise.
4641 (linemap_macro_map_loc_unwind_toward_spel): Likewise.
4642 (linemap_get_expansion_line): Likewise.
4643 (linemap_get_expansion_filename): Likewise.
4644 (linemap_location_in_system_header_p): Likewise.
4645 (linemap_location_from_macro_expansion_p): Likewise.
4646 (linemap_macro_loc_to_spelling_point): Likewise.
4647 (linemap_macro_loc_to_def_point): Likewise.
4648 (linemap_macro_loc_to_exp_point): Likewise.
4649 (linemap_resolve_location): Likewise.
4650 (linemap_unwind_toward_expansion): Likewise.
4651 (linemap_unwind_to_first_non_reserved_loc): Likewise.
4652 (linemap_expand_location): Likewise.
4653 (linemap_dump_location): Likewise.
4654 (linemap_line_start): Likewise.
4656 2012-05-25 Dodji Seketeli <dodji@redhat.com>
4658 PR preprocessor/53469
4659 * directives.c (do_pragma): Use the virtual location for the
4660 pragma token, instead of its spelling location.
4662 2012-08-14 Diego Novillo <dnovillo@google.com>
4664 Merge from cxx-conversion branch. Configury.
4666 * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX.
4667 * configure.ac: Likewise.
4668 * configure: Regenerate.
4670 2012-08-14 Lawrence Crowl <crowl@google.com>
4672 Merge from cxx-conversion branch. New C++ hash table.
4674 * include/symtab.h (typedef struct ht hash_table): Change the typedef
4675 name to cpp_hash_table. Update all users of the typedef.
4677 2012-07-30 Laurynas Biveinis <laurynas.biveinis@gmail.com>
4679 * include/line-map.h (line_map_macro): Use the "atomic" GTY option
4680 for the macro_locations field.
4682 2011-06-19 Uros Bizjak <ubizjak@gmail.com>
4684 * lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and
4685 __builtin_ia32_pcmpestri128 instead of asm.
4687 2012-06-04 Dimitrios Apostolou <jimis@gmx.net>
4689 * line-map.c (linemap_enter_macro): Don't zero max_column_hint in
4690 every macro. This improves performance by reducing the number of
4691 reallocations when track-macro-expansion is on.
4693 2012-06-04 Dodji Seketeli <dodji@redhat.com>
4695 PR preprocessor/53463
4696 * line-map.c (linemap_location_in_system_header_p): For built-in
4697 macro tokens, check the first expansion point location that is not
4698 for a token coming from a built-in macro.
4700 2012-05-29 Joseph Myers <joseph@codesourcery.com>
4702 * directives.c: Fix typos.
4703 * include/line-map.h: Fix typos.
4704 * line-map.c: Fix typos.
4705 * macro.c: Fix typos.
4707 2012-05-25 Dodji Seketeli <dodji@redhat.com>
4710 * lex.c (search_line_fast): Avoid unused local typedefs to simulate
4713 2012-05-29 Dodji Seketeli <dodji@redhat.com>
4715 PR preprocessor/53229
4716 * internal.h (cpp_reader::set_invocation_location): Remove.
4717 (cpp_reader::about_to_expand_macro_p): New member flag.
4718 * directives.c (do_pragma): Remove Kludge as
4719 pfile->set_invocation_location is no more.
4720 * macro.c (cpp_get_token_1): Do away with the use of
4721 cpp_reader::set_invocation_location. Just collect the macro
4722 expansion point when we are about to expand the top-most macro.
4723 Do not override cpp_reader::about_to_expand_macro_p.
4724 This fixes gcc.dg/cpp/paste12.c by making get_token_no_padding
4725 properly handle locations of expansion points.
4726 (cpp_get_token_with_location): Adjust, as
4727 cpp_reader::set_invocation_location is no more.
4728 (paste_tokens): Take a virtual location parameter for
4729 the LHS of the pasting operator. Use it in diagnostics. Update
4731 (paste_all_tokens): Tighten the assert. Propagate the location of
4732 the expansion point when no virtual locations are available.
4733 Pass the virtual location to paste_tokens.
4734 (in_macro_expansion_p): New static function.
4735 (enter_macro_context): Set the cpp_reader::about_to_expand_macro_p
4736 flag until we really start expanding the macro.
4738 2012-05-16 Dodji Seketeli <dodji@redhat.com>
4740 PR preprocessor/7263
4741 * include/cpplib.h (cpp_classify_number): Take a location
4743 * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic
4744 macros that take a location parameter.
4745 (cpp_classify_number): Take a (virtual) location parameter. Use
4746 it for diagnostics. Adjust comments.
4747 (eval_token): Take a location parameter. Pass it to
4748 cpp_classify_number and to diagnostic routines.
4749 (_cpp_parse_expr): Use virtual locations of tokens when parsing
4750 expressions. Pass a virtual location to eval_token and to
4751 diagnostic routines.
4753 2012-05-10 Tristan Gingold <gingold@adacore.com>
4755 * expr.c (interpret_float_suffix): Add a guard.
4757 2012-05-02 Dodji Seketeli <dodji@redhat.com>
4759 Properly initialize cpp_context in destringize_and_run
4760 * directives.c (destringize_and_run): Properly initialize the new
4762 * macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
4763 the initial base context, which has the same life time as the
4764 current instance of cpp_file.
4766 2012-04-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
4767 Dodji Seketeli <dodji@seketeli.org>
4770 * libcpp/files.c (maybe_shorter_path): New.
4771 (find_file_in_dir): Use it.
4773 2012-04-30 Dodji Seketeli <dodji@redhat.com>
4775 Switch -ftrack-macro-expansion=2 on by default.
4776 * init.c (cpp_create_reader): Switch -ftrack-macro-expansion=2 on
4777 by default. Add comments.
4779 Strip "<built-in>" loc from displayed expansion context
4780 * include/line-map.h (linemap_unwind_toward_expansion): Fix typo
4782 (linemap_unwind_to_first_non_reserved_loc): Declare new function.
4783 * line-map.c (linemap_unwind_to_first_non_reserved_loc): Define
4786 Fix expansion point loc for macro-like tokens
4787 * macro.c (macro_of_context): New static function.
4788 (_cpp_push_token_context, push_extended_tokens_context): If the
4789 macro argument is NULL, it means we are continuing the expansion
4790 of the current macro, if any. Update comments.
4791 (_cpp_pop_context): Re-enable expansion of the macro only when we
4792 are really out of the context of the current expansion.
4794 Fix token pasting with -ftrack-macro-expansion
4795 * macro.c (paste_all_tokens): Put the token resulting from pasting
4796 into an extended token context with -ftrack-macro-location is in
4799 Fix cpp_sys_macro_p with -ftrack-macro-expansion
4800 * macro.c (cpp_sys_macro_p): Support -ftrack-macro-expansion.
4802 2012-04-29 Dodji Seketeli <dodji@redhat.com>
4804 * lex.c (lex_raw_string): Change C++ style comments into C style
4806 (lex_string): Likewise.
4808 2012-04-27 Ollie Wild <aaw@google.com>
4810 * include/cpplib.h (struct cpp_options): Add new field,
4811 warn_literal_suffix.
4812 (CPP_W_LITERAL_SUFFIX): New enum.
4813 * init.c (cpp_create_reader): Default initialization of
4814 warn_literal_suffix.
4815 * lex.c (lex_raw_string): Treat user-defined literals which don't
4816 begin with '_' as separate tokens and produce a warning.
4817 (lex_string): Ditto.
4819 2012-04-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
4821 * line-map.c (linemap_resolve_location): Synchronize comments with
4822 those in line-map.h.
4823 * include/line-map.h (linemap_resolve_location): Fix spelling in
4826 2012-03-22 Richard Earnshaw <rearnsha@arm.com>
4828 * lex.c (search_line_fast): Provide Neon-optimized version for ARM.
4830 2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4832 * lex.c: Remove Solaris 8 reference.
4834 2012-02-14 Walter Lee <walt@tilera.com>
4836 * configure.ac: Require 64-bit hwint for tilegx and tilepro.
4837 * configure: Regenerate.
4839 2012-01-09 Richard Guenther <rguenther@suse.de>
4841 * macro.c (_cpp_builtin_macro_text): Remove unused variable map.
4843 2012-01-09 Gary Funck <gary@intrepid.com>
4845 PR preprocessor/33919
4846 * files.c (_cpp_get_file_name): New. Implement file name
4848 * internal.h (_cpp_get_file_name): New prototype.
4849 * macro.c (_cpp_builtin_macro_text): Call _cpp_get_file_name()
4850 to use pfile->main_file in lieu of traversing INCLUDED_FROM chain.
4852 2012-01-03 Olivier Hainque <hainque@adacore.com>
4854 * system.h: Prior to #define, #undef fopen and freopen unconditionally.
4856 2011-12-20 Joseph Myers <joseph@codesourcery.com>
4858 * include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11.
4859 (CLK_STDC1X): Change to CLK_STDC11.
4860 * init.c (lang_defaults): Update comments.
4861 (cpp_init_builtins): Update language tests. Use 201112L for C11
4864 2011-12-20 Andreas Schwab <schwab@linux-m68k.org>
4866 * configure: Regenerate.
4868 2011-12-19 Andreas Schwab <schwab@linux-m68k.org>
4870 * configure: Regenerate.
4872 2011-12-07 Jakub Jelinek <jakub@redhat.com>
4875 * internal.h (_cpp_init_lexer): New prototype.
4876 * init.c (init_library): Call it.
4877 * lex.c (init_vectorized_lexer): Remove constructor attribute,
4879 (HAVE_init_vectorized_lexer): Define.
4880 (_cpp_init_lexer): New function.
4882 2011-12-03 Dodji Seketeli <dodji@redhat.com>
4884 * macro.c (tokens_buff_remove_last_token)
4885 (tokens_buff_put_token_to): Add an 'inline' function specifier to
4888 2011-11-22 Diego Novillo <dnovillo@google.com>
4890 * include/line-map.h (linemap_dump): Declare.
4891 (line_table_dump): Declare.
4892 * line-map.c (linemap_dump): New.
4893 (line_table_dump): New.
4895 2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net>
4898 * expr.c (cpp_userdef_char_remove_type): Fix typo.
4900 2011-11-03 Michael Matz <matz@suse.de>
4903 * configure.ac: Check for -fno-exceptions -fno-rtti.
4904 * configure: Regenerate.
4905 * Makefile.in (NOEXCEPTION_FLAGS): New flag.
4906 (ALL_CXXFLAGS): Use it.
4908 2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
4910 * internal.h (uxstrdup, ustrchr): Return const unsigned char *.
4912 2011-11-02 Jason Merrill <jason@redhat.com>
4915 * configure.ac: Add -Wno-narrowing to warning options.
4917 2011-10-31 Jason Merrill <jason@redhat.com>
4920 * init.c (cpp_init_builtins): Set __cplusplus for C++11.
4923 * include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11,
4924 CLK_GNUCXX0X to CLK_GNUCXX11.
4926 2011-10-26 Ed Smith-Rowland <3dw4rd@verizon.net>
4928 Implement C++11 user-defined literals.
4929 * expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix,
4930 cpp_userdef_string_remove_type, cpp_userdef_string_add_type,
4931 cpp_userdef_char_remove_type, cpp_userdef_char_add_type,
4932 cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New.
4933 (cpp_classify_number): Classify unrecognized tokens as user-defined
4935 * include/cpplib.h: Add new tokens for user-defined literals.
4936 * init.c: Add new preprocessor flag (cxx11).
4937 * lex.c: (lex_string, lex_raw_string): Handle user-defined literals
4938 including concatenation and promotion with suffixes.
4940 2011-10-24 Dodji Seketeli <dodji@redhat.com>
4942 * line-map.c (linemap_macro_map_lookup): Fix logic.
4944 2011-10-24 Dodji Seketeli <dodji@redhat.com>
4946 * include/line-map.h (linemap_expand_location): Take a line table
4947 parameter. Update comment.
4948 (linemap_resolve_location): Update comment.
4949 (linemap_expand_location_full): Remove.
4950 * line-map.c (linemap_resolve_location): Handle reserved
4951 locations; return a NULL map in those cases.
4952 (linemap_expand_location): If location is reserved, return a
4953 zeroed expanded location. Update comment. Take a line table to
4954 assert that the function takes non-virtual locations only.
4955 (linemap_expand_location_full): remove.
4956 (linemap_dump_location): Handle the fact that
4957 linemap_resolve_location can return NULL line maps when the
4958 location resolves to a reserved location.
4960 * line-map.c (linemap_macro_map_lookup): Fix logic.
4962 2011-10-22 Dodji Seketeli <dodji@redhat.com>
4965 * include/internal.h (_cpp_remaining_tokens_num_in_context): Take the
4966 context to act upon.
4967 * lex.c (_cpp_remaining_tokens_num_in_context): Likewise. Update
4969 (cpp_token_from_context_at): Likewise.
4970 (cpp_peek_token): Use the context to peek tokens from.
4972 2011-10-20 Dodji Seketeli <dodji@redhat.com>
4975 * lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of
4978 2011-10-18 Dodji Seketeli <dodji@redhat.com>
4981 * include/line-map.h (struct linemap_stats): Change the type of
4982 the members from size_t to long.
4983 * macro.c (macro_arg_token_iter_init): Unconditionally initialize
4986 2011-10-17 Dodji Seketeli <dodji@redhat.com>
4988 * line-map.c (linemap_macro_map_loc_to_exp_point): Avoid setting a
4989 variable without using it if ENABLE_CHECKING is not defined. Mark
4990 the LOCATION parameter as being unused.
4992 2011-10-15 Tom Tromey <tromey@redhat.com>
4993 Dodji Seketeli <dodji@redhat.com>
4995 * include/line-map.h (struct line_maps::alloced_size_for_request):
4997 * line-map.c (new_linemap): Use set->alloced_size_for_request to
4998 get the actual allocated size of line maps.
5000 2011-10-15 Tom Tromey <tromey@redhat.com>
5001 Dodji Seketeli <dodji@redhat.com>
5003 * line-map.h (struct linemap_stats): Declare new struct.
5004 (linemap_get_statistics): Declare ...
5005 * line-map.c (linemap_get_statistics): ... new function.
5006 * macro.c (num_expanded_macros_counter, num_macro_tokens_counter):
5007 Declare new counters.
5008 (enter_macro_context, replace_args): Update
5009 num_macro_tokens_counter.
5010 (cpp_get_token_1): Update num_expanded_macros_counter.
5012 2011-10-15 Tom Tromey <tromey@redhat.com>
5013 Dodji Seketeli <dodji@redhat.com>
5015 * include/cpplib.h (struct cpp_options)<debug>: New struct member.
5016 * include/line-map.h (linemap_dump_location): Declare ...
5017 * line-map.c (linemap_dump_location): ... new function.
5019 2011-10-15 Tom Tromey <tromey@redhat.com>
5020 Dodji Seketeli <dodji@redhat.com>
5022 * include/cpplib.h (struct cpp_options)<track_macro_expansion>:
5024 * internal.h (struct macro_context): New struct.
5025 (enum context_tokens_kind): New enum.
5026 (struct cpp_context)<tokens_kind>: New member of type enum
5027 context_tokens_kind.
5028 (struct cpp_context)<macro>: Remove this. Replace it with an enum
5029 of macro and macro_context.
5030 (struct cpp_context)<direct_p>: Remove.
5031 (_cpp_remaining_tokens_num_in_context): Declare new function.
5032 * directives.c (destringize_and_run): Adjust.
5033 * lex.c (_cpp_remaining_tokens_num_in_context)
5034 (_cpp_token_from_context_at): Define new functions
5035 (cpp_peek_token): Use them.
5036 * init.c (cpp_create_reader): Initialize the base context to zero.
5037 (_cpp_token_from_context_at): Define new static function.
5038 (cpp_peek_token): Use new _cpp_remaining_tokens_num_in_context and
5039 _cpp_token_from_context_at.
5040 * macro.c (struct macro_arg)<virt_locs, expanded_virt_locs>: New
5042 (enum macro_arg_token_kind): New enum.
5043 (struct macro_arg_token_iter): New struct.
5044 (maybe_adjust_loc_for_trad_cpp, push_extended_tokens_context)
5045 (alloc_expanded_arg_mem, ensure_expanded_arg_room)
5046 (delete_macro_args, set_arg_token, get_arg_token_location)
5047 (arg_token_ptr_at, macro_arg_token_iter_init)
5048 (macro_arg_token_iter_get_token)
5049 (macro_arg_token_iter_get_location, macro_arg_token_iter_forward)
5050 (expanded_token_index, tokens_buff_new, tokens_buff_count)
5051 (tokens_buff_last_token_ptr, tokens_buff_put_token_to)
5052 (tokens_buff_add_token, tokens_buff_remove_last_token)
5053 (reached_end_of_context, consume_next_token_from_context): New
5055 (cpp_get_token_1): New static function. Split and extended from
5056 cpp_get_token. Use reached_end_of_context and
5057 consume_next_token_from_context. Unify its return point. Move
5058 the location tweaking from cpp_get_token_with_location in here.
5059 (cpp_get_token): Use cpp_get_token_1
5060 (stringify_arg): Use the new arg_token_at.
5061 (paste_all_tokens): Support tokens coming from extended tokens
5063 (collect_args): Return the number of collected arguments, by
5064 parameter. Store virtual locations of tokens that constitute the
5066 (funlike_invocation_p): Return the number of collected arguments,
5068 (enter_macro_context): Add a parameter for macro expansion point.
5069 Pass it to replace_args and to the "used" cpp callback. Get the
5070 number of function-like macro arguments from funlike_invocation_p,
5071 pass it to the new delete_macro_args to free the memory used by
5072 macro args. When -ftrack-macro-expansion is in effect, for macros
5073 that have no arguments, create a macro map for the macro expansion
5074 and use it to allocate proper virtual locations for tokens
5075 resulting from the expansion. Push an extended tokens context
5076 containing the tokens resulting from macro expansion and their
5078 (replace_args): Rename the different variables named 'count' into
5079 variables with more meaningful names. Create a macro map;
5080 allocate virtual locations of tokens resulting from this
5081 expansion. Use macro_arg_token_iter to iterate over tokens of a
5082 given macro. Handle the case of the argument of
5083 -ftrack-macro-expansion being < 2. Don't free macro arguments
5084 memory resulting from expand_arg here, as these are freed by the
5085 caller of replace_arg using delete_macro_args now. Push extended
5087 (next_context, push_ptoken_context, _cpp_push_token_context)
5088 (_cpp_push_text_context): Properly initialize the context.
5089 (expand_arg): Use the new alloc_expanded_arg_mem,
5090 push_extended_tokens_context, cpp_get_token_1, and set_arg_token.
5091 (_cpp_pop_context): Really free the memory held by the context.
5092 Handle freeing memory used by extended tokens contexts.
5093 (cpp_get_token_with_location): Use cpp_get_token_1.
5094 (cpp_sys_macro_p): Adjust.
5095 (_cpp_backup_tokens): Support the new kinds of token contexts.
5096 * traditional.c (recursive_macro): Adjust.
5098 2011-10-15 Tom Tromey <tromey@redhat>
5099 Dodji Seketeli <dodji@redhat.com>
5101 * include/line-map.h (enum lc_reason)<LC_ENTER_MACRO>: New enum
5103 (MAX_SOURCE_LOCATION): New constant.
5104 (struct line_map_ordinary, struct line_map_macro): New structs.
5105 (struct line_map): Turn this into a union of the two above. Add
5107 (struct maps_info): New struct.
5108 (struct line_maps)<info_ordinary, info_macro>: Two new fields.
5109 These now carry the map information that was previously scattered
5110 in struct line_maps.
5111 (struct map_info::allocated): Fix comment.
5112 (MAP_START_LOCATION, ORDINARY_MAP_FILE_NAME)
5113 (ORDINARY_MAP_STARTING_LINE_NUMBER)
5114 (ORDINARY_MAP_INCLUDER_FILE_INDEX)
5115 (ORDINARY_MAP_IN_SYSTEM_HEADER_P)
5116 (ORDINARY_MAP_NUMBER_OF_COLUMN_BITS, MACRO_MAP_MACRO)
5117 (MACRO_MAP_NUM_MACRO_TOKENS MACRO_MAP_LOCATIONS)
5118 (MACRO_MAP_EXPANSION_POINT_LOCATION)
5119 (LOCATION_POSSIBLY_IN_MACRO_MAP_P, LINEMAPS_MAP_INFO)
5120 (LINEMAPS_MAPS, LINEMAPS_ALLOCATE, LINEMAPS_USED, LINEMAPS_CACHE)
5121 (LINEMAPS_LAST_MAP, LINEMAPS_LAST_ALLOCATED_MAP)
5122 (LINEMAPS_ORDINARY_MAPS, LINEMAPS_ORDINARY_ALLOCATED)
5123 (LINEMAPS_ORDINARY_USED, LINEMAPS_ORDINARY_CACHE)
5124 (LINEMAPS_LAST_ORDINARY_MAP, LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP)
5125 (LINEMAPS_MACRO_MAPS, LINEMAPS_MACRO_ALLOCATED)
5126 (LINEMAPS_MACRO_USED, LINEMAPS_MACRO_CACHE)
5127 (LINEMAPS_LAST_MACRO_MAP, LINEMAPS_LAST_ALLOCATED_MACRO_MAP)
5128 (LINEMAPS_MAP_AT, LINEMAPS_ORDINARY_MAP_AT)
5129 (LINEMAPS_MACRO_MAP_AT): New accessors for ordinary and macro map
5131 (linemap_check_ordinary, linemap_assert)
5132 (linemap_location_before_p): New macros.
5133 (linemap_position_for_line_and_column)
5134 (linemap_tracks_macro_expansion_locs_p, linemap_add_macro_token)
5135 (linemap_macro_expansion_map_p)
5136 (linemap_macro_map_loc_to_def_point)
5137 (linemap_macro_map_loc_unwind_once)
5138 (linemap_macro_map_loc_to_exp_point, linemap_step_out_once)
5139 (linemap_get_source_line linemap_get_source_column)
5140 (linemap_map_get_macro_name, linemap_get_file_path)
5141 (linemap_location_in_system_header_p)
5142 (linemap_location_from_macro_expansion_p): Declare new functions.
5143 (SOURCE_LINE, SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION)
5144 (LINEMAP_FILE, LINEMAP_LINE, LINEMAP_SYSP): Assert that this
5145 accessors act on ordinary maps only.
5146 (INCLUDED_FROM): Return NULL for main files; use the new
5148 (LINEMAP_POSITION_FOR_COLUMN): Use the new accessors.
5149 (struct expanded_location): Move here from gcc/input.h
5150 (linemap_resolve_location, linemap_expand_location)
5151 (linemap_expand_location_full): Declare new functions.
5152 * line-map.c: Include cpplib.h, internal.h
5153 (linemap_enter_macro, linemap_add_macro_token)
5154 (linemap_get_expansion_line, linemap_get_expansion_filename): New
5155 functions that are private to libcpp.
5156 (linemap_assert): New macro.
5157 (linemap_macro_loc_to_exp_point, linemap_macro_loc_to_exp_point)
5158 (linemap_macro_loc_unwind, linemap_macro_map_loc_to_def_point)
5159 (linemap_macro_map_loc_unwind_toward_spelling)
5160 (linemap_macro_map_loc_to_exp_point)
5161 (first_map_in_common_1, first_map_in_common): New static
5163 (new_linemap): Define new static functions. Extracted and
5165 (linemap_add): ... here. Use linemap_assert in lieu of abort
5167 (linemap_tracks_macro_expansion_locs_p)
5168 (linemap_add_macro_token, linemap_macro_expansion_map_p)
5169 (linemap_check_ordinary, linemap_macro_map_loc_to_exp_point)
5170 (linemap_macro_map_loc_to_def_point)
5171 (linemap_macro_map_loc_unwind_once)
5172 (linemap_step_out_once, linemap_map_get_index)
5173 (linemap_get_source_line,linemap_get_source_column)
5174 (linemap_get_file_path, linemap_map_get_macro_name)
5175 (linemap_location_in_system_header_p)
5176 (linemap_location_originated_from_system_header_p)
5177 (linemap_location_from_macro_expansion_p)
5178 (linemap_tracks_macro_expansion_locs_p)
5179 (linemap_resolve_location, linemap_expand_location)
5180 (linemap_expand_location_full)
5181 (linemap_tracks_macro_expansion_locs_p)
5182 (linemap_position_for_line_and_column, linemap_compare_locations):
5183 Define new public functions.
5184 (linemap_init): Initialize ordinary and macro maps information in
5186 (linemap_check_files_exited): Use the new accessors.
5187 (linemap_free): Remove this dead code.
5188 (linemap_line_start): Assert this uses an ordinary map. Adjust to
5189 use the new ordinary map accessors and data structures. Don't
5190 overflow past the lowest possible macro token's location.
5191 (linemap_position_for_column): Assert the ordinary maps of the map
5192 set are really ordinary. Use ordinary map accessors.
5193 (linemap_lookup): Keep the same logic but generalize to allow
5194 lookup of both ordinary and macro maps. Do not crash when called
5195 with an empty line table.
5196 * directives-only.c (_cpp_preprocess_dir_only): Adjust to use the
5197 new API of line-map.h.
5198 * directives.c (start_directive, do_line, do_linemarker)
5199 (do_linemarker): Likewise.
5200 * files.c (_cpp_find_file, _cpp_stack_include, open_file_failed)
5201 (make_cpp_dir, cpp_make_system_header): Likewise.
5202 * init.c (cpp_read_main_file): Likewise.
5203 * internal.h (CPP_INCREMENT_LINE): Likewise.
5204 (linemap_enter_macro, linemap_add_macro_token)
5205 (linemap_get_expansion_line, linemap_get_expansion_filename): New
5206 functions private to libcpp.
5207 * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment)
5208 (skip_line_comment, skip_whitespace, lex_raw_string)
5209 (_cpp_lex_direct): Likewise.
5210 * macro.c (_cpp_builtin_macro_text): Likewise.
5211 (_cpp_aligned_alloc): Initialize the new name member of the macro.
5212 * traditional.c (copy_comment, _cpp_scan_out_logical_line):
5214 * errors.c (cpp_diagnostic): Adjust to new linemap API.
5216 2011-08-28 Dodji Seketeli <dodji@redhat.com>
5218 * line-map.c (linemap_add): Assert that reason must not be
5219 LC_RENAME when called for the first time on a "main input file".
5221 2011-08-22 Gabriel Charette <gchare@google.com>
5223 * init.c (cpp_create_reader): Inititalize forced_token_location_p.
5224 * internal.h (struct cpp_reader): Add field forced_token_location_p.
5225 * lex.c (_cpp_lex_direct): Use forced_token_location_p.
5226 (cpp_force_token_locations): New.
5227 (cpp_stop_forcing_token_locations): New.
5229 2011-08-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5232 * init.c (cpp_init_builtins): Define __cplusplus 19971L.
5234 2011-08-18 Joseph Myers <joseph@codesourcery.com>
5236 * include/cpplib.h (struct cpp_options): Fix typo.
5238 2011-08-18 Joseph Myers <joseph@codesourcery.com>
5240 * include/cpplib.h (struct cpp_options): Add rliterals.
5241 * init.c (struct lang_flags, lang_defaults): Add rliterals.
5242 (cpp_set_lang): Set rliterals option.
5243 (cpp_init_builtins): Define __STDC_UTF_16__ and __STDC_UTF_32__.
5244 * lex.c (_cpp_lex_direct): Only accept raw strings if rliterals.
5246 2011-08-15 Gabriel Charette <gchare@google.com>
5248 * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Remove.
5249 Update all users to use linemap_position_for_column instead.
5251 2011-07-28 Gabriel Charette <gchare@google.com>
5253 * include/line-map.h (struct line_maps):
5254 Remove unused field last_listed. Update all users.
5256 2011-07-28 H.J. Lu <hongjiu.lu@intel.com>
5258 * configure.ac: Set need_64bit_hwint to yes for x86 targets.
5259 * configure: Regenerated.
5261 2011-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5263 * system.h [__cplusplus]: Wrap C function declarations in extern "C".
5265 2011-07-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5266 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5269 * configure.ac: Test AM_ICONV with CXX.
5270 * configure: Regenerate.
5271 * system.h (HAVE_DESIGNATED_INITIALIZERS): Never define for C++.
5273 2011-07-15 Dodji Seketeli <dodji@redhat.com>
5275 * directives.c (struct if_stack): Use source_location as type
5277 * include/cpplib.h (struct cpp_callbacks)<include, define, undef,
5278 indent, def_pragma, used_define, used_undef>: Properly use
5279 source_location as parameter type, rather than unsigned int.
5281 2011-07-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5284 * configure.ac (host_wide_int): Handle x86_64-*-solaris2.1[0-9]
5285 like i[34567]86-*-solaris2.1[0-9]*.
5286 * configure: Regenerate.
5288 2011-06-16 Jason Merrill <jason@redhat.com>
5291 * lex.c (lex_raw_string): Don't check for embedded NUL.
5293 2011-06-06 Dodji Seketeli <dodji@redhat.com>
5295 PR preprocessor/48532
5296 * directives.c (do_pragma): Don't forget the invocation location
5297 when parsing the pragma name of a namespaced pragma directive.
5299 2011-05-29 John Tytgat <John.Tytgat@aaug.net>
5301 * files.c (read_file_guts): Add test on non-zero value of S_ISREG.
5303 2011-05-22 Uros Bizjak <ubizjak@gmail.com>
5306 * lex.c (init_vectorized_lexer): Do not set "minimum" when __3dNOW_A__
5307 is defined. Check bit_MMXEXT and bit_CMOV to use search_line_mmx.
5309 2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>
5311 * system.h (ENUM_BITFIELD): Remove.
5313 2011-04-24 Jakub Jelinek <jakub@redhat.com>
5315 PR preprocessor/48740
5316 * lex.c (lex_raw_string): When raw string ends with
5317 ??) followed by raw prefix and ", ensure it is preprocessed
5318 with ??) rather than ??].
5320 2011-04-20 Jim Meyering <meyering@redhat.com>
5322 * files.c (destroy_cpp_file): Remove useless if-before-free.
5323 * init.c (cpp_destroy): Likewise.
5324 * macro.c (replace_args): Likewise.
5325 * pch.c (cpp_valid_state): Likewise.
5327 2011-03-25 Kai Tietz <ktietz@redhat.com>
5329 * files.c (file_hash_eq): Use filename_cmp
5331 (nonexistent_file_hash_eq): Likewise.
5332 (remap_filename): Likewise.
5333 Handle absolute DOS-path,
5334 (append_file_to_dir): Check for IS_DIR_SEPARATOR
5336 (read_name_map): Likewise.
5337 * linemap.c (linemap_add): Use filename_cmp
5339 * mkdeps.c (apply_vpath): Use filename_ncmp
5341 (deps_restore): Use filename_cmp instead of
5343 * init.c (read_original_directory): Use
5344 IS_DIR_SEPARATOR instead of checking for slash.
5346 2011-03-21 Michael Meissner <meissner@linux.vnet.ibm.com>
5348 PR preprocessor/48192
5349 * directives.c (do_ifdef): Do not consider conditional macros as
5352 * expr.c (parse_defined): Ditto.
5354 2011-03-18 Richard Henderson <rth@redhat.com>
5357 * lex.c [ALTIVEC] (search_line_fast): Require gcc version 4.5.
5359 2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
5360 Jakub Jelinek <jakub@redhat.com>
5362 PR preprocessor/39213
5363 * directives.c (end_directive): Call _cpp_remove_overlay for deferred
5364 pragmas as well in traditional mode.
5366 2010-11-17 Ian Lance Taylor <iant@google.com>
5369 * configure.ac: Use AC_USE_SYSTEM_EXTENSIONS. Remove switch of
5370 AC_LANG based on ENABLE_BUILD_WITH_CXX.
5372 2010-11-16 Kai Tietz <kai.tietz@onevision.com>
5374 PR preprocessor/17349
5375 * lex.c (save_comment): Handle in argument passing c++
5378 2010-11-02 Ian Lance Taylor <iant@google.com>
5380 * configure.ac: Use AC_SYS_LARGEFILE.
5381 * configure: Rebuild.
5382 * config.in: Rebuild.
5384 2010-10-19 Basile Starynkevitch <basile@starynkevitch.net>
5386 * line-map.h (source_location): Remove obsolete comment
5387 mentioning location_s.
5389 2010-09-29 Kai Tietz <kai.tietz@onevision.com>
5391 PR preprocessor/45362
5392 * directives.c (cpp_pop_definition): Make static.
5393 (do_pragma_push_macro): Reworked to store text
5395 (do_pragma_pop_macro): Add free text definition.
5396 (cpp_push_definition): Removed.
5397 * include/cpplib.h (cpp_push_definition): Removed.
5398 (cpp_pop_definition): Likewise.
5399 * internal.h (def_pragma_macro): Remove member 'value'
5400 and add new members 'definition', 'line',
5401 'syshdr', 'sued' and 'is_undef'.
5402 * pch.c (_cpp_restore_pushed_macros): Rework to work
5403 on text definition and store additional macro flags.
5404 (_cpp_save_pushed_macros): Likewise.
5406 2010-09-29 Joseph Myers <joseph@codesourcery.com>
5408 * include/cpplib.h (cpp_options): Rename warn_deprecated,
5409 warn_traditional, warn_long_long and pedantic.
5410 * directives.c (directive_diagnostics, _cpp_handle_directive):
5411 Update names of cpp_options members.
5412 * expr.c (cpp_classify_number, eval_token): Update names of
5413 cpp_options members.
5414 * init.c (cpp_create_reader, post_options): Update names of
5415 cpp_options members.
5416 * internal.h (CPP_PEDANTIC, CPP_WTRADITIONAL): Update names of
5417 cpp_options members.
5418 * macro.c (parse_params): Update names of cpp_options members.
5420 2010-09-15 Ian Lance Taylor <iant@google.com>
5422 * init.c: Fix type name in comment.
5424 2010-08-31 Jakub Jelinek <jakub@redhat.com>
5426 PR preprocessor/45457
5427 * expr.c (parse_defined): Call pfile->cb.user_builtin_macro hook if
5429 * directives.c (do_ifdef, do_ifndef): Likewise.
5431 2010-08-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5433 * system.h [HAVE_INTTYPES_H]: Include inttypes.h.
5435 2010-08-24 Richard Henderson <rth@redhat.com>
5438 * configure.ac (HAVE_SSE4): New check.
5439 * configure, config.in: Rebuild.
5440 * lex.c (search_line_sse42): Omit if !HAVE_SSE4.
5442 2010-08-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5444 * lex.c [__sun__ && __svr4__]: Disable init_vectorized_lexer
5445 etc. on Solaris 2/x86.
5447 2010-08-21 Richard Henderson <rth@redhat.com>
5448 Andi Kleen <ak@linux.intel.com>
5449 David S. Miller <davem@davemloft.net>
5451 * configure.ac (AC_C_BIGENDIAN, AC_TYPE_UINTPTR_T): New tests.
5452 (ssize_t): Check via AC_TYPE_SSIZE_T instead of AC_CHECK_TYPE.
5453 (ptrdiff_t): Check via AC_CHECK_TYPE.
5454 * config.in, configure: Rebuild.
5455 * system.h: Include stdint.h, if available.
5456 * lex.c (WORDS_BIGENDIAN): Provide default.
5457 (acc_char_mask_misalign, acc_char_replicate, acc_char_cmp,
5458 acc_char_index, search_line_acc_char, repl_chars, search_line_mmx,
5459 search_line_sse2, search_line_sse42, init_vectorized_lexer,
5460 search_line_fast): New.
5461 (_cpp_clean_line): Use search_line_fast. Restructure the fast
5462 loop to make it clear when we're leaving the loop. Stay in the
5463 fast loop for non-trigraph '?'.
5465 2010-06-11 Jakub Jelinek <jakub@redhat.com>
5467 * include/cpplib.h (struct cpp_callbacks): Add user_builtin_macro
5469 (enum cpp_builtin_type): Add BT_FIRST_USER and BT_LAST_USER.
5470 (cpp_macro_definition): Remove const qual from second argument.
5471 * macro.c (enter_macro_context): Call user_builtin_macro callback for
5472 NODE_BUILTIN !NODE_USED macros.
5473 (warn_of_redefinition): Likewise. Remove const qual from second
5475 (cpp_macro_definition): Likewise.
5476 * pch.c (write_macdef, save_macros): Call user_builtin_macro callback
5477 for NODE_BUILTIN !NODE_USED macros.
5479 2010-06-10 Joseph Myers <joseph@codesourcery.com>
5481 * include/cpplib.h (struct cpp_options): Remove show_column.
5482 * init.c (cpp_create_reader, post_options): Don't set show_column.
5484 2010-06-09 Joern Rennecke <joern.rennecke@embecosm.com>
5487 * configure.ac: Before using ZW_PROG_COMPILER_DEPENDENCIES for C++,
5488 check that C++ compiler works.
5489 * configure: Regenerate.
5491 2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
5493 * include/symtab.h (ht_identifier_ptr): New.
5495 2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com>
5496 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5499 * configure.ac: Check for declaration of 'basename(char *)'.
5500 * configure: Regenerate.
5501 * config.in: Regenerate.
5503 2010-04-25 Joseph Myers <joseph@codesourcery.com>
5505 * include/cpplib.h (enum c_lang): Add CLK_GNUC1X and CLK_STDC1X.
5506 * init.c (lang_defaults): Add entries for new language variants.
5507 (cpp_init_builtins): Define __STDC_VERSION__ to 201000L for C1X
5510 2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
5513 * files.c (report_missing_guard): Test for #pragma once.
5515 2010-04-07 Simon Baldwin <simonb@google.com>
5517 * directives.c (do_diagnostic): Add warning reason argument,
5518 call appropriate error reporting function for code.
5519 (directive_diagnostics): Call specific warning functions with
5520 warning reason where appropriate.
5521 (do_error, do_warning, do_pragma_dependency): Add warning reason
5522 argument to do_diagnostic calls.
5523 * macro.c (_cpp_warn_if_unused_macro, enter_macro_context,
5524 _cpp_create_definition): Call specific warning functions with
5525 warning reason where appropriate.
5526 * Makefile.in: Add new diagnostic functions to gettext translations.
5527 * include/cpplib.h (struct cpp_callbacks): Add warning reason code
5529 (CPP_DL_WARNING, CPP_DL_WARNING_SYSHDR, CPP_DL_PEDWARN, CPP_DL_ERROR,
5530 CPP_DL_ICE, CPP_DL_NOTE, CPP_DL_FATAL): Replace macros with enums.
5531 (CPP_W_NONE, CPP_W_DEPRECATED, CPP_W_COMMENTS,
5532 CPP_W_MISSING_INCLUDE_DIRS, CPP_W_TRIGRAPHS, CPP_W_MULTICHAR,
5533 CPP_W_TRADITIONAL, CPP_W_LONG_LONG, CPP_W_ENDIF_LABELS,
5534 CPP_W_NUM_SIGN_CHANGE, CPP_W_VARIADIC_MACROS,
5535 CPP_W_BUILTIN_MACRO_REDEFINED, CPP_W_DOLLARS, CPP_W_UNDEF,
5536 CPP_W_UNUSED_MACROS, CPP_W_CXX_OPERATOR_NAMES, CPP_W_NORMALIZE,
5537 CPP_W_INVALID_PCH, CPP_W_WARNING_DIRECTIVE): New enums for cpp
5538 warning reason codes.
5539 (cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
5540 cpp_warning_with_line, cpp_pedwarning_with_line,
5541 cpp_warning_with_line_syshdr): New specific error reporting functions.
5542 * pch.c (cpp_valid_state): Call specific warning functions with
5543 warning reason where appropriate.
5544 * errors.c (cpp_diagnostic, cpp_diagnostic_with_line): New central
5545 diagnostic handlers.
5546 (cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
5547 cpp_warning_with_line, cpp_pedwarning_with_line,
5548 cpp_warning_with_line_syshdr): New specific error reporting functions.
5549 * expr.c (cpp_classify_number, eval_token, num_unary_op): Call
5550 specific warning functions with warning reason where appropriate.
5551 * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment,
5552 warn_about_normalization, lex_identifier_intern, lex_identifier,
5553 _cpp_lex_direct): Ditto.
5554 * charset.c (_cpp_valid_ucn, convert_hex, convert_escape,
5555 narrow_str_to_charconst): Ditto.
5557 2010-04-06 Jakub Jelinek <jakub@redhat.com>
5559 PR preprocessor/43642
5560 * lex.c (lex_raw_string): Change type of TYPE variable to
5563 2010-04-02 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5565 * aclocal.m4: Regenerate.
5567 2010-03-29 Jason Merrill <jason@redhat.com>
5569 More N3077 raw string changes
5570 * charset.c (cpp_interpret_string): Don't transform UCNs in raw
5572 * lex.c (bufring_append): Split out from...
5573 (lex_raw_string): ...here. Undo trigraph and line splicing
5574 transformations. Do process line notes in multi-line literals.
5575 (_cpp_process_line_notes): Ignore notes that were already handled.
5577 Some raw string changes from N3077
5578 * charset.c (cpp_interpret_string): Change inner delimiters to ().
5579 * lex.c (lex_raw_string): Likewise. Also disallow '\' in delimiter.
5581 2010-02-11 Jakub Jelinek <jakub@redhat.com>
5583 * init.c (read_original_filename): Don't call read_original_directory
5584 if _cpp_handle_directive returns 0.
5586 2010-01-01 Joseph Myers <joseph@codesourcery.com>
5588 PR preprocessor/41947
5589 * expr.c (cpp_classify_number): Give error for hexadecimal
5590 floating-point constant with no digits before or after point.
5592 2009-11-20 Arnaud Charlet <charlet@adacore.com>
5594 * macro.c (enter_macro_context): Call cb.used callback if defined.
5595 * directives.c (do_idef, do_ifndef): Ditto.
5596 * include/cpplib.h (struct cpp_callbacks): Add used callback.
5598 2009-11-11 Kai Tietz <kai.tietz@onevision.com>
5600 * directives.c (do_pragma_push_macro): New pragma handler.
5601 (do_pragma_pop_macro): Likewise.
5602 (_cpp_init_internal_pragmas): Add push_macro and
5603 pop_macro handler to internal pragmas.
5604 (lex_macro_node_from_str): Removed.
5605 (cpp_push_definition): Replace lex_macro_node_from_str
5606 by _cpp_lex_identifier.
5607 (cpp_pop_definition): Likewise.
5608 * internal.h (_cpp_lex_identifier): New prototype.
5609 (def_pragma_macro): New structure.
5610 (cpp_reader): New member pushed_macros.
5611 * lex.c (_cpp_lex_identifier): New function.
5612 (lex_identifier_intern): New function.
5613 * init.c (cpp_create_reader): Initialize pushed_macros
5615 (cpp_destroy): Free elements in pushed_macros member.
5616 * pch.c (_cpp_save_pushed_macros): New function.
5617 (_cpp_restore_pushed_macros): Likewise.
5618 (_cpp_restore_pushed_macros): Use _cpp_save_pushed_macros.
5619 (cpp_read_state): Use _cpp_restore_pushed_macros.
5621 2009-10-19 Jakub Jelinek <jakub@redhat.com>
5623 * charset.c (cpp_init_iconv): Initialize utf8_cset_desc.
5624 (_cpp_destroy_iconv): Destroy utf8_cset_desc, char16_cset_desc
5625 and char32_cset_desc.
5626 (converter_for_type): Handle CPP_UTF8STRING.
5627 (cpp_interpret_string): Handle CPP_UTF8STRING and raw-strings.
5628 * directives.c (get__Pragma_string): Handle CPP_UTF8STRING.
5629 (parse_include): Reject raw strings.
5630 * include/cpplib.h (CPP_UTF8STRING): New token type.
5631 * internal.h (struct cpp_reader): Add utf8_cset_desc field.
5632 * lex.c (lex_raw_string): New function.
5633 (lex_string): Handle u8 string literals, call lex_raw_string
5634 for raw string literals.
5635 (_cpp_lex_direct): Call lex_string even for u8" and {,u,U,L,u8}R"
5637 * macro.c (stringify_arg): Handle CPP_UTF8STRING.
5639 2009-10-14 Jakub Jelinek <jakub@redhat.com>
5641 PR preprocessor/41543
5642 * include/line-map.h (RESERVED_LOCATION_COUNT): Define.
5643 * line-map.c (linemap_init): Initialize highest_location and
5644 highest_line to RESERVED_LOCATION_COUNT-1 instead of 0.
5646 2009-10-09 Jason Merrill <jason@redhat.com>
5648 * charset.c (_cpp_valid_ucn): Update C++0x restrictions.
5650 2009-10-09 Neil Vachharajani <nvachhar@google.com>
5652 * directives.c (DIRECTIVE_TABLE): Remove DEPRECATED from ident and
5655 2009-09-23 Loren J. Rittle <ljrittle@acm.org>
5657 * configure.ac (AC_CHECK_HEADERS after AC_LANG(C++)): Add sys/stat.h.
5658 * configure: Rebuilt.
5660 2009-09-22 Richard Guenther <rguenther@suse.de>
5663 * files.c (pch_open_file): Disallow non-toplevel PCH inclusion.
5665 2009-09-18 Chris Demetriou <cgd@google.com>
5667 PR preprocessor/28435:
5668 * include/cpplib.h (struct cpp_options): Add new member
5669 deps.need_preprocessor_output.
5670 * files.c (open_file_failed): If preprocessor output is needed
5671 always report an error.
5673 2009-09-13 Kai Tietz <kai.tietz@onevision.com>
5675 * configure.ac: Set for i?86-w64-mingw*
5676 need_64bit_hwint to yes.
5677 * configure: Regenerated.
5679 2009-09-10 Jason Merrill <jason@redhat.com>
5681 * directives.c (cpp_define): constify.
5683 2009-09-02 Ian Lance Taylor <iant@google.com>
5685 * macro.c (stringify_arg): Escape CPP_WCHAR tokens.
5687 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5689 * configure.ac (AC_PREREQ): Bump to 2.64.
5691 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5693 * aclocal.m4: Regenerate.
5694 * config.in: Regenerate.
5695 * configure: Regenerate.
5697 2009-08-17 Tom Tromey <tromey@redhat.com>
5699 PR preprocessor/41067:
5700 * charset.c (convert_escape): Add missing ":" to error text.
5702 2009-07-27 Douglas B Rupp <rupp@gnat.com>
5704 * include/cpplib.h (INO_T_CPP): New macro.
5705 (struct cpp_dir): Use it.
5707 2009-07-20 Jerry Quinn <jlquinn@optonline.net>
5710 * configure.ac: Use = instead of == for testing
5711 ENABLE_BUILD_WITH_CXX.
5712 * configure: Rebuild.
5714 2009-07-17 Jerry Quinn <jlquinn@optonline.net>
5716 * directives.c (do_linemarker, do_line): Use CPP_STRING for
5718 * files.c (find_file_in_dir): Add cast from void* to char*.
5719 * symtab.c (ht_lookup_with_hash): Add cast from void* to char*.
5720 * Makefile.in: (WARN_CFLAGS): Use general and C-specific
5722 (CXX, CXXFLAGS, WARN_CXXFLAGS, ALL_CXXFLAGS,
5723 ENABLE_BUILD_WITH_CXX, CCDEPMODE, CXXDEPMODE, COMPILER,
5724 COMPILER_FLAGS): New.
5725 (DEPMODE): Set from CCDEPMODE or CXXDEPMODE.
5726 (COMPILE.base): Use COMPILER instead of CC. Use COMPILER_FLAGS
5727 instead of ALL_CFLAGS.
5728 * configure.ac: Invoke AC_PROG_CXX. Separate C-specific warnings
5729 from other warnings. Add -Wc++-compat to C-specific warnings.
5730 Check for --enable-build-with-cxx. Set and substitute
5731 ENABLE_BUILD_WITH_CXX. Invoke ZW_PROG_COMPILER_DEPENDENCIES
5732 according to ENABLE_BUILD_WITH_CXX. Invoke AC_LANG before
5734 * configure: Rebuild.
5735 * include/cpp-id-data.h: Remove extern "C".
5736 * include/line-map.h: Likewise.
5737 * include/mkdeps.h: Likewise.
5738 * include/symtab.h: Likewise.
5739 * internal.h: Likewise.
5741 2009-06-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5743 * directives.c (parse_include): Add location argument. Update all
5745 (parse_answer): Likewise.
5746 (do_include_common): Error with exact location.
5747 (parse_assertion): Likewise.
5749 2009-06-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
5751 * expr.c (num_div_op): Take explicit location.
5753 2009-06-17 Ian Lance Taylor <iant@google.com>
5755 * include/cpplib.h (progname): Don't declare.
5757 2009-06-12 Ian Lance Taylor <iant@google.com>
5759 * include/cpplib.h (struct cpp_options): Add
5760 warn_cxx_operator_names field.
5761 (NODE_WARN_OPERATOR): Define.
5762 (struct cpp_hashnode): Increase flags field to 10 bits, decrease
5764 * init.c (mark_named_operators): Add flags parameter.
5765 (cpp_post_options): Pick flags value to pass to
5766 mark_named_operators.
5767 * lex.c (lex_identifier): If NODE_WARN_OPERATOR is set, warn that
5768 identifier is an operator name in C++.
5770 2009-06-01 Aldy Hernandez <aldyh@redhat.com>
5772 * include/line-map.h (LAST_SOURCE_COLUMN): New.
5774 2009-06-01 Ian Lance Taylor <iant@google.com>
5776 * include/cpp-id-data.h: Add extern "C".
5777 * include/line-map.h: Likewise.
5778 * include/mkdeps.h: Likewise.
5779 * include/symtab.h: Likewise.
5780 * internal.h: Likewise.
5782 2009-05-15 Ian Lance Taylor <iant@google.com>
5784 * include/cpplib.h (enum cpp_builtin_type): Rename from enum
5785 builtin_type. Change all uses.
5787 2009-05-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5790 * directives (do_linemarker): Compensate for the increment in
5791 location that occurs when we reach the end of line.
5792 * files (_cpp_stack_include): Mention _cpp_find_file in the
5795 2009-05-10 Joseph Myers <joseph@codesourcery.com>
5797 * include/cpplib.h (enum cpp_token_fld_kind): Add
5798 CPP_TOKEN_FLD_TOKEN_NO.
5799 (struct cpp_macro_arg, struct cpp_identifier): Define.
5800 (union cpp_token_u): Use struct cpp_identifier for identifiers.
5801 Use struct cpp_macro_arg for macro arguments. Add token_no for
5802 CPP_PASTE token numbers.
5803 * directives.c (_cpp_handle_directive, lex_macro_node, do_pragma,
5804 do_pragma_poison, parse_assertion): Use val.node.node in place of
5806 * expr.c (parse_defined, eval_token): Use val.node.node in place
5808 * lex.c (cpp_ideq, _cpp_lex_direct, cpp_token_len,
5809 cpp_spell_token, cpp_output_token, _cpp_equiv_tokens,
5810 cpp_token_val_index): Use val.macro_arg.arg_no or val.token_no in
5811 place of val.arg_no. Use val.node.node in place of val.node.
5812 * macro.c (replace_args, cpp_get_token, parse_params,
5813 lex_expansion_token, create_iso_definition, cpp_macro_definition):
5814 Use val.macro_arg.arg_no or val.token_no in place of val.arg_no.
5815 Use val.node.node in place of val.node.
5817 2009-05-03 Joseph Myers <joseph@codesourcery.com>
5819 * charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte
5822 2009-04-25 Joseph Myers <joseph@codesourcery.com>
5824 PR preprocessor/39559
5825 * expr.c (cpp_interpret_integer): Use a pedwarn for decimal
5826 constants larger than intmax_t in C99 mode.
5828 2009-04-21 Taras Glek <tglek@mozilla.com>
5830 * include/cpp-id-data.h: Update GTY annotations to new syntax.
5831 * include/cpplib.h: Likewise.
5832 * include/line-map.h: Likewise.
5833 * include/symtab.h: Likewise.
5835 2009-04-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5838 * lex.c (cpp_type2name): Take a flags parameter. Call
5839 cpp_named_operator2name for named operators and cpp_digraph2name
5841 (cpp_digraph2name): New.
5842 (cpp_spell_token): Use it.
5843 (cpp_output_token): Likewise.
5844 * include/cpplib.h (cpp_type2name): Update declaration.
5845 * init.c (cpp_named_operator2name): New.
5846 * internal.h (cpp_named_operator2name): Declare.
5848 2009-04-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
5851 * init.c (cpp_create_reader): Wlong_long is disabled by default.
5852 * expr.c (cpp_classify_number): Give different messages for C and
5855 2009-04-19 Joseph Myers <joseph@codesourcery.com>
5857 PR preprocessor/20078
5858 * include/cpp-id-data.h (struct cpp_macro): Add extra_tokens
5860 * include/cpplib.h (SP_DIGRAPH, SP_PREV_WHITE): Define.
5861 (struct cpp_token): Change flags to unsigned short.
5862 * lex.c (_cpp_lex_direct): Initialize arg_no for CPP_PASTE tokens.
5863 (_cpp_equiv_tokens): Check arg_no for CPP_PASTE tokens.
5864 (cpp_token_val_index): Return CPP_TOKEN_FLD_ARG_NO for CPP_PASTE
5866 * macro.c (macro_real_token_count): New.
5867 (enter_macro_context, replace_args): Use macro_real_token_count.
5868 (create_iso_definition): Record whitespace surrounding and digraph
5869 spelling of # and ## tokens using SP_PREV_WHITE and SP_DIGRAPH.
5870 Set extra_tokens and save CPP_PASTE tokens with arg_no set for
5871 multiple consecutive ## tokens.
5872 (_cpp_create_definition): Initialize extra_tokens.
5873 (cpp_macro_definition): Use macro_real_token_count.
5875 2009-04-18 Joseph Myers <joseph@codesourcery.com>
5877 * directives.c (parse_include): Pass true to check_eol.
5879 2009-04-18 Joseph Myers <joseph@codesourcery.com>
5881 PR preprocessor/39646
5882 * include/line-map.h (enum lc_reason): Add LC_RENAME_VERBATIM.
5883 * line-map.c (linemap_add): Handle LC_RENAME_VERBATIM.
5884 * directives.c (do_line, do_linemarker): Use LC_RENAME_VERBATIM in
5887 2009-04-18 Joseph Myers <joseph@codesourcery.com>
5889 PR preprocessor/39647
5890 * directives.c (check_eol): Add parameter expand.
5891 (do_undef, parse_include, do_line, do_linemarker, do_ident,
5892 do_pragma_once, do_pragma_system_header, do_ifdef, do_ifndef,
5893 do_else, do_endif, do_assert, do_unassert): All callers changed.
5894 Pass true from do_line, false elsewhere.
5896 2009-04-12 Joseph Myers <joseph@codesourcery.com>
5898 PR preprocessor/31869
5899 * macro.c (stringify_arg): Handle NULL source token in padding
5900 token where previous padding token did not have source token with
5901 preceding whitespace.
5903 2009-04-09 Jakub Jelinek <jakub@redhat.com>
5905 * Makefile.in: Change copyright header to refer to version
5906 3 of the GNU General Public License and to point readers at the
5907 COPYING3 file and the FSF's license web page.
5908 * charset.c: Likewise.
5909 * directives-only.c: Likewise.
5910 * directives.c: Likewise.
5911 * errors.c: Likewise.
5913 * files.c: Likewise.
5914 * identifiers.c: Likewise.
5915 * include/cpp-id-data.h: Likewise.
5916 * include/cpplib.h: Likewise.
5917 * include/line-map.h: Likewise.
5918 * include/mkdeps.h: Likewise.
5919 * include/symtab.h: Likewise.
5921 * internal.h: Likewise.
5923 * line-map.c: Likewise.
5924 * macro.c: Likewise.
5925 * makeucnid.c: Likewise.
5926 * mkdeps.c: Likewise.
5928 * symtab.c: Likewise.
5929 * system.h: Likewise.
5930 * traditional.c: Likewise.
5931 * ucnid.tab: Likewise.
5932 * ucnid.h: Regenerate.
5934 2009-04-01 Janis Johnson <janis187@us.ibm.com>
5937 * include/cpplib.h (CPP_N_DEFAULT): Define.
5938 * expr.c (interpret_float_suffix): Recognize d or D for double,
5939 return new value for default.
5940 (cpp_classify_number): Issue pedwarn for use of d or D in suffix.
5943 * expr.c (interpret_float_suffix): Reject invalid suffix that uses
5944 letters from decimal float and fixed-point suffixes.
5946 2009-03-31 Joseph Myers <joseph@codesourcery.com>
5948 PR preprocessor/15638
5949 * files.c (_cpp_find_file): Call open_file_failed after diagnosing
5951 (open_file_failed): Make error for missing file fatal.
5952 * include/cpplib.h (CPP_DL_FATAL): Define.
5954 2009-03-30 Sergiy Vyshnevetskiy <serg@vostok.net>
5956 PR preprocessor/31932:
5957 * internal.h: Don't mention HAVE_ICONV_H.
5958 * configure, config.in: Rebuild.
5959 * configure.ac: Don't check for iconv.h.
5961 2009-03-30 Tom Tromey <tromey@redhat.com>
5963 PR preprocessor/39512:
5964 * line-map.c (linemap_init): Initialize 'reallocator' field.
5966 2009-03-30 Jakub Jelinek <jakub@redhat.com>
5969 * macro.c (cpp_get_token): If macro_to_expand returns NULL
5970 and used some tokens, add CPP_PADDING before next token.
5972 2009-03-29 Joseph Myers <joseph@codesourcery.com>
5974 PR preprocessor/34695
5975 * makedepend.c: Remove.
5976 * Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove.
5977 (all, clean, TAGS_SOURCES, include): Remove makedepend handling.
5978 * directives.c (cpp_errors): Remove.
5979 * errors.c (print_location, _cpp_begin_message, v_message):
5981 (cpp_error, cpp_error_with_line): Always use error callback.
5982 (cpp_error, cpp_error_with_line, cpp_errno): Return bool.
5983 * include/cpplib.h (cpp_options): Remove pedantic_errors,
5984 inhibit_warnings, warn_system_headers, inhibit_errors,
5985 warnings_are_errors, client_diagnostic.
5986 (cpp_callbacks): Add extra arguments to error callback; make it
5988 (cpp_finish): Return void.
5989 (cpp_destroy): Remove inaccurate comment about return value.
5990 (cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove.
5991 (CPP_DL_NOTE): Define.
5992 * include/line-map.h (linemap_print_containing_files): Remove.
5993 * init.c (cpp_finish): Do not check for or return number of
5995 * internal.h (cpp_reader): Remove errors field.
5996 * line-map.c (linemap_print_containing_files): Remove.
5997 * macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message
5998 about previous definition. Only emit it if previous diagnostic
6001 2009-03-28 Joseph Myers <joseph@codesourcery.com>
6003 * Makefile.in (po/$(PACKAGE).pot): Use $(mkinstalldirs) not
6006 2009-03-18 Jakub Jelinek <jakub@redhat.com>
6008 * include/cpplib.h (struct cpp_dir): Reorder fields for 64-bit hosts.
6010 2009-02-21 Joseph Myers <joseph@codesourcery.com>
6012 * lex.c (lex_string): Return a CPP_LESS token for missing '>' in a
6014 (_cpp_lex_direct): Handle this.
6016 2009-02-15 Richard Guenther <rguenther@suse.de>
6020 2009-02-13 Richard Guenther <rguenther@suse.de>
6022 * configure.ac: Enable LFS.
6023 * configure: Re-generate.
6024 * config.in: Likewise.
6026 2009-01-05 Ben Elliston <bje@au.ibm.com>
6028 * Makefile.in (.po.gmo): Use mkinstalldirs, not test -d || mkdir.
6029 (.po.pox): Likewise.
6030 (po/$(PACKAGE).pot): Likewise.
6032 2008-12-10 Alexandre Oliva <aoliva@redhat.com>
6035 * pch.c (cpp_valid_state): Improve message for poisoned symbols.
6036 Allow for differences in __GCC_HAVE_DWARF2_CFI_ASM.
6038 2008-11-29 Joseph Myers <joseph@codesourcery.com>
6040 * lex.c (cpp_token_len): Use 6 as default length.
6042 2008-10-31 Manuel López-Ibáñez <manu@gcc.gnu.org>
6044 * expr.c (struct op): Add location.
6045 (_cpp_parse_expr): Propagate locations throught the stack
6048 (check_promotion): Use explicit location in errors.
6050 2008-10-05 Matthew Gingell <gingell@adacore.com>
6051 Arnaud Charlet <charlet@adacore.com>
6053 * include/cpplib.h (cpp_comments, cpp_comment_table): New structs.
6054 (cpp_get_comments): New function.
6055 * internal.h (struct cpp_reader): Add comments field.
6056 * init.c (cpp_destroy): Free comments.
6057 * lex.c (store_comment, cpp_get_comments): New functions.
6058 (comments): New struct.
6059 (save_comment): Store comments in comments struct.
6061 2008-09-18 Simon Baldwin <simonb@google.com>
6063 * include/cpplib.h (struct cpp_options): Add new boolean flag
6064 warn_builtin_macro_redefined.
6065 * init.c (cpp_create_reader): Initialize warn_builtin_macro_redefined.
6066 * (struct builtin_operator): Split out from previous struct builtin,
6067 enhance extra const correctness.
6068 * (struct builtin_macro): Split out from previous struct builtin, add
6069 new always_warn_if_redefined flag, enhance const correctness.
6070 * (mark_named_operators): Use struct builtin_operator.
6071 * (cpp_init_special_builtins): Use struct builtin_macro, add NODE_WARN
6072 to builtins selectively.
6073 * macro.c (warn_of_redefinition): Return false if a builtin macro
6074 is not flagged with NODE_WARN.
6076 2008-07-31 Jakub Jelinek <jakub@redhat.com>
6078 PR preprocessor/36649
6079 * files.c (struct report_missing_guard_data): New type.
6080 (report_missing_guard): Put paths into an array instead of printing
6081 them right away. Return 1 rather than 0.
6082 (report_missing_guard_cmp): New function.
6083 (_cpp_report_missing_guards): Sort and print paths gathered by
6084 report_missing_guard callback.
6086 2008-07-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
6089 * directives.c (strtolinenum): Handle overflow.
6090 (do_line): Give a warning if line number overflowed.
6091 (do_linemarker): Update call to strtolinenum.
6093 2008-07-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
6095 * include/line-map.h (linenum_type): New typedef.
6096 (struct line_map): Use it.
6097 (SOURCE_LINE): Second arguments is a LOCATION not a LINE.
6098 (SOURCE_COLUMN): Likewise.
6099 * macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store
6100 source_location values in a variable of type linenum_type.
6101 * directives.c (struct if_stack): Use linenum_type.
6102 (strtoul_for_line): Rename as strtolinenum.
6103 (do_line): Use linenum_type.
6104 (do_linemarker): Use linenum_type and strtolinenum.
6105 (_cpp_do_file_change): Use linenum_t.
6106 * line-map.c (linemap_add): Likewise.
6107 (linemap_line_start): Likewise.
6108 * traditional.c (struct fun_macro): 'line' is a source_location.
6109 * errors.c (print_location): Use linenum_type.
6110 * directives-only.c (_cpp_preprocess_dir_only): Likewise.
6111 * internal.h (CPP_INCREMENT_LINE): Likewise.
6112 * lex.c (_cpp_skip_block_comment): Use source_location.
6114 2008-07-14 Ben Elliston <bje@au.ibm.com>
6116 * include/cpplib.h (NODE_CONDITIONAL): New.
6117 (struct cpp_callbacks): New macro_to_expand field.
6118 (struct cpp_hashnode): Adjust size of flags and type fields.
6119 (cpp_peek_token): Prototype.
6120 * lex.c (cpp_peek_token): New function.
6121 (_cpp_temp_token): Protect pre-existing lookaheads.
6122 * macro.c (cpp_get_token): Expand any conditional macros.
6123 (_cpp_backup_tokens_direct): New.
6124 (_cpp_backup_tokens): Call _cpp_backup_tokens_direct.
6125 (warn_of_redefinition): Silently allow redefined conditional
6127 (_cpp_create_definition): Remove the conditional flag when a user
6128 defines one of the conditional macros.
6129 * internal.h (_cpp_backup_tokens_direct): New prototype.
6131 2008-06-13 Andrew Haley <aph@redhat.com>
6133 PR preprocessor/33305
6134 * macro.c (replace_args): Print a warning for empty macro
6135 arguments in C89 and C++.
6137 2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6139 * Makefile.in ($(srcdir)/aclocal.m4): Update dependencies.
6140 * configure: Regenerate.
6142 2008-06-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6144 * Makefile.in (datarootdir): New variable.
6146 2008-06-12 H.J. Lu <hongjiu.lu@intel.com>
6148 PR preprocessor/36479
6149 * charset.c (cpp_interpret_string_notranslate): Also set
6150 narrow_cset_desc.width.
6152 2008-06-07 Joseph Myers <joseph@codesourcery.com>
6154 * configure.ac (parisc*64*-*-*): Remove.
6155 * configure: Regenerate.
6157 2008-05-30 Tom Tromey <tromey@redhat.com>
6159 PR preprocessor/36320:
6160 * internal.h (_cpp_parse_expr): Update.
6161 * expr.c (_cpp_parse_expr): Add 'is_if' argument. Update error
6163 * directives.c (do_if): Update.
6164 (do_elif): Require expression if processing group.
6166 2008-05-30 Danny Smith <dannysmith@users.sourceforge.net>
6168 * include/cpplib.h (struct cpp_dir): Add new field, canonical_name.
6170 2008-05-21 Tom Tromey <tromey@redhat.com>
6172 PR preprocessor/27777:
6173 * lex.c (cpp_output_line_to_string): New function.
6174 * internal.h (_cpp_begin_message): Don't declare.
6175 * errors.c (_cpp_begin_message): Now static.
6176 * include/cpplib.h (cpp_output_line_to_string): Declare.
6177 * directives.c (do_diagnostic): Rewrote. Use
6178 cpp_output_line_to_string. Don't use _cpp_begin_message.
6180 2008-05-21 Tom Tromey <tromey@redhat.com>
6182 * include/symtab.h (HT_ALLOCED): Remove.
6183 (ht_purge): Declare.
6184 * symtab.c (DELETED): New define.
6185 (ht_lookup): Update comment.
6186 (ht_lookup_with_hash): Handle deleted entries. Remove HT_ALLOCED
6187 code. Use subobject allocator for strings, if it exists.
6188 (ht_expand): Handle deleted entries.
6189 (ht_forall): Likewise.
6190 (ht_purge): New function.
6191 (ht_dump_statistics): Print deletion statistics.
6193 2008-05-13 Tom Tromey <tromey@redhat.com>
6195 PR preprocessor/22168:
6196 * include/cpplib.h (struct cpp_options) <objc>: Update
6198 * expr.c (eval_token): Warn for use of assertions.
6199 * directives.c (directive_diagnostics): Warn about extensions.
6200 (DEPRECATED): New define.
6201 (DIRECTIVE_TABLE): Use it.
6203 2008-05-06 Tom Tromey <tromey@redhat.com>
6205 PR preprocessor/35313, PR preprocessor/36088:
6206 * expr.c (optab) <QUERY, COMMA>: Set precedence to 4.
6207 (reduce) <case CPP_QUERY>: Special case CPP_COMMA and CPP_COLON.
6209 2008-05-04 David S. Miller <davem@davemloft.net>
6211 * configure.ac (sparc*-*-*): Always set need_64bit_hwint to yes.
6212 * configure: Regenerate.
6214 2008-04-22 Daniel Franke <franke.daniel@gmail.com>
6216 * include/cpplib.h (cpp_define_formatted): New.
6217 * directives.c (cpp_define_formatted): New.
6219 2008-04-21 Tom Tromey <tromey@redhat.com>
6222 * charset.c (_cpp_convert_input): Add buffer_start argument.
6223 Ignore UTF-8 BOM if seen.
6224 * internal.h (_cpp_convert_input): Add argument.
6225 * files.c (struct _cpp_file) <buffer_start>: New field.
6226 (destroy_cpp_file): Free buffer_start, not buffer.
6227 (_cpp_pop_file_buffer): Likewise.
6228 (read_file_guts): Update.
6230 2008-04-18 Kris Van Hees <kris.van.hees@oracle.com>
6232 * include/cpp-id-data.h (UC): Was U, conflicts with U"..." literal.
6233 * include/cpplib.h (CHAR16, CHAR32, STRING16, STRING32): New tokens.
6234 (struct cpp_options): Added uliterals.
6235 (cpp_interpret_string): Update prototype.
6236 (cpp_interpret_string_notranslate): Idem.
6237 * charset.c (init_iconv_desc): New width member in cset_converter.
6238 (cpp_init_iconv): Add support for char{16,32}_cset_desc.
6239 (convert_ucn): Idem.
6240 (emit_numeric_escape): Idem.
6241 (convert_hex): Idem.
6242 (convert_oct): Idem.
6243 (convert_escape): Idem.
6244 (converter_for_type): New function.
6245 (cpp_interpret_string): Use converter_for_type, support u and U prefix.
6246 (cpp_interpret_string_notranslate): Match changed prototype.
6247 (wide_str_to_charconst): Use converter_for_type.
6248 (cpp_interpret_charconst): Add support for CPP_CHAR{16,32}.
6249 * directives.c (linemarker_dir): Macro U changed to UC.
6250 (parse_include): Idem.
6251 (register_pragma_1): Idem.
6252 (restore_registered_pragmas): Idem.
6253 (get__Pragma_string): Support CPP_STRING{16,32}.
6254 * expr.c (eval_token): Support CPP_CHAR{16,32}.
6255 * init.c (struct lang_flags): Added uliterals.
6256 (lang_defaults): Idem.
6257 * internal.h (struct cset_converter) <width>: New field.
6258 (struct cpp_reader) <char16_cset_desc>: Idem.
6259 (struct cpp_reader) <char32_cset_desc>: Idem.
6260 * lex.c (digraph_spellings): Macro U changed to UC.
6262 (lex_string): Add support for u'...', U'...', u"..." and U"...".
6263 (_cpp_lex_direct): Idem.
6264 * macro.c (_cpp_builtin_macro_text): Macro U changed to UC.
6265 (stringify_arg): Support CPP_CHAR{16,32} and CPP_STRING{16,32}.
6267 2008-04-18 Paolo Bonzini <bonzini@gnu.org>
6270 * aclocal.m4: Regenerate.
6271 * configure: Regenerate.
6273 2008-04-17 Tom Tromey <tromey@redhat.com>
6276 * errors.c (cpp_error): Don't reference a token before the start
6279 2008-04-16 Tom Tromey <tromey@redhat.com>
6281 * Makefile.in (TAGS_SOURCES): New variable.
6284 2008-04-11 Kaz Kojima <kkojima@gcc.gnu.org>
6286 * configure.ac: (need_64bit_hwint): Need 64bit hwint for sh-*-*
6288 * configure: Rebuilt.
6290 2008-04-02 Joseph Myers <joseph@codesourcery.com>
6292 * include/cpplib.h (struct cpp_callbacks): Add used_define,
6293 used_undef and before_define.
6294 (NODE_USED): Define.
6295 * directives.c (do_define, do_undef, undefine_macros, do_ifdef,
6296 do_ifndef, cpp_pop_definition): Handle new flag and use new
6298 * expr.c (parse_defined): Handle new flag and use new callbacks.
6299 * macro.c (enter_macro_context, _cpp_free_definition): Handle new
6300 flag and use new callbacks.
6302 2008-04-01 Jakub Jelinek <jakub@redhat.com>
6305 * files.c (struct _cpp_file): Remove pch field.
6306 (pch_open_file): Don't set file->pch, just file->pchname.
6307 (should_stack_file): After pfile->cb.read_pch call
6308 free pchname and clear pchname, don't close file->fd.
6309 Test file->pchname instead of file->pch. Don't close fd after cb.
6310 (_cpp_stack_include): Test file->pchname instead of file->pch.
6312 2008-03-28 Tom Tromey <tromey@redhat.com>
6314 * Makefile.in (POSTCOMPILE): New variable.
6317 2008-03-13 Tom Tromey <tromey@redhat.com>
6320 * directives.c (destringize_and_run): Set pfile->directive.
6322 2008-03-06 Markus Milleder <markus.milleder@generali.at>
6324 PR preprocessor/35458
6325 * mkdeps.c (munge): Quote '#' with a '\'.
6327 2008-02-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6329 PR preprocessor/35379
6330 * mkdeps.c (deps_write): Ensure the first target always appears
6331 in the first column, without leading backslash newline. Avoid
6332 some more extra whitespace.
6334 2008-02-25 Thiemo Seufer <ths@mips.com>
6336 * Makefile.in ($(srcdir)/config.in): Depend on configure.ac.
6338 2008-02-19 Tom Tromey <tromey@redhat.com>
6340 * traditional.c (lex_identifier): Use CPP_HASHNODE.
6341 * lex.c (lex_identifier): Use CPP_HASHNODE.
6342 * include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Wrap in
6344 * identifiers.c (alloc_node): Change return type.
6345 (_cpp_init_hashtable): Don't cast 'alloc_node'.
6346 (proxy_assertion_broken): New declaration.
6347 (cpp_forall_identifiers): Move comment.
6348 * line-map.c (linemap_add): Comment fix.
6349 (linemap_line_start): Indentation fix.
6351 2008-01-25 Jakub Jelinek <jakub@redhat.com>
6353 PR preprocessor/34692
6354 * macro.c (collect_args): Add pragma_buff argument. Push
6355 CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather
6356 than into arguments. Reset prevent_expansion and parsing_args
6357 state at CPP_PRAGMA_EOL/CPP_EOF.
6358 (funlike_invocation_p): Add pragma_buff argument, pass it through
6360 (enter_macro_context): Add result argument. Adjust
6361 funlike_invocation_p caller. Emit all deferred pragma tokens
6362 gathered during collect_args before the expansion, add a padding
6363 token. Return 2 instead of 1 if any pragma tokens were prepended.
6364 (cpp_get_token): If enter_macro_context returns 2, don't return
6365 a padding token, instead cycle to grab CPP_PRAGMA token.
6366 * directives.c (_cpp_handle_directive): If was_parsing_args
6367 in deferred pragma, leave parsing_args and prevent_expansion as is.
6369 2008-01-22 Tom Tromey <tromey@redhat.com>
6372 * macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and
6373 __STDC_CONSTANT_MACROS.
6375 2008-01-07 Fred Fish <fnf@specifix.com>
6377 PR preprocessor/30363
6378 * traditional.c (replace_args_and_push): Add local variable
6379 cxtquote, calculate the replacement text size assuming a
6380 worst case of every input character quoted with backslash,
6381 and properly handle output quoting of quote characters in
6382 actual arguments used in function-like macros.
6384 2008-01-03 Tom Tromey <tromey@redhat.com>
6386 PR preprocessor/34602
6387 * directives.c (do_line): Don't try to spell EOF token.
6388 (do_linemarker): Add comment.
6390 2007-12-11 DJ Delorie <dj@redhat.com>
6392 * charset.c (convert_using_iconv): Close out any shift states,
6393 returning to the initial state.
6395 2007-12-06 Tom Tromey <tromey@redhat.com>
6398 * internal.h (struct cpp_reader) <file_hash_entries>: Changed
6400 <file_hash_entries_allocated, file_hash_entries_used>: Removed.
6401 * files.c (FILE_HASH_POOL_SIZE): New macro.
6402 (struct file_hash_entry_pool): New.
6403 (destroy_all_cpp_files): New function.
6404 (allocate_file_hash_entries): Allocate a file_hash_entry_pool.
6405 (new_file_hash_entry): Update.
6406 (free_file_hash_entries): New function.
6407 (_cpp_cleanup_files): Call free_file_hash_entries and
6408 destroy_all_cpp_files.
6409 (cpp_clear_file_cache): New function.
6410 * include/cpplib.h (cpp_clear_file_cache): Declare.
6412 2007-12-03 Tom Tromey <tromey@redhat.com>
6414 PR preprocessor/34288
6415 * configure.ac, config.in: Rebuilt.
6416 * configure.ac: Check for ssize_t.
6418 2007-11-30 Tom Tromey <tromey@redhat.com>
6420 PR preprocessor/32868
6421 * macro.c (_cpp_create_definition): Special case
6422 __STDC_FORMAT_MACROS.
6424 2007-11-16 Michael Matz <matz@suse.de>
6426 * files.c (search_path_head): Fix check for absolute paths.
6428 2007-11-11 Tom Tromey <tromey@redhat.com>
6431 * include/cpplib.h (cpp_included_before): Declare.
6432 * files.c (struct file_hash_entry) <location>: New field.
6433 (_cpp_find_file): Initialize new field.
6434 (make_cpp_dir): Likewise.
6435 (cpp_included_before): New function.
6437 2007-11-01 Tom Tromey <tromey@redhat.com>
6439 PR preprocessor/30805
6440 * macro.c (paste_tokens): Handle padding token.
6441 (paste_tokens): Don't abort unless padding has PASTE_LEFT flag.
6443 2007-10-31 Tom Tromey <tromey@redhat.com>
6445 PR preprocessor/30786
6446 * macro.c (builtin_macro): Return result of _cpp_do__Pragma.
6447 * directives.c (_cpp_do__Pragma): Return error status.
6448 * internal.h (_cpp_do__Pragma): Update.
6449 * directives.c (get__Pragma_string): Back up if EOF seen.
6451 2007-09-06 Tom Tromey <tromey@redhat.com>
6453 * internal.h (struct cpp_reader) <invocation_location>: New
6455 (struct cpp_reader) <set_invocation_location>: Likewise.
6456 * init.c (cpp_set_line_map): New function.
6457 * line-map.c (linemap_add): Use linemap's allocator.
6458 * include/line-map.h (GTY): Define.
6459 (line_map_realloc): New typedef.
6460 (struct line_map): Mark with GTY.
6461 (struct line_maps): Likewise.
6462 (struct line_maps) <maps>: Likewise.
6463 (struct line_maps) <reallocator>: New field.
6464 * include/symtab.h (GTY): Conditionally define.
6465 * include/cpplib.h (cpp_set_line_map): Declare.
6466 (cpp_get_token_with_location): Declare.
6467 * macro.c (cpp_get_token): Set invocation_location on the reader.
6468 (cpp_get_token_with_location): New function.
6470 2007-08-30 Chao-ying Fu <fu@mips.com>
6472 * expr.c (interpret_float_suffix): Support hr, r, lr, llr, uhr, ur,
6473 ulr, ullr, hk, k, lk, llk, uhk, uk, ulk, ullk.
6474 (cpp_classify_number): Support decimal fixed-point constants without
6476 Warn about fixed-point constants when -pedantic.
6477 * include/cpplib.h (CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE): Change
6478 comments to support fixed-point values.
6479 (CPP_N_FRACT, CPP_N_ACCUM): Define.
6481 2007-08-18 Tom Tromey <tromey@redhat.com>
6483 PR preprocessor/32974
6484 * directives.c (parse_include): Don't check for EOL when
6485 processing #pragma dependency.
6487 2007-07-30 Ollie Wild <aaw@google.com>
6489 * directives-only.c: New file.
6490 * internal.h (struct _cpp_dir_only_callbacks): New.
6491 (_cpp_preprocess_dir_only): New function.
6492 * directives.c (_cpp_handle_directive): Check directives_only before
6493 disabling execution of indented directives.
6494 * files.c (_cpp_stack_file): Add directives_only check.
6495 * include/cpplib.h (struct cpp_options): Add directives_only.
6496 (cpp_init_special_builtins): New function.
6497 * init.c (cpp_init_special_builtins): New function.
6498 (cpp_init_builtins): Move builtin_array initialization to
6499 cpp_init_special_builtins.
6500 (post_options): Check directives_only before setting
6501 pfile->state.prevent_expansion = 1.
6502 * macro.c (_cpp_builtin_macro_text): Print an error if __COUNTER__
6503 is expanded inside a directive while -fdirectives-only is enabled.
6504 * Makefile.in (libcpp_a_OBJS): Add directives-only.o.
6505 (libcpp_a_SOURCES): Add directives-only.c.
6507 2007-07-04 Uros Bizjak <ubizjak@gmail.com>
6509 * traditional.c (_cpp_scan_out_logical_line): Initialize
6510 fmacro.args, fmacro.node, fmacro.offset, fmacro.line and
6511 fmacro.args to prevent 'may be used uninitialized' warning.
6513 2007-07-03 Uros Bizjak <ubizjak@gmail.com>
6515 * include/cpplib.h (CPP_N_WIDTH_MD, CPP_N_MD_W, CPP_N_MD_Q):
6517 * expr.c (interpret_float_suffix): Process 'w', 'W', 'q' and 'Q'
6518 suffixes. Return CPP_N_MD_W for 'w' or 'W' suffixes and CPP_N_MD_Q
6519 for 'q' or 'Q' suffixes.
6521 2007-06-17 Danny Smith <dannysmith@users.sourceforge.net
6523 * files.c (open_file): Correct typo.
6525 2007-06-16 Vladimir Prus <vladimir@codesourcery.com>
6527 * files.c (open_file): Prevent the call
6528 for stat from overwriting errno.
6530 2007-06-09 Vladimir Prus <vladimir@codesourcery.com>
6532 * files.c (open_file): Account for the
6533 fact that on windows, opening a directory gives
6536 2007-06-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
6538 PR preprocessor/23479
6539 * expr.c (cpp_classify_number): Implement 0b-prefixed binary
6541 (append_digit): Likewise.
6542 * include/cpplib.h: Add CPP_N_BINARY, to be used for 0b-prefixed
6543 binary integer constants.
6545 2007-05-31 Dave Korn <dave.korn@artimi.com>
6547 PR preprocessor/14331
6548 * lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.
6550 2007-05-24 Ollie Wild <aaw@google.com>
6552 * macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
6553 * pch.c (cpp_write_pch_deps): Save __COUNTER__ state.
6554 (cpp_write_pch_state): Save __COUNTER__ state.
6555 (cpp_valid_state): Check valid __COUNTER__ state.
6556 (cpp_read_state): Read new __COUNTER__ state.
6557 * include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator.
6558 * init.c (builtin_array): Add __COUNTER__/BT_COUNTER.
6559 * internal.h (struct cpp_reader): Add counter member.
6561 2007-05-23 Simon Martin <simartin@users.sourceforge.net>
6563 PR preprocessor/20077
6564 * macro.c (create_iso_definition): Fixed the method to determine
6565 whether the token-pasting operator appears at the beginning or the end
6568 2007-05-21 Ian Lance Taylor <iant@google.com>
6570 * internal.h (struct cpp_reader): Add new fields:
6571 nonexistent_file_hash and nonexistent_file_ob.
6572 * files.c: Include "obstack.h".
6573 (find_file_in_dir): Before trying to open the file, look up the
6574 path name in the hash table of nonexistent files. After failing
6575 to open the file, add the path name to the hash table.
6576 (_cpp_find_file): Cache the results of looking up the file name
6577 starting with the quote and bracket chain heads, if we can.
6578 (nonexistent_file_hash_eq): New static function.
6579 (_cpp_init_files): Initialize pfile->nonexistent_file_hash and
6580 pfile->nonexistent_file_ob.
6581 (_cpp_cleanup_files): Free pfile->nonexistent_file_hash and
6582 pfile->nonexistent_file_ob.
6584 2007-05-14 Janis Johnson <janis187@us.ibm.com>
6586 * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
6589 * expr.c (interpret_float_suffix): Check for invalid suffix.
6591 2007-05-02 Eric Christopher <echristo@apple.com>
6593 * expr.c (num_div_op): Don't overflow if the result is
6596 2007-05-02 Tom Tromey <tromey@redhat.com>
6598 PR preprocessor/28709
6599 * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.
6601 2007-03-30 Michael Meissner <michael.meissner@amd.com>
6603 * directives.c (lex_macro_node_from_str): Fix alloca call to be
6606 2007-03-30 Richard Henderson <rth@redhat.com>
6608 * directives.c (lex_macro_node_from_str): New.
6609 (cpp_push_definition, cpp_pop_definition): New.
6610 * include/cpplib.h (cpp_push_definition, cpp_pop_definition): Declare.
6612 2007-03-01 Brooks Moses <brooks.moses@codesourcery.com>
6614 * Makefile.in: Add dummy install-pdf target.
6616 2007-01-30 Tom Tromey <tromey@redhat.com>
6618 PR preprocessor/30468
6619 * mkdeps.c (apply_vpath): Strip successive '/'s if we stripped
6622 2007-01-30 Tom Tromey <tromey@redhat.com>
6624 PR preprocessor/29966
6625 * macro.c (lex_expansion_token): Save and restore cpp_reader's
6627 (_cpp_create_definition): Don't restore cur_token here.
6628 * lex.c (_cpp_lex_token): Added assertion.
6630 2007-01-27 Tom Tromey <tromey@redhat.com>
6632 * configure: Rebuilt.
6634 2007-01-12 Tom Tromey <tromey@redhat.com>
6636 PR preprocessor/28227
6637 * directives.c (lex_macro_node): Added 'is_def_or_undef'
6639 (do_define): Update.
6642 (do_ifndef): Update.
6644 2007-01-11 Paolo Bonzini <bonzini@gnu.org>
6646 * configure: Regenerate.
6648 2007-01-11 Paolo Bonzini <bonzini@gnu.org>
6650 * configure: Regenerate.
6652 2007-01-04 Tom Tromey <tromey@redhat.com>
6654 PR preprocessor/28165
6655 * internal.h (cpp_in_primary_file): New function.
6656 * directives.c (do_include_next): Use cpp_in_primary_file.
6657 (do_pragma_once): Likewise.
6658 (do_pragma_system_header): Likewise.
6660 2006-12-29 Ian Lance Taylor <iant@google.com>
6662 * lex.c (_cpp_clean_line): Add uses of __builtin_expect. Don't
6663 look backward at the end of the line unless we saw a backslash.
6665 2006-12-29 Jakub Jelinek <jakub@redhat.com>
6667 PR preprocessor/29612
6668 * directives.c (do_linemarker): Set pfile->buffer->sysp always, not
6669 only when new_sysp is non-zero.
6671 2006-12-28 Tom Tromey <tromey@redhat.com>
6673 PR preprocessor/30001
6674 * charset.c (_cpp_convert_input): Check that to.len is greater
6677 2006-11-20 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
6679 * configure.ac (need_64bit_hwint): Need 64bit hwint for SPU.
6680 * configure: Rebuilt.
6682 2006-11-01 Douglas Gregor <doug.gregor@gmail.com>
6684 * include/cpplib.h (enum c_lang): Add CLK_GNUCXX0X and CLK_CXX0X
6685 for experimental C++0x mode.
6686 * init.c (lang_defaults): Add defaults for C++0x modes. C++0x has
6687 adopted the preprocessor changes introduced in C99.
6689 2006-10-29 Joseph Myers <joseph@codesourcery.com>
6691 * configure.ac (need_64bit_hwint): Set for i[34567]86-*-linux*
6692 depending on --enable-targets=all.
6693 * configure: Regenerate.
6695 2006-10-12 Jakub Jelinek <jakub@redhat.com>
6697 PR preprocessor/28709
6698 * macro.c (paste_tokens): Do error reporting here, use BUF with the
6699 spelled LHS token as opposed to spelling it again.
6700 (paste_all_tokens): Don't report errors here, just break on failure.
6702 2006-10-10 Brooks Moses <bmoses@stanford.edu>
6704 * Makefile.in: Added empty "pdf" target.
6706 2006-09-22 Geoffrey Keating <geoffk@apple.com>
6708 * configure.ac: Make need_64_bit_hwint case for x86-darwin
6709 match exactly the glob in gcc/config.gcc.
6710 * configure: Regenerate.
6712 2006-09-13 Joseph S. Myers <joseph@codesourcery.com>
6715 PR preprocessor/14634
6716 * lex.c (lex_string): Pedwarn for unterminated literals.
6718 2006-09-08 Eric Christopher <echristo@apple.com>
6720 * configure.ac: Add 64-bit HWI support for i?86-darwin.
6722 2006-08-14 Steve Ellcey <sje@cup.hp.com>
6726 * include/cpplib.h: Remove <?, >?, <?=, and >?= tokens.
6727 (CPP_LAST_EQ): Change.
6728 (CPP_LAST_PUNCTUATOR): Change.
6729 * expr.c (cpp_operator): Remove MIN and MAX.
6730 (reduce): Remove CPP_MIN and CPP_MAX.
6731 (num_binary_op): Ditto.
6732 * lex.c (_cpp_lex_direct): Ditto.
6733 (cpp_avoid_paste): Remove ? as legal symbol after > or <.
6735 2006-06-09 Jakub Jelinek <jakub@redhat.com>
6737 PR preprocessor/27746
6738 * directives.c (do_pragma): Handle pragma with valid namespace
6739 and invalid name coming from macro expansion.
6740 * directives.c (destringize_and_run): Initialize next field in
6745 * directives.c (destringize_and_run): Set NO_EXPAND on the
6748 * macro.c (_cpp_backup_tokens): Fix comment typo.
6750 2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
6752 * Makefile.in (CATALOGS): Add po/ prefix.
6753 * configure: Regenerated.
6755 2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
6757 * Makefile.in: Add install-html target. Add install-html to .PHONY
6759 2006-02-17 Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com>
6761 * macro.c (_cpp_builtin_macro_text): Handle BT_TIMESTAMP.
6762 * files.c (_cpp_get_file_stat): New function.
6763 * include/cpplib.h (builtin_type): Add BT_TIMESTAMP.
6764 * init.c (builtin_array): Add support for __TIMESTAMP__/BT_TIMESTAMP.
6765 * internal.h (_cpp_get_file_stat): Prototype.
6766 (struct cpp_buffer): Add timestamp.
6768 2006-01-23 Jakub Jelinek <jakub@redhat.com>
6770 PR preprocessor/25717
6771 * init.c (cpp_init_builtins): If __STDC__ will not change value
6772 between system headers and other sources, define it as a normal
6773 macro rather than a builtin.
6774 * macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check
6775 cpp_in_system_header condition.
6777 2006-01-05 Paolo Bonzini <bonzini@gnu.org>
6779 * Makefile.in: Use -MMD instead of -MD.
6781 2006-01-04 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
6782 Richard Henderson <rth@redhat.com>
6784 Merge from gomp branch:
6785 * directives.c (struct pragma_entry): Add is_deferred. Add ident
6786 entry to value union.
6787 (end_directive): Don't eat the line if in_deferred_pragma.
6788 (run_directive): Remove pragma hacks.
6789 (insert_pragma_entry): Remove.
6790 (new_pragma_entry): New.
6791 (register_pragma_1): Split out of register_pragma. Only handle
6792 the lookup tree and return the new entry.
6793 (cpp_register_pragma): Fill in the pragma entry here.
6794 (cpp_register_deferred_pragma): New.
6795 (register_pragma_internal): New.
6796 (_cpp_init_internal_pragmas): Use register_pragma_internal.
6797 (do_pragma): Allow pragma expansion after namespace. For deferred
6798 pragmas, don't slurp the line into a string.
6799 (destringize_and_run): Save tokens for deferred pragmas.
6800 (cpp_handle_deferred_pragma): Remove.
6801 * macro.c (builtin_macro): Remove pragma token hack.
6802 (_cpp_push_token_context): Rename from push_token_context and export.
6803 * internal.h (struct lexer_state): Add pragma_allow_expansion.
6804 (_cpp_push_token_context): Declare.
6805 * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return
6806 a token. Update the line number correctly if so.
6807 (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens.
6808 (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas.
6809 * include/cpplib.h (PRAGMA_EOL): New.
6810 (CPP_TOKEN_FLD_PRAGMA): New.
6811 (struct cpp_token): Add val.pragma.
6812 (struct cpp_options): Remove defer_pragmas.
6813 (cpp_handle_deferred_pragma): Remove.
6814 (cpp_register_deferred_pragma): Declare.
6816 2006-01-01 Jakub Jelinek <jakub@redhat.com>
6819 * directives.c (do_pragma): If pragma line ends with multi-line
6820 block comment, end the saved deferred pragma string before that
6821 comment. Handle embedded '\0' chars on the pragma line.
6823 2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
6826 * include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure.
6828 2005-12-07 Jon Grimm <jgrimm2@us.ibm.com>
6829 Ben Elliston <bje@au.ibm.com>
6831 * include/cpplib.h (CPP_N_DFLOAT): New.
6832 * expr.c (interpret_float_suffix): Identify df, dd, and dl
6833 suffixes as decimal floating point constants.
6834 (cpp_classify_number): Disallow hexadecimal DFP constants.
6836 2005-11-14 Gerald Pfeifer <gerald@pfeifer.com>
6837 Ian Lance Taylor <ian@airs.com>
6839 * include/cpplib.h (struct cpp_callbacks): Annotate error with
6840 ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0).
6842 2005-11-09 Per Bothner <per@bothner.com>
6843 Uros Bizjak <uros@kss-loka.si>
6846 * init.c (read_original_filename): Temporarily set
6847 state.in_directive before calling _cpp_lex_direct for
6850 2005-11-03 James E Wilson <wilson@specifix.com>
6852 PR preprocessor/24202
6853 * files.c (_cpp_pop_file_buffer): Set buffer_valid to false.
6855 2005-11-04 Joseph S. Myers <joseph@codesourcery.com>
6857 * include/cpplib.h (struct cpp_callbacks): Make error take
6859 * errors.c (cpp_error): Update call to callback.
6861 2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
6863 PR preprocessor/22042
6864 * macro.c (_cpp_builtin_macro_text): Lower the needed max
6866 (cpp_quote_string): Don't octalify non printable
6869 2005-11-03 Joseph S. Myers <joseph@codesourcery.com>
6872 * include/cpplib.h (struct cpp_options): Add client_diagnostic.
6873 (struct cpp_callbacks): Add error.
6874 * errors.c (cpp_error): If client_diagnostic, use error callback.
6875 * charset.c (convert_escape): Don't use %03o in diagnostic.
6877 2005-10-21 James E Wilson <wilson@specifix.com>
6879 PR preprocessor/15220
6880 * files.c (_cpp_find_file): New parameter angle_brackets. Fix all
6881 callers. Pass to open_file_failed.
6882 (open_file_failed): New parameter angle_brackets. Fix all callers.
6883 Use in print_dep assignment.
6884 * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file.
6885 * internal.h (_cpp_find_file): Add new parm to declaration.
6887 2005-10-08 Kazu Hirata <kazu@codesourcery.com>
6889 * configure.ac: Require 64-bit int for arm*-*-*eabi*.
6890 * configure: Regenerate.
6892 2005-10-04 Ian Lance Taylor <ian@airs.com>
6894 PR preprocessor/13726
6895 * directives.c (check_eol_return_comments): New static function.
6896 (parse_include): Add buf parameter. Change all callers.
6897 (do_include_common): If not discard comments, turn on
6898 save_comments. Pass collected comments to include callback.
6899 * include/cpplib.h (struct cpp_callbacks): Add new parameter to
6900 include callback: cpp_token list.
6902 2005-09-20 Joseph S. Myers <joseph@codesourcery.com>
6904 * include/cpplib.h (struct cpp_options): Add extended_identifiers.
6905 * init.c (struct lang_flags, lang_defaults): Add
6906 extended_identifiers.
6907 (cpp_set_lang): Use it.
6908 * lex.c (forms_identifier_p): Check extended_identifiers.
6910 2005-08-30 Jakub Jelinek <jakub@redhat.com>
6912 PR preprocessor/20348
6913 PR preprocessor/20356
6914 * files.c (_cpp_find_file, search_cache): Revert 2004-06-26 and
6917 2005-07-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
6919 * configure.ac (ACX_PROG_CC_WARNING_OPTS): add
6920 -Wmissing-format-attribute.
6922 * configure: Regenerate.
6924 2005-06-29 Kelley Cook <kcook@gcc.gnu.org>
6926 * all files: Update FSF address in copyright headers.
6927 * makeucnid.c (write_copyright): Update outputted FSF address.
6929 2005-06-13 Zack Weinberg <zack@codesourcery.com>
6931 * configure.ac: Invoke ZW_CREATE_DEPDIR and
6932 ZW_PROG_COMPILER_DEPENDENCIES.
6933 * aclocal.m4, configure: Regenerate.
6934 * Makefile.in (DEPMODE, DEPDIR, depcomp, COMPILE.base, COMPILE):
6936 (distclean): Clean up $(DEPDIR) and its contents.
6937 (.c.o): Use $(COMPILE).
6938 Include $(DEPDIR)/*.Po for most object->header dependencies.
6940 2005-05-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
6942 * configure.ac: Check declarations for asprintf and vasprintf.
6943 * config.in: Regenerate.
6944 * configure: Likewise.
6946 * charset.c (conversion_loop): Use XRESIZEVEC.
6947 (convert_no_conversion): Likewise.
6948 (convert_using_iconv): Likewise.
6949 (init_iconv_desc): Cast return value of alloca.
6950 (cpp_host_to_exec_charset): Use XNEWVEC.
6951 (emit_numeric_escape): Use XRESIZEVEC.
6952 (cpp_interpret_string): Use XNEWVEC.
6953 (cpp_interpret_string): Use XRESIZEVEC.
6954 (_cpp_interpret_identifier): Cast return value of alloca.
6955 (_cpp_convert_input): Use XNEWVEC and XRESIZEVEC.
6956 * directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC.
6957 (parse_include): Use XNEWVEC.
6958 (insert_pragma_entry): Rename local variable "new" to
6960 (save_registered_pragmas): Cast return value of xmemdup.
6961 (destringize_and_run): Same for alloca.
6962 (parse_assertion): Likewise.
6963 (do_assert): Cast allocated storage to proper type.
6964 (cpp_define): Likewise.
6965 (_cpp_define_builtin): Likewise.
6966 (cpp_undef): Likewise.
6967 (handle_assertion): Likewise.
6968 (cpp_push_buffer): Rename local variable "new" to "new_buffer".
6969 * expr.c (CPP_UPLUS): Cast value to type cpp_ttype.
6970 (CPP_UMINUS): Likewise.
6971 (struct cpp_operator): Rename from struct operator.
6972 (_cpp_expand_op_stack): Use XRESIZEVEC.
6973 * files.c (pch_open_file): Use XNEWVEC.
6974 (pch_open_file): Use XRESIZEVEC.
6975 (read_file_guts): Use XNEWVEC and XRESIZEVEC.
6976 (dir_name_of_file): Use XNEWVEC.
6977 (make_cpp_file): Use XCNEW.
6978 (make_cpp_dir): Likewise.
6979 (allocate_file_hash_entries): USE XNEWVEC.
6980 (cpp_included): Cast return value of htab_find_with_hash.
6981 (append_file_to_dir): Use XNEWVEC.
6982 (read_filename_string): Likewise. Use XRESIZEVEC too.
6983 (read_name_map): Cast return value of alloca. Use XRESIZEVEC.
6984 (remap_filename): Use XNEWVEC.
6985 (struct pchf_entry): Move definition out of struct pchf_data.
6986 (_cpp_save_file_entries): Use XCNEWVAR.
6987 (_cpp_read_file_entries): Use XNEWVAR.
6988 * identifiers.c (alloc_node): Use XOBNEW.
6989 * init.c (cpp_create_reader): Use XCNEW.
6990 (cpp_init_builtins): Cast of b->value to enum builtin_type.
6991 (read_original_directory): Cast return value of alloca.
6992 * lex.c (add_line_note): Use XRESIZEVEC.
6993 (warn_about_normalization): Use XNEWVEC.
6994 (_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype).
6995 (new_buff): Use XNEWVEC.
6996 * line-map.c (linemap_add): Use XRESIZEVEC.
6997 * macro.c (builtin_macro): Cast return value of alloca.
6998 (paste_tokens): Likewise.
6999 (expand_arg): Use XNEWVEC and XRESIZEVEC.
7000 (_cpp_save_parameter): Use XRESIZEVEC.
7001 (create_iso_definition): Cast allocated storage to proper type.
7002 (_cpp_create_definition): Likewise.
7003 (cpp_macro_definition): Use XRESIZEVEC.
7004 * makedepend.c (add_clm): Use XNEW.
7005 (add_dir): Likewise.
7006 * mkdeps.c (munge): Use XNEWVEC.
7007 (deps_init): Use XCNEW.
7008 (deps_add_target): Use XRESIZEVEC.
7009 (deps_add_default_target): Cast return value of alloca.
7010 (deps_add_dep): Use XRESIZEVEC.
7011 (deps_add_vpath): Likewise. Use XNEWVEC too.
7012 (deps_restore): Likewise.
7013 * pch.c (save_idents): Use XNEW and XNEWVEC.
7014 (cpp_save_state): Use XNEW.
7015 (count_defs): Cast return value of htab_find.
7016 (write_defs): Likewise.
7017 (cpp_write_pch_deps): Use XNEWVEC.
7018 (collect_ht_nodes): Use XRESIZEVEC.
7019 (cpp_valid_state): Use XNEWVEC.
7020 (save_macros): Use XRESIZEVEC. Cast return value of xmemdup.
7021 * symtab.c (ht_create): Use XCNEW.
7022 (ht_lookup_with_hash): Cast return value of obstack_copy0.
7023 (ht_expand): Use XCNEWVEC.
7024 * system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus.
7025 (bool): Do not define if __cplusplus.
7027 2005-05-12 Zack Weinberg <zack@codesourcery.com>
7029 * directives.c (#sccs table entry): Mark IN_I, consistent with #ident.
7030 (do_sccs): Delete function definition, #define to do_ident.
7031 (do_ident): Don't hardwire directive name.
7033 2005-05-12 Ryota Kunisawa <kunisawa@access.co.jp>
7036 * configure: Regenerate.
7038 2005-04-27 Andris Pavenis <pavenis@latnet.lv>
7040 * files.c: Include io.h for DJGPP to get prototype of setmode.
7042 2005-04-19 Per Bothner <per@bothner.com>
7044 PR preprocessor/20907
7045 * line-map.c (linemap_line_start): Fix bug when we need to increse
7046 column_bits but can re-use the current line_map.
7048 2005-04-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
7050 * system.h (fopen, fdopen, freopen): Define these to the unlocked
7051 libiberty functions.
7053 2005-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
7055 * configure.ac (libcpp_UNLOCKED_FUNCS): New.
7056 (AC_CHECK_FUNCS, AC_CHECK_DECLS): Check for libcpp_UNLOCKED_FUNCS.
7057 * system.h (putchar, getc, getchar, clearerr, feof, fileno,
7058 fflush, fgetc, fgets, ferror, fread): Redefine to the associated
7060 (fwrite_unlocked): Fix prototype.
7062 * configure, config.in: Regenerate.
7064 2005-04-05 Jakub Jelinek <jakub@redhat.com>
7066 PR preprocessor/19475
7067 * macro.c (create_iso_definition): For < ISO C99, don't
7068 pedwarn if there is no whitespace between macro name and its
7069 replacement, but the replacement starts with a basic character
7072 2005-03-28 Andreas Jaeger <aj@suse.de>
7074 * lex.c (warn_about_normalization): Cast field width to int to
7077 2005-03-19 Joseph S. Myers <joseph@codesourcery.com>
7079 * configure.ac: Consistently use solaris2.1[0-9]* instead of
7081 * configure: Regenerate.
7083 2005-03-15 Geoffrey Keating <geoffk@apple.com>
7085 * charset.c (_cpp_valid_ucn): In identifiers, reject a partial
7086 UCN rather than printing an error.
7088 2005-03-14 Geoffrey Keating <geoffk@apple.com>
7090 * lex.c (forms_identifier_p): Disable UCNs in C89 mode.
7092 2005-03-14 Geoffrey Keating <geoffk@apple.com>
7094 * init.c (cpp_create_reader): Default warn_normalize to normalized_C.
7095 * charset.c: Update for new format of ucnid.h.
7096 (ucn_valid_in_identifier): Update for new format of ucnid.h.
7097 Add NST parameter, and update it; update callers.
7098 (cpp_valid_ucn): Add NST parameter, update callers. Replace abort
7100 (convert_ucn): Pass normalize_state to cpp_valid_ucn.
7101 * internal.h (struct normalize_state): New.
7102 (INITIAL_NORMALIZE_STATE): New.
7103 (NORMALIZE_STATE_RESULT): New.
7104 (NORMALIZE_STATE_UPDATE_IDNUM): New.
7105 (_cpp_valid_ucn): New.
7106 * lex.c (warn_about_normalization): New.
7107 (forms_identifier_p): Add normalize_state parameter, update callers.
7108 (lex_identifier): Add normalize_state parameter, update callers. Keep
7110 (lex_number): Likewise.
7111 (_cpp_lex_direct): Pass normalize_state to subroutines. Check
7112 it with warn_about_normalization.
7116 * ucnid.tab: Make appropriate for input to makeucnid.c. Remove
7117 comments about obsolete version of C++.
7118 * include/cpplib.h (enum cpp_normalize_level): New.
7119 (struct cpp_options): Add warn_normalize field.
7121 2005-03-11 Geoffrey Keating <geoffk@apple.com>
7123 * directives.c (glue_header_name): Update call to cpp_spell_token.
7124 * internal.h (_cpp_interpret_identifier): New.
7125 * charset.c (_cpp_interpret_identifier): New.
7126 (_cpp_valid_ucn): Allow UCN version of '$'.
7127 * lex.c (lex_identifier): Add extra parameter to indicate if initial
7128 character was '$' or '\'. Support identifiers with UCNs.
7129 (forms_identifier_p): Allow UCNs.
7130 (_cpp_lex_direct): Pass extra parameter to lex_identifier.
7132 (cpp_spell_token): Add FORSTRING parameter. Use it.
7133 (cpp_token_as_text): Update call to cpp_spell_token.
7134 (cpp_output_token): Write UCNs back out.
7135 (stringify_arg): Update call to cpp_spell_token.
7136 (paste_tokens): Likewise.
7137 (cpp_macro_definition): Likewise.
7138 * macro.c (stringify_arg): Likewise.
7139 (paste_tokens): Likewise.
7140 (cpp_macro_definition): Likewise.
7141 * include/cpplib.h: Add parameter to cpp_spell_token.
7143 2005-03-04 Jakub Jelinek <jakub@redhat.com>
7147 * macro.c (replace_args, cpp_get_token): Copy whole
7148 cpp_token_u instead of just cpp_string field from it.
7150 2005-02-28 Devang Patel <dpatel@apple.com>
7152 * directives.c (do_line): Save sysp early before line table is
7155 2005-02-20 Zack Weinberg <zack@codesourcery.com>
7158 * charset.c (LAST_POSSIBLY_BASIC_SOURCE_CHAR): New helper macro.
7159 (cpp_host_to_exec_charset): New function.
7160 * include/cpplib.h: Declare cpp_host_to_exec_charset.
7162 2005-02-19 Devang Patel <dpatel@apple.com>
7164 * charset.c (_cpp_convert_input): Check '\r' before inserting
7167 2005-02-15 Eric Christopher <echristo@redhat.com>
7169 PR preprocessor/19077
7170 * macro.c (cpp_macro_definition): Move handling of whitespace
7171 to PREV_WHITE conditional. Remove overloading of len
7174 2005-02-14 Kazu Hirata <kazu@cs.umass.edu>
7176 * directives.c, files.c, init.c, internal.h, macro.c, pch.c,
7177 traditional.c: Update copyright.
7179 2005-02-14 Paolo Bonzini <bonzini@gnu.org>
7182 * configure.ac: Check for declaration of basename and getopt.
7183 * config.in: Regenerate.
7184 * configure: Regenerate.
7185 * internal.h (ustrcspn): New.
7186 * macro.c (create_iso_definition): Fix allocation of memory.
7187 (padding_token): Add cast to remove const-ness.
7188 * pch.c (cpp_read_state): Use ustrcspn.
7190 2005-02-08 Mike Stump <mrs@apple.com>
7192 * files.c (pchf_adder): Remove.
7193 (struct pchf_adder_info): Likewise.
7194 (_cpp_save_file_entries): Write out all files so that #import works.
7196 2005-01-23 Joseph S. Myers <joseph@codesourcery.com>
7198 * configure: Regenerate.
7200 2005-01-11 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
7202 * include/cpplib.h (c_lang): Fix comment to say cpp_create_reader.
7204 * include/cpplib.h: Also update copyright years.
7206 2005-01-03 Geoffrey Keating <geoffk@apple.com>
7208 * files.c (_cpp_find_file): Add files found by search_path_exhausted
7209 to the list of all files.
7211 2005-01-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
7213 * internal.h: Update references to Cpp lib filenames.
7214 * directives.c: Likewise.
7216 * macro.c: Likewise.
7217 * traditional.c: Likewise.
7219 2004-12-15 Eric Botcazou <ebotcazou@libertysurf.fr>
7221 PR preprocessor/15167
7222 * files.c (destroy_cpp_file): New function.
7223 (should_stack_file): Make a new file if the
7224 compared file is still stacked.
7226 2004-11-28 Nathanael Nerode <neroden@gcc.gnu.org>
7228 PR preprocessor/17610
7229 * directives.c (do_include_common): Error out if an empty filename
7230 is given for #include (or #include_next or #import).
7232 2004-11-27 Roger Sayle <roger@eyesopen.com>
7233 Zack Weinberg <zack@codesourcery.com>
7235 * internal.h: Replace all uses of uchar with unsigned char.
7236 * include/cpp-id-data.h: Likewise. Guard typedef of uchar
7237 with !IN_GCC, so uchar is only defined whilst building libcpp.
7239 2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
7241 * aclocal.m4: Regenerate.
7243 2004-11-24 Roger Sayle <roger@eyesopen.com>
7245 PR preprocessor/15824
7246 * configure.ac: Correct HAVE_UCHAR test to #include <sys/types.h>
7247 directly, instead of the non-existant "system.h" and "ansidecl.h".
7248 * configure: Regenerate.
7250 2004-11-23 Daniel Jacobowitz <dan@codesourcery.com>
7251 Joseph Myers <joseph@codesourcery.com>
7253 * internal.h (struct lexer_state): Add in_deferred_pragma.
7254 * directives.c (struct pragma_entry): Add allow_expansion.
7255 (insert_pragma_entry): Take allow_expansion flag.
7256 (register_pragma): Likewise.
7257 (cpp_register_pragma): Likewise.
7258 (_cpp_init_internal_pragmas): Update calls to cpp_register_pragma.
7259 (do_pragma): Honor allow_expansion.
7260 (cpp_handle_deferred_pragma): Set in_deferred_pragma.
7261 * include/cpplib.h (cpp_register_pragma): Update prototype.
7263 2004-11-18 Daniel Jacobowitz <dan@codesourcery.com>
7264 Mark Mitchell <mark@codesourcery.com>
7266 * configure.ac (i[34567]86-*-solaris2.1[0-9]*): Set
7267 need_64bit_hwint=yes.
7268 * configure: Regenerate.
7270 2004-11-09 Joseph S. Myers <joseph@codesourcery.com>
7272 * Makefile.in ($(PACKAGE).pot): New rule. Depend on
7274 (po/$(PACKAGE).pot): Use ":" instead of "," in --keyword
7275 arguments. Add keywords _, N_, SYNTAX_ERROR and SYNTAX_ERROR2.
7276 Remove local srcdir path from generated file.
7278 2004-11-04 Zack Weinberg <zack@codesourcery.com>
7279 Gerald Pfeifer <gerald@pfeifer.com>
7281 * internal.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H
7284 2004-10-27 Zack Weinberg <zack@codesourcery.com>
7287 * directives.c (do_pragma): Do not defer pragmas which are unknown.
7288 (cpp_handle_deferred_pragma): Add cast to silence warning.
7290 2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk>
7292 * errors.c (_cpp_begin_message): Print "error: " for errors.
7294 2004-10-10 Andreas Jaeger <aj@suse.de>
7296 * makedepend.c: Include mkdeps.h for prototype of deps_add_vpath.
7297 * Makefile.in (makedepend.o): Add dependency on mkdeps.h.
7299 2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
7301 * pch.c (cpp_write_pch_state): Remove variable z as it is not
7303 (cpp_read_state): Remove unused variables, m, d and mac_count.
7305 2004-09-29 Per Bothner <per@bothner.com>
7307 * directives.c (cpp_handle_deferred_pragma): Save, clear and restore
7308 cb.line_change. Otherwise do_pragma will call the line_change
7309 call-back with a meaningless line number.
7311 2004-09-24 Zack Weinberg <zack@codesourcery.com>
7313 * configure.ac: Move AC_PROG_MAKE_SET, AC_PROG_INSTALL to
7314 programs cluster. Use ACX_PROG_CC_WARNING_OPTS,
7315 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC, ACX_PROG_CC_WARNINGS_ARE_ERRORS.
7316 * aclocal.m4, configure: Regenerate.
7317 * init.c: Include localedir.h.
7318 * Makefile.in (WARN_CFLAGS, ALL_CFLAGS): New variables.
7320 (.c.o): Use $(ALL_CFLAGS).
7321 (localedir.h, localedir.hs): New rules.
7322 (clean): Use rm -rf to remove directories.
7323 (distclean): Also delete localedir.h and localedir.hs.
7324 (init.o): Update dependencies.
7326 2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
7328 * Makefile.in (aclocal.m4): Update dependencies.
7329 * configure.ac (AC_CONFIG_MACRO_DIR): New.
7330 * aclocal.m4, configure: Regenerate.
7332 2004-09-17 Zack Weinberg <zack@codesourcery.com>
7334 * charset.c (_cpp_destroy_iconv, emit_numeric_escape)
7335 (_cpp_convert_input, _cpp_default_encoding): Add comments.
7336 Some other comments in this file also tweaked.
7338 * directives.c (do_pragma): Save current buffer position
7339 before lexing the pragma keywords; don't call
7340 _cpp_backup_tokens in the defer_pragmas case.
7342 2004-09-15 Per Bothner <per@bothner.com>
7344 * include/line-map.h (line_map_start): Add parameter names so
7345 preceding comment makes sense.
7346 (linemap_add): Remove from comment mention of non-existing parameter.
7348 2004-09-09 Matt Austern <austern@apple.com>
7349 Zack Weinberg <zack@codesourcery.com>
7351 * include/cpplib.h (TTYPE_TABLE): Remove CPP_ and SPELL_
7352 prefixes throughout. Add entry for PRAGMA. Remove
7353 unnecessary "= 0" from EQ.
7354 (enum cpp_ttype): Adjust OP and TK definitions to restore
7355 prefixes, via token-paste.
7356 (CPP_LAST_EQ, CPP_FIRST_DIGRAPH, CPP_LAST_PUNCTUATOR, CPP_LAST_CPP_OP):
7357 Change from #defines to additional cpp_ttype enumerators.
7358 (struct cpp_options): Add defer_pragmas.
7359 (cpp_handle_deferred_pragma): Prototype new interface.
7361 * internal.h (struct cpp_reader): Add directive_result.
7362 * directives.c (struct pragma_entry): Add is_internal field;
7363 give boolean fields type bool.
7364 (start_directive): Initialize pfile->directive_result.type.
7365 (_cpp_do__Pragma): Likewise.
7366 (run_directive): Do not crash if pfile->buffer->prev is NULL.
7367 (insert_pragma_entry): Add 'internal' argument; set new->is_internal
7369 (register_pragma): New static function, bulk of former
7370 cpp_register_pragma here; add 'internal' argument, pass along
7371 to insert_pragma_entry.
7372 (cpp_register_pragma): Now a wrapper around register_pragma which
7373 always passes false for 'internal' argument.
7374 (_cpp_init_internal_pragmas): Call register_pragma directly, passing
7375 true for 'internal'.
7376 (do_pragma): If CPP_OPTION (pfile, defer_pragmas) and this isn't
7377 an internal pragma, save text till the end of the line as a CPP_PRAGMA
7378 token instead of executing the pragma.
7379 (cpp_handle_deferred_pragma): New interface.
7380 * lex.c (token_spellings): Adjust OP and TK definitions to
7381 match changes to cpplib.h.
7382 (_cpp_lex_token): Check for a directive-result token and
7383 return it if present.
7384 (cpp_token_val_index): Handle CPP_PRAGMA.
7385 * macro.c (cpp_builtin_macro_text): Correct comment.
7386 (builtin_macro): Handle directive-result tokens from _cpp_do__Pragma.
7388 2004-09-06 Serge Belyshev <belyshev@lubercy.com>
7390 PR preprocessor/14699
7391 * symtab.c (ht_dump_statistics): Change type of sum_of_squares
7392 from size_t to double.
7394 2004-08-28 Andreas Schwab <schwab@suse.de>
7395 Andreas Jaeger <aj@suse.de>
7397 * configure.ac: Set PACKAGE correctly.
7398 * configure: Regenerated.
7400 2004-08-25 Paolo Bonzini <bonzini@gnu.org>
7402 * Makefile.in: Add back top_builddir.
7404 2004-08-25 Paolo Bonzini <bonzini@gnu.org>
7406 * configure.ac: Replace Automake macro invocations
7407 with manual Autoconf checks and substitutions.
7408 * configure: Regenerate.
7409 * aclocal.m4: Regenerate.
7410 * config.in: Regenerate.
7411 * Makefile.am: Removed.
7412 * Makefile.in: Heavy simplification and reorganization.
7414 2004-08-09 Mark Mitchell <mark@codesourcery.com>
7416 * configure.ac (arm*-*-eabi*): New target.
7417 (arm*-*-symbianelf*): Likewise.
7418 * configure: Regenerated.
7420 2004-07-24 Bernardo Innocenti <bernie@develer.com>
7422 * internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Remove.
7423 * directives.c: Use XNEW-family macros from libiberty.
7425 * macro.c: Likewise.
7426 * cpplib.h (cpp_deps_style): Export enum with name.
7428 2004-07-23 Matthias Klose <doko@debian.org>
7430 * init.c (init_library): Use PACKAGE for the text domain.
7432 2004-07-16 Andris Pavenis <pavenis@latnet.lv>
7434 PR preprocessor/16366
7435 * internal.h (struct cpp_reader): New field dir_hash.
7436 * files.c (make_cpp_dir): Use dir_hash, not file_hash.
7437 (_cpp_init_files, _cpp_cleanup_files): Update for new field.
7439 2004-07-04 Neil Booth <neil@duron.akihabara.co.uk>
7441 PR preprocessor/16192
7442 PR preprocessor/15913
7443 PR preprocessor/15572
7444 * expr.c (_cpp_parse_expr): Handle remaining cases where an
7445 expression is missing.
7446 * init.c (post_options): Traditional cpp doesn't do // comments.
7448 2004-06-30 Per Bothner <per@bothner.com>
7450 * include/line-map.h (fileline): Remove old typedef.
7451 * internal.h (struct cpp_reader): Use source_location typedef instead.
7453 2004-06-26 Zack Weinberg <zack@codesourcery.com>
7455 Partially revert patch of 2004-06-05.
7456 * files.c (search_cache): Remove pfile argument. Don't check
7457 for file that would be found by "" or <> search here...
7458 (_cpp_find_file): ...do it here, before calling find_file_in_dir.
7459 Do not apply directory-of-current-file correction to files
7460 found by this check. Rearrange code slightly.
7462 2004-06-21 Geoffrey Keating <geoffk@apple.com>
7464 * files.c (should_stack_file): Correct swapped parameters to call
7466 * pch.c (cpp_valid_state): Handle -fpreprocessed.
7468 2004-06-15 Paolo Bonzini <bonzini@gnu.org>
7470 * Makefile.in: Regenerate with automake 1.8.5.
7471 * aclocal.m4: Likewise.
7472 * configure: Regenerate.
7474 2004-06-11 Zack Weinberg <zack@codesourcery.com>
7476 * configure.ac: Don't invoke ACX_HEADER_STDBOOL.
7477 * configure, config.in: Regenerate.
7478 * system.h: Unconditionally define bool as unsigned char,
7479 BOOL_BITFIELD as unsigned int.
7480 * .cvsignore: New file.
7482 2004-06-09 Geoffrey Keating <geoffk@apple.com>
7484 * traditional.c (push_replacement_text): Set macro->traditional.
7485 (save_replacement_text): Likewise.
7486 * pch.c (cpp_write_pch_state): Don't write list of defined macros.
7487 (struct save_macro_item): Delete.
7488 (struct save_macro_data): Use a character array not the previous
7490 (save_macros): Save macro as text not as internal structures.
7491 (cpp_prepare_state): Update for changes to save_macro_data.
7492 (cpp_read_state): Don't read macros defined in PCH. Restore
7494 * macro.c (create_iso_definition): Honour alloc_subobject.
7495 Clear traditional flag.
7496 (_cpp_create_definition): Honour alloc_subobject.
7497 * lex.c (cpp_token_val_index): New.
7498 * internal.h: Include cpp-id-data.h.
7499 (uchar): Move definition to cpp-id-data.h.
7501 (cpp_macro): Likewise.
7502 * directives.c (struct answer): Move to cpp-id-data.h.
7503 (do_assert): Honour alloc_subobject.
7505 * include/symtab.h (struct ht): Add field 'alloc_subobject'.
7506 * include/cpplib.h (struct cpp_string): Add GTY marker.
7507 (enum cpp_token_fld_kind): New.
7508 (struct cpp_token): Add GTY markers.
7509 (cpp_token_val_index): Prototype.
7510 (CPP_HASHNODE_VALUE_IDX): New.
7511 (struct cpp_hashnode): Don't skip fields of 'value' when marking.
7512 * include/cpp-id-data.h: New file.
7514 2004-06-09 Paolo Bonzini <bonzini@gnu.org>
7516 * Makefile.am (all-local): New.
7517 * Makefile.in: Regenerate.
7519 2004-06-06 Roger Sayle <roger@eyesopen.com>
7521 * Makefile.am (LIBICONV): Declare.
7522 (makedepend_LDADD): Use LIBICONV.
7523 * Makefile.in: Regenerate.
7525 2004-06-05 Andrew Pinski <pinskia@physics.uc.edu>
7527 * Makefile.am (LIBINTL): Declare
7528 (makedepend_LDADD): Use LIBINTL.
7529 * Makefile.in: Regenerate.
7531 2004-06-05 Zack Weinberg <zack@codesourcery.com>
7533 * Makefile.am: Add makedepend.
7534 * Makefile.in, aclocal.m4: Regenerate.
7535 * charset.c: Insert a space to avoid a warning.
7536 * directives.c: Include mkdeps.h.
7537 (_cpp_handle_directive): Reenable macro expander if appropriate.
7538 (undefine_macros): Inline body of _cpp_free_definition for speed.
7539 Do not call undef callback or _cpp_warn_if_unused_macro.
7540 (cpp_get_deps): New interface.
7541 * files.c (search_cache): Add pfile argument. Check for file
7542 that would be found by "" or <> search here...
7543 (_cpp_find_file): ...not here. Correct recorded start_dir of
7544 files found by directory-of-current-file search that would be
7545 found by "" or <> search.
7546 * init.c (cpp_add_dependency_target): Delete.
7547 * internal.h (struct lexer_state): Add discarding_output flag.
7548 * lex.c (lex_identifier): Compute hash function while scanning.
7549 * macro.c (cpp_scan_nooutput): Disable macro expansion outside
7551 * makedepend.c: New file.
7552 * mkdeps.c (struct deps): Add vpath vector.
7553 (apply_vpath, deps_add_vpath): New function.
7554 (deps_free): Free vpath vector.
7555 (deps_add_dep, deps_add_target): Use apply_vpath.
7556 * symtab.c (calc_hash): Use HT_HASHSTEP and HT_FINISH.
7557 (ht_lookup_with_hash): New function.
7558 * cpplib.h, mkdeps.h: Update prototypes.
7559 * symtab.h: Update prototypes.
7560 (HT_HASHSTEP, HT_FINISH): New macros.
7562 2004-05-29 Geoffrey Keating <geoffk@apple.com>
7564 * symtab.c (ht_create): Set entries_owned.
7565 (ht_destroy): Honour entries_owned.
7566 (ht_expand): Likewise.
7568 * include/symtab.h (struct ht): New field 'entries_owned'
7569 (ht_load): New prototype.
7571 2004-05-26 Paolo Bonzini <bonzini@gnu.org>
7574 * configure.ac: Fix m4 quoting when picking
7575 the size of HOST_WIDE_INT.
7576 * configure: Regenerate.
7578 2004-05-25 Paolo Bonzini <bonzini@gnu.org>
7580 * Makefile.am: the correct directory for
7581 gettext include files is given by @INCINTL@.
7582 * Makefile.in: Regenerate.
7584 2004-05-24 Paolo Bonzini <bonzini@gnu.org>
7586 * system.h [!ENABLE_NLS]: dgettext takes two
7589 2004-05-23 Paolo Bonzini <bonzini@gnu.org>
7591 Moved libcpp from the gcc subdirectory to the toplevel.
7592 * Makefile.am: New file.
7593 * Makefile.in: Regenerate.
7594 * configure.ac: New file.
7595 * configure: Regenerate.
7596 * config.in: Regenerate.
7597 * charset.c: Moved from gcc/cppcharset.c. Add note about
7598 brokenness of input charset detection. Adjust for change
7599 in name of cppucnid.h.
7600 * errors.c: Moved from gcc/cpperror.c. Do not include intl.h.
7601 * expr.c: Moved from gcc/cppexp.c.
7602 * files.c: Moved from gcc/cppfiles.c. Do not include intl.h.
7603 Remove #define of O_BINARY, it is in system.h.
7604 * identifiers.c: Moved from gcc/cpphash.c.
7605 * internal.h: Moved from gcc/cpphash.h. Change header
7606 guard name. All other files adjusted to match name change.
7607 * init.c: Moved from gcc/cppinit.c.
7608 (init_library) [ENABLE_NLS]: Call bindtextdomain.
7609 * lex.c: Moved from gcc/cpplex.c.
7610 * directives.c: Moved from gcc/cpplib.c.
7611 * macro.c: Moved from gcc/cppmacro.c.
7612 * pch.c: Moved from gcc/cpppch.c. Do not include intl.h.
7613 * traditional.c: Moved from gcc/cpptrad.c.
7614 * ucnid.h: Moved from gcc/cppucnid.h. Change header
7616 * ucnid.pl: Moved from gcc/cppucnid.pl.
7617 * ucnid.tab: Moved from gcc/cppucnid.tab. Change header
7619 * symtab.c: Moved from gcc/hashtable.c.
7620 * line-map.c: Moved from gcc. Do not include intl.h.
7621 * mkdeps.c: Moved from gcc.
7622 * system.h: New file.
7623 * include/cpplib.h: Moved from gcc. Change header guard name.
7624 * include/line-map.h: Moved from gcc. Change header guard name.
7625 * include/mkdeps.h: Moved from gcc. Change header guard name.
7626 * include/symtab.h: Moved from gcc/hashtable.h. Change header
7629 Copyright (C) 2004-2023 Free Software Foundation, Inc.
7631 Copying and distribution of this file, with or without modification,
7632 are permitted in any medium without royalty provided the copyright
7633 notice and this notice are preserved.