On Wed, May 30, 2018 at 3:56 PM, Jeff Law <l...@redhat.com> wrote:
> On 04/22/2018 01:17 PM, dave.pa...@oracle.com wrote:
>> This patch fixes handling of -Werror=return-type as well as
>> -Wno-return-type. Currently, -Werror=return-type does not turn the
>> warnings into errors and -Wno-return-type does not turn off
>> warning/error. Now they both work as expected.
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55976
>>
>> Initialize warn_return_type only for C++/C++ with ObjC extensions. In C,
>> this allows us to differentiate between default (no option), or cases
>> where -Wreturn-type/-Wno-return-type are specified. Elsewhere, update
>> references to warn_return_type (for C) to reflect change in initialization.
>>
>> Patch was successfully bootstrapped and tested on x86_64-linux.
>>
>> --Dave
>>
>>
>> CL-55976
>>
>>
>> /c
>> 2018-04-22  David Pagan  <dave.pa...@oracle.com>
>>
>>       PR c/55976
>>       * c-decl.c (grokdeclarator): Update check for return type warnings.
>>       (start_function): Likewise.
>>       (finish_function): Likewise.
>>       * c-typeck.c (c_finish_return): Update check for return type warnings.
>>       Pass OPT_Wreturn_type to pedwarn when appropriate.
>>       * c-opts.c (c_common_post_options): Set default for warn_return_type
>>       for C++/C++ with ObjC extensions only. For C, makes it possible to
>>       differentiate between default (no option), -Wreturn-type, and
>>       -Wno-return-type.
>>
>> /testsuite
>> 2018-04-22  David Pagan  <dave.pa...@oracle.com>
>>
>>       PR c/55976
>>       * gcc.dg/noncompile/pr55976-1.c: New test.
>>       * gcc.dg/noncompile/pr55976-2.c: New test.
> THanks.  Installed on the trunk.
>

On x86, I got

FAIL: gcc.dg/noncompile/pr55976-1.c   -O0  (test for excess errors)
FAIL: gcc.dg/noncompile/pr55976-1.c   -O1  (test for excess errors)
FAIL: gcc.dg/noncompile/pr55976-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  (test for excess errors)
FAIL: gcc.dg/noncompile/pr55976-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  (test for excess errors)
FAIL: gcc.dg/noncompile/pr55976-1.c   -O2  (test for excess errors)
FAIL: gcc.dg/noncompile/pr55976-1.c   -O3 -g  (test for excess errors)
FAIL: gcc.dg/noncompile/pr55976-1.c   -Os  (test for excess errors)

[hjl@gnu-skx-1 testsuite]$
/export/ssd/git/gcc-test-native/bld/gcc/xgcc
-B/export/ssd/git/gcc-test-native/bld/gcc/
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c
-mx32 -B/export/ssd/git/gcc-test-native/bld/x86_64-pc-linux-gnu/32/libmpx/
-B/export/ssd/git/gcc-test-native/bld/x86_64-pc-linux-gnu/32/libmpx/mpxrt
-L/export/ssd/git/gcc-test-native/bld/x86_64-pc-linux-gnu/32/libmpx/mpxrt/.libs
-B/export/ssd/git/gcc-test-native/bld/x86_64-pc-linux-gnu/32/libmpx/
-B/export/ssd/git/gcc-test-native/bld/x86_64-pc-linux-gnu/32/libmpx/mpxwrap
-L/export/ssd/git/gcc-test-native/bld/x86_64-pc-linux-gnu/32/libmpx/mpxwrap/.libs
-fno-diagnostics-show-caret -fdiagnostics-color=never -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects -Werror=return-type -S -o
pr55976-1.s
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c:
In function \u2018t\u2019:
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c:7:20:
error: \u2018return\u2019 with a value, in function returning void
[-Werror=return-type]
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c:7:6:
note: declared here
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c:
In function \u2018b\u2019:
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c:8:12:
error: \u2018return\u2019 with no value, in function returning
non-void [-Werror=return-type]
/export/ssd/git/gcc-test-native/src-trunk/gcc/testsuite/gcc.dg/noncompile/pr55976-1.c:8:5:
note: declared here
cc1: some warnings being treated as errors
[hjl@gnu-skx-1 testsuite]$

-- 
H.J.

Reply via email to