From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4866 invoked by alias); 1 Apr 2011 08:39:31 -0000 Received: (qmail 4855 invoked by uid 22791); 1 Apr 2011 08:39:28 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Apr 2011 08:39:23 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LIY00A00TBLIO00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Fri, 01 Apr 2011 11:39:21 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.126.47.180]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LIY0099ITDK8JE0@a-mtaout22.012.net.il>; Fri, 01 Apr 2011 11:39:21 +0300 (IDT) Date: Fri, 01 Apr 2011 08:39:00 -0000 From: Eli Zaretskii Subject: Re: [RFC 1/9] Unify windows specifics into common/windows-hdep files In-reply-to: <002e01cbf02b$7a9cafa0$6fd60ee0$%muller@ics-cnrs.unistra.fr> To: Pierre Muller Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83tyeipdqc.fsf@gnu.org> 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> <002e01cbf02b$7a9cafa0$6fd60ee0$%muller@ics-cnrs.unistra.fr> X-IsSubscribed: yes 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/msg00002.txt.bz2 > From: "Pierre Muller" > Cc: > Date: Fri, 1 Apr 2011 07:12:42 +0200 > > > > 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. Again, I think it's bad practice to use such macros, but that's me. If no one else cares, you can disregard me on that account. > > > > > +# 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. Sorry, I'm not following. What difficulties you envision. In general, I don't think we should drag into GDB the stuff MinGW headers do to "transparently" support compile-time selection of ANSI vs Unicode APIs. I think we should use the mechanism provided for that by the headers. That mechanism is to define _UNICODE. > 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. I don't know enough about the Cygwin part of this, so maybe you are right. But in that case, we should have explicit code that selects either ..A or ..W variety of the API at run time, instead of hiding them in a header using #define's.