Re: [PATCH v2 4/7] builtin: directly predefine builtin macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 08, 2018 at 06:43:01PM +0100, Ramsay Jones wrote:
> 
> 
> On 08/06/18 17:44, Luc Van Oostenryck wrote:
> > Use the newly created predefine()/predefinef() to
> 
> predefinef() is no more.

hehe, indeed.
 
> >  static void predefined_sizeof(const char *name, unsigned bits)
> >  {
> > -	add_pre_buffer("#weak_define __SIZEOF_%s__ %d\n", name, bits/8);
> > +	char buf[32];
> > +
> > +	snprintf(buf, sizeof(buf), "__SIZEOF_%s__", name);
> > +	predefine(buf, 1, "%d", bits/8);
> 
> $ gcc -dM -E - </dev/null | grep SIZEOF | cut -d' ' -f2 | awk 'length($1) >  max { max = length($1); maxline = $0 } END { print max, maxline }'
> 22 __SIZEOF_LONG_DOUBLE__
> $ 
> 
> OK.
> 
> >  }
> >  
> >  static void predefined_max(const char *name, const char *suffix, unsigned bits)
> >  {
> >  	unsigned long long max = (1ULL << (bits - 1 )) - 1;
> > +	char buf[32];
> >  
> > -	add_pre_buffer("#weak_define __%s_MAX__ %#llx%s\n", name, max, suffix);
> > +	snprintf(buf, sizeof(buf), "__%s_MAX__", name);
> > +	predefine(buf, 1, "%#llx%s", max, suffix);
> 
> $ gcc -dM -E - </dev/null | grep MAX | cut -d' ' -f2 | awk 'length($1) >  max { max = length($1); maxline = $0 } END { print max, maxline }'
> 20 __UINT_LEAST16_MAX__
> $ 
> 
> OK.

Yes, all those are quite short but thanks for checking.

Best regards,
-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux