public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Joel Sherrill <joel@rtems.org>
To: Pavel M <pavel.morozkin@gmail.com>
Cc: Newlib <newlib@sourceware.org>
Subject: Re: Issue: CMPLX is not defined
Date: Tue, 10 May 2022 10:49:18 -0500	[thread overview]
Message-ID: <CAF9ehCVg3=JiwrWR73QoEiUhD505f2apUwcTFsTFO3FfCkyBmw@mail.gmail.com> (raw)
In-Reply-To: <CAL9Mx1sD_=5h2uTDwoFq-XRvU1SyB0qnzEU8uZ4pp_waNyjOdA@mail.gmail.com>

On Tue, May 10, 2022 at 10:40 AM Pavel M <pavel.morozkin@gmail.com> wrote:

> Hi all,
>
> Issue: CMPLX is not defined.
>
> $ cat t649.c
> #if __STDC_NO_COMPLEX__ != 1
> #include <complex.h>
> #ifndef CMPLX
> #error
> #endif
> #endif
>
> $ gcc t649.c -std=c11 -pedantic -Wall -Wextra
> t649.c:4:2: error: #error
>     4 | #error
>       |  ^~~~~
>
> C11:
> > 7.3.9.3 The CMPLX macros
>
> Please fix.
>

If you really need these, they are simple to implement and patches are
always welcomed. This is the entirety of the implementation for glibc:

#if defined __USE_ISOC11 && __GNUC_PREREQ (4, 7)
/* Macros to expand into expression of specified complex type.  */
# define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y))
# define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y))
# ifndef __NO_LONG_DOUBLE_MATH
#  define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double)
(y))
# endif
#endif

Should be a simple patch to complex.h

--joel

  reply	other threads:[~2022-05-10 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 15:39 Pavel M
2022-05-10 15:49 ` Joel Sherrill [this message]
2022-05-10 18:09   ` Pavel M

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='CAF9ehCVg3=JiwrWR73QoEiUhD505f2apUwcTFsTFO3FfCkyBmw@mail.gmail.com' \
    --to=joel@rtems.org \
    --cc=newlib@sourceware.org \
    --cc=pavel.morozkin@gmail.com \
    /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).