This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix PR 23439/23440


On 16 Sep, Daniel Berlin wrote:
> On Fri, 2005-09-16 at 22:50 +0200, Volker Reichelt wrote:
>> On 16 Sep, Ian Lance Taylor wrote:
>> > Volker Reichelt <reichelt@igpm.rwth-aachen.de> writes:
>> > 
>> >> Apart from "SET_EXPR_LOCUS (node, NULL);" vs. "return;" I fail
>> >> to see a real difference between this and my version.
>> > 
>> > There isn't one.  I was more answering Daniel's comment than your
>> > patch.
>> 
>> This cosmetic change won't make Daniel happy, I suppose.
> 
> Meh, it just worries me.  I've started to see a lot of functions
> recently with if (!arg) return;
> 
> If this is a legitimate use (which it seems to be), that's fine.

But we can indeed do without:
Because annotate_with_file_line chokes on empty filenames, here's a
patch that just adds a dummy filename to the annotations that cause
the hiccups. So we need no extra logic in annotate_with_file_line.

Is this preferable to the first approach?
Is this OK for the C and C++ frontend maintainers?

I had to improve the testcases because the original ones weren't
failing on mainline anymore due to my patch
http://gcc.gnu.org/ml/gcc-patches/2005-09/msg00679.html

Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for mainline and 4.0 branch?

Regards,
Volker


2005-09-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c/23439
	* toplev.c (unknown_location): Annotate with dummy filename.

===================================================================
--- gcc/gcc/toplev.c	9 Sep 2005 00:46:45 -0000	1.975
+++ gcc/gcc/toplev.c	16 Sep 2005 21:06:17 -0000
@@ -140,7 +140,7 @@ static const char **save_argv;
 const char *main_input_filename;
 
 #ifndef USE_MAPPED_LOCATION
-location_t unknown_location = { NULL, 0 };
+location_t unknown_location = { "dummy_location", 0 };
 #endif
 
 /* Used to enable -fvar-tracking, -fweb and -frename-registers according
===================================================================

2005-09-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/23440
	* parser.c (eof_token): Annotate with dummy filename.

===================================================================
--- gcc/gcc/cp/parser.c	8 Sep 2005 13:14:13 -0000	1.356
+++ gcc/gcc/cp/parser.c	15 Sep 2005 15:40:38 -0000
@@ -76,7 +76,7 @@ static const cp_token eof_token =
 #if USE_MAPPED_LOCATION
   0
 #else
-  {0, 0}
+  {"dummy_location", 0}
 #endif
 };
 
===================================================================


2005-09-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c/23439
	* gcc.dg/for-1.c: New test.

	PR c++/23440
	* g++.dg/parse/for1.C: New test.

===================================================================
--- gcc/gcc/testsuite/gcc.dg/for-1.c   2003-09-23 19:59:22 +0200
+++ gcc/gcc/testsuite/gcc.dg/for-1.c   2005-09-11 01:19:56 +0200
@@ -0,0 +1,7 @@
+/* PR c/23439 */
+/* Origin: Serge Belyshev <belyshev@depni.sinp.msu.ru> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+# 0 "for-1.c"
+void foo() { for  /* { dg-error "at end of input" "" { target *-*-* } 0 } */
===================================================================
--- gcc/gcc/testsuite/g++.dg/parse/for1.C   2003-09-23 19:59:22 +0200
+++ gcc/gcc/testsuite/g++.dg/parse/for1.C   2005-09-11 01:21:43 +0200
@@ -0,0 +1,7 @@
+// PR c++/23440
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+// { dg-do compile }
+// { dg-options "" }
+
+# 0 "for1.C"
+void foo() { for (;;)  // { dg-error "at end of input" "" { target *-*-* } 0 }
===================================================================



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]