Message ID | 1250367991.14751.1.camel@penberg-laptop (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/lib.c b/lib.c index 42affcd..0510ae0 100644 --- 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__); } static struct symbol_list *sparse_tokenstream(struct token *token)