public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	Florian Weimer <fweimer@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Check for ISO C compilers should also allow C++
Date: Fri, 13 May 2022 23:46:08 -0700	[thread overview]
Message-ID: <20220514064608.lonhluprui6ypv4k@google.com> (raw)
In-Reply-To: <CACb0b4mYGHZPrFWAs781-Ov-h4mocRrzRZT3zR5Yg2t6NSaZhQ@mail.gmail.com>

On 2022-05-13, Jonathan Wakely via Libc-alpha wrote:
>On Fri, 13 May 2022 at 18:28, Joseph Myers wrote:
>>
>> On Fri, 13 May 2022, Jonathan Wakely via Libc-alpha wrote:
>>
>> > Tested x86_64-linux.
>> >
>> > There is a suggestion[1] to make clang++ stop defining __STDC__ but it's
>> > blocked by this. The clang++ change will still be blocked while old
>> > Glibc versions are still in use, but we can start the clock ticking by
>> > fixing Glibc now.
>> >
>> > [1] https://discourse.llvm.org/t/rfc-stop-defining-the-stdc-and-related-macros-in-c-mode/62468/1
>> >
>> > >From a quick grep, I don't think any other places in Glibc need a
>> > similar change. Florian pointed out that gnulib overrides
>> > <sys/cdefs.h> and so should make the same change in its version.
>>
>> The change seems sane.  While we don't document what extensions (beyond
>> C90 / C++98) are needed to use glibc's headers (e.g. long long, flexible
>> array members, anonymous structs / unions; in at least some cases,
>> alignment attributes and asm redirection of functions), I see no reason
>> defining __STDC__ in C++ should be such a required extension.
>
>Right. Its meaning in ISO C++ is entirely implementation-defined, and
>G++ doesn't document any particular meaning for it, and clang++
>doesn't either AFAIK, and follows a slightly different set of rules
>for when it's defined (see the link above). So in C++ the only thing
>that __STDC__ being defined tells you is that __STDC__ is defined :-)
>That's not a very useful thing to test for in isolation.
>

I agree with the spirit of the clang RFC but I am sad to know that glibc sys/cdefs.h blocks it.
Thanks for sending the patch!

It seems that the subject may be clearer if starting with "<sys/cdefs.h>: ..."

In addition, It will be clearer if the token `__STDC__` is mentioned on the subject line.

Reviewed-by: Fangrui Song <maskray@google.com>

  reply	other threads:[~2022-05-14  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 16:31 Jonathan Wakely
2022-05-13 16:46 ` Florian Weimer
2022-05-13 17:27 ` Joseph Myers
2022-05-13 17:41   ` Jonathan Wakely
2022-05-14  6:46     ` Fangrui Song [this message]
2022-05-16 15:50       ` Jonathan Wakely

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=20220514064608.lonhluprui6ypv4k@google.com \
    --to=maskray@google.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=jwakely@redhat.com \
    --cc=libc-alpha@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).