diff options
| author | Logan Gunthorpe <logang@deltatee.com> | 2017-11-16 16:08:17 -0700 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-17 18:38:50 +0100 |
| commit | 6794d824a8d69981cdfa2ffb97debd8ec50e090c (patch) | |
| tree | 2fef669a8e663a4cd5ecb9ca8c31c80603b5276a | |
| parent | 47bc08be942f2661d4bdd31ebe9c0caed9c8a753 (diff) | |
| download | sparse-dev-6794d824a8d69981cdfa2ffb97debd8ec50e090c.tar.gz | |
add __builtin functions for isinf_sign, isfinite and isnan
These builtins are defined by gcc since 4.4. They are also now
used by the isinf, isfinite and isnan macros. So using them with a
newer gcc causes 'undefined identifier' errors.
Add the builtin definitions and some validation checks for these
functions.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | lib.c | 3 | ||||
| -rw-r--r-- | validation/builtin_inf.c | 3 |
2 files changed, 6 insertions, 0 deletions
@@ -1246,6 +1246,9 @@ static void declare_builtin_functions(void) add_pre_buffer("extern double __builtin_nan(const char *);\n"); add_pre_buffer("extern float __builtin_nanf(const char *);\n"); add_pre_buffer("extern long double __builtin_nanl(const char *);\n"); + add_pre_buffer("extern int __builtin_isinf_sign(float);\n"); + add_pre_buffer("extern int __builtin_isfinite(float);\n"); + add_pre_buffer("extern int __builtin_isnan(float);\n"); /* And some __FORTIFY_SOURCE ones.. */ add_pre_buffer ("extern __SIZE_TYPE__ __builtin_object_size(const void *, int);\n"); diff --git a/validation/builtin_inf.c b/validation/builtin_inf.c index 48546e48..f09f53f4 100644 --- a/validation/builtin_inf.c +++ b/validation/builtin_inf.c @@ -7,6 +7,9 @@ static long double li = __builtin_infl(); static double dn = __builtin_nan(""); static float fn = __builtin_nanf(""); static long double ln = __builtin_nanl(""); +static int inf = __builtin_isinf_sign(0.0); +static int fin = __builtin_isfinite(0.0); +static int nan = __builtin_isnan(0.0); /* * check-name: __builtin INFINITY / nan() |
