This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] PR55189 enable -Wreturn-type by default
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Sylvestre Ledru <sylvestre at debian dot org>
- Date: Thu, 14 Aug 2014 20:48:46 +0200
- Subject: Re: [Patch] PR55189 enable -Wreturn-type by default
- Authentication-results: sourceware.org; auth=none
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -693,6 +693,10 @@ gfc_handle_option (size_t scode, const char *arg,
int value,
gfc_option.warn_line_truncation = value;
break;
+ case OPT_Wmissing_return:
+ warn_missing_return = value;
+ break;
+
case OPT_Wrealloc_lhs:
gfc_option.warn_realloc_lhs = value;
break;
The entry in c.opt says this is a C/C++ option, why you need this?
+Wmissing-return
+C ObjC C++ ObjC++ Var(warn_missing_return) LangEnabledBy(C ObjC C++
ObjC++,Wreturn-type)
+Warn whenever control may reach end of non-void function
This should prevent that using -Wreturn-type in Fortran tries to
enable -Wmissing-return, if not that is a bug.
In any case, the work-around should be adding Wmissing-return to
fortran/lang.opt with a ??? comment, not there.
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -472,7 +472,7 @@ C ObjC Var(warn_implicit_function_declaration)
Init(-1) Warning LangEnabledBy(C
Warn about implicit function declarations
Wimplicit-int
-C ObjC Var(warn_implicit_int) Warning LangEnabledBy(C ObjC,Wimplicit)
+C ObjC Var(warn_implicit_int) Warning
Warn when a declaration does not specify a type
Wimport
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5ae910c..3f2019a 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3615,7 +3615,7 @@ This warning is enabled by @option{-Wall} in C++.
@opindex Wimplicit-int
@opindex Wno-implicit-int
Warn when a declaration does not specify a type.
-This warning is enabled by @option{-Wall}.
+This warning is enabled by default.
@item -Wimplicit-function-declaration @r{(C and Objective-C only)}
@opindex Wimplicit-function-declaration
Does this patch actually enables -Wimplicit-int by default? The
default without Init() should be zero!
And according to this: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01367.html
we still want -Wno-implicit to disable -Wimplicit-int (and
-Werror=implicit to set -Werror=implicit-int), so the LangEnabledBy()
should stay. The documentation could say: "This warning is enabled by
default and it is also controlled by -Wimplicit."
Cheers,
Manuel.