diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-04-22 10:21:45 +0000 |
---|---|---|
committer | <> | 2015-04-25 21:44:09 +0000 |
commit | f80b5ea1605c9f9408c5aa386ba71c16d918ebbf (patch) | |
tree | bb7eafaa81fc4b8c5c215bc08d517fd158db234a /libcpp/charset.c | |
parent | c27a97d04853380f1e80525391b3f0d156ed4c84 (diff) | |
download | gcc-tarball-f80b5ea1605c9f9408c5aa386ba71c16d918ebbf.tar.gz |
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-5.1.0.tar.bz2.gcc-5.1.0
Diffstat (limited to 'libcpp/charset.c')
-rw-r--r-- | libcpp/charset.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libcpp/charset.c b/libcpp/charset.c index a3c24d6862..b427638065 100644 --- a/libcpp/charset.c +++ b/libcpp/charset.c @@ -1,5 +1,5 @@ /* CPP Library - charsets - Copyright (C) 1998-2014 Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. Broken out of c-lex.c Apr 2003, adding valid C99 UCN ranges. @@ -353,7 +353,7 @@ one_utf8_to_utf16 (iconv_t bigend, const uchar **inbufp, size_t *inbytesleftp, return EILSEQ; } - if (s < 0xFFFF) + if (s <= 0xFFFF) { if (*outbytesleftp < 2) { @@ -537,6 +537,7 @@ convert_no_conversion (iconv_t cd ATTRIBUTE_UNUSED, if (to->len + flen > to->asize) { to->asize = to->len + flen; + to->asize += to->asize / 4; to->text = XRESIZEVEC (uchar, to->text, to->asize); } memcpy (to->text + to->len, from, flen); @@ -608,13 +609,13 @@ convert_using_iconv (iconv_t cd, const uchar *from, size_t flen, #define APPLY_CONVERSION(CONVERTER, FROM, FLEN, TO) \ CONVERTER.func (CONVERTER.cd, FROM, FLEN, TO) -struct conversion +struct cpp_conversion { const char *pair; convert_f func; iconv_t fake_cd; }; -static const struct conversion conversion_tab[] = { +static const struct cpp_conversion conversion_tab[] = { { "UTF-8/UTF-32LE", convert_utf8_utf32, (iconv_t)0 }, { "UTF-8/UTF-32BE", convert_utf8_utf32, (iconv_t)1 }, { "UTF-8/UTF-16LE", convert_utf8_utf16, (iconv_t)0 }, @@ -995,6 +996,10 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99)) cpp_error (pfile, CPP_DL_WARNING, "universal character names are only valid in C++ and C99"); + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 + && !CPP_OPTION (pfile, cplusplus)) + cpp_error (pfile, CPP_DL_WARNING, + "C99's universal character names are incompatible with C90"); else if (CPP_WTRADITIONAL (pfile) && identifier_pos == 0) cpp_warning (pfile, CPP_W_TRADITIONAL, "the meaning of '\\%c' is different in traditional C", |