diff options
author | Florian Weimer <fweimer@redhat.com> | 2023-11-09 09:50:54 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2023-11-09 09:53:40 +0100 |
commit | 6e312b2b864bf923a9d772429f014375bf9dabc8 (patch) | |
tree | 42a9ab533a216f375efd9dbd5163482fe4738af8 /gcc/tree-vect-loop.cc | |
parent | f88b78b1196d71042cf129be7a0bf02b9a4de0d3 (diff) | |
download | gcc-6e312b2b864bf923a9d772429f014375bf9dabc8.zip gcc-6e312b2b864bf923a9d772429f014375bf9dabc8.tar.gz gcc-6e312b2b864bf923a9d772429f014375bf9dabc8.tar.bz2 |
c: Add -Wreturn-mismatch warning, split from -Wreturn-type
The existing -Wreturn-type option covers both constraint violations
(which are mandatory to diagnose) and warnings that have known
false positives. The new -Wreturn-mismatch warning is only about
the constraint violations (missing or extra return expressions),
and should eventually be turned into a permerror.
The -std=gnu89 test cases show that by default, we do not warn for
return; in a function not returning void. This matches previous
practice for -Wreturn-type.
gcc/c-family/
* c.opt (Wreturn-mismatch): New.
gcc/c/
* c-typeck.cc (c_finish_return): Use pedwarn with
OPT_Wreturn_mismatch for missing/extra return expressions.
gcc/
* doc/invoke.texi (Warning Options): Document
-Wreturn-mismatch. Update -Wreturn-type documentation.
gcc/testsuite/
* gcc.dg/Wreturn-mismatch-1.c: New.
* gcc.dg/Wreturn-mismatch-2.c: New.
* gcc.dg/Wreturn-mismatch-3.c: New.
* gcc.dg/Wreturn-mismatch-4.c: New.
* gcc.dg/Wreturn-mismatch-5.c: New.
* gcc.dg/Wreturn-mismatch-6.c: New.
* gcc.dg/noncompile/pr55976-1.c: Change -Werror=return-type
to -Werror=return-mismatch.
* gcc.dg/noncompile/pr55976-2.c: Change -Wreturn-type
to -Wreturn-mismatch.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions