From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21370 invoked by alias); 1 Apr 2011 05:13:17 -0000 Received: (qmail 21354 invoked by uid 22791); 1 Apr 2011 05:13:15 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Apr 2011 05:13:10 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p315D4Vf044454 ; Fri, 1 Apr 2011 07:13:04 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms3.u-strasbg.fr [130.79.204.12]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p315D4PB088800 ; Fri, 1 Apr 2011 07:13:04 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p315ClN9066076 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Fri, 1 Apr 2011 07:13:03 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Eli Zaretskii'" Cc: References: <00a201cbeed2$a924dfa0$fb6e9ee0$%muller@ics-cnrs.unistra.fr> <83lizwqtz9.fsf@gnu.org> <003f01cbef22$038bef20$0aa3cd60$%muller@ics-cnrs.unistra.fr> <8362qzq93q.fsf@gnu.org> In-Reply-To: <8362qzq93q.fsf@gnu.org> Subject: RE: [RFC 1/9] Unify windows specifics into common/windows-hdep files Date: Fri, 01 Apr 2011 05:13:00 -0000 Message-ID: <002e01cbf02b$7a9cafa0$6fd60ee0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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: 2011-04/txt/msg00000.txt.bz2 > > From: "Pierre Muller" > > Cc: > > Date: Wed, 30 Mar 2011 23:32:36 +0200 > > > > > > +#undef _G_SUFFIX > > > > > > I think the C Standard says that macros whose name begins with an > > > underscore and a capital letter are reserved. Applications should not > > > use such macros. > > > > But we are also using __USEWIDE before my patch ... > > or do you mean that two underscores are OK? > > No, AFAIK macros that begin with two underscores are also reserved. But nobody protested for __USEWIDE nor for __PMAX for instance... But checking gdb directory, it seems that are only a fee macros starting with an underscore. > > I completely remove __USEWIDE and tried to replace it by this new > > USE_WIDE_WINAPI. > > Or is this __USEWIDE macro used anywhere else than inside GDB code? > > I don't think so, but maybe someone else could tell for sure. > > > Should I rather call the macro USE_UNICODE_WINAPI > > (and USE_ANSI_WINAPI to force ANSI version?) > > I don't think it matters what the macro is called. I agree with you on this point. > > > > +# define CreateProcess CreateProcessW > > > > +# define GetSystemDirectory GetSystemDirectoryW > > > > +# define windows_strlen wcslen > > > > > > Ouch! So any API that needs one of the two varieties will need to be > > > added to this list of #define's? Is that wise? > > > > Isn't it better than being forced to use > > #ifdef __USEWIDE > > CreateProcessW (... > > #else > > CreateProcessA (... > > #endif > > The Windows headers already have the machinery to do all this for you: > it works by defining _UNICODE. But using this macro would require that we are able to put of the code that decides if we want to use the Unicode or ASCII version of the windows header before even including it. I am unsure if this is possible... If you look at the code in common/windows-hdep.c I submitted, you will see that we need at least to load sys/cygwin.h and cygwin/version.h headers in order to be able to compute the Cygwin DLL version. Each might already also include windows.h meaning than setting _UNICODE at that point would be too late. If fact, looking at ChangeLogs and using 'git blame' it seems like __USEWIDE was only introduced in March 2010 by Christopher Faylor. Maybe Christopher could tell us why he decided to use this conditional instead of the standard _UNICODE macro. Pierre