This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 1/9] Unify windows specifics into common/windows-hdep files
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 31 Mar 2011 23:21:45 +0200
- Subject: Re: [RFC 1/9] Unify windows specifics into common/windows-hdep files
- References: <00a201cbeed2$a924dfa0$fb6e9ee0$%muller@ics-cnrs.unistra.fr> <83lizwqtz9.fsf@gnu.org> <003f01cbef22$038bef20$0aa3cd60$%muller@ics-cnrs.unistra.fr>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Cc: <gdb-patches@sourceware.org>
> 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.
> 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.
> > > +# 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.