From: Pavel M <pavel.morozkin@gmail.com>
To: joel@rtems.org
Cc: Newlib <newlib@sourceware.org>
Subject: Re: Issue: CMPLX is not defined
Date: Tue, 10 May 2022 21:09:16 +0300 [thread overview]
Message-ID: <CAL9Mx1uj7ZYaf9Z3Tu43BtWpZ-U1muofWzr3aXUEj9uQnixtnw@mail.gmail.com> (raw)
In-Reply-To: <CAF9ehCVg3=JiwrWR73QoEiUhD505f2apUwcTFsTFO3FfCkyBmw@mail.gmail.com>
Thanks! Now I can compile clean (GCC only, Clang produces "error: use of
unknown builtin '__builtin_complex'").
On Tue, 10 May 2022 at 18:49, Joel Sherrill <joel@rtems.org> wrote:
>
>
> 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
>
prev parent reply other threads:[~2022-05-10 18:09 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
2022-05-10 18:09 ` Pavel M [this message]
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=CAL9Mx1uj7ZYaf9Z3Tu43BtWpZ-U1muofWzr3aXUEj9uQnixtnw@mail.gmail.com \
--to=pavel.morozkin@gmail.com \
--cc=joel@rtems.org \
--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).