Re: [PATCH] sparse: Add GCC pre-defined macros for user-space

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

 



On Sat, Aug 15, 2009 at 11:26:31PM +0300, Pekka Enberg wrote:
> --- a/lib.c
> +++ b/lib.c
> @@ -788,6 +788,14 @@ void create_builtin_stream(void)
>  		add_pre_buffer("#define __OPTIMIZE__ 1\n");
>  	if (optimize_size)
>  		add_pre_buffer("#define __OPTIMIZE_SIZE__ 1\n");
> +
> +	/* GCC defines these for limits.h */
> +	add_pre_buffer("#weak_define __SHRT_MAX__ %d\n", __SHRT_MAX__);
> +	add_pre_buffer("#weak_define __SCHAR_MAX__ %d\n", __SCHAR_MAX__);
> +	add_pre_buffer("#weak_define __INT_MAX__ %d\n", __INT_MAX__);
> +	add_pre_buffer("#weak_define __LONG_MAX__ %ld\n", __LONG_MAX__);
> +	add_pre_buffer("#weak_define __LONG_LONG_MAX__ %lld\n", __LONG_LONG_MAX__);
> +	add_pre_buffer("#weak_define __WCHAR_MAX__ %d\n", __WCHAR_MAX__);

These defines need to have the right type suffixes.  GCC defines
__LONG_LONG_MAX__ with an LL suffix, and __LONG_MAX__ with an L suffix.
You could either add the appropriate suffixes, or better yet, stringize
the constants and print them as strings.

- Josh Triplett
--
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