]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
c++: Fix commit 4dfe1c46
authorDaiki Ueno <ueno@gnu.org>
Tue, 13 Jan 2015 06:29:35 +0000 (15:29 +0900)
committerDaiki Ueno <ueno@gnu.org>
Tue, 13 Jan 2015 06:30:49 +0000 (15:30 +0900)
* 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.

gettext-tools/src/ChangeLog
gettext-tools/src/x-c.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/xgettext-c-20

index 3332eab0095e8bf7cefcb554343ebabd0ab24bf5..0a4dbdbeab8782eacafa6e7c539b2544fdc5e172 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Daiki Ueno  <ueno@gnu.org>
+
+       * x-c.c (phase5_get): Reset raw_expected at the beginning of the
+       function.
+
 2015-01-13  Daiki Ueno  <ueno@gnu.org>
 
        c++: Make C++11 raw string recognition stricter
index a8f07a13b8d48580fddab5b8076b1c1791c52494..6b531d04214d61300628be16597c2c127d0d28e6 100644 (file)
@@ -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')
                         {
index d8616bfa7cf940d521f259254141237e823d2e00..f8cb454b36ee1509b80168b2c950d5f739b64988 100644 (file)
@@ -1,3 +1,7 @@
+2015-01-13  Daiki Ueno  <ueno@gnu.org>
+
+       * xgettext-c-20: Improve test coverage of raw string tests.
+
 2015-01-13  Daiki Ueno  <ueno@gnu.org>
 
        * xgettext-c-20: Adjust to the latest xgettext C++ scanner change;
index 69bb8a20eab557df2dcac5f3c1601f29d706b6c0..621663cb7d089fe9219688a4c8b384b7b6285126 100755 (executable)
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\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