public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96284] New: Outdated C features should be made errors with newer standards
@ 2020-07-22 13:16 david at westcontrol dot com
  2020-07-22 14:09 ` [Bug c/96284] " rguenth at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: david at westcontrol dot com @ 2020-07-22 13:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

            Bug ID: 96284
           Summary: Outdated C features should be made errors with newer
                    standards
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david at westcontrol dot com
  Target Milestone: ---

While C has tried to remain backwards compatible with each new standards
revision, some changes have been made so that particularly unsafe features from
old code are no longer supported.  gcc has (reasonably enough) tried to keep
support for old features, but when something has been deprecated for decades,
perhaps it is time for it to be treated as an error by default and require an
explicit flag.  (This is in the same style as bug 85678 making "-fno-common"
the default.)

For example, implicit function declarations from K&R C were made obsolescent in
C90, and removed from the language in C99.  But by default, they still only
cause a warning (-Wimplicit-function-declaration) in gcc, no matter what
standard is picked.

Could this be made an error by default (-Werror=implicit-function-declarations)
?  Let those who want to compile old code with implicit function declarations,
do so with an explicit flag.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
@ 2020-07-22 14:09 ` rguenth at gcc dot gnu.org
  2020-07-22 14:51 ` redi at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-22 14:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
There's -pedantic and -pedantic-errors

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
  2020-07-22 14:09 ` [Bug c/96284] " rguenth at gcc dot gnu.org
@ 2020-07-22 14:51 ` redi at gcc dot gnu.org
  2020-07-22 17:18 ` msebor at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-22 14:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
But they're not enabled by default, meaning that the unsafe, ill-formed code is
still accepted by default.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
  2020-07-22 14:09 ` [Bug c/96284] " rguenth at gcc dot gnu.org
  2020-07-22 14:51 ` redi at gcc dot gnu.org
@ 2020-07-22 17:18 ` msebor at gcc dot gnu.org
  2020-07-22 17:33 ` msebor at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-22 17:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |82922
     Ever confirmed|0                           |1
                 CC|                            |msebor at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-22

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
I support including more diagnostics in -Wall and -Werror, and some perhaps
even by default.  Especially those for "features" as unsafe as function
declarations without a prototype.  See also pr82922.  So confirmed on that
basis.  I should resubmit my patch for it to see if we can make more progress
there for GCC 11.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82922
[Bug 82922] Request: add -Wstrict-prototypes to -Wextra as K&R style is
obsolescent

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (2 preceding siblings ...)
  2020-07-22 17:18 ` msebor at gcc dot gnu.org
@ 2020-07-22 17:33 ` msebor at gcc dot gnu.org
  2020-07-28  5:57 ` egallager at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-22 17:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #3)
> I support including more diagnostics in -Wall and -Werror

I meant "-Wall and -Wextra."

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (3 preceding siblings ...)
  2020-07-22 17:33 ` msebor at gcc dot gnu.org
@ 2020-07-28  5:57 ` egallager at gcc dot gnu.org
  2020-07-28  7:20 ` david at westcontrol dot com
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-07-28  5:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org,
                   |                            |fw at gcc dot gnu.org

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to David Brown from comment #0)
> While C has tried to remain backwards compatible with each new standards
> revision, some changes have been made so that particularly unsafe features
> from old code are no longer supported.  gcc has (reasonably enough) tried to
> keep support for old features, but when something has been deprecated for
> decades, perhaps it is time for it to be treated as an error by default and
> require an explicit flag.  (This is in the same style as bug 85678 making
> "-fno-common" the default.)
> 
> For example, implicit function declarations from K&R C were made obsolescent
> in C90, and removed from the language in C99.  But by default, they still
> only cause a warning (-Wimplicit-function-declaration) in gcc, no matter
> what standard is picked.
> 
> Could this be made an error by default
> (-Werror=implicit-function-declarations) ?  Let those who want to compile
> old code with implicit function declarations, do so with an explicit flag.

