https://sourceware.org/bugzilla/show_bug.cgi?id=34486

            Bug ID: 34486
           Summary: opcodes fails to compile with mingw.org's MinGW
           Product: binutils
           Version: 2.47
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: eliz at gnu dot org
  Target Milestone: ---

Compiling Binutils 2.47 with mingw.org's MinGW fails in the opcodes directory:

       CC       i386-dis.lo
     ../../binutils-2.47/opcodes/i386-dis.c: In function 'oappend_immediate':
     ../../binutils-2.47/opcodes/i386-dis.c:11714:7: error: implicit
declaration of function 'asprintf'; did you mean 'xasprintf'?
[-Werror=implicit-function-declaration]
     11714 |   if (asprintf (& annotation, "[%s]", sym->name) > 0)
           |       ^~~~~~~~
           |       xasprintf
     cc1.exe: all warnings being treated as errors
     Makefile:1076: recipe for target `i386-dis.lo' failed
     make[4]: *** [i386-dis.lo] Error 1

mingw.org's MinGW doesn't have asprintf.  libiberty has a replacement, but its
declaration in libiberty.h is guarded:

     #if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF
     /* Like sprintf but provides a pointer to malloc'd storage, which must
        be freed by the caller.  */

     extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
     #endif

However, the configure script in the opcodes directory doesn't include the test
for HAVE_DECL_ASPRINTF, and so the prototype remains invisible to the compiler.

The solution is to include a test for asprintf's declaration in opcodes'
configure script, or perhaps modify libiberty.h to also expose the prototype if
HAVE_DECL_ASPRINTF is undefined.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to