diff options
| author | mrg <mrg@NetBSD.org> | 2020-08-11 05:10:28 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2020-08-11 05:10:28 +0000 |
| commit | 5306d5447fbcfe9ab0e93e473785cb6aa3f4e0da (patch) | |
| tree | eccd4be48b6fade54ce0f8fc37d7f671bee3b5f4 /external/gpl3/gcc/dist/libcpp/include | |
| parent | e5c64bea106db558f6c45da5437be1624cd05a63 (diff) | |
import GCC 7.5.0. doing this here so that the vendor branch has
the code we'll merge into gcc.old and the netbsd-9 tree gcc tree.
GCC 8.4.0 will be imported immediately on top of this again,
restoring the current status.
these PRs in the GCC bugzilla are fixed with this update:
89869 80693 89795 84272 85593 86669 87148 87647 87895 88103 88107 88563
88870 88976 89002 89187 89195 89234 89303 89314 89354 89361 89403 89412
89512 89520 89590 89621 89663 89679 89704 89734 89872 89933 90090 90208
87075 85870 89009 89242 88167 80864 81933 85890 86608 87145 88857 89024
89119 89214 89511 89612 89705 89400 81740 82186 84552 86554 87609 88105
88149 88415 88739 88903 89135 89223 89296 89505 89572 89677 89698 89710
90006 90020 90071 90328 90474 91126 91162 91812 91887 90075 88998 89945
87047 87506 88074 88656 88740 91137 89008 84010 89349 91136 91347 91995
89397 87030 60702 78884 85594 87649 87725 88181 88470 88553 88568 88588
88620 88644 88906 88949 89246 89587 89726 89768 89796 89998 90108 90756
90950 91704 88825 88983 86538 51333 89446 90220 91308 92143 89392 90213
90278 91131 91200 91510 89037 91481 87673 88418 88938 88948 90547 27221
58321 61250 67183 67958 77583 83531 86215 88648 88720 88726 89091 89466
89629 90105 90329 90585 90760 90924 91087 89222 81956 71861 35031 69455
81849 82993 85798 88138 88155 88169 88205 88206 88228 88249 88269 88376
77703 80260 82077 86248 88393 90786 57048 66089 66695 67679 68009 71723
72714 84394 85544 87734 88298 90937 91557 63891 64132 65342 68649 68717
71066 71860 71935 77746 78421 78645 78865 78983 79485 79540 85953 88326
89651 90744
Diffstat (limited to 'external/gpl3/gcc/dist/libcpp/include')
| -rw-r--r-- | external/gpl3/gcc/dist/libcpp/include/cpp-id-data.h | 2 | ||||
| -rw-r--r-- | external/gpl3/gcc/dist/libcpp/include/line-map.h | 203 | ||||
| -rw-r--r-- | external/gpl3/gcc/dist/libcpp/include/mkdeps.h | 2 | ||||
| -rw-r--r-- | external/gpl3/gcc/dist/libcpp/include/symtab.h | 2 |
4 files changed, 90 insertions, 119 deletions
diff --git a/external/gpl3/gcc/dist/libcpp/include/cpp-id-data.h b/external/gpl3/gcc/dist/libcpp/include/cpp-id-data.h index 0299984efb7..1dcfb43cb48 100644 --- a/external/gpl3/gcc/dist/libcpp/include/cpp-id-data.h +++ b/external/gpl3/gcc/dist/libcpp/include/cpp-id-data.h @@ -1,5 +1,5 @@ /* Structures that hang off cpp_identifier, for PCH. - Copyright (C) 1986-2018 Free Software Foundation, Inc. + Copyright (C) 1986-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/external/gpl3/gcc/dist/libcpp/include/line-map.h b/external/gpl3/gcc/dist/libcpp/include/line-map.h index d6cf81627cc..522e8bb17eb 100644 --- a/external/gpl3/gcc/dist/libcpp/include/line-map.h +++ b/external/gpl3/gcc/dist/libcpp/include/line-map.h @@ -1,5 +1,5 @@ /* Map (unsigned int) keys to (source file, line, column) triples. - Copyright (C) 2001-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -26,41 +26,6 @@ along with this program; see the file COPYING3. If not see #define GTY(x) /* nothing */ #endif -/* Both gcc and emacs number source *lines* starting at 1, but - they have differing conventions for *columns*. - - GCC uses a 1-based convention for source columns, - whereas Emacs's M-x column-number-mode uses a 0-based convention. - - For example, an error in the initial, left-hand - column of source line 3 is reported by GCC as: - - some-file.c:3:1: error: ...etc... - - On navigating to the location of that error in Emacs - (e.g. via "next-error"), - the locus is reported in the Mode Line - (assuming M-x column-number-mode) as: - - some-file.c 10% (3, 0) - - i.e. "3:1:" in GCC corresponds to "(3, 0)" in Emacs. */ - -/* The type of line numbers. */ -typedef unsigned int linenum_type; - -/* A function for for use by qsort for comparing line numbers. */ - -inline int compare (linenum_type lhs, linenum_type rhs) -{ - /* Avoid truncation issues by using long long for the comparison, - and only consider the sign of the result. */ - long long diff = (long long)lhs - (long long)rhs; - if (diff) - return diff > 0 ? 1 : -1; - return 0; -} - /* Reason for creating a new line map with linemap_add. LC_ENTER is when including a new file, e.g. a #include directive in C. LC_LEAVE is when reaching a file's end. LC_RENAME is when a file @@ -78,6 +43,9 @@ enum lc_reason /* FIXME: add support for stringize and paste. */ }; +/* The type of line numbers. */ +typedef unsigned int linenum_type; + /* The typedef "source_location" is a key within the location database, identifying a source location or macro expansion, along with range information, and (optionally) a pointer for use by gcc. @@ -292,11 +260,6 @@ enum lc_reason worked example in libcpp/location-example.txt. */ typedef unsigned int source_location; -/* Do not track column numbers higher than this one. As a result, the - range of column_bits is [12, 18] (or 0 if column numbers are - disabled). */ -const unsigned int LINE_MAP_MAX_COLUMN_NUMBER = (1U << 12); - /* Do not pack ranges if locations get higher than this. If you change this, update: gcc.dg/plugin/location-overflow-test-*.c. */ @@ -342,6 +305,9 @@ struct GTY(()) source_range result.m_finish = finish; return result; } + + /* Is there any part of this range on the given line? */ + bool intersects_line_p (const char *file, int line) const; }; /* Memory allocation function typedef. Works like xrealloc. */ @@ -1288,6 +1254,26 @@ typedef struct bool sysp; } expanded_location; +/* Both gcc and emacs number source *lines* starting at 1, but + they have differing conventions for *columns*. + + GCC uses a 1-based convention for source columns, + whereas Emacs's M-x column-number-mode uses a 0-based convention. + + For example, an error in the initial, left-hand + column of source line 3 is reported by GCC as: + + some-file.c:3:1: error: ...etc... + + On navigating to the location of that error in Emacs + (e.g. via "next-error"), + the locus is reported in the Mode Line + (assuming M-x column-number-mode) as: + + some-file.c 10% (3, 0) + + i.e. "3:1:" in GCC corresponds to "(3, 0)" in Emacs. */ + /* A location within a rich_location: a caret&range, with the caret potentially flagged for display. */ @@ -1430,6 +1416,8 @@ semi_embedded_vec<T, NUM_EMBEDDED>::truncate (int len) } class fixit_hint; + class fixit_insert; + class fixit_replace; /* A "rich" source code location, for use when printing diagnostics. A rich_location has one or more carets&ranges, where the carets @@ -1568,13 +1556,7 @@ class fixit_hint; Attempts to add a fix-it hint within a macro expansion will fail. - There is only limited support for newline characters in fix-it hints: - only hints with newlines which insert an entire new line are permitted, - inserting at the start of a line, and finishing with a newline - (with no interior newline characters). Other attempts to add - fix-it hints containing newline characters will fail. - Similarly, attempts to delete or replace a range *affecting* multiple - lines will fail. + We do not yet support newlines in fix-it text; attempts to do so will fail. The rich_location API handles these failures gracefully, so that diagnostics can attempt to add fix-it hints without each needing @@ -1682,33 +1664,10 @@ class rich_location fixit_hint *get_last_fixit_hint () const; bool seen_impossible_fixit_p () const { return m_seen_impossible_fixit; } - /* Set this if the fix-it hints are not suitable to be - automatically applied. - - For example, if you are suggesting more than one - mutually exclusive solution to a problem, then - it doesn't make sense to apply all of the solutions; - manual intervention is required. - - If set, then the fix-it hints in the rich_location will - be printed, but will not be added to generated patches, - or affect the modified version of the file. */ - void fixits_cannot_be_auto_applied () - { - m_fixits_cannot_be_auto_applied = true; - } - - bool fixits_can_be_auto_applied_p () const - { - return !m_fixits_cannot_be_auto_applied; - } - private: bool reject_impossible_fixit (source_location where); void stop_supporting_fixits (); - void maybe_add_fixit (source_location start, - source_location next_loc, - const char *new_content); + void add_fixit (fixit_hint *hint); public: static const int STATICALLY_ALLOCATED_RANGES = 3; @@ -1726,52 +1685,74 @@ protected: semi_embedded_vec <fixit_hint *, MAX_STATIC_FIXIT_HINTS> m_fixit_hints; bool m_seen_impossible_fixit; - bool m_fixits_cannot_be_auto_applied; }; -/* A fix-it hint: a suggested insertion, replacement, or deletion of text. - We handle these three types of edit with one class, by representing - them as replacement of a half-open range: - [start, next_loc) - Insertions have start == next_loc: "replace" the empty string at the - start location with the new string. - Deletions are replacement with the empty string. - - There is only limited support for newline characters in fix-it hints - as noted above in the comment for class rich_location. - A fixit_hint instance can have at most one newline character; if - present, the newline character must be the final character of - the content (preventing e.g. fix-its that split a pre-existing line). */ - class fixit_hint { - public: - fixit_hint (source_location start, - source_location next_loc, - const char *new_content); - ~fixit_hint () { free (m_bytes); } +public: + enum kind {INSERT, REPLACE}; + + virtual ~fixit_hint () {} + + virtual enum kind get_kind () const = 0; + virtual bool affects_line_p (const char *file, int line) const = 0; + virtual source_location get_start_loc () const = 0; + virtual bool maybe_get_end_loc (source_location *out) const = 0; + /* Vfunc for consolidating successor fixits. */ + virtual bool maybe_append_replace (line_maps *set, + source_range src_range, + const char *new_content) = 0; +}; +class fixit_insert : public fixit_hint +{ + public: + fixit_insert (source_location where, + const char *new_content); + ~fixit_insert (); + enum kind get_kind () const { return INSERT; } bool affects_line_p (const char *file, int line) const; - source_location get_start_loc () const { return m_start; } - source_location get_next_loc () const { return m_next_loc; } - bool maybe_append (source_location start, - source_location next_loc, - const char *new_content); + source_location get_start_loc () const { return m_where; } + bool maybe_get_end_loc (source_location *) const { return false; } + bool maybe_append_replace (line_maps *set, + source_range src_range, + const char *new_content); + source_location get_location () const { return m_where; } const char *get_string () const { return m_bytes; } size_t get_length () const { return m_len; } - bool insertion_p () const { return m_start == m_next_loc; } + private: + source_location m_where; + char *m_bytes; + size_t m_len; +}; - bool ends_with_newline_p () const; +class fixit_replace : public fixit_hint +{ + public: + fixit_replace (source_range src_range, + const char *new_content); + ~fixit_replace (); + + enum kind get_kind () const { return REPLACE; } + bool affects_line_p (const char *file, int line) const; + source_location get_start_loc () const { return m_src_range.m_start; } + bool maybe_get_end_loc (source_location *out) const + { + *out = m_src_range.m_finish; + return true; + } + bool maybe_append_replace (line_maps *set, + source_range src_range, + const char *new_content); + + source_range get_range () const { return m_src_range; } + const char *get_string () const { return m_bytes; } + size_t get_length () const { return m_len; } private: - /* We don't use source_range here since, unlike most places, - this is a half-open/half-closed range: - [start, next_loc) - so that we can support insertion via start == next_loc. */ - source_location m_start; - source_location m_next_loc; + source_range m_src_range; char *m_bytes; size_t m_len; }; @@ -1922,15 +1903,6 @@ void linemap_dump (FILE *, struct line_maps *, unsigned, bool); specifies how many macro maps to dump. */ void line_table_dump (FILE *, struct line_maps *, unsigned int, unsigned int); -/* An enum for distinguishing the various parts within a source_location. */ - -enum location_aspect -{ - LOCATION_ASPECT_CARET, - LOCATION_ASPECT_START, - LOCATION_ASPECT_FINISH -}; - /* The rich_location class requires a way to expand source_location instances. We would directly use expand_location_to_spelling_point, which is implemented in gcc/input.c, but we also need to use it for rich_location @@ -1938,7 +1910,6 @@ enum location_aspect Hence we require client code of libcpp to implement the following symbol. */ extern expanded_location -linemap_client_expand_location_to_spelling_point (source_location, - enum location_aspect); +linemap_client_expand_location_to_spelling_point (source_location ); #endif /* !LIBCPP_LINE_MAP_H */ diff --git a/external/gpl3/gcc/dist/libcpp/include/mkdeps.h b/external/gpl3/gcc/dist/libcpp/include/mkdeps.h index aefb69d4927..2c1bca9170c 100644 --- a/external/gpl3/gcc/dist/libcpp/include/mkdeps.h +++ b/external/gpl3/gcc/dist/libcpp/include/mkdeps.h @@ -1,5 +1,5 @@ /* Dependency generator for Makefile fragments. - Copyright (C) 2000-2018 Free Software Foundation, Inc. + Copyright (C) 2000-2017 Free Software Foundation, Inc. Contributed by Zack Weinberg, Mar 2000 This program is free software; you can redistribute it and/or modify it diff --git a/external/gpl3/gcc/dist/libcpp/include/symtab.h b/external/gpl3/gcc/dist/libcpp/include/symtab.h index c08a4f29ca2..cf0c33f9aed 100644 --- a/external/gpl3/gcc/dist/libcpp/include/symtab.h +++ b/external/gpl3/gcc/dist/libcpp/include/symtab.h @@ -1,5 +1,5 @@ /* Hash tables. - Copyright (C) 2000-2018 Free Software Foundation, Inc. + Copyright (C) 2000-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the |
