Patchwork [4.7] Fix a couple of C++isms

login
register
mail settings
Submitter Eric Botcazou
Date April 21, 2013, 7:59 a.m.
Message ID <7725102.aKVEupMyhz@polaris>
Download mbox | patch
Permalink /patch/238200/
State New
Headers show

Comments

Eric Botcazou - April 21, 2013, 7:59 a.m.
Bootstrapped/regtested on x86_64-suse-linux, applied as obvious.


2013-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* cfgexpand.c (avoid_complex_debug_insns): Fix C++ism.
cp/
	* parser.c (cp_parser_late_return_type_opt): Likewise.
Jeff Law - April 21, 2013, 9:13 p.m.
On 04/21/2013 01:59 AM, Eric Botcazou wrote:
> Bootstrapped/regtested on x86_64-suse-linux, applied as obvious.
>
>
> 2013-04-21  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* cfgexpand.c (avoid_complex_debug_insns): Fix C++ism.
> cp/
> 	* parser.c (cp_parser_late_return_type_opt): Likewise.
Umm, I thought declaring at first use (or near first use) was one of the 
approved C++-isms?

http://gcc.gnu.org/wiki/CppConventions


Jeff
Andrew Pinski - April 21, 2013, 9:17 p.m.
On Sun, Apr 21, 2013 at 2:13 PM, Jeff Law <law@redhat.com> wrote:
> On 04/21/2013 01:59 AM, Eric Botcazou wrote:
>>
>> Bootstrapped/regtested on x86_64-suse-linux, applied as obvious.
>>
>>
>> 2013-04-21  Eric Botcazou  <ebotcazou@adacore.com>
>>
>>         * cfgexpand.c (avoid_complex_debug_insns): Fix C++ism.
>> cp/
>>         * parser.c (cp_parser_late_return_type_opt): Likewise.
>
> Umm, I thought declaring at first use (or near first use) was one of the
> approved C++-isms?

Yes but not for 4.7.x which is still written in C90.

Thanks,
Andrew

>
> http://gcc.gnu.org/wiki/CppConventions
>
>
> Jeff
>


On Sun, Apr 21, 2013 at 2:13 PM, Jeff Law <law@redhat.com> wrote:
> On 04/21/2013 01:59 AM, Eric Botcazou wrote:
>>
>> Bootstrapped/regtested on x86_64-suse-linux, applied as obvious.
>>
>>
>> 2013-04-21  Eric Botcazou  <ebotcazou@adacore.com>
>>
>>         * cfgexpand.c (avoid_complex_debug_insns): Fix C++ism.
>> cp/
>>         * parser.c (cp_parser_late_return_type_opt): Likewise.
>
> Umm, I thought declaring at first use (or near first use) was one of the
> approved C++-isms?
>
> http://gcc.gnu.org/wiki/CppConventions
>
>
> Jeff
>
Eric Botcazou - April 21, 2013, 9:19 p.m.
> Umm, I thought declaring at first use (or near first use) was one of the
> approved C++-isms?
> 
> http://gcc.gnu.org/wiki/CppConventions

You probably missed the [4.7] in the subject.

Patch

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 198109)
+++ cp/parser.c	(working copy)
@@ -16691,7 +16691,7 @@  static tree
 cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals)
 {
   cp_token *token;
-  tree type;
+  tree type, save_ccp, save_ccr;
 
   /* Peek at the next token.  */
   token = cp_lexer_peek_token (parser->lexer);
@@ -16702,8 +16702,8 @@  cp_parser_late_return_type_opt (cp_parse
   /* Consume the ->.  */
   cp_lexer_consume_token (parser->lexer);
 
-  tree save_ccp = current_class_ptr;
-  tree save_ccr = current_class_ref;
+  save_ccp = current_class_ptr;
+  save_ccr = current_class_ref;
   if (quals >= 0)
     {
       /* DR 1207: 'this' is in scope in the trailing return type.  */
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 198109)
+++ cfgexpand.c	(working copy)
@@ -3646,6 +3646,8 @@  static void
 avoid_complex_debug_insns (rtx insn, rtx *exp_p, int depth)
 {
   rtx exp = *exp_p;
+  const char *format_ptr;
+  int i, j;
 
   if (exp == NULL_RTX)
     return;
@@ -3668,8 +3670,7 @@  avoid_complex_debug_insns (rtx insn, rtx
       return;
     }
 
-  const char *format_ptr = GET_RTX_FORMAT (GET_CODE (exp));
-  int i, j;
+  format_ptr = GET_RTX_FORMAT (GET_CODE (exp));
   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (exp)); i++)
     switch (*format_ptr++)
       {