I think Florian Weimer tried this and it broke the majority of configure
scripts in existence...

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (4 preceding siblings ...)
  2020-07-28  5:57 ` egallager at gcc dot gnu.org
@ 2020-07-28  7:20 ` david at westcontrol dot com
  2020-07-28  7:39 ` fw at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: david at westcontrol dot com @ 2020-07-28  7:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #6 from David Brown <david at westcontrol dot com> ---
(In reply to Eric Gallager from comment #5)
> (In reply to David Brown from comment #0)

> > Could this be made an error by default
> > (-Werror=implicit-function-declarations) ?  Let those who want to compile
> > old code with implicit function declarations, do so with an explicit flag.
> 
> I think Florian Weimer tried this and it broke the majority of configure
> scripts in existence...

Fixing existing code and build systems is always hard - backwards compatibility
is C's biggest strength and its biggest weakness.

I'm not bothered about my own code - I have makefiles with the relevant options
set in case I make mistakes.  My hope is for gcc to be able to have stricter
warnings to reduce bugs in code written now and in the future.  But I
understand that it's also important not to cause trouble for existing code and
build systems.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (5 preceding siblings ...)
  2020-07-28  7:20 ` david at westcontrol dot com
@ 2020-07-28  7:39 ` fw at gcc dot gnu.org
  2021-12-15  7:01 ` egallager at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: fw at gcc dot gnu.org @ 2020-07-28  7:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #7 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to David Brown from comment #6)
> I'm not bothered about my own code - I have makefiles with the relevant
> options set in case I make mistakes.  My hope is for gcc to be able to have
> stricter warnings to reduce bugs in code written now and in the future.  But
> I understand that it's also important not to cause trouble for existing code
> and build systems.

The implicit function declaration warning does not seem to be quite enough, it
would help programmers to turn it into an error. But that's what also impacts
configure scripts.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (6 preceding siblings ...)
  2020-07-28  7:39 ` fw at gcc dot gnu.org
@ 2021-12-15  7:01 ` egallager at gcc dot gnu.org
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-12-15  7:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=91092

--- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> ---
Similar: bug 91092

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (7 preceding siblings ...)
  2021-12-15  7:01 ` egallager at gcc dot gnu.org
@ 2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-01  7:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@gcc.gnu.org>:

https://gcc.gnu.org/g:2c3db94d9fd07681f8806dae93d555779ff4dfb1

commit r14-6032-g2c3db94d9fd07681f8806dae93d555779ff4dfb1
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Dec 1 08:10:12 2023 +0100

    c: Turn int-conversion warnings into permerrors

    gcc/

            * doc/invoke.texi (Warning Options): Document changes.

    gcc/c/

            PR c/96284
            PR c/106416
            * c-typeck.cc (build_conditional_expr): Use permerror_opt for
            pointer/integer type mismatches, based on -Wint-conversion.
            (pedwarn_permerror_init, permerror_init): New function.
            (pedwarn_init): Call pedwarn_permerror_init.
            (convert_for_assignment): Use permerror_opt and
            permerror_init for -Wint-conversion warnings.

    gcc/testsuite/

            * gcc.dg/permerror-default.c (int_conversion_1)
            (int_conversion_2): Expect the new permerrors.
            * gcc.dg/permerror-gnu89-nopermissive.c (int_conversion_1)
            (int_conversion_2): Likewise.
            * gcc.dg/permerror-system.c: Likewise.
            * c-c++-common/pr77624-1.c (foo, bar): Expect
            error instead of warning.
            * gcc.dg/Wint-conversion-2.c: Compile with -fpermissive due
            to expected int-conversion warning.
            * gcc.dg/Wint-conversion-3.c: Likewise.
            * gcc.dg/Wint-conversion-4.c: New test.  Based on
            gcc.dg/Wint-conversion-3.c.  Expect int-conversion errors.
            * gcc.dg/assign-warn-1.c: Compile with -fpermissive.
            * gcc.dg/assign-warn-4.c: New file.  Extracted from
            assign-warn1.c.  Expect int-conversion errors.
            * gcc.dg/diagnostic-types-1.c: Compile with -fpermissive.
            * gcc.dg/diagnostic-types-2.c: New file.  Extracted from
            gcc.dg/diagnostic-types-1.c.  Expect some errors instead of
            warnings.
            * gcc.dg/gomp/pr35738.c: Compile with -fpermissive due to
            expected int-conversion error.
            * gcc.dg/gomp/pr35738-2.c: New test.  Based on
            gcc.dg/gomp/pr35738.c.  Expect int-converison errors.
            * gcc.dg/init-excess-3.c: Expect int-converison errors.
            * gcc.dg/overflow-warn-1.c: Likewise.
            * gcc.dg/overflow-warn-3.c: Likewise.
            * gcc.dg/param-type-mismatch.c: Compile with -fpermissive.
            * gcc.dg/param-type-mismatch-2.c: New test.  Copied from
            gcc.dg/param-type-mismatch.c.  Expect errors.
            * gcc.dg/pr61162-2.c: Compile with -fpermissive.
            * gcc.dg/pr61162-3.c: New test. Extracted from
            gcc.dg/pr61162-2.c.  Expect int-conversion errors.
            * gcc.dg/spec-barrier-3.c: Use -fpermissive due to expected
            int-conversion error.
            * gcc.dg/spec-barrier-3a.c: New test.  Based on
            gcc.dg/spec-barrier-3.c.  Expect int-conversion errors.
            * gcc.target/aarch64/acle/memtag_2.c: Use -fpermissive due to
expected
            int-conversion error.
            * gcc.target/aarch64/acle/memtag_2a.c: New test.  Copied from
            gcc.target/aarch64/acle/memtag_2.c.  Expect error.
            * gcc.target/aarch64/sve/acle/general-c/load_3.c (f1): Expect
            error.
            * gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
            (f1): Likewise.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (8 preceding siblings ...)
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
@ 2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-01  7:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@gcc.gnu.org>:

https://gcc.gnu.org/g:55e94561e97ed0bce4774aa1c6b5d5d82209a379

commit r14-6033-g55e94561e97ed0bce4774aa1c6b5d5d82209a379
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Dec 1 08:10:13 2023 +0100

    c: Turn -Wimplicit-function-declaration into a permerror

    In the future, it may make sense to avoid cascading errors from
    the implicit declaration, especially its assumed int return type.
    This change here only changes the kind of the diagnostic, not
    its wording or consequences.

    gcc/

            * doc/invoke.texi (Warning Options): Document changes.

    gcc/c/

            PR c/91092
            PR c/96284
            * c-decl.cc (implicit_decl_permerror): Rename from
            implicit_decl_warning.  Call permerror_opt instead of
            pedwarn and warning_at.
            (implicitly_declare): Adjust callers.

    gcc/testsuite/

            * gcc.dg/permerror-default.c (implicit_function_declaration):
            Expect the new permerror.
            * gcc.dg/permerror-system.c: Likewise.
            * c-c++-common/spellcheck-reserved.c (test, test_2): Expect
            error instead of warning.
            (f): Expect error instead of warning.
            * gcc.dg/Wimplicit-function-declaration-c99.c: Compile with
            -fpermissive due to expected warning.
            * gcc.dg/Wimplicit-function-declaration-c99-2.c: New test.
            Copied from gcc.dg/Wimplicit-function-declaration-c99.c.
            Expect error.
            * gcc.dg/missing-header-fixit-1.c: Compile with -fpermissive
            due to expect error.
            * gcc.dg/missing-header-fixit-1a.c: New test.  Copied from
            gcc.dg/missing-header-fixit-1.c, but expect error.
            * gcc.dg/missing-header-fixit-2.c: Compile with -fpermissive
            due to expect error.
            * gcc.dg/missing-header-fixit-2a.c: New test.  Copied from
            gcc.dg/missing-header-fixit-2.c, but expect error.
            * gcc.dg/missing-header-fixit-4.c: Compile with -fpermissive
            due to expect error.
            * gcc.dg/missing-header-fixit-4a.c: New test.  Copied from
            gcc.dg/missing-header-fixit-4.c, but expect error.
            * gcc.dg/missing-header-fixit-5.c: Compile with -fpermissive
            due to expect error.
            * gcc.dg/missing-header-fixit-5a.c: New test.  Copied from
            gcc.dg/missing-header-fixit-5.c, but expect error.
            * gcc.dg/pr61852.c: Expect implicit-function-declaration
            error instead of warning.
            * gcc.dg/spellcheck-identifiers-2.c: Compile with
            -fpermissive due to expected warnings.
            * gcc.dg/spellcheck-identifiers-2a.c: New test.  Copied
            from gcc.dg/spellcheck-identifiers-2a.c.  Expect errors.
            * gcc.dg/spellcheck-identifiers-3.c: Compile with
            -fpermissive due to expected warnings.
            * gcc.dg/spellcheck-identifiers-3a.c: New test.  Copied
            from gcc.dg/spellcheck-identifiers-2a.c.  Expect errors.
            * gcc.dg/spellcheck-identifiers-4.c: Compile with
            -fpermissive due to expected warnings.
            * gcc.dg/spellcheck-identifiers-4a.c: New test.  Copied
            from gcc.dg/spellcheck-identifiers-2a.c.  Expect error.
            * gcc.dg/spellcheck-identifiers.c: Compile with
            -fpermissive due to expected warnings.
            * gcc.dg/spellcheck-identifiers-1a.c: New test.  Copied
            from gcc.dg/spellcheck-identifiers.c.  Expect errors.
            * gcc.target/aarch64/sve/acle/general-c/ld1sh_gather_1.c (f1):
            Expect error.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_index_1.c:
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_index_restricted_1.c:
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_1.c:
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_2.c:
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_3.c:
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_4.c:
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_5.c:
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_1.c:
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_2.c:
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_3.c:
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_4.c:
            (f1): Likewise.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (9 preceding siblings ...)
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
@ 2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-01  7:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@gcc.gnu.org>:

https://gcc.gnu.org/g:4ee2aca7ca098cc6e622a9a41e63224af37e6532

commit r14-6034-g4ee2aca7ca098cc6e622a9a41e63224af37e6532
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Dec 1 08:10:13 2023 +0100

    c: Turn -Wimplicit-int into a permerror

    Most of these new permerrors are currently not diagnosed in system
    headers.

    gcc/

            PR c/91093
            PR c/96284
            * doc/invoke.texi (Warning Options): Document changes.

    gcc/c/

            * c-decl.cc (warn_defaults_to): Remove.
            (grok_declarator, start_function): Call permerror_opt
            instead of warn_defaults_to.
            (store_parm_decls_oldstyle): Call permerror_opt for
            OPT_Wimplicit_int.

    gcc/testsuite/

            * gcc.dg/permerror-default.c (implicit_int_1, implicit_int_2)
            (implicit_int_3, implicit_int_4): Expect new permerror.
            * gcc.dg/permerror-system.c: Expect a single new permerror.
            * gcc.dg/Wimplicit-int-1.c: Compile with -fpermissive due to
            expected warning.
            * gcc.dg/Wimplicit-int-4.c: Likewise.
            * gcc.dg/Wimplicit-int-1a.c: New test.  Copied from
            gcc.dg/Wimplicit-int-1.c, but expect errors.
            * gcc.dg/Wimplicit-int-4a.c: New test.  Copied from
            gcc.dg/Wimplicit-int-4.c, but expect errors.
            * gcc.dg/gnu23-attr-syntax-2.c: Compile with -fpermissive
            due to expected implicit-int error.
            * gcc.dg/gnu23-attr-syntax-3.c: New test.  Copied from
            gcc.dg/gnu23-attr-syntax-2.c, but expect an error.
            * gcc.dg/pr105635.c: Build with -fpermissive due to implicit
            int.
            * gcc.dg/pr105635-2.c: New test.  Copied from
            gcc.dg/pr105635.c.  Expect implicit int error.
            * gcc.dg/noncompile/pr79758.c: Build with -fpermissive due to
            implicit int.
            * gcc.dg/noncompile/pr79758-2.c: New test.  Copied from
            gcc.dg/noncompile/pr79758.c.  Expect implicit int error.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (10 preceding siblings ...)
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
@ 2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-01  7:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@gcc.gnu.org>:

https://gcc.gnu.org/g:4ecfa6c4a9df19b364cbdf6d9de5f0b98c22bd8f

commit r14-6036-g4ecfa6c4a9df19b364cbdf6d9de5f0b98c22bd8f
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Dec 1 08:10:13 2023 +0100

    c: Turn -Wreturn-mismatch into a permerror

    gcc/

            * doc/invoke.texi (Warning Options): Document that
            -Wreturn-mismatch is a permerror in C99 and later.

    gcc/c/

            PR c/96284
            * c-typeck.cc (c_finish_return): Use permerrors
            for OPT_Wreturn_mismatch diagnostics.

    gcc/testsuite/

            * gcc.dg/permerror-default.c (return_mismatch_1)
            (return_mismatch_2): Expect new permerror.
            * gcc.dg/permerror-gnu89-nopermissive.c (return_mismatch_1):
            Likewise.
            * gcc.dg/permerror-system.c: Likewise.
            * gcc.dg/20030906-1.c: Compile with -fpermissive due to
            expected -Wreturn-mismatch error.
            * gcc.dg/20030906-1a.c: New test.  Copied from
            gcc.dg/20030906-1.c.  Expect the error.
            * gcc.dg/20030906-2.c: Compile with -fpermissive due to
            expected -Wreturn-mismatch error.
            * gcc.dg/20030906-2a.c: New test.  Copied from
            gcc.dg/20030906-2.c.  Expect the error.
            * gcc.dg/Wreturn-mismatch-1.c: Compile with -fpermissive due to
            expected -Wreturn-mismatch error.
            * gcc.dg/Wreturn-mismatch-1a.c: New test.  Copied from
            gcc.dg/Wreturn-mismatch-1.c.  Expect the error.
            * gcc.dg/Wreturn-mismatch-2.c: Compile with -fpermissive due to
            expected -Wreturn-mismatch error.
            * gcc.dg/Wreturn-mismatch-2a.c: New test.  Copied from
            gcc.dg/Wreturn-mismatch-2.c.  Expect the error.
            * gcc.dg/diagnostic-range-bad-return.c: Compile with
            -fpermissive due to expected -Wreturn-mismatch error.
            * gcc.dg/diagnostic-range-bad-return-2.c: New test.
            Copied from gcc.dg/diagnostic-range-bad-return.c.  Expect the
            error.
            * gcc.dg/pr105635-2.c: Expect -Wreturn-mismatch error.
            * gcc.dg/pr23075.c: Build with -fpermissive due to
            expected -Wreturn-mismatch error.
            * gcc.dg/pr23075-2.c: New test.  Copied from gcc.dg/pr23075.c.
            Expect the error.
            * gcc.dg/pr29521.c: Compile with -fpermissive due to expected
            -Wreturn-mismatch error.
            * gcc.dg/pr29521-a.c: New test. Copied from gcc.dg/pr29521.c.
            Expect error.
            * gcc.dg/pr67730.c: Compile with -fpermissive due to expected
            -Wreturn-mismatch error.
            * gcc.dg/pr67730-a.c: New test.  Copied from
            gcc.dg/pr67730-a.c.  Expect error.
            * gcc.target/powerpc/conditional-return.c: Compile with
            -fpermissive due to expected -Wreturn-mismatch error.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (11 preceding siblings ...)
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
@ 2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
  2023-12-01  7:15 ` fw at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-01  7:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@gcc.gnu.org>:

