public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Alexander Monakov <amonakov@ispras.ru>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	 Andrew Clayton <andrew@digital-domain.net>
Subject: Re: -minstd: Require a minimum std version, without being specific
Date: Wed, 21 Dec 2022 19:14:14 +0000	[thread overview]
Message-ID: <CAH6eHdQZuTNNY7Pitb6c54jJ=RFYMn9HgjxfSCz0wmRWMXcAEA@mail.gmail.com> (raw)
In-Reply-To: <cbd644ba-df35-bdac-1ebc-35ecee8b48d8@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

On Wed, 21 Dec 2022, 19:08 Alejandro Colomar via Gcc, <gcc@gcc.gnu.org>
wrote:

>
>
> On 12/21/22 19:53, Alejandro Colomar wrote:
> > Hi Alexander,
> >
> > On 12/21/22 19:51, Alexander Monakov wrote:
> >>
> >>
> >> On Wed, 21 Dec 2022, Alejandro Colomar via Gcc wrote:
> >>
> >>> Hi,
> >>>
> >>> I've long had this wish: an option similar to -std, but which would not
> >>> specify the standard.  Rather, mark a requirement that the standard be
> at
> >>> least a version.
> >>>
> >>> This would be especially useful for libraries, which might for example
> require
> >>> C99 or C11 to work.  They would be able to specify -minstd=c11 in
> their pc(5)
> >>> file (for use with pkgconf(1)).
> >>
> >> There's already a standard, portable way to check:
> >>
> >> #if __STDC_VERSION__ < 201710
> >> #error C17 required
> >> #endif
> >
> > Hmm, not my favourite to stick that in every public header file, but
> yes, it's
> > portable.
>
> But yes, I could provide a <project/__compiler.h> "hidden" header that
> does all
> this stuff, then include it everywhere.  :)
>


And this works for projects that don't use pkg-config, and with all
compilers, including existing versions of gcc.

I really don't know why you'd want to enforce this outside the source
itself, with a separate non-portable tool.

  reply	other threads:[~2022-12-21 19:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 18:33 Alejandro Colomar
2022-12-21 18:51 ` Alexander Monakov
2022-12-21 18:53   ` Alejandro Colomar
2022-12-21 19:08     ` Alejandro Colomar
2022-12-21 19:14       ` Jonathan Wakely [this message]
2022-12-21 19:12     ` Alexander Monakov
2022-12-21 19:15       ` Alejandro Colomar
2022-12-22  2:42 ` Ben Boeckel

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='CAH6eHdQZuTNNY7Pitb6c54jJ=RFYMn9HgjxfSCz0wmRWMXcAEA@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=alx.manpages@gmail.com \
    --cc=amonakov@ispras.ru \
    --cc=andrew@digital-domain.net \
    --cc=gcc@gcc.gnu.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).