diff options
author | Emilio G. Cota <cota@braap.org> | 2014-01-08 16:32:42 -0500 |
---|---|---|
committer | Christopher Li <sparse@chrisli.org> | 2014-01-29 15:47:44 -0800 |
commit | 67a7f893b14526002afc0b478a744cfb4acbfebe (patch) | |
tree | ad8988aca5ae306dcd892043e3a0f37d1a97c948 | |
parent | 66b24573e9cb5eaa0c41dc4164f81f3b83b9cb41 (diff) | |
download | sparse-67a7f893b14526002afc0b478a744cfb4acbfebe.tar.gz |
Define __CHAR_BIT__
gcc defines __CHAR_BIT__ as a pre-defined macro.
Define __CHAR_BIT__ in sparse so that code that needs it (e.g. code
using CHAR_BIT from limits.h) does not generate false warnings.
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r-- | lib.c | 1 | ||||
-rw-r--r-- | validation/builtin_char_bit.c | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -928,6 +928,7 @@ void create_builtin_stream(void) add_pre_buffer("#weak_define __LONG_LONG_MAX__ " STRINGIFY(__LONG_LONG_MAX__) "\n"); add_pre_buffer("#weak_define __WCHAR_MAX__ " STRINGIFY(__WCHAR_MAX__) "\n"); add_pre_buffer("#weak_define __SIZEOF_POINTER__ " STRINGIFY(__SIZEOF_POINTER__) "\n"); + add_pre_buffer("#weak_define __CHAR_BIT__ " STRINGIFY(__CHAR_BIT__) "\n"); } static struct symbol_list *sparse_tokenstream(struct token *token) diff --git a/validation/builtin_char_bit.c b/validation/builtin_char_bit.c new file mode 100644 index 00000000..30e6bed4 --- /dev/null +++ b/validation/builtin_char_bit.c @@ -0,0 +1,7 @@ +#include <limits.h> + +static unsigned int word_bits = sizeof(unsigned int) * CHAR_BIT; + +/* + * check-name: __CHAR_BIT__ + */ |