diff options
author | Martin Liska <mliska@suse.cz> | 2022-09-29 10:41:04 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-09-29 10:41:04 +0200 |
commit | 54f3cfaf3a6f50958c71d79c85206a6c722e1a22 (patch) | |
tree | 5f33297a30acc0df71baa0566cffa701eb97ab4e /libcpp | |
parent | 3c527a35fa428b727807c81f1225a5e0025446c1 (diff) | |
parent | a1cd4d52d6ef90b977fb2d80c1cf17f3efa5b01d (diff) | |
download | gcc-54f3cfaf3a6f50958c71d79c85206a6c722e1a22.zip gcc-54f3cfaf3a6f50958c71d79c85206a6c722e1a22.tar.gz gcc-54f3cfaf3a6f50958c71d79c85206a6c722e1a22.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 32 | ||||
-rw-r--r-- | libcpp/expr.cc | 1 | ||||
-rw-r--r-- | libcpp/include/line-map.h | 10 | ||||
-rw-r--r-- | libcpp/lex.cc | 7 | ||||
-rw-r--r-- | libcpp/line-map.cc | 38 |
5 files changed, 74 insertions, 14 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 5984915..3b41845 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,35 @@ +2022-09-28 Eugene Rozenfeld <erozen@microsoft.com> + + * include/line-map.h: Add discriminator to location_adhoc_data. + (get_combined_adhoc_loc): Add discriminator parameter. + (get_discriminator_from_adhoc_loc): Add external declaration. + (get_discriminator_from_loc): Add external declaration. + (COMBINE_LOCATION_DATA): Add discriminator parameter. + * lex.cc (get_location_for_byte_range_in_cur_line) Pass 0 discriminator + in a call to COMBINE_LOCATION_DATA. + (warn_about_normalization): Pass 0 discriminator in a call to + COMBINE_LOCATION_DATA. + (_cpp_lex_direct): Pass 0 discriminator in a call to + COMBINE_LOCATION_DATA. + * line-map.cc (location_adhoc_data_hash): Use discriminator compute + location_adhoc_data hash. + (location_adhoc_data_eq): Use discriminator when comparing + location_adhoc_data. + (can_be_stored_compactly_p): Check discriminator to determine + compact storage. + (get_combined_adhoc_loc): Add discriminator parameter. + (get_discriminator_from_adhoc_loc): New function to get the discriminator + from an ad-hoc location. + (get_discriminator_from_loc): New function to get the discriminator + from a location. + +2022-09-27 Jakub Jelinek <jakub@redhat.com> + + PR c++/106652 + PR c++/85518 + * expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and + {f,F}{32,64,128}x suffixes for C++. + 2022-09-08 Lewis Hyatt <lhyatt@gmail.com> * line-map.cc (location_adhoc_data_update): Remove reliance on diff --git a/libcpp/expr.cc b/libcpp/expr.cc index 4bb02c4..1d68064 100644 --- a/libcpp/expr.cc +++ b/libcpp/expr.cc @@ -215,7 +215,6 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len) case 'f': case 'F': f++; if (len > 0 - && !CPP_OPTION (pfile, cplusplus) && s[1] >= '1' && s[1] <= '9' && fn_bits == 0) diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 9bdd5b9..50207ca 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -757,6 +757,7 @@ struct GTY(()) location_adhoc_data { location_t locus; source_range src_range; void * GTY((skip)) data; + unsigned discriminator; }; struct htab; @@ -1034,12 +1035,14 @@ LINEMAPS_LAST_ALLOCATED_MACRO_MAP (const line_maps *set) } extern location_t get_combined_adhoc_loc (line_maps *, location_t, - source_range, void *); + source_range, void *, unsigned); extern void *get_data_from_adhoc_loc (const line_maps *, location_t); +extern unsigned get_discriminator_from_adhoc_loc (const line_maps *, location_t); extern location_t get_location_from_adhoc_loc (const line_maps *, location_t); extern source_range get_range_from_loc (line_maps *set, location_t loc); +extern unsigned get_discriminator_from_loc (line_maps *set, location_t loc); /* Get whether location LOC is a "pure" location, or whether it is an ad-hoc location, or embeds range information. */ @@ -1058,9 +1061,10 @@ inline location_t COMBINE_LOCATION_DATA (class line_maps *set, location_t loc, source_range src_range, - void *block) + void *block, + unsigned discriminator) { - return get_combined_adhoc_loc (set, loc, src_range, block); + return get_combined_adhoc_loc (set, loc, src_range, block, discriminator); } extern void rebuild_location_adhoc_htab (class line_maps *); diff --git a/libcpp/lex.cc b/libcpp/lex.cc index 41f905de..a429a3d 100644 --- a/libcpp/lex.cc +++ b/libcpp/lex.cc @@ -1362,7 +1362,8 @@ get_location_for_byte_range_in_cur_line (cpp_reader *pfile, location_t combined_loc = COMBINE_LOCATION_DATA (pfile->line_table, start_loc, src_range, - NULL); + NULL, + 0); return combined_loc; } @@ -2028,7 +2029,7 @@ warn_about_normalization (cpp_reader *pfile, CPP_BUF_COLUMN (pfile->buffer, pfile->buffer->cur)); loc = COMBINE_LOCATION_DATA (pfile->line_table, - loc, tok_range, NULL); + loc, tok_range, NULL, 0); } encoding_rich_location rich_loc (pfile, loc); @@ -4256,7 +4257,7 @@ _cpp_lex_direct (cpp_reader *pfile) result->src_loc = COMBINE_LOCATION_DATA (pfile->line_table, result->src_loc, - tok_range, NULL); + tok_range, NULL, 0); } return result; diff --git a/libcpp/line-map.cc b/libcpp/line-map.cc index 391f1d4..50e8043 100644 --- a/libcpp/line-map.cc +++ b/libcpp/line-map.cc @@ -67,7 +67,8 @@ location_adhoc_data_hash (const void *l) return ((hashval_t) lb->locus + (hashval_t) lb->src_range.m_start + (hashval_t) lb->src_range.m_finish - + (size_t) lb->data); + + (size_t) lb->data + + lb->discriminator); } /* Compare function for location_adhoc_data hashtable. */ @@ -82,7 +83,8 @@ location_adhoc_data_eq (const void *l1, const void *l2) return (lb1->locus == lb2->locus && lb1->src_range.m_start == lb2->src_range.m_start && lb1->src_range.m_finish == lb2->src_range.m_finish - && lb1->data == lb2->data); + && lb1->data == lb2->data + && lb1->discriminator == lb2->discriminator); } /* Update the hashtable when location_adhoc_data_map::data is reallocated. @@ -127,13 +129,17 @@ static bool can_be_stored_compactly_p (line_maps *set, location_t locus, source_range src_range, - void *data) + void *data, + unsigned discriminator) { /* If there's an ad-hoc pointer, we can't store it directly in the location_t, we need the lookaside. */ if (data) return false; + if (discriminator != 0) + return false; + /* We only store ranges that begin at the locus and that are sufficiently "sane". */ if (src_range.m_start != locus) @@ -168,7 +174,8 @@ location_t get_combined_adhoc_loc (line_maps *set, location_t locus, source_range src_range, - void *data) + void *data, + unsigned discriminator) { struct location_adhoc_data lb; struct location_adhoc_data **slot; @@ -186,7 +193,7 @@ get_combined_adhoc_loc (line_maps *set, || pure_location_p (set, locus)); /* Consider short-range optimization. */ - if (can_be_stored_compactly_p (set, locus, src_range, data)) + if (can_be_stored_compactly_p (set, locus, src_range, data, discriminator)) { /* The low bits ought to be clear. */ linemap_assert (pure_location_p (set, locus)); @@ -206,15 +213,16 @@ get_combined_adhoc_loc (line_maps *set, when locus == start == finish (and data is NULL). */ if (locus == src_range.m_start && locus == src_range.m_finish - && !data) + && !data && discriminator == 0) return locus; - if (!data) + if (!data && discriminator == 0) set->num_unoptimized_ranges++; lb.locus = locus; lb.src_range = src_range; lb.data = data; + lb.discriminator = discriminator; slot = (struct location_adhoc_data **) htab_find_slot (set->location_adhoc_data_map.htab, &lb, INSERT); if (*slot == NULL) @@ -261,6 +269,13 @@ get_data_from_adhoc_loc (const class line_maps *set, location_t loc) return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].data; } +unsigned +get_discriminator_from_adhoc_loc (const class line_maps *set, location_t loc) +{ + linemap_assert (IS_ADHOC_LOC (loc)); + return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].discriminator; +} + /* Return the location for the adhoc loc. */ location_t @@ -306,6 +321,15 @@ get_range_from_loc (line_maps *set, return source_range::from_location (loc); } +unsigned +get_discriminator_from_loc (line_maps *set, + location_t loc) +{ + if (IS_ADHOC_LOC (loc)) + return get_discriminator_from_adhoc_loc (set, loc); + return 0; +} + /* Get whether location LOC is a "pure" location, or whether it is an ad-hoc location, or embeds range information. */ |