This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch,libgfortran] PR 41219, fix getlogin include on MINGW


Hi all,

MINGW has getlogin thus the link check in configure works. However,
without defining _POSIX the prototype is not available with #include.

../../../gcc/libgfortran/intrinsics/getlog.c: In function â_gfortran_getlogâ:
../../../gcc/libgfortran/intrinsics/getlog.c:85:3: warning: implicit
declaration of function âgetloginâ
../../../gcc/libgfortran/intrinsics/getlog.c:85:5: warning: assignment makes
pointer from integer without a cast

The following adds the _POSIX definition. Nightstrike wrote at #gfortran:
"applying it manually does cause ../../../gcc/libgfortran/intrinsics/getlog.c
to be recompiled, adn thje compile is silent"

An alternative would be to use AC_CHECK_DECLS which - without _POSIX - will
likely cause HAVE_GETLOGIN to be undefined and thus the use of the fallback
implementation in the same file, which uses GetUserName.

OK for the trunk?

Tobias
2009-09-03  Tobias Burnus  <burnus@net-b.de>

	PR fortran/41219
	* intrinsics/getlog.c: Define _POSIX for MINGW32.

Index: intrinsics/getlog.c
===================================================================
--- intrinsics/getlog.c	(Revision 151381)
+++ intrinsics/getlog.c	(Arbeitskopie)
@@ -28,6 +28,9 @@ see the files COPYING3 and COPYING.RUNTI
 #include <string.h>
 
 #ifdef HAVE_UNISTD_H
+#  if defined __MINGW32__ && defined  HAVE_GETLOGIN
+#    define _POSIX 1
+#  endif
 #include <unistd.h>
 #endif
 #ifdef HAVE_PWD_H

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]