This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch[mingw/cygwin]: Fix dllimport "unmarking" thinko in winnt.c [Take 2]
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: Christopher Faylor <cgf at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, chorns at users dot sourceforge dot net
- Date: Wed, 12 Mar 2003 06:55:56 +1100 (EST)
- Subject: Re: Patch[mingw/cygwin]: Fix dllimport "unmarking" thinko in winnt.c [Take 2]
--- Christopher Faylor <cgf at redhat dot com> wrote: > On Tue, Mar 11, 2003 at
08:17:19PM +1100, Danny Smith wrote:
> >"Christopher Faylor" wrote:
> >
> >> On Thu, Mar 06, 2003 at 09:16:18AM +1100, Danny Smith wrote:
> >> >Hello,
> >> >
> >> >The modifications to provide __fastcall support
> >> >
> >> >http://gcc.gnu.org/ml/gcc-cvs/2002-12/msg00633.html
> >> >
> >> >introduced mistakes in config/i386/winnt.c.
> >== 8< ==
> >> Rather than using oldname += 3, wouldn't it make sense to define a
> >constant
> >> so that it was little more obvious what the "3" referred to?
> >>
> >> cgf
> >
> >
> >Well, this cleans up a bit more than that to get rid of most of the magic
> >numbers.
> >
> >I've replaced the use of DLL_IMPORT_EXPORT_PREFIX combined with the
> >strings "e." and "i." with two new defines: DLL_IMPORT_PREFIX and
> >DLL_EXPORT_PREFIX. These new symbolic constants get used throughout.
> >This seemed to be easier to follow than fooling around with a lot of
> >string/char concatenations
>
> Rather than recalculating the strlen of the prefix repeatdly, couldn't
> you just declare a DLL_IMPORT_EXPORT_PREFIX which was equal to the
> sizeof DLL_IMPORT_EXPORT_PREFIX - 1? It just saves some unneeded cycles,
> although, hmm, maybe gcc does this for you automatically.
>
> cgf
GCC does it all anyway,
#include <string.h>
#define FOO "foo"
int bar(){
int a;
int b;
int c;
char foostring[] = "foostring";
a = strlen (FOO);
c = a;
b = strlen (FOO);
c = a + b + strncmp (FOO, foostring, strlen(FOO));
return c;
}
generates no calls to strlen.
At -O1, the call to strncmp is generated inline as well.
But if you like, I could add new defines DLL_IMPORT_PREFIX_LEN and
DLL_EXPORT_PREFIX_LEN.
Danny
http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.