The attached patch adds definitions of TARGET_PRINTF_POINTER_FORMAT
to the rs6000 pair of linux.h and linux64.h headers, analogous to
the config/linux.h header.  This appears to be necessary since
unlike most other back ends, the rs6000 back end doesn't include
the latter linux.h.

The patch fixes bug 77837 - missing -Wformat-length warning for %p
with null argument on powerpc64.

Thanks
Martin
PR target/77837 - missing -Wformat-length warning for %p with null argument on powerpc64

gcc/ChangeLog:
2016-10-03  Martin Sebor  <mse...@redhat.com>

	PR target/77837
	* config/rs6000/linux.h (TARGET_PRINTF_POINTER_FORMAT): Define.
	* config/rs6000/linux64.h (TARGET_PRINTF_POINTER_FORMAT): Likewise.

diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
index ac9296d..e70fa02 100644
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -138,3 +138,7 @@
   || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
 #define RS6000_GLIBC_ATOMIC_FENV 1
 #endif
+
+/* The format string to which "%p" corresponds.  */
+#undef TARGET_PRINTF_POINTER_FORMAT
+#define TARGET_PRINTF_POINTER_FORMAT gnu_libc_printf_pointer_format
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index e86b5d5..fa75bce 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -634,3 +634,7 @@ extern int dot_symbols;
   || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
 #define RS6000_GLIBC_ATOMIC_FENV 1
 #endif
+
+/* The format string to which "%p" corresponds.  */
+#undef TARGET_PRINTF_POINTER_FORMAT
+#define TARGET_PRINTF_POINTER_FORMAT gnu_libc_printf_pointer_format

Reply via email to