c-std-porting.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	David Edelsohn <dje.gcc@gmail.com>,
	 Jakub Jelinek <jakub@redhat.com>,
	gcc@gcc.gnu.org, c-std-porting@lists.linux.dev
Subject: Re: More C type errors by default for GCC 14
Date: Tue, 9 May 2023 13:08:22 -0400	[thread overview]
Message-ID: <CADzB+2kA5dsuOFC88ZA0qL7tbyqz17c4SL=yY-b=cOtrEC=sYw@mail.gmail.com> (raw)
In-Reply-To: <87y1lx4fpb.fsf@oldenburg.str.redhat.com>

On Tue, May 9, 2023 at 12:45 PM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>
> * Richard Biener:
>
> > > Am 09.05.2023 um 18:13 schrieb David Edelsohn <dje.gcc@gmail.com>:
> > >
> > > On Tue, May 9, 2023 at 12:07 PM Jakub Jelinek via Gcc <gcc@gcc.gnu.org> wrote:
> > >
> > > On Tue, May 09, 2023 at 05:16:19PM +0200, Richard Biener via Gcc wrote:
> > > >
> > > >
> > > > > Am 09.05.2023 um 14:16 schrieb Florian Weimer via Gcc <gcc@gcc.gnu.org>:
> > > > >
> > > > > TL;DR: This message is about turning implicit-int,
> > > > > implicit-function-declaration, and possibly int-conversion into errors
> > > > > for GCC 14.
> > > >
> > > > I suppose the goal is to not need to rely on altering CFLAGS but
> > > > change the default behavior with still being able to undo this
> > > > using -Wno-error= or -Wno-?
> > >
> > > Can't people just compile C89/K&R code with -std=c89/-std=gnu89 and not get
> > > these errors that way?
> > >
> > > As Florian mentioned:
> > >
> > > "Presently, we
> > > cannot use -std=gnu89 etc. to opt out because there are packages which
> > > require both C89-only language features and C99-style inlining, which is
> > > currently not a combination supported by GCC (but maybe that could be
> > > changed). "
> >
> > But surely it would reduce the number of packages to fix?  So I
> > support both having only C99 and up reject no longer valid code _and_
> > having -fpermissive be forgiving (demoting errors to warnings).
>
> It makes sense to disable the new erros in C89 mode.  It's what I did in
> the instrumented compiler.  It also gives you yet another way to disable
> the errors, using CC=c89, which works for some packages that do not
> honor CFLAGS and do not support whitespace in CC.
>
> The part David quoted above is about this:
>
> $ gcc -fno-gnu89-inline -std=gnu89 t.c
> cc1: error: ‘-fno-gnu89-inline’ is only supported in GNU99 or C99 mode
>
> And some packages need -fno-gnu89-inline, but also rely on implicit ints
> and implicit function declarations heavily.  With a purely C89-based
> opt-out and the -fno-gnu89-inline limitation, we wouldn't have a way to
> compile these self-contradictory programs.  Hence the idea of
> -fpermissive, in addition to the -std=gnu89 escape hatch.
>
> But perhaps the -fno-gnu89-inline limitation is easy to eliminate.  The
> remaining reason for -fpermissive would be a flag that is accepted by
> both gcc and g++, in case a package build system passes CFLAGS to g++ as
> well, which sometimes happens.  And -fno-gnu89-inline is currently not
> accepted by g++.  But in the Fedora package set, this (some C++ and a
> C89 requirement) must be exceedingly rare because it's a subset of the
> already tiny set of -fno-gnu89-inline -std=gnu89 packages.

Another reason for -fpermissive is ease of use.  So if someone just
wants to get an older package to build, they can add -fpermissive
without having to figure out more detailed flags.

Alternatively, if we go the default -Werror=various route, adding
-Wno-error without any =foo to override everything might also be
fairly convenient.

In any case, I think we want an easy answer for the second group.


Jason


  parent reply	other threads:[~2023-05-09 17:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAGWvnynMpa83AduLhRhf1PxkVujngDmmwE7Z4vk1z6+UqqAuKA@mail.gmail.com>
     [not found] ` <BBE9950C-28AA-4A1C-A4C5-7F486538004E@gmail.com>
2023-05-09 16:44   ` More C type errors by default for GCC 14 Florian Weimer
2023-05-09 16:58     ` Ian Lance Taylor
2023-05-09 17:08     ` Jason Merrill [this message]
2023-05-09 17:16       ` Sam James
2023-05-09 12:15 Florian Weimer
2023-05-09 15:16 ` Richard Biener
2023-05-09 16:05   ` Jakub Jelinek
2023-05-09 16:11     ` Sam James
2023-05-09 16:59   ` Florian Weimer
2023-05-09 17:07     ` Sam James
2023-05-09 17:35       ` Florian Weimer
     [not found] ` <CAGWvnykoEtT0BQtuN70DN6tWohtf=Mm7SW55psZvVmj3OvKUEg@mail.gmail.com>
2023-05-09 15:07   ` Sam James
2023-05-09 15:14   ` Jonathan Wakely
     [not found]     ` <20230509102201.6aa2a7d14fdb2f1e7abff449@killthe.net>
     [not found]       ` <87r0rp5uf8.fsf@aarsen.me>
     [not found]         ` <83ttwla1ep.fsf@gnu.org>
     [not found]           ` <CAH6eHdS-7USHzX3rPJaR66sEdjG+-nHp7mDb0gD7ceBnp+Fmpg@mail.gmail.com>
     [not found]             ` <83lehx9vix.fsf@gnu.org>
     [not found]               ` <ZFqZ25xKm4w4IkqF@tucnak>
     [not found]                 ` <83fs859unu.fsf@gnu.org>
     [not found]                   ` <CAGWvny=xi++Ghyo2Ez5MJdYy5h3yH16gVpviKC99Ufu_bUmdYQ@mail.gmail.com>
     [not found]                     ` <CAH6eHdRAVwBcCmBgiuPyQNWGx3x33diAgQU8UG3s_NrJxK3ucQ@mail.gmail.com>
     [not found]                       ` <CAGWvnyk_MkQOrNNh1C=ubPj8qzg5x-p8CBfgWNqqtDVJ1mbhMg@mail.gmail.com>
     [not found]                         ` <CAF9ehCWsq-N9+U1+mTQahKT7cXEqLTptLb=b3Yq58gsWFEnxgA@mail.gmail.com>
     [not found]                           ` <CAH6eHdS_sQ37VTpJHL7cqtgSdCSL3i4=tqMoY65wep9G56cf5g@mail.gmail.com>
     [not found]                             ` <CAMfHzOsR=gY6QTss2R029Q-uMOTpC-RDV09bEF2FO7x5jpy5gg@mail.gmail.com>
2023-05-10 10:45                               ` Sam James
2023-05-10 10:56                                 ` Neal Gompa
2023-05-10 12:06                                   ` Eli Zaretskii
2023-05-10 12:10                                     ` Neal Gompa
2023-05-10 12:41                                       ` Eli Zaretskii
2023-05-09 18:22   ` Florian Weimer
2023-05-11 21:32     ` Segher Boessenkool
2023-05-12  9:33 ` Martin Jambor
2023-05-12 12:30   ` Jakub Jelinek
2023-05-15 12:46     ` Michael Matz
2023-05-15 13:14     ` Richard Earnshaw (lists)

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='CADzB+2kA5dsuOFC88ZA0qL7tbyqz17c4SL=yY-b=cOtrEC=sYw@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=c-std-porting@lists.linux.dev \
    --cc=dje.gcc@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=richard.guenther@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 NNTP newsgroup(s).