diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-21 12:48:02 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-21 12:48:02 +0200 |
commit | 5776a5ffab3b92d6ccac87ccf32c580ee2742d5a (patch) | |
tree | cbdbbff551198c5e4bba8d08d734ad74a1d0d684 /libcpp | |
parent | 4465e2a047c3b175bf6c4ca500547eb6b12df52f (diff) | |
parent | bf3b532b524ecacb3202ab2c8af419ffaaab7cff (diff) | |
download | gcc-5776a5ffab3b92d6ccac87ccf32c580ee2742d5a.zip gcc-5776a5ffab3b92d6ccac87ccf32c580ee2742d5a.tar.gz gcc-5776a5ffab3b92d6ccac87ccf32c580ee2742d5a.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 6 | ||||
-rw-r--r-- | libcpp/include/symtab.h | 5 |
3 files changed, 14 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 3a1b499..18d5bcc 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2022-10-19 Lewis Hyatt <lhyatt@gmail.com> + + * include/cpplib.h (struct cpp_string): Use new "string_length" GTY. + * include/symtab.h (struct ht_identifier): Likewise. + 2022-10-14 Joseph Myers <joseph@codesourcery.com> * charset.cc (ucn_valid_in_identifier): Check xid_identifiers not diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index d5ef12a..1d34c00 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -179,7 +179,11 @@ enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17, CLK_GNUC2X, /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ struct GTY(()) cpp_string { unsigned int len; - const unsigned char *text; + + /* TEXT is always null terminated (terminator not included in len); but this + GTY markup arranges that PCH streaming works properly even if there is a + null byte in the middle of the string. */ + const unsigned char * GTY((string_length ("1 + %h.len"))) text; }; /* Flags for the cpp_token structure. */ diff --git a/libcpp/include/symtab.h b/libcpp/include/symtab.h index 53efe6c..8b45fd5 100644 --- a/libcpp/include/symtab.h +++ b/libcpp/include/symtab.h @@ -29,7 +29,10 @@ along with this program; see the file COPYING3. If not see typedef struct ht_identifier ht_identifier; typedef struct ht_identifier *ht_identifier_ptr; struct GTY(()) ht_identifier { - const unsigned char *str; + /* This GTY markup arranges that the null-terminated identifier would still + stream to PCH correctly, if a null byte were to make its way into an + identifier somehow. */ + const unsigned char * GTY((string_length ("1 + %h.len"))) str; unsigned int len; unsigned int hash_value; }; |