# Enable -Werror=return-type by default in C++ to avoid miscompilation # of functions returning non-void that have either no return statements # or control flow that reaches the end of function. # https://bugzilla.altlinux.org/36038 --- gcc/gcc/cp/lang-specs.h +++ gcc/gcc/cp/lang-specs.h @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see " cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed" " %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}" " %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}" - " %(cc1_options) %2" + " -Werror=return-type %(cc1_options) %2" " %{!fsyntax-only:%{!S:-o %g.s}" " %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}" " %W{o*:--output-pch=%*}}%V}}}}", @@ -60,7 +60,7 @@ along with GCC; see the file COPYING3. If not see " cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed" " %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}" " %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}" - " %(cc1_options) %2" + " -Werror=return-type %(cc1_options) %2" " %{!fsyntax-only:%(invoke_as)}}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, {".ii", "@c++-cpp-output", 0, 0, 0},