Patch for %E formatting for C

Joseph S. Myers jsm@polyomino.org.uk
Sat Oct 2 19:32:00 GMT 2004


This patch fixes the problem of %E formats for C including a bogus
"({anonymous})" in the output.  (I don't think the PR requested in
<http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02087.html> was ever
opened.)

There is still a small patch to pretty-print.c in bug 16119 which
needs review by someone suitably familiar with the code; the bug
doesn't explain what was meant by "exposed glitches" or give a
testcase for it.

Bootstrapped with no regressions on i686-pc-linux-gnu.  Applied to
mainline.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
  http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-10-02  Joseph S. Myers  <jsm@polyomino.org.uk>

	* c-objc-common.c (c_tree_printer): Correct description of %E.
	Don't fall through after printing an expression.

testsuite:
2004-10-02  Joseph S. Myers  <jsm@polyomino.org.uk>

	* gcc.dg/20040920-1.c: Update expected message text.

diff -rupN GCC.orig/gcc/c-objc-common.c GCC/gcc/c-objc-common.c
--- GCC.orig/gcc/c-objc-common.c	2004-09-22 08:40:40.000000000 +0000
+++ GCC/gcc/c-objc-common.c	2004-10-01 16:04:58.000000000 +0000
@@ -187,7 +187,7 @@ c_objc_common_init (void)
    source-level entity onto BUFFER.  The meaning of the format specifiers
    is as follows:
    %D: a general decl,
-   %E: An expression,
+   %E: an identifier or expression,
    %F: a function declaration,
    %T: a type.
 
@@ -235,7 +235,10 @@ c_tree_printer (pretty_printer *pp, text
       if (TREE_CODE (t) == IDENTIFIER_NODE)
 	n = IDENTIFIER_POINTER (t);
       else
-	pp_expression (cpp, t);
+	{
+	  pp_expression (cpp, t);
+	  return true;
+	}
       break;
 
     default:
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20040920-1.c GCC/gcc/testsuite/gcc.dg/20040920-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20040920-1.c	2004-09-21 15:42:44.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20040920-1.c	2004-10-01 16:05:37.000000000 +0000
@@ -7,6 +7,6 @@ struct a
 int main(void)
 {
   struct a bar;
-  bob(5); /* { dg-error "called object 'bob\\({anonymous}\\)' is not a function" } */
-  bar.foo(); /* { dg-error "called object 'bar.foo\\({anonymous}\\)' is not a function" } */
+  bob(5); /* { dg-error "called object 'bob' is not a function" } */
+  bar.foo(); /* { dg-error "called object 'bar.foo' is not a function" } */
 }



More information about the Gcc-patches mailing list