From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24961 invoked by alias); 3 Mar 2010 20:30:23 -0000 Received: (qmail 24913 invoked by uid 22791); 3 Mar 2010 20:30:20 -0000 X-Spam-Check-By: sourceware.org Received: from pool-173-48-46-17.bstnma.fios.verizon.net (HELO cgf.cx) (173.48.46.17) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Wed, 03 Mar 2010 20:30:14 +0000 Received: from ednor.cgf.cx (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 955D713C0C9; Wed, 3 Mar 2010 15:30:12 -0500 (EST) Received: by ednor.cgf.cx (Postfix, from userid 201) id 91E972B352; Wed, 3 Mar 2010 15:30:12 -0500 (EST) Date: Wed, 03 Mar 2010 20:30:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org, Pierre Muller Subject: Re: [RFC] Reenable compilation with cygwin 1.5 versions Message-ID: <20100303203012.GA31597@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org, Pierre Muller References: <002701cabaf2$39739ad0$ac5ad070$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002701cabaf2$39739ad0$ac5ad070$@muller@ics-cnrs.unistra.fr> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00123.txt.bz2 On Wed, Mar 03, 2010 at 05:54:43PM +0100, Pierre Muller wrote: >Index: remote-fileio.c >=================================================================== >RCS file: /cvs/src/src/gdb/remote-fileio.c,v >retrieving revision 1.34 >diff -u -p -r1.34 remote-fileio.c >--- remote-fileio.c 1 Mar 2010 09:09:24 -0000 1.34 >+++ remote-fileio.c 3 Mar 2010 16:11:15 -0000 >@@ -35,6 +35,11 @@ > #include > #ifdef __CYGWIN__ > #include /* For >cygwin_conv_to_full_posix_path. */ >+#include >+#if >CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API >_MINOR) < 181 >+#define __USE_OLD_CYGWIN_API_ >+#endif >+ > #endif > #include > >@@ -1021,14 +1026,24 @@ remote_fileio_func_rename (char *buf) > errno = EISDIR; > else > { >+#ifndef __USE_OLD_CYGWIN_API_ > char oldfullpath[PATH_MAX]; > char newfullpath[PATH_MAX]; >+#else /* __USE_OLD_CYGWIN_API_ */ >+ char oldfullpath[PATH_MAX + 1]; >+ char newfullpath[PATH_MAX + 1]; >+#endif /* __USE_OLD_CYGWIN_API_ */ > int len; > >+#ifndef __USE_OLD_CYGWIN_API_ > cygwin_conv_path (CCP_WIN_A_TO_POSIX, oldpath, >oldfullpath, > PATH_MAX); > cygwin_conv_path (CCP_WIN_A_TO_POSIX, newpath, >newfullpath, > PATH_MAX); >+#else /* __USE_OLD_CYGWIN_API_ */ >+ cygwin_conv_to_full_posix_path (oldpath, oldfullpath); >+ cygwin_conv_to_full_posix_path (newpath, newfullpath); >+#endif /* __USE_OLD_CYGWIN_API_ */ > len = strlen (oldfullpath); > if (newfullpath[len] == '/' > && !strncmp (oldfullpath, newfullpath, len)) I think it would be cleaner to define a cygwin_conv_path at the top of the file based on cygwin_conv_to_full_posix_path. Then no __USE_OLD_CYGWIN_API_ would be necessary (given the understanding that the PATH_MAX changes aren't needed). >Index: windows-nat.c >=================================================================== >RCS file: /cvs/src/src/gdb/windows-nat.c,v >retrieving revision 1.204 >diff -u -p -r1.204 windows-nat.c >--- windows-nat.c 1 Mar 2010 09:09:24 -0000 1.204 >+++ windows-nat.c 3 Mar 2010 16:11:15 -0000 >@@ -41,6 +41,12 @@ > #include > #ifdef __CYGWIN__ > #include >+#include >+#if >CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API >_MINOR) < 181 >+#define __USE_OLD_CYGWIN_API_ >+#else >+#define __USE_NEW_CYGWIN_API_ >+#endif > #endif > #include > >@@ -71,11 +77,11 @@ > #define DebugBreakProcess dyn_DebugBreakProcess > #define DebugSetProcessKillOnExit dyn_DebugSetProcessKillOnExit > #define EnumProcessModules dyn_EnumProcessModules >-#ifndef __CYGWIN__ >+#ifndef __USE_NEW_CYGWIN_API_ > #define GetModuleFileNameExA dyn_GetModuleFileNameExA >-#else >+#else /* __USE_NEW_CYGWIN_API_ */ > #define GetModuleFileNameExW dyn_GetModuleFileNameExW >-#endif >+#endif /* __USE_NEW_CYGWIN_API_ */ > #define GetModuleInformation dyn_GetModuleInformation > #define LookupPrivilegeValueA dyn_LookupPrivilegeValueA > #define OpenProcessToken dyn_OpenProcessToken >@@ -87,13 +93,13 @@ static BOOL WINAPI (*DebugBreakProcess) > static BOOL WINAPI (*DebugSetProcessKillOnExit) (BOOL); > static BOOL WINAPI (*EnumProcessModules) (HANDLE, HMODULE *, DWORD, > LPDWORD); >-#ifndef __CYGWIN__ >+#ifndef __USE_NEW_CYGWIN_API_ > static DWORD WINAPI (*GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR, > DWORD); >-#else >+#else /* __USE_NEW_CYGWIN_API_ */ > static DWORD WINAPI (*GetModuleFileNameExW) (HANDLE, HMODULE, LPWSTR, > DWORD); >-#endif >+#endif /* __USE_NEW_CYGWIN_API_ */ > static BOOL WINAPI (*GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO, > DWORD); > static BOOL WINAPI (*LookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID); Here also, it seems like just defining and using a GetModulesFileNameEx, etc. and deciding whether to do "A" or "W" in a macro would be much cleaner. You probably still need to make decisions about using wide characters but the test should be on something like "USE_WIDE_CHARS" rather than "__USE_NEW_CYGWIN_API" since, the use of wide characters doesn't really have anything to do with the new Cygwin API. cgf