Re: c-parser.c replace error() by error_at()

2014-02-20 Thread Joseph S. Myers
On Thu, 20 Feb 2014, Prathamesh Kulkarni wrote:

> On Wed, Feb 19, 2014 at 11:32 PM, Joseph S. Myers
>  wrote:
> > On Wed, 19 Feb 2014, Prathamesh Kulkarni wrote:
> >
> >> I have sent it attached this time.
> >
> > Thanks, this version is OK.  Please start the copyright assignment
> > paperwork process if you haven't already done so, if you may be
> > contributing more changes in future.
> >
> > http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
> Thanks. I had sent the assignment form by postal mail a week ago. I
> have not received
> a reply.

If you don't hear anything within another week, I suggest chasing up 
ass...@gnu.org about it.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: c-parser.c replace error() by error_at()

2014-02-20 Thread Prathamesh Kulkarni
On Wed, Feb 19, 2014 at 11:32 PM, Joseph S. Myers
 wrote:
> On Wed, 19 Feb 2014, Prathamesh Kulkarni wrote:
>
>> I have sent it attached this time.
>
> Thanks, this version is OK.  Please start the copyright assignment
> paperwork process if you haven't already done so, if you may be
> contributing more changes in future.
>
> http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
Thanks. I had sent the assignment form by postal mail a week ago. I
have not received
a reply.
>
> --
> Joseph S. Myers
> jos...@codesourcery.com


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Marek Polacek
On Wed, Feb 19, 2014 at 06:02:23PM +, Joseph S. Myers wrote:
> On Wed, 19 Feb 2014, Prathamesh Kulkarni wrote:
> 
> > I have sent it attached this time.
> 
> Thanks, this version is OK.  Please start the copyright assignment 
> paperwork process if you haven't already done so, if you may be 
> contributing more changes in future.
> 
> http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

I'll commit the latest version shortly.

Marek


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Joseph S. Myers
On Wed, 19 Feb 2014, Prathamesh Kulkarni wrote:

> I have sent it attached this time.

Thanks, this version is OK.  Please start the copyright assignment 
paperwork process if you haven't already done so, if you may be 
contributing more changes in future.

