Bug 18249 - C++ parser i18n problems
Summary: C++ parser i18n problems
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks: trivial_translation_nits
  Show dependency treegraph
 
Reported: 2004-10-31 10:35 UTC by Joseph S. Myers
Modified: 2010-05-25 12:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-02 13:43:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2004-10-31 10:35:52 UTC
The message parameter to cp_parser_error is called "message" rather
than "msgid", so the messages don't get in the message catalog.  Much the
same applies to several other functions in the C++ parser:
cp_parser_require, cp_parser_name_lookup_error,
cp_parser_non_integral_constant_expression all take English arguments that
aren't marked for translation and may not end up getting passed to _() in
all cases.  cp_parser_require also concatenates the argument with the
string "expected ".  The type_definition_forbidden_message structure
member has a similar problem.
Comment 1 Shujing Zhao 2010-05-25 06:26:20 UTC
Subject: Bug 18249

Author: pzhao
Date: Tue May 25 06:26:07 2010
New Revision: 159808

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159808
Log:
2010-05-25  Shujing Zhao  <pearly.zhao@oracle.com>

        PR c++/18249
        * parser.c: Remove inclusion of dyn-string.h.
        (non_integral_constant): New enum.
        (name_lookup_error): New enum.
        (required_token): New enum.
        (cp_parser_required_error): New function.
        (cp_parser_require): Change the type of variable token_desc to
        required_token and use cp_parser_required_error.
        (cp_parser_require_keyword): Likewise.
        (cp_parser_error): Use gmsgid as parameter.
        (cp_parser_name_lookup_error): Change the type of variable desired to
        name_lookup_error and put the diagnostic in the full sentences. Change
        caller.
        (cp_parser_non_integral_constant_expression): Change the type of the
        variable thing to non_integral_constant and put the diagnostics in
        full sentences. Change caller.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c

Comment 2 Shujing Zhao 2010-05-25 06:57:15 UTC
Fixed for 4.6.0.
Comment 3 Shujing Zhao 2010-05-25 06:57:57 UTC
Fixed.
Comment 4 Jorn Wolfgang Rennecke 2010-05-25 12:09:29 UTC
(In reply to comment #1)
> Subject: Bug 18249
> 
> Author: pzhao
> Date: Tue May 25 06:26:07 2010
> New Revision: 159808
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159808
> Log:
> 2010-05-25  Shujing Zhao  <pearly.zhao@oracle.com>
> 
>         PR c++/18249
>         * parser.c: Remove inclusion of dyn-string.h.
>         (non_integral_constant): New enum.
>         (name_lookup_error): New enum.
>         (required_token): New enum.
>         (cp_parser_required_error): New function.
>         (cp_parser_require): Change the type of variable token_desc to
>         required_token and use cp_parser_required_error.
>         (cp_parser_require_keyword): Likewise.
>         (cp_parser_error): Use gmsgid as parameter.
>         (cp_parser_name_lookup_error): Change the type of variable desired to
>         name_lookup_error and put the diagnostic in the full sentences. Change
>         caller.
>         (cp_parser_non_integral_constant_expression): Change the type of the
>         variable thing to non_integral_constant and put the diagnostics in
>         full sentences. Change caller.
> 
> Modified:
>     trunk/gcc/cp/ChangeLog
>     trunk/gcc/cp/parser.c
> 

This broke bootstrap on i686-pc-linux-gnu:

/user/inria/fsf/bld-20100525/./prev-gcc/xgcc -B/user/inria/fsf/bld-20100525/./prev-gcc/ -B/user/inria/i686-pc-linux-gnu/bin/ -B/user/inria/i686-pc-linux-gnu/bin/ -B/user/inria/i686-pc-linux-gnu/lib/ -isystem /user/inria/i686-pc-linux-gnu/include -isystem /user/inria/i686-pc-linux-gnu/sys-include    -c  -g -O2 -fomit-frame-pointer -gtoggle -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I. -Icp -I../../gcc/gcc -I../../gcc/gcc/cp -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber  -DCLOOG_PPL_BACKEND  -I/usr/include/libelf  ../../gcc/gcc/cp/parser.c -o cp/parser.o
../../gcc/gcc/cp/parser.c: In function ‘cp_parser_unary_expression’:
../../gcc/gcc/cp/parser.c:5898:7: error: enum conversion in initialization is invalid in C++ [-Werror=c++-compat]
../../gcc/gcc/cp/parser.c: In function ‘cp_parser_asm_definition’:
../../gcc/gcc/cp/parser.c:13478:3: error: enum conversion in initialization is invalid in C++ [-Werror=c++-compat]
cc1: all warnings being treated as errors
Comment 6 Jakub Jelinek 2010-05-25 16:18:00 UTC
Subject: Bug 18249

Author: jakub
Date: Tue May 25 16:17:32 2010
New Revision: 159827

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159827
Log:
	PR c++/18249
	* parser.c (non_integral_constant): Add NIC_NONE.
	(required_token): Add RT_NONE.
	(cp_parser_unary_expression): Initialize non_constant_p
	to NIC_NONE.
	(cp_parser_asm_definition): Initialize missing to RT_NONE.
	(cp_parser_primary_expression, cp_parser_postfix_expression,
	cp_parser_cast_expression, cp_parser_binary_expression,
	cp_parser_functional_cast): Fix formatting.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c