diff mbox

PR bootstrap/71471: remove selftest for pp_format (%p)

Message ID 1465490744-9985-1-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm June 9, 2016, 4:45 p.m. UTC
I was confused by the comment to pp_format:

  /* The following format specifiers are recognized as being client independent:
     ...
     %p: pointer
     ... */

into thinking that %p is printed in a host-independent manner, when
"client independent" means in relation to different pretty-printers e.g the
C++ pretty printer, or normal tree one etc.

The following patch removes the overzealous test case and clarifies
the comment.

OK for trunk?

I'm working on a followup that makes selftest failures easier to
track down.

gcc/ChangeLog:
	PR bootstrap/71471
	* pretty-print.c (pp_indent): Specify that %p is printed in a
	host-dependent manner.
	(test_pp_format): Remove the test for %p.
---
 gcc/pretty-print.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jeff Law June 9, 2016, 5:22 p.m. UTC | #1
On 06/09/2016 10:45 AM, David Malcolm wrote:
> I was confused by the comment to pp_format:
>
>   /* The following format specifiers are recognized as being client independent:
>      ...
>      %p: pointer
>      ... */
>
> into thinking that %p is printed in a host-independent manner, when
> "client independent" means in relation to different pretty-printers e.g the
> C++ pretty printer, or normal tree one etc.
>
> The following patch removes the overzealous test case and clarifies
> the comment.
>
> OK for trunk?
>
> I'm working on a followup that makes selftest failures easier to
> track down.
>
> gcc/ChangeLog:
> 	PR bootstrap/71471
> 	* pretty-print.c (pp_indent): Specify that %p is printed in a
> 	host-dependent manner.
> 	(test_pp_format): Remove the test for %p.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index d805da4..8febda0 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -279,7 +279,7 @@  pp_indent (pretty_printer *pp)
    %wd, %wi, %wo, %wu, %wx: HOST_WIDE_INT versions.
    %c: character.
    %s: string.
-   %p: pointer.
+   %p: pointer (printed in a host-dependent manner).
    %r: if pp_show_color(pp), switch to color identified by const char *.
    %R: if pp_show_color(pp), reset color.
    %m: strerror(text->err_no) - does not consume a value from args_ptr.
@@ -1317,8 +1317,8 @@  test_pp_format ()
   assert_pp_format ("A 12345678", "%c %x", 'A', 0x12345678);
   assert_pp_format ("hello world 12345678", "%s %x", "hello world",
 		    0x12345678);
-  assert_pp_format ("0xcafebabe 12345678", "%p %x", (void *)0xcafebabe,
-		    0x12345678);
+  /* We can't test for %p; the pointer is printed in an implementation-defined
+     manner.  */
   assert_pp_format ("normal colored normal 12345678",
 		    "normal %rcolored%R normal %x",
 		    "error", 0x12345678);