diff mbox

[libgFortran] Fix MinGW64 compile warning

Message ID 4D8CCC8D.5060206@net-b.de
State New
Headers show

Commit Message

Tobias Burnus March 25, 2011, 5:10 p.m. UTC
The attached patch fixes a compiler warning on MinGW64

../../../../../build/gcc/src/libgfortran/io/unix.c:51:0: warning: 
"lseek" redefined [enabled by default]

which is due to MinGW64 now supporting LFS. (Seemingly, using a similar 
define as libgfortran.) The following patch should fix the issue.

Thanks for Kai for suggestions and testing the patch on MinGW64. The 
goal is that it also works with older MinGW64 and with 32bit MinGW, but 
that has not been tested ...

OK for the trunk?

Tobias

Comments

Janne Blomqvist March 26, 2011, 7:09 a.m. UTC | #1
On Fri, Mar 25, 2011 at 19:10, Tobias Burnus <burnus@net-b.de> wrote:
> The attached patch fixes a compiler warning on MinGW64
>
> ../../../../../build/gcc/src/libgfortran/io/unix.c:51:0: warning: "lseek"
> redefined [enabled by default]
>
> which is due to MinGW64 now supporting LFS. (Seemingly, using a similar
> define as libgfortran.) The following patch should fix the issue.
>
> Thanks for Kai for suggestions and testing the patch on MinGW64. The goal is
> that it also works with older MinGW64 and with 32bit MinGW, but that has not
> been tested ...
>
> OK for the trunk?

Since the reason for adding the gfstat_t typedef was that on mingw we
needed to use struct _stati64 instead of struct stat, and that
justification now seems to be gone with this patch, please also remove
gfstat_t and just use struct stat everywhere.

Otherwise Ok.
diff mbox

Patch

2011-03-25  Tobias Burnus  <burnus@net-b.de>

	* unix.c: Adapt stat defines now that MinGW64 supports LFS.

Index: libgfortran/io/unix.c
===================================================================
--- libgfortran/io/unix.c	(Revision 171454)
+++ libgfortran/io/unix.c	(Arbeitskopie)
@@ -48,11 +48,17 @@ 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
+#if !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64
+#undef lseek
 #define lseek _lseeki64
+#undef fstat
 #define fstat _fstati64
+#undef stat
 #define stat _stati64
-typedef struct _stati64 gfstat_t;
+#endif
 
+typedef struct stat gfstat_t;
+
 #ifndef HAVE_WORKING_STAT
 static uint64_t
 id_from_handle (HANDLE hFile)