From 70daf0a1a1dc1d80b2e1de46bcc39834bc0307b8 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sat, 31 Oct 2015 21:40:15 +0000 Subject: [PATCH] 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/read.c | 2 +- gold/configure | 2 +- gold/configure.ac | 2 +- include/ansidecl.h | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 1d477c3f5f..b8a5ec6e9e 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -157,7 +157,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 93745bd3fd..e6b8980f4e 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -164,7 +164,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 e46fffc796..b591a8214c 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -171,7 +171,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"; @@ -302,7 +302,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 4b9fa06c26..97dce5b2d4 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 96a7884767..d373126738 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1228,7 +1228,7 @@ dump_relocations (Filedata * filedata, : "%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 ", @@ -13413,7 +13413,7 @@ dump_section_as_strings (Elf_Internal_Shdr * section, Filedata * filedata) { 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/read.c b/gas/read.c index 1f211b6819..b983f1a628 100644 --- a/gas/read.c +++ b/gas/read.c @@ -4412,7 +4412,7 @@ emit_expr_with_reloc (expressionS *exp, { /* 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 a57025bd0b..1d5ceb631d 100755 --- a/gold/configure +++ b/gold/configure @@ -10052,7 +10052,7 @@ else /* end confdefs.h. */ template extern void foo(const char*, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); + __attribute__ ((__format__ (gnu_printf, 1, 2))); template void foo(const char* format, ...) {} void bar() { foo("%s\n", "foo"); } diff --git a/gold/configure.ac b/gold/configure.ac index d9a1869070..60b4fd6892 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -655,7 +655,7 @@ AC_CACHE_CHECK([whether we can use attributes with template functions], [gold_cv_template_attribute], [AC_COMPILE_IFELSE([AC_LANG_SOURCE([ template extern void foo(const char*, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); + __attribute__ ((__format__ (gnu_printf, 1, 2))); template void foo(const char* format, ...) {} void bar() { foo("%s\n", "foo"); } ])], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])]) diff --git a/include/ansidecl.h b/include/ansidecl.h index 406473ca9e..cd70d949e6 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -195,7 +195,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) @@ -223,7 +223,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.18.0