diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-21 23:48:37 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-21 23:48:37 +0000 |
commit | 252c78be95fb1dba06e956f0353dd0cee21707d5 (patch) | |
tree | fe958c2e2145d8d5563b4d59b42bc67f7fc77fa7 /gcc/go/gofrontend/lex.cc | |
parent | dd91be9de449c7bba4f30a41280d7612e211847f (diff) | |
download | gcc-252c78be95fb1dba06e956f0353dd0cee21707d5.tar.gz |
Don't warn about []int of string with NUL bytes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168146 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/gofrontend/lex.cc')
-rw-r--r-- | gcc/go/gofrontend/lex.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 67d4b1b4670..7fabd3dfd1c 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -742,12 +742,7 @@ int Lex::fetch_char(const char* p, unsigned int* value) { unsigned char c = *p; - if (c == 0) - { - *value = 0xfffd; - return 0; - } - else if (c <= 0x7f) + if (c <= 0x7f) { *value = c; return 1; @@ -812,13 +807,19 @@ Lex::advance_one_utf8_char(const char* p, unsigned int* value, bool* issued_error) { *issued_error = false; + + if (*p == '\0') + { + error_at(this->location(), "invalid NUL byte"); + *issued_error = true; + *value = 0; + return p + 1; + } + int adv = Lex::fetch_char(p, value); if (adv == 0) { - if (*p == '\0') - error_at(this->location(), "invalid NUL byte"); - else - error_at(this->location(), "invalid UTF-8 encoding"); + error_at(this->location(), "invalid UTF-8 encoding"); *issued_error = true; return p + 1; } |