public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: Andreas Schwab <schwab@suse.de>,
	 Siddhesh Poyarekar <siddhesh@gotplt.org>,
	 libc-alpha@sourceware.org
Subject: Re: [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments
Date: Wed, 24 May 2023 14:45:03 +0200	[thread overview]
Message-ID: <874jo1x5io.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAN9u=HeFDQ8frcvrkYnB3SrFyinp_u4Zi9w4Ci_MzDhnBmOH6w@mail.gmail.com> (Sergey Bugaev's message of "Wed, 24 May 2023 15:37:16 +0300")

* Sergey Bugaev:

> On Wed, May 24, 2023 at 3:18 PM Florian Weimer <fweimer@redhat.com> wrote:
>> We also generally do not prevent the use of compiler extensions in
>> strict feature modes.  I think this should use a compiler version check
>> and maybe a fallback check against C17 compiler support if we do not
>> need any extensions (assuming that all C17 compilers implement _Generic,
>> so that an exception like the one you mentioned for GCC does not apply
>> vis-a-vis C17).
>
> Do I understand this correctly? -- you want the check to be
>
> #if  (__STDC_VERSION__ >= 201710L) || (__GNUC_PREREQ (4, 9) &&
> __STDC_VERSION__ >= 201112L)
>
> right?

More like this:

#if  __STDC_VERSION__ >= 201710L) || __GNUC_PREREQ (4, 9)

If you have GCC 4.9, __STDC_VERSION__ does not matter if you use
__extension__ in front of _Generic (untested).  Clang would benefit from
another version conditional.

But we may not need _Generic after all.

> Why even care for compilers other than modern GCC (and Clang
> pretending to be GCC), considering the fortifications use very
> GCC-specific intrinsics (__builtin_*, attributes)?

Some of us want to reproduce things with older compilers, for bisecting
regressions for example.  For that, the headers better remain
compatible.  And GCC 4.8 is still very widely used (although not with
current GCC headers, admittedly).

Thanks,
Florian


  reply	other threads:[~2023-05-24 12:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 21:30 [RFC PATCH 0/1] Attempt to detect missing fcntl argument at compile time Sergey Bugaev
2023-05-19 21:30 ` [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments Sergey Bugaev
2023-05-19 21:55   ` Joseph Myers
2023-05-20 11:46     ` Sergey Bugaev
2023-05-20 18:21       ` [RFC PATCH] debug: Add tests for fortified fcntl () Sergey Bugaev
2023-05-23 18:40         ` Adhemerval Zanella Netto
2023-05-23 19:19           ` Sergey Bugaev
2023-05-23 19:48             ` Adhemerval Zanella Netto
2023-05-24  7:15               ` Sergey Bugaev
2023-05-24 12:15                 ` Adhemerval Zanella Netto
2023-05-23 19:09   ` [RFC PATCH 1/1] io: Add FORTIFY_SOURCE check for fcntl arguments Adhemerval Zanella Netto
2023-05-23 19:43     ` Sergey Bugaev
2023-05-23 19:56       ` Adhemerval Zanella Netto
2023-05-23 20:24         ` Sergey Bugaev
2023-05-23 20:44           ` Sergey Bugaev
2023-05-24 12:04           ` Adhemerval Zanella Netto
2023-05-23 19:15   ` Siddhesh Poyarekar
2023-05-23 20:01     ` Sergey Bugaev
2023-05-23 20:06       ` Sergey Bugaev
2023-05-23 21:46   ` Florian Weimer
2023-05-24  7:31     ` Sergey Bugaev
2023-05-24  8:29       ` Florian Weimer
2023-05-24 10:51         ` Sergey Bugaev
2023-05-24 11:18           ` Florian Weimer
2023-05-24 11:46             ` Siddhesh Poyarekar
2023-05-24 12:12               ` Andreas Schwab
2023-05-24 12:18                 ` Florian Weimer
2023-05-24 12:37                   ` Sergey Bugaev
2023-05-24 12:45                     ` Florian Weimer [this message]
2023-05-24 13:02                       ` Sergey Bugaev
2023-05-24 13:18                         ` Florian Weimer

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=874jo1x5io.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=bugaevc@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    --cc=siddhesh@gotplt.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).