183 lines
6.5 KiB
Diff
183 lines
6.5 KiB
Diff
From ca890339d26efeb33f611a6a18e44907b49bd5e6 Mon Sep 17 00:00:00 2001
|
|
From: Ray Donnelly <mingw.android@gmail.com>
|
|
Date: Sat, 31 Oct 2015 21:40:15 +0000
|
|
Subject: [PATCH 4/5] MinGW-w64: Use gnu-printf
|
|
|
|
---
|
|
bfd/bfd-in.h | 2 +-
|
|
bfd/bfd-in2.h | 2 +-
|
|
binutils/nm.c | 4 ++--
|
|
binutils/prdbg.c | 2 +-
|
|
binutils/readelf.c | 4 ++--
|
|
gas/as.h | 4 ++--
|
|
gas/read.c | 2 +-
|
|
gold/configure | 2 +-
|
|
gold/configure.ac | 2 +-
|
|
include/ansidecl.h | 4 ++--
|
|
10 files changed, 14 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
|
|
index 1607872..b5a9432 100644
|
|
--- a/bfd/bfd-in.h
|
|
+++ b/bfd/bfd-in.h
|
|
@@ -137,7 +137,7 @@ typedef BFD_HOST_U_64_BIT symvalue;
|
|
|
|
#if BFD_HOST_64BIT_LONG
|
|
#define BFD_VMA_FMT "l"
|
|
-#elif defined (__MSVCRT__)
|
|
+#elif defined(__MSVCRT__) && !defined( __USE_MINGW_ANSI_STDIO)
|
|
#define BFD_VMA_FMT "I64"
|
|
#else
|
|
#define BFD_VMA_FMT "ll"
|
|
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
|
|
index bca5181..9d493ae 100644
|
|
--- a/bfd/bfd-in2.h
|
|
+++ b/bfd/bfd-in2.h
|
|
@@ -144,7 +144,7 @@ typedef BFD_HOST_U_64_BIT symvalue;
|
|
|
|
#if BFD_HOST_64BIT_LONG
|
|
#define BFD_VMA_FMT "l"
|
|
-#elif defined (__MSVCRT__)
|
|
+#elif defined (__MSVCRT__) && !defined(__USE_MINGW_ANSI_STDIO)
|
|
#define BFD_VMA_FMT "I64"
|
|
#else
|
|
#define BFD_VMA_FMT "ll"
|
|
diff --git a/binutils/nm.c b/binutils/nm.c
|
|
index ed1ed12..9c4d25c 100644
|
|
--- a/binutils/nm.c
|
|
+++ b/binutils/nm.c
|
|
@@ -162,7 +162,7 @@ static char value_format_32bit[] = "%08lx";
|
|
#if BFD_HOST_64BIT_LONG
|
|
static char value_format_64bit[] = "%016lx";
|
|
#elif BFD_HOST_64BIT_LONG_LONG
|
|
-#ifndef __MSVCRT__
|
|
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
|
|
static char value_format_64bit[] = "%016llx";
|
|
#else
|
|
static char value_format_64bit[] = "%016I64x";
|
|
@@ -292,7 +292,7 @@ set_print_radix (char *radix)
|
|
#if BFD_HOST_64BIT_LONG
|
|
value_format_64bit[5] = *radix;
|
|
#elif BFD_HOST_64BIT_LONG_LONG
|
|
-#ifndef __MSVCRT__
|
|
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
|
|
value_format_64bit[6] = *radix;
|
|
#else
|
|
value_format_64bit[7] = *radix;
|
|
diff --git a/binutils/prdbg.c b/binutils/prdbg.c
|
|
index b43030b..24ce976 100644
|
|
--- a/binutils/prdbg.c
|
|
+++ b/binutils/prdbg.c
|
|
@@ -502,7 +502,7 @@ print_vma (bfd_vma vma, char *buf, bfd_boolean unsignedp, bfd_boolean hexp)
|
|
#if BFD_HOST_64BIT_LONG_LONG
|
|
else if (sizeof (vma) <= sizeof (unsigned long long))
|
|
{
|
|
-#ifndef __MSVCRT__
|
|
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
|
|
if (hexp)
|
|
sprintf (buf, "0x%llx", (unsigned long long) vma);
|
|
else if (unsignedp)
|
|
diff --git a/binutils/readelf.c b/binutils/readelf.c
|
|
index af92d5b..ad31d93 100644
|
|
--- a/binutils/readelf.c
|
|
+++ b/binutils/readelf.c
|
|
@@ -1123,7 +1123,7 @@ dump_relocations (FILE * file,
|
|
: "%12.12lx %12.12lx ",
|
|
offset, inf);
|
|
#elif BFD_HOST_64BIT_LONG_LONG
|
|
-#ifndef __MSVCRT__
|
|
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
|
|
printf (do_wide
|
|
? "%16.16llx %16.16llx "
|
|
: "%12.12llx %12.12llx ",
|
|
@@ -11552,7 +11552,7 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file)
|
|
{
|
|
size_t maxlen = end - data;
|
|
|
|
-#ifndef __MSVCRT__
|
|
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
|
|
/* PR 11128: Use two separate invocations in order to work
|
|
around bugs in the Solaris 8 implementation of printf. */
|
|
printf (" [%6tx] ", data - start);
|
|
diff --git a/gas/as.h b/gas/as.h
|
|
index df04dce..c3e5e07 100644
|
|
--- a/gas/as.h
|
|
+++ b/gas/as.h
|
|
@@ -451,10 +451,10 @@ typedef struct _pseudo_type pseudo_typeS;
|
|
|
|
#define PRINTF_LIKE(FCN) \
|
|
void FCN (const char *format, ...) \
|
|
- __attribute__ ((__format__ (__printf__, 1, 2)))
|
|
+ __attribute__ ((__format__ (gnu_printf, 1, 2)))
|
|
#define PRINTF_WHERE_LIKE(FCN) \
|
|
void FCN (char *file, unsigned int line, const char *format, ...) \
|
|
- __attribute__ ((__format__ (__printf__, 3, 4)))
|
|
+ __attribute__ ((__format__ (gnu_printf, 3, 4)))
|
|
|
|
#else /* __GNUC__ < 2 || defined(VMS) */
|
|
|
|
diff --git a/gas/read.c b/gas/read.c
|
|
index 6e441da..2fa9137 100644
|
|
--- a/gas/read.c
|
|
+++ b/gas/read.c
|
|
@@ -4322,7 +4322,7 @@ emit_expr_with_reloc (expressionS *exp,
|
|
|| (get & hibit) == 0))
|
|
{ /* Leading bits contain both 0s & 1s. */
|
|
#if defined (BFD64) && BFD_HOST_64BIT_LONG_LONG
|
|
-#ifndef __MSVCRT__
|
|
+#if !defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO)
|
|
as_warn (_("value 0x%llx truncated to 0x%llx"),
|
|
(unsigned long long) get, (unsigned long long) use);
|
|
#else
|
|
diff --git a/gold/configure b/gold/configure
|
|
index 3427074..4eefa14 100755
|
|
--- a/gold/configure
|
|
+++ b/gold/configure
|
|
@@ -7553,7 +7553,7 @@ else
|
|
/* end confdefs.h. */
|
|
|
|
template<typename T> extern void foo(const char*, ...)
|
|
- __attribute__ ((__format__ (__printf__, 1, 2)));
|
|
+ __attribute__ ((__format__ (gnu_printf, 1, 2)));
|
|
template<typename T> void foo(const char* format, ...) {}
|
|
void bar() { foo<int>("%s\n", "foo"); }
|
|
|
|
diff --git a/gold/configure.ac b/gold/configure.ac
|
|
index e0ac1df..f87efe17 100644
|
|
--- a/gold/configure.ac
|
|
+++ b/gold/configure.ac
|
|
@@ -615,7 +615,7 @@ AC_CACHE_CHECK([whether we can use attributes with template functions],
|
|
[gold_cv_template_attribute],
|
|
[AC_COMPILE_IFELSE([
|
|
template<typename T> extern void foo(const char*, ...)
|
|
- __attribute__ ((__format__ (__printf__, 1, 2)));
|
|
+ __attribute__ ((__format__ (gnu_printf, 1, 2)));
|
|
template<typename T> void foo(const char* format, ...) {}
|
|
void bar() { foo<int>("%s\n", "foo"); }
|
|
], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])])
|
|
diff --git a/include/ansidecl.h b/include/ansidecl.h
|
|
index 0fb23bb..6adf802 100644
|
|
--- a/include/ansidecl.h
|
|
+++ b/include/ansidecl.h
|
|
@@ -197,7 +197,7 @@ So instead we use the macro below and test it against specific values. */
|
|
before GCC 3.3, but as of 3.3 we need to add the `nonnull'
|
|
attribute to retain this behavior. */
|
|
#ifndef ATTRIBUTE_PRINTF
|
|
-#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
|
|
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (gnu_printf, m, n))) ATTRIBUTE_NONNULL(m)
|
|
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
|
|
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
|
|
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
|
|
@@ -225,7 +225,7 @@ So instead we use the macro below and test it against specific values. */
|
|
NULL format specifier was allowed as of gcc 3.3. */
|
|
#ifndef ATTRIBUTE_NULL_PRINTF
|
|
# if (GCC_VERSION >= 3003)
|
|
-# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
|
|
+# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (gnu_printf, m, n)))
|
|
# else
|
|
# define ATTRIBUTE_NULL_PRINTF(m, n)
|
|
# endif /* GNUC >= 3.3 */
|
|
--
|
|
2.6.3
|
|
|