From: Daiki Ueno Date: Tue, 13 Jan 2015 06:29:35 +0000 (+0900) Subject: c++: Fix commit 4dfe1c46 X-Git-Tag: v0.19.5~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28d7bcb5a8ed365752bc2a8ef1b10aa960f5d048;p=thirdparty%2Fgettext.git c++: Fix commit 4dfe1c46 * gettext-tools/src/x-c.c (phase5_get): Reset raw_expected at the beginning of the function. * gettext-tools/tests/xgettext-c-20: Improve test coverage of raw string tests. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 3332eab00..0a4dbdbea 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Daiki Ueno + + * x-c.c (phase5_get): Reset raw_expected at the beginning of the + function. + 2015-01-13 Daiki Ueno c++: Make C++11 raw string recognition stricter diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index a8f07a13b..6b531d042 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -1101,7 +1101,7 @@ phase5_get (token_ty *tp) int bufpos; int c; int last_was_backslash; - bool raw_expected; + bool raw_expected = false; int delimiter_left_end; int delimiter_right_start; int last_rparen; @@ -1207,10 +1207,7 @@ phase5_get (token_ty *tp) break; case 'u': if (bufpos == 1) - { - is_prefix = true; - raw_expected = false; - } + is_prefix = true; else switch (buffer[1]) { @@ -1223,10 +1220,7 @@ phase5_get (token_ty *tp) break; case '8': if (bufpos == 2) - { - is_prefix = true; - raw_expected = false; - } + is_prefix = true; else if (cxx_extensions && bufpos == 3 && buffer[2] == 'R') { @@ -1239,10 +1233,7 @@ phase5_get (token_ty *tp) case 'U': case 'L': if (bufpos == 1) - { - is_prefix = true; - raw_expected = false; - } + is_prefix = true; else if (cxx_extensions && bufpos == 2 && buffer[1] == 'R') { diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index d8616bfa7..f8cb454b3 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,7 @@ +2015-01-13 Daiki Ueno + + * xgettext-c-20: Improve test coverage of raw string tests. + 2015-01-13 Daiki Ueno * xgettext-c-20: Adjust to the latest xgettext C++ scanner change; diff --git a/gettext-tools/tests/xgettext-c-20 b/gettext-tools/tests/xgettext-c-20 index 69bb8a20e..621663cb7 100755 --- a/gettext-tools/tests/xgettext-c-20 +++ b/gettext-tools/tests/xgettext-c-20 @@ -25,6 +25,24 @@ cat <<\EOF > xg-c-20.cc #define X "" gettext (X"This is a concatenation of a macro and a string"); +#define RR "" +gettext (RR"This (is NOT a raw string"); + +#define u8RR "" +gettext (u8RR"This (is NOT a raw string"); + +#define uRR "" +gettext (uRR"This (is NOT a raw string"); + +#define URR "" +gettext (URR"This (is NOT a raw string"); + +#define LRR "" +gettext (LRR"This (is NOT a raw string"); + +#define uX "" +gettext (uX"This (is NOT a raw string"); + gettext (u8"This is a UTF-8 string"); u88"This is not a UTF-8 string"; @@ -87,6 +105,9 @@ msgstr "" msgid "This is a concatenation of a macro and a string" msgstr "" +msgid "This (is NOT a raw string" +msgstr "" + msgid "This is a UTF-8 string" msgstr "" @@ -102,7 +123,42 @@ msgstr "" EOF : ${DIFF=diff} -${DIFF} xg-c-20.ok xg-c-20.po -result=$? +${DIFF} xg-c-20.ok xg-c-20.po || exit 1 + +cat <<\EOF > xg-c-20.c +gettext (R"aaa(This is NOT a raw string"); + +gettext (u8R"aaa(This is NOT a raw string"); + +uR"aaa(This is NOT a raw string"; +EOF + +${XGETTEXT} --add-comments --no-location --no-wrap \ + -o - xg-c-20.c | grep -v 'POT-Creation-Date' > xg-c-20c.tmp.po \ + || { cp core* ..; exit 1; } +LC_ALL=C tr -d '\r' < xg-c-20c.tmp.po > xg-c-20c.po || exit 1 + +cat <<\EOF > xg-c-20c.ok +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "aaa(This is NOT a raw string" +msgstr "" +EOF -exit $result +${DIFF} xg-c-20c.ok xg-c-20c.po || exit 1