diff options
author | Martin Liska <mliska@suse.cz> | 2022-08-09 15:30:09 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-08-09 15:30:09 +0200 |
commit | 9fce2fbb1dff9f090d98a056df1da459ba45f16f (patch) | |
tree | 097d3bc54e8fd0f304bb8c4d99667289e9f3fd25 /libcpp | |
parent | b3a187edd33b89acf19ba46f3b8070d7c977ac57 (diff) | |
parent | 04284176d549ff2565406406a6d53ab4ba8e507d (diff) | |
download | gcc-9fce2fbb1dff9f090d98a056df1da459ba45f16f.zip gcc-9fce2fbb1dff9f090d98a056df1da459ba45f16f.tar.gz gcc-9fce2fbb1dff9f090d98a056df1da459ba45f16f.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/charset.cc | 4 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 4 | ||||
-rw-r--r-- | libcpp/init.cc | 1 |
4 files changed, 13 insertions, 4 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 4905bd5..259adb9 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2022-08-08 Tom Honermann <tom@honermann.net> + + PR preprocessor/106426 + * charset.cc (narrow_str_to_charconst): Set signedness of CPP_UTF8CHAR + literals based on unsigned_utf8char. + * include/cpplib.h (cpp_options): Add unsigned_utf8char. + * init.cc (cpp_create_reader): Initialize unsigned_utf8char. + 2022-07-15 Jonathan Wakely <jwakely@redhat.com> * include/line-map.h (label_text::take_or_copy): Remove. diff --git a/libcpp/charset.cc b/libcpp/charset.cc index ca8b7cf..12e3163 100644 --- a/libcpp/charset.cc +++ b/libcpp/charset.cc @@ -1960,8 +1960,8 @@ narrow_str_to_charconst (cpp_reader *pfile, cpp_string str, /* Multichar constants are of type int and therefore signed. */ if (i > 1) unsigned_p = 0; - else if (type == CPP_UTF8CHAR && !CPP_OPTION (pfile, cplusplus)) - unsigned_p = 1; + else if (type == CPP_UTF8CHAR) + unsigned_p = CPP_OPTION (pfile, unsigned_utf8char); else unsigned_p = CPP_OPTION (pfile, unsigned_char); diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 3eba6f7..f9c042d 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -581,8 +581,8 @@ struct cpp_options ints and target wide characters, respectively. */ size_t precision, char_precision, int_precision, wchar_precision; - /* True means chars (wide chars) are unsigned. */ - bool unsigned_char, unsigned_wchar; + /* True means chars (wide chars, UTF-8 chars) are unsigned. */ + bool unsigned_char, unsigned_wchar, unsigned_utf8char; /* True if the most significant byte in a word has the lowest address in memory. */ diff --git a/libcpp/init.cc b/libcpp/init.cc index f4ab83d..0242da5 100644 --- a/libcpp/init.cc +++ b/libcpp/init.cc @@ -231,6 +231,7 @@ cpp_create_reader (enum c_lang lang, cpp_hash_table *table, CPP_OPTION (pfile, int_precision) = CHAR_BIT * sizeof (int); CPP_OPTION (pfile, unsigned_char) = 0; CPP_OPTION (pfile, unsigned_wchar) = 1; + CPP_OPTION (pfile, unsigned_utf8char) = 1; CPP_OPTION (pfile, bytes_big_endian) = 1; /* does not matter */ /* Default to no charset conversion. */ |