https://gcc.gnu.org/g:9715c545d33b3a32ddc1ae817ba9356ade1fb9df

commit r14-6037-g9715c545d33b3a32ddc1ae817ba9356ade1fb9df
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Dec 1 08:10:13 2023 +0100

    c: Turn -Wincompatible-pointer-types into a permerror

    The change to build_conditional_expr drops the downgrade
    from a pedwarn to warning for builtins for C99 and later
    language dialects.  It remains a warning in C89 mode (not
    a permerror), as the -std=gnu89 -fno-permissive test shows.

    gcc/

            * doc/invoke.texi (Warning Options): Document changes.

    gcc/c/

            PR c/96284
            * c-typeck.cc (build_conditional_expr): Upgrade most pointer
            type mismatches to a permerror.
            (convert_for_assignment): Use permerror_opt and
            permerror_init for OPT_Wincompatible_pointer_types warnings.

    gcc/testsuite/

            * gcc.dg/permerror-default.c (incompatible_pointer_types):
            Expect new permerror.
            * gcc.dg/permerror-gnu89-nopermissive.c
            (incompatible_pointer_types): Likewise.
            * gcc.dg/permerror-pedantic.c (incompatible_pointer_types):
            Likewise.
            * gcc.dg/permerror-system.c: Likewise.
            * gcc.dg/Wincompatible-pointer-types-2.c: Compile with
            -fpermissive due to expected errors.
            * gcc.dg/Wincompatible-pointer-types-5.c: New test.  Copied
            from gcc.dg/Wincompatible-pointer-types-2.c.  Expect errors.
            * gcc.dg/anon-struct-11.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/anon-struct-11a.c: New test.  Copied from
            gcc.dg/anon-struct-11.c.  Expect errors.
            * gcc.dg/anon-struct-13.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/anon-struct-13a.c: New test.  Copied from
            gcc.dg/anon-struct-13.c.  Expect errors.
            * gcc.dg/builtin-arith-overflow-4.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/builtin-arith-overflow-4a.c: New test.  Copied from
            gcc.dg/builtin-arith-overflow-4.c.  Expect errors.
            * gcc.dg/c23-qual-4.c: Expect -Wincompatible-pointer-types errors.
            * gcc.dg/dfp/composite-type.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/dfp/composite-type-2.c: New test.  Copied from
            gcc.dg/dfp/composite-type.c.  Expect errors.
            * gcc.dg/diag-aka-1.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/diag-aka-1a.c: New test.  Copied from
            gcc.dg/diag-aka-1a.c.  Expect errors.
            * gcc.dg/enum-compat-1.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/enum-compat-2.c: New test.  Copied from
            gcc.dg/enum-compat-1.c.  Expect errors.
            * gcc.dg/func-ptr-conv-1.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/func-ptr-conv-2.c: New test.  Copied from
            gcc.dg/func-ptr-conv-1.c.  Expect errors.
            * gcc.dg/init-bad-7.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/init-bad-7a.c: New test.  Copied from gcc.dg/init-bad-7.c.
            Expect errors.
            * gcc.dg/noncompile/incomplete-3.c (foo): Expect
            -Wincompatible-pointer-types error.
            * gcc.dg/param-type-mismatch-2.c (test8): Likewise.
            * gcc.dg/pointer-array-atomic.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/pointer-array-atomic-2.c: New test.  Copied from
            gcc.dg/pointer-array-atomic.c.  Expect errors.
            * gcc.dg/pointer-array-quals-1.c (test): Expect
            -Wincompatible-pointer-types errors.
            * gcc.dg/transparent-union-1.c: Compile with -fpermissive
            due to expected errors.
            * gcc.dg/transparent-union-1a.c: New test.  Copied from
            gcc.dg/transparent-union-1.c.  Expect errors.
            * gcc.target/aarch64/acle/memtag_2a.c
            (test_memtag_warning_return_qualifier): Expect additional
            errors.
            * gcc.target/aarch64/sve/acle/general-c/load_2.c (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_1.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_2.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_3.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_4.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_5.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_1.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_2.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_3.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_4.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c (f1):
Likewise.
            * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c (f1):
Likewise.
            * gcc.target/aarch64/sve/acle/general-c/store_1.c (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
            (f1): Likewise.
            *
gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
            (f1): Likewise.
            * gcc.target/aarch64/sve/acle/general/attributes_7.c
            (f1): Likewise.
            * gcc.target/i386/sse2-bfloat16-scalar-typecheck.c (footest):
            Expect -Wincompatible-pointer-types errors.
            * gcc.target/i386/vect-bfloat16-typecheck_1.c (footest): Likewise.
            * gcc.target/i386/vect-bfloat16-typecheck_2.c (footest): Likewise.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (12 preceding siblings ...)
  2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
@ 2023-12-01  7:15 ` fw at gcc dot gnu.org
  2023-12-01  7:15 ` fw at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-01  7:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284
Bug 96284 depends on bug 106416, which changed state.

Bug 106416 Summary: -Wint-conversion should be an error, not a pedwarn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106416

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (13 preceding siblings ...)
  2023-12-01  7:15 ` fw at gcc dot gnu.org
@ 2023-12-01  7:15 ` fw at gcc dot gnu.org
  2023-12-01  8:21 ` sjames at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: fw at gcc dot gnu.org @ 2023-12-01  7:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284
Bug 96284 depends on bug 91093, which changed state.

Bug 91093 Summary: Error on implicit int by default
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91093

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (14 preceding siblings ...)
  2023-12-01  7:15 ` fw at gcc dot gnu.org
@ 2023-12-01  8:21 ` sjames at gcc dot gnu.org
  2023-12-01  8:21 ` sjames at gcc dot gnu.org
  2023-12-01  8:41 ` david at westcontrol dot com
  17 siblings, 0 replies; 19+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-12-01  8:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |108476, 85678
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=108476    |
   Target Milestone|---                         |14.0

--- Comment #14 from Sam James <sjames at gcc dot gnu.org> ---
I'm going to boldly call this done for 14 given we've covered all the major
stuff, with the exception of prototypes which as discussed elsewhere are not
easy to split up into obsolete/not.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678
[Bug 85678] -fno-common should be default
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108476
[Bug 108476] Please turn -Wreturn-type on by default for C

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (15 preceding siblings ...)
  2023-12-01  8:21 ` sjames at gcc dot gnu.org
@ 2023-12-01  8:21 ` sjames at gcc dot gnu.org
  2023-12-01  8:41 ` david at westcontrol dot com
  17 siblings, 0 replies; 19+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-12-01  8:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #15 from Sam James <sjames at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c/96284] Outdated C features should be made errors with newer standards
  2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
                   ` (16 preceding siblings ...)
  2023-12-01  8:21 ` sjames at gcc dot gnu.org
@ 2023-12-01  8:41 ` david at westcontrol dot com
  17 siblings, 0 replies; 19+ messages in thread
From: david at westcontrol dot com @ 2023-12-01  8:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96284

--- Comment #16 from David Brown <david at westcontrol dot com> ---
Thank you for making these changes.  There's always a trade-off between
supporting code that "has always compiled fine and works in testing", and
making it harder for people to write new poor quality code with a high risk of
bugs.  I believe, however, that changes like this help all developers - and
more importantly, help all the end-users by reducing software bug rates, even
if it is just by a very small step.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-12-01  8:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 13:16 [Bug c/96284] New: Outdated C features should be made errors with newer standards david at westcontrol dot com
2020-07-22 14:09 ` [Bug c/96284] " rguenth at gcc dot gnu.org
2020-07-22 14:51 ` redi at gcc dot gnu.org
2020-07-22 17:18 ` msebor at gcc dot gnu.org
2020-07-22 17:33 ` msebor at gcc dot gnu.org
2020-07-28  5:57 ` egallager at gcc dot gnu.org
2020-07-28  7:20 ` david at westcontrol dot com
2020-07-28  7:39 ` fw at gcc dot gnu.org
2021-12-15  7:01 ` egallager at gcc dot gnu.org
2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
2023-12-01  7:12 ` cvs-commit at gcc dot gnu.org
2023-12-01  7:15 ` fw at gcc dot gnu.org
2023-12-01  7:15 ` fw at gcc dot gnu.org
2023-12-01  8:21 ` sjames at gcc dot gnu.org
2023-12-01  8:21 ` sjames at gcc dot gnu.org
2023-12-01  8:41 ` david at westcontrol dot com

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).