This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Speed-up get_identifier("main")
- From: Roger Sayle <roger at eyesopen dot com>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: jason at redhat dot com, <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 7 Aug 2003 10:43:38 -0600 (MDT)
- Subject: Re: [PATCH] Speed-up get_identifier("main")
On Thu, 7 Aug 2003, Kaveh R. Ghazi wrote:
> > > #define get_identifier(STR) \
> > > __builtin_constant_p (STR) \
> > > ? get_identifier_with_length (STR, (unsigned) (STR)) \
> > ^strlen, oops
> > > : (get_identifier) (STR)
> >
> > Jason
>
> The cast to unsigned of the strlen was only necessary when prototypes
> were missing in traditional C.
I've kept the explicit cast to (unsigned int) in the latest version of
my patch. Many compilers issue warnings about implicit loss of precision
converting the size_t returned by strlen into the unsigned int required
by the prototype. Whilst an explicit cast isn't required, it helps
silence compiler warnings from non-GCC host compilers.
At some point in the future, we may even enable such portability warnings
by default during GCC bootstraps.
Roger
--