]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Disable -Wreturn-type by default in all languages other from C++.
authorMartin Liska <mliska@suse.cz>
Wed, 15 Nov 2017 12:39:06 +0000 (13:39 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 15 Nov 2017 12:39:06 +0000 (12:39 +0000)
2017-11-15  Martin Liska  <mliska@suse.cz>

* tree-cfg.c (pass_warn_function_return::execute):
Compare warn_return_type for greater than zero.
2017-11-15  Martin Liska  <mliska@suse.cz>

* options.c (gfc_post_options):
Do not set default value of warn_return_type.
* trans-decl.c (gfc_trans_deferred_vars):
Compare warn_return_type for greater than zero.
(generate_local_decl): Likewise
(gfc_generate_function_code): Likewise.

From-SVN: r254764

gcc/ChangeLog
gcc/fortran/ChangeLog
gcc/fortran/options.c
gcc/fortran/trans-decl.c
gcc/tree-cfg.c

index 4bae57c7d3aee9c19e5a628ea4b3b519ca134a8f..4e2e4151859918fec60627583ab50add49d7f66a 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-15  Martin Liska  <mliska@suse.cz>
+
+       * tree-cfg.c (pass_warn_function_return::execute):
+       Compare warn_return_type for greater than zero.
+
 2017-11-15  Sebastian Peryt  <sebastian.peryt@intel.com>
 
        PR target/82941
index 54877ff50a949ea787fc025f5961091938f9ef90..d3170c7370a93f961771ba1ba85189a421015205 100644 (file)
@@ -1,3 +1,12 @@
+2017-11-15  Martin Liska  <mliska@suse.cz>
+
+       * options.c (gfc_post_options):
+       Do not set default value of warn_return_type.
+       * trans-decl.c (gfc_trans_deferred_vars):
+       Compare warn_return_type for greater than zero.
+       (generate_local_decl): Likewise
+       (gfc_generate_function_code): Likewise.
+
 2017-11-13  Fritz Reese <fritzoreese@gmail.com>
 
        PR fortran/78240
index c584a19e5596fc3e7506fc37d10c4a874ef4e25a..0ee6b7808d97aaae479646dd14df15dcaa5bc4d5 100644 (file)
@@ -435,9 +435,6 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
                     MAX_SUBRECORD_LENGTH);
 
-  if (warn_return_type == -1)
-    warn_return_type = 0;
-
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
index 8efaae79ebcdeecf0d666f0c3f83976440351e77..60e7d8f79eec4961d9d68ad80645ad2ab09786d1 100644 (file)
@@ -4198,7 +4198,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
                  break;
            }
          /* TODO: move to the appropriate place in resolve.c.  */
-         if (warn_return_type && el == NULL)
+         if (warn_return_type > 0 && el == NULL)
            gfc_warning (OPT_Wreturn_type,
                         "Return value of function %qs at %L not set",
                         proc_sym->name, &proc_sym->declared_at);
@@ -5619,7 +5619,7 @@ generate_local_decl (gfc_symbol * sym)
   else if (sym->attr.flavor == FL_PROCEDURE)
     {
       /* TODO: move to the appropriate place in resolve.c.  */
-      if (warn_return_type
+      if (warn_return_type > 0
          && sym->attr.function
          && sym->result
          && sym != sym->result
@@ -6494,11 +6494,11 @@ gfc_generate_function_code (gfc_namespace * ns)
       if (result == NULL_TREE || artificial_result_decl)
        {
          /* TODO: move to the appropriate place in resolve.c.  */
-         if (warn_return_type && sym == sym->result)
+         if (warn_return_type > 0 && sym == sym->result)
            gfc_warning (OPT_Wreturn_type,
                         "Return value of function %qs at %L not set",
                         sym->name, &sym->declared_at);
-         if (warn_return_type)
+         if (warn_return_type > 0)
            TREE_NO_WARNING(sym->backend_decl) = 1;
        }
       if (result != NULL_TREE)
index 9a2fa1d98cac8d03be25c36003fe4e6d39eacc5f..f08a0547f0f7de1aeab8885b676774d4c6e625ef 100644 (file)
@@ -9071,7 +9071,7 @@ pass_warn_function_return::execute (function *fun)
 
   /* If we see "return;" in some basic block, then we do reach the end
      without returning a value.  */
-  else if (warn_return_type
+  else if (warn_return_type > 0
           && !TREE_NO_WARNING (fun->decl)
           && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
           && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))