public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Keith Packard <keithp@keithp.com>
Cc: <newlib@sourceware.org>
Subject: Re: [PATCH 3/6] Avoid implicit floating point conversions
Date: Thu, 20 Aug 2020 22:43:23 +0000	[thread overview]
Message-ID: <alpine.DEB.2.21.2008202239580.13981@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20200820221449.686006-4-keithp@keithp.com>

On Thu, 20 Aug 2020, Keith Packard via Newlib wrote:

> diff --git a/newlib/libc/include/complex.h b/newlib/libc/include/complex.h
> index 0a3ea97ed..13b300021 100644
> --- a/newlib/libc/include/complex.h
> +++ b/newlib/libc/include/complex.h
> @@ -9,8 +9,10 @@
>  #define	_COMPLEX_H
>  
>  #define complex _Complex
> -#define _Complex_I 1.0fi
> +#define _Complex_I 1.0i
> +#define _Complex_If 1.0if
>  #define I _Complex_I
> +#define I_f _Complex_If

This is contrary to the standard requirement that _Complex_I and I have 
type const float _Complex.

>  # ifndef INFINITY
> -#  define INFINITY (__builtin_inff())
> +#  define INFINITY (__builtin_inf())
> +# endif

This is contrary to the standard requirement that INFINITY has type float.

>  # ifndef NAN
> -#  define NAN (__builtin_nanf(""))
> +#  define NAN (__builtin_nan(""))
> +# endif

This is contrary to the standard requirement that NAN has type float.

>  #ifndef NO_ERRNO
> -  if (isinf (retval) && !isinf (val))
> +  if (isinff (retval) && !isinff (val))

isinf, isnan, etc. are *type-generic* macros.  If newlib is declaring them 
in a non-type-generic way, that should be fixed, rather than changing 
users to use a type-specific function.

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2020-08-20 22:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 22:14 [PATCH 0/6] Fixes inspired by building with clang Keith Packard
2020-08-20 22:14 ` [PATCH 1/6] libm/stdlib: Recover from realloc failure when shrinking Keith Packard
2020-08-20 22:14 ` [PATCH 2/6] libc/iconv: Check ces handlers table value in euc_from_ucs_init Keith Packard
2020-08-20 22:14 ` [PATCH 3/6] Avoid implicit floating point conversions Keith Packard
2020-08-20 22:43   ` Joseph Myers [this message]
     [not found]   ` <SN5P110MB03830A3D8272D82A089605659A5A0@SN5P110MB0383.NAMP110.PROD.OUTLOOK.COM>
2020-08-20 23:03     ` Fw: " C Howland
2020-08-21  0:01       ` Keith Packard
2020-08-20 22:14 ` [PATCH 4/6] libc/stdlib: Undefined shift negative value in a64l Keith Packard
2020-08-20 22:14 ` [PATCH 5/6] libc/stdlib: Clean up clang warnings Keith Packard
2020-08-20 22:14 ` [PATCH 6/6] libc/stdio: Conditionally declare vars for _FSEEK_OPTIMIZATION Keith Packard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2008202239580.13981@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=keithp@keithp.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).