Paul Eggert <[email protected]> writes: > I tried GNU gettext 0.19 on the latest 'grep' sources, and it failed > with the symptoms quoted at the end of this message. The problem > seems to have something to do with character constants. Even this > trivial source file: > > #define SEP_CHAR_SELECTED ':' > int main (void) { return SEP_CHAR_SELECTED; } > > causes xgettext to fail with a diagnostic like this: > > t.c:1: warning: unterminated character constant
Oops, what a shameful mistake. Thanks for catching this. I've pushed the attached fix.
>From d5f16c16df9131b7591ae9a3f0ecd0acb88109d3 Mon Sep 17 00:00:00 2001 From: Daiki Ueno <[email protected]> Date: Sat, 7 Jun 2014 10:35:14 +0900 Subject: [PATCH] xgettext: Fix misrecognition of character literals in C and Vala Problem reported by Paul Eggert at <http://lists.gnu.org/archive/html/bug-gettext/2014-06/msg00015.html>. * x-c.c (phase5_get): Make sure to skip contents of character constant. * x-vala.c (phase3_get): Likewise. --- gettext-tools/src/ChangeLog | 8 ++++++++ gettext-tools/src/x-c.c | 4 +++- gettext-tools/src/x-vala.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index b766d30..f492e00 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,11 @@ +2014-06-07 Daiki Ueno <[email protected]> + + xgettext: Fix misrecognition of character literals in C and Vala + Problem reported by Paul Eggert at + <http://lists.gnu.org/archive/html/bug-gettext/2014-06/msg00015.html>. + * x-c.c (phase5_get): Make sure to skip contents of character constant. + * x-vala.c (phase3_get): Likewise. + 2014-06-03 Daiki Ueno <[email protected]> desktop: Use logical filename as msgid location diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index 2ae2f3c..203eb79 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -1288,6 +1288,8 @@ phase5_get (token_ty *tp) { case '\\': last_was_backslash = true; + /* FALLTHROUGH */ + default: continue; case '\n': error_with_progname = false; @@ -1299,7 +1301,7 @@ phase5_get (token_ty *tp) case EOF: case '\'': break; } - break; + break; } tp->type = token_type_character_constant; return; diff --git a/gettext-tools/src/x-vala.c b/gettext-tools/src/x-vala.c index 1d88f47..288f9b7 100644 --- a/gettext-tools/src/x-vala.c +++ b/gettext-tools/src/x-vala.c @@ -622,6 +622,8 @@ phase3_get (token_ty *tp) { case '\\': last_was_backslash = true; + /* FALLTHROUGH */ + default: continue; case '\n': error_with_progname = false; -- 2.0.0
Regards, -- Daiki Ueno
