[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/29915] New: bfdio.c does not compile with mingw.org's MinG
From: |
eliz at gnu dot org |
Subject: |
[Bug binutils/29915] New: bfdio.c does not compile with mingw.org's MinGW |
Date: |
Sat, 17 Dec 2022 17:26:06 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=29915
Bug ID: 29915
Summary: bfdio.c does not compile with mingw.org's MinGW
Product: binutils
Version: 2.40 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: eliz at gnu dot org
Target Milestone: ---
CC bfdio.lo
bfdio.c: In function '_bfd_real_fopen':
bfdio.c:130:28: error: implicit declaration of function
'___lc_codepage_func' [-Werror=implicit-function-declaration]
130 | const unsigned int cp = ___lc_codepage_func();
| ^~~~~~~~~~~~~~~~~~~
This happens because the proper prototype of ___lc_codepage_func is
defined under a condition that is only valid for MinGW64:
#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 9
/* This prototype was added to locale.h in version 9.0 of MinGW-w64. */
_CRTIMP unsigned int __cdecl ___lc_codepage_func(void);
#endif
mingw.org's MinGW doesn't define __MINGW64_VERSION_MAJOR, and it lacks
the prototype of ___lc_codepage_func in all of its versions.
Therefore, I suggest the following fix to satisfy both flavors of
MinGW:
--- bfd/bfdio.c~0 2022-12-17 03:47:10.000000000 +0200
+++ bfd/bfdio.c 2022-12-17 16:45:38.067750000 +0200
@@ -31,8 +31,10 @@
#include <locale.h>
#endif
-#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 9
-/* This prototype was added to locale.h in version 9.0 of MinGW-w64. */
+#if (defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 9) \
+ || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
+/* This prototype was added to locale.h in version 9.0 of MinGW-w64,
+ and is absent from all versions of mingw.org's MinGW. */
_CRTIMP unsigned int __cdecl ___lc_codepage_func(void);
#endif
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/29915] New: bfdio.c does not compile with mingw.org's MinGW,
eliz at gnu dot org <=
- [Bug binutils/29915] bfdio.c does not compile with mingw.org's MinGW, amodra at gmail dot com, 2022/12/18
- [Bug binutils/29915] bfdio.c does not compile with mingw.org's MinGW, eliz at gnu dot org, 2022/12/18
- [Bug binutils/29915] bfdio.c does not compile with mingw.org's MinGW, eliz at gnu dot org, 2022/12/18
- [Bug binutils/29915] bfdio.c does not compile with mingw.org's MinGW, cvs-commit at gcc dot gnu.org, 2022/12/20
- [Bug binutils/29915] bfdio.c does not compile with mingw.org's MinGW, amodra at gmail dot com, 2022/12/20
- [Bug binutils/29915] bfdio.c does not compile with mingw.org's MinGW, cvs-commit at gcc dot gnu.org, 2022/12/22