diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-04-30 23:31:56 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-04 20:47:52 +0200 |
| commit | 4e9c8ee467dd87d41d5aaa3c5a487e3f05ffb79c (patch) | |
| tree | 84dab69712bfc49a205a42d4aadd163d27c6cb92 /symbol.c | |
| parent | 8ddbf2e8157938e219ff2cf19da34b9c6f5f1d4f (diff) | |
| download | sparse-dev-4e9c8ee467dd87d41d5aaa3c5a487e3f05ffb79c.tar.gz | |
teach sparse about _Floatn and _Floatnx
It seems that some system headers (Debian x32's glibc) use
these types based on GCC's version without checking one of
the '__STDC_IEC_60559_<something>' macro. This, of course,
creates warnings and errors when using sparse on them.
Avoid these errors & warnings by letting sparse know about
these types.
Note: Full support would require changes in the parsing to
recognize the suffixes for constants ([fF]32, ...),
the conversion rules between these types and the
standard ones and probably and most others things,
all outside the scope of this patch.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Acked-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Diffstat (limited to 'symbol.c')
| -rw-r--r-- | symbol.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -696,6 +696,9 @@ struct symbol bool_ctype, void_ctype, type_ctype, string_ctype, ptr_ctype, lazy_ptr_ctype, incomplete_ctype, label_ctype, bad_ctype, null_ctype; +struct symbol float32_ctype, float32x_ctype; +struct symbol float64_ctype, float64x_ctype; +struct symbol float128_ctype; struct symbol const_void_ctype, const_char_ctype; struct symbol const_ptr_ctype, const_string_ctype; @@ -719,6 +722,11 @@ void init_symbols(void) init_builtins(stream); } +// For fix-sized types +static int bits_in_type32 = 32; +static int bits_in_type64 = 64; +static int bits_in_type128 = 128; + #define MOD_ESIGNED (MOD_SIGNED | MOD_EXPLICITLY_SIGNED) #define MOD_LL (MOD_LONG | MOD_LONGLONG) #define MOD_LLL MOD_LONGLONGLONG @@ -759,6 +767,12 @@ static const struct ctype_declare { { &double_ctype, SYM_BASETYPE, MOD_LONG, &bits_in_double, &max_fp_alignment, &fp_type }, { &ldouble_ctype, SYM_BASETYPE, MOD_LONG | MOD_LONGLONG, &bits_in_longdouble, &max_fp_alignment, &fp_type }, + { &float32_ctype, SYM_BASETYPE, 0, &bits_in_type32, &max_fp_alignment, &fp_type }, + { &float32x_ctype, SYM_BASETYPE, MOD_LONG, &bits_in_double, &max_fp_alignment, &fp_type }, + { &float64_ctype, SYM_BASETYPE, 0, &bits_in_type64, &max_fp_alignment, &fp_type }, + { &float64x_ctype, SYM_BASETYPE, MOD_LONG | MOD_LONGLONG, &bits_in_longdouble, &max_fp_alignment, &fp_type }, + { &float128_ctype, SYM_BASETYPE, 0, &bits_in_type128, &max_alignment, &fp_type }, + { &string_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &char_ctype }, { &ptr_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &void_ctype }, { &null_ctype, SYM_PTR, 0, &bits_in_pointer, &pointer_alignment, &void_ctype }, |