http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Prathamesh Kulkarni
On Wed, Feb 19, 2014 at 9:41 PM, Marek Polacek  wrote:
> On Wed, Feb 19, 2014 at 08:45:04PM +0530, Prathamesh Kulkarni wrote:
>> Index: gcc/c/c-parser.c
>> ===
>> --- gcc/c/c-parser.c (revision 207700)
>> +++ gcc/c/c-parser.c (working copy)
>> @@ -2223,7 +2223,7 @@ c_parser_declspecs (c_parser *parser, st
>>attrs_ok = true;
>>if (kind == C_ID_ID)
>>  {
>> -  error ("unknown type name %qE", value);
>> +  error_at (loc, "unknown type name %qE", value);
>>t.kind = ctsk_typedef;
>>t.spec = error_mark_node;
>>  }
>> @@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
>>c_parser_set_source_position_from_token (token);
>>if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
>>   {
>> -  error ("unknown type name %qE", token->value);
>> +  error_at (token->location, "unknown type name %qE", token->value);
>>parser->error = true;
>>   }
>>/* ??? In some Objective-C cases '...' isn't applicable so there
>
> BTW, your MUA eats tabs, so the patch can't be applied (common gmail
> problem).
I have sent it attached this time.
>
>> Index: gcc/testsuite/gcc.dg/decl-10.c
>> ===
>> --- gcc/testsuite/gcc.dg/decl-10.c (revision 0)
>> +++ gcc/testsuite/gcc.dg/decl-10.c (working copy)
>> @@ -0,0 +1,13 @@
>> +/* { dg-do compile } */
>> +
>> +void
>> +f4(const foo x) /* { dg-error "unknown type name" } */
>> +{}
>> +
>> +void
>> +f5(foo x, int i) /* { dg-error "unknown type name" } */
>> +{}
>> +
>> +void
>> +f6(char c, foo x, ...) /* { dg-error "unknown type name" } */
>> +{}
>
> Since we're testing the column numbers here, those dg-errors should
> test that.  So please adjust them:
> /* { dg-error "10:unknown type name" } */
> /* { dg-error "4:unknown type name" } */
> /* { dg-error "12:unknown type name" } */
Added.
>
> Thanks.
>
[gcc/c]
* c-parser.c (c_parser_declspecs): Replace call to error by error_at.
* c-parser.c (c_parser_parameter_declaration): Likewise.

[gcc/testsuite]
* gcc.dg/decl-10.c: New test case.

> Marek
Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c	(revision 207700)
+++ gcc/c/c-parser.c	(working copy)
@@ -2223,7 +2223,7 @@ c_parser_declspecs (c_parser *parser, st
 	  attrs_ok = true;
 	  if (kind == C_ID_ID)
 	{
-	  error ("unknown type name %qE", value);
+	  error_at (loc, "unknown type name %qE", value);
 	  t.kind = ctsk_typedef;
 	  t.spec = error_mark_node;
 	}
@@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
   c_parser_set_source_position_from_token (token);
   if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
 	{
-	  error ("unknown type name %qE", token->value);
+	  error_at (token->location, "unknown type name %qE", token->value);
 	  parser->error = true;
 	}
   /* ??? In some Objective-C cases '...' isn't applicable so there
Index: gcc/testsuite/gcc.dg/decl-10.c
===
--- gcc/testsuite/gcc.dg/decl-10.c	(revision 0)
+++ gcc/testsuite/gcc.dg/decl-10.c	(working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+void
+f4(const foo x) /* { dg-error "10:unknown type name" } */
+{}
+
+void
+f5(foo x, int i) /* { dg-error "4:unknown type name" } */
+{}
+
+void
+f6(char c, foo x, ...) /* { dg-error "12:unknown type name" } */
+{}


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Marek Polacek
On Wed, Feb 19, 2014 at 08:45:04PM +0530, Prathamesh Kulkarni wrote:
> Index: gcc/c/c-parser.c
> ===
> --- gcc/c/c-parser.c (revision 207700)
> +++ gcc/c/c-parser.c (working copy)
> @@ -2223,7 +2223,7 @@ c_parser_declspecs (c_parser *parser, st
>attrs_ok = true;
>if (kind == C_ID_ID)
>  {
> -  error ("unknown type name %qE", value);
> +  error_at (loc, "unknown type name %qE", value);
>t.kind = ctsk_typedef;
>t.spec = error_mark_node;
>  }
> @@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
>c_parser_set_source_position_from_token (token);
>if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
>   {
> -  error ("unknown type name %qE", token->value);
> +  error_at (token->location, "unknown type name %qE", token->value);
>parser->error = true;
>   }
>/* ??? In some Objective-C cases '...' isn't applicable so there

BTW, your MUA eats tabs, so the patch can't be applied (common gmail
problem).

> Index: gcc/testsuite/gcc.dg/decl-10.c
> ===
> --- gcc/testsuite/gcc.dg/decl-10.c (revision 0)
> +++ gcc/testsuite/gcc.dg/decl-10.c (working copy)
> @@ -0,0 +1,13 @@
> +/* { dg-do compile } */
> +
> +void
> +f4(const foo x) /* { dg-error "unknown type name" } */
> +{}
> +
> +void
> +f5(foo x, int i) /* { dg-error "unknown type name" } */
> +{}
> +
> +void
> +f6(char c, foo x, ...) /* { dg-error "unknown type name" } */
> +{}

Since we're testing the column numbers here, those dg-errors should
test that.  So please adjust them:
/* { dg-error "10:unknown type name" } */
/* { dg-error "4:unknown type name" } */
/* { dg-error "12:unknown type name" } */

Thanks.

Marek


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Prathamesh Kulkarni
On Wed, Feb 19, 2014 at 7:56 PM, Marek Polacek  wrote:
> On Wed, Feb 19, 2014 at 07:43:56PM +0530, Prathamesh Kulkarni wrote:
>> Index: gcc/testsuite/gcc.dg/decl-9.c
>> ===
>> --- gcc/testsuite/gcc.dg/decl-9.c (revision 207700)
>> +++ gcc/testsuite/gcc.dg/decl-9.c (working copy)
>> @@ -30,3 +30,14 @@ void *f3()
>>return x; /* { dg-bogus "'x' undeclared" } */
>>  }
>>
>> +void
>> +f4(const foo x) /* { dg-error "unknown type name 'foo'" } */
>> +{}
>> +
>> +void
>> +f5(int i; foo x, int i) /* { dg-error "unknown type name 'foo'" } */
>> +{}
>> +
>> +void
>> +f6(char c, foo x, ...) /* { dg-error "unknown type name 'foo'" } */
>> +{}
>
> I'd omit the 'foo' in dg-error and please create a new testcase for this,
> don't reuse decl-9.c.
Ok. I moved the test cases into new file decl-10.c (suggest a better name ?)
>
> Otherwise looks good (can't approve though), thanks.
>
[gcc/c]
* c-parser.c (c_parser_declspecs): Replace call to error by error_at.
* c-parser.c (c_parser_parameter_declaration): Likewise.

[gcc/testsuite]
* gcc.dg/decl-10.c: New test case.

Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c (revision 207700)
+++ gcc/c/c-parser.c (working copy)
@@ -2223,7 +2223,7 @@ c_parser_declspecs (c_parser *parser, st
   attrs_ok = true;
   if (kind == C_ID_ID)
 {
-  error ("unknown type name %qE", value);
+  error_at (loc, "unknown type name %qE", value);
   t.kind = ctsk_typedef;
   t.spec = error_mark_node;
 }
@@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
   c_parser_set_source_position_from_token (token);
   if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
  {
-  error ("unknown type name %qE", token->value);
+  error_at (token->location, "unknown type name %qE", token->value);
   parser->error = true;
  }
   /* ??? In some Objective-C cases '...' isn't applicable so there
Index: gcc/testsuite/gcc.dg/decl-10.c
===
--- gcc/testsuite/gcc.dg/decl-10.c (revision 0)
+++ gcc/testsuite/gcc.dg/decl-10.c (working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+void
+f4(const foo x) /* { dg-error "unknown type name" } */
+{}
+
+void
+f5(foo x, int i) /* { dg-error "unknown type name" } */
+{}
+
+void
+f6(char c, foo x, ...) /* { dg-error "unknown type name" } */
+{}

> Marek


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Marek Polacek
On Wed, Feb 19, 2014 at 07:43:56PM +0530, Prathamesh Kulkarni wrote:
> Index: gcc/testsuite/gcc.dg/decl-9.c
> ===
> --- gcc/testsuite/gcc.dg/decl-9.c (revision 207700)
> +++ gcc/testsuite/gcc.dg/decl-9.c (working copy)
> @@ -30,3 +30,14 @@ void *f3()
>return x; /* { dg-bogus "'x' undeclared" } */
>  }
> 
> +void
> +f4(const foo x) /* { dg-error "unknown type name 'foo'" } */
> +{}
> +
> +void
> +f5(int i; foo x, int i) /* { dg-error "unknown type name 'foo'" } */
> +{}
> +
> +void
> +f6(char c, foo x, ...) /* { dg-error "unknown type name 'foo'" } */
> +{}

I'd omit the 'foo' in dg-error and please create a new testcase for this,
don't reuse decl-9.c.

Otherwise looks good (can't approve though), thanks.

Marek


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Prathamesh Kulkarni
On Wed, Feb 19, 2014 at 7:01 PM, Marek Polacek  wrote:
> On Wed, Feb 19, 2014 at 06:05:12PM +0530, Prathamesh Kulkarni wrote:
>> Replace calls to error() by error_at().
>>
>> * c-parser.c (c_parser_declspecs): replace call to error () by error_at ()
>
> "Replace", drop ()'s, full stop at the end.
>
>> * c-parser.c (c_parser_parameter_declaration): Likewise
>
> Full stop at the end.
>
>> @@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
>>c_parser_set_source_position_from_token (token);
>>if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
>>   {
>> -  error ("unknown type name %qE", token->value);
>> +  error_at (token->location,  "unknown type name %qE", token->value);
>
> Only one space between , and ".
>
> It'd be nice to add a testcase as well, e.g. something like this
>
> void
> fn1 (const foo x) /* { dg-error "..." } */
> {
> }
>
> void
> fn2 (int i; foo a; int i) /* { dg-error "..." } */
> {
> }
>
> void
> fn3 (char c, foo x, ...) /* { dg-error "..." } */
> {
> }
>
Is this fine ?

* c-parser.c (c_parser_declspecs): Replace call to error by error_at.
* c-parser.c (c_parser_parameter_declaration): Likewise.

Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c (revision 207700)
+++ gcc/c/c-parser.c (working copy)
@@ -2223,7 +2223,7 @@ c_parser_declspecs (c_parser *parser, st
   attrs_ok = true;
   if (kind == C_ID_ID)
 {
-  error ("unknown type name %qE", value);
+  error_at (loc, "unknown type name %qE", value);
   t.kind = ctsk_typedef;
   t.spec = error_mark_node;
 }
@@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
   c_parser_set_source_position_from_token (token);
   if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
  {
-  error ("unknown type name %qE", token->value);
+  error_at (token->location, "unknown type name %qE", token->value);
   parser->error = true;
  }
   /* ??? In some Objective-C cases '...' isn't applicable so there
Index: gcc/testsuite/gcc.dg/decl-9.c
===
--- gcc/testsuite/gcc.dg/decl-9.c (revision 207700)
+++ gcc/testsuite/gcc.dg/decl-9.c (working copy)
@@ -30,3 +30,14 @@ void *f3()
   return x; /* { dg-bogus "'x' undeclared" } */
 }

+void
+f4(const foo x) /* { dg-error "unknown type name 'foo'" } */
+{}
+
+void
+f5(int i; foo x, int i) /* { dg-error "unknown type name 'foo'" } */
+{}
+
+void
+f6(char c, foo x, ...) /* { dg-error "unknown type name 'foo'" } */
+{}
> Marek


Re: c-parser.c replace error() by error_at()

2014-02-19 Thread Marek Polacek
On Wed, Feb 19, 2014 at 06:05:12PM +0530, Prathamesh Kulkarni wrote:
> Replace calls to error() by error_at().
> 
> * c-parser.c (c_parser_declspecs): replace call to error () by error_at ()

"Replace", drop ()'s, full stop at the end.

> * c-parser.c (c_parser_parameter_declaration): Likewise

Full stop at the end.

> @@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
>c_parser_set_source_position_from_token (token);
>if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
>   {
> -  error ("unknown type name %qE", token->value);
> +  error_at (token->location,  "unknown type name %qE", token->value);

Only one space between , and ".

It'd be nice to add a testcase as well, e.g. something like this

void
fn1 (const foo x) /* { dg-error "..." } */
{
}

void
fn2 (int i; foo a; int i) /* { dg-error "..." } */
{
}

void
fn3 (char c, foo x, ...) /* { dg-error "..." } */
{
}

Marek


c-parser.c replace error() by error_at()

2014-02-19 Thread Prathamesh Kulkarni
Replace calls to error() by error_at().

* c-parser.c (c_parser_declspecs): replace call to error () by error_at ()
* c-parser.c (c_parser_parameter_declaration): Likewise

Bootstrapped on x86_64-unknown-linux-gnu
Ok for trunk ?

Thanks and Regards,
Prathamesh

Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c (revision 207700)
+++ gcc/c/c-parser.c (working copy)
@@ -2223,7 +2223,7 @@ c_parser_declspecs (c_parser *parser, st
   attrs_ok = true;
   if (kind == C_ID_ID)
 {
-  error ("unknown type name %qE", value);
+  error_at (loc, "unknown type name %qE", value);
   t.kind = ctsk_typedef;
   t.spec = error_mark_node;
 }
@@ -3608,7 +3608,7 @@ c_parser_parameter_declaration (c_parser
   c_parser_set_source_position_from_token (token);
   if (c_parser_next_tokens_start_typename (parser, cla_prefer_type))
  {
-  error ("unknown type name %qE", token->value);
+  error_at (token->location,  "unknown type name %qE", token->value);
   parser->error = true;
  }
   /* ??? In some Objective-C cases '...' isn't applicable so there