Make warn_inline Optimization option.
authorMartin Liska <mliska@suse.cz>
Tue, 7 Jan 2020 09:15:38 +0000 (10:15 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 7 Jan 2020 09:15:38 +0000 (09:15 +0000)
2020-01-07  Martin Liska  <mliska@suse.cz>

PR tree-optimization/92860
* common.opt: Make in Optimization option
as it is affected by -O0, which is an Optimization
option.
* tree-inline.c (tree_inlinable_function_p):
Use opt_for_fn for warn_inline.
(expand_call_inline): Likewise.
2020-01-07  Martin Liska  <mliska@suse.cz>

PR tree-optimization/92860
* gcc.dg/pr92860-2.c: New test.

From-SVN: r279947

gcc/ChangeLog
gcc/common.opt
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr92860-2.c [new file with mode: 0644]
gcc/tree-inline.c

index 288c0e25598dfeab1d8690ae419b09aba053ac6d..d4c3731a8ffd7a89f849e60543df27988326db9c 100644 (file)
@@ -1,3 +1,13 @@
+2020-01-07  Martin Liska  <mliska@suse.cz>
+
+       PR tree-optimization/92860
+       * common.opt: Make in Optimization option
+       as it is affected by -O0, which is an Optimization
+       option.
+       * tree-inline.c (tree_inlinable_function_p):
+       Use opt_for_fn for warn_inline.
+       (expand_call_inline): Likewise.
+
 2020-01-07  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/92860
index 02c7cddbb26c2bfbada57c3ae179dc4fc76817ea..9fc921109caa7744ad3ccde9d930cf53cfdf0811 100644 (file)
@@ -617,7 +617,7 @@ Common Var(warn_implicit_fallthrough) RejectNegative Joined UInteger Warning Int
 Warn when a switch case falls through.
 
 Winline
-Common Var(warn_inline) Warning
+Common Var(warn_inline) Warning Optimization
 Warn when an inlined function cannot be inlined.
 
 Winvalid-memory-model
index dabc9d2e3226b546291b50ed9733584b94a8788f..4e02fb48c3bc5efba3dde9f7a65631b470b5cf68 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-07  Martin Liska  <mliska@suse.cz>
+
+       PR tree-optimization/92860
+       * gcc.dg/pr92860-2.c: New test.
+
 2020-01-07  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/92860
diff --git a/gcc/testsuite/gcc.dg/pr92860-2.c b/gcc/testsuite/gcc.dg/pr92860-2.c
new file mode 100644 (file)
index 0000000..57af606
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR tree-optimization/92860 */
+/* { dg-do compile } */
+/* { dg-options "-Winline -O2 -fgnu89-inline" } */
+
+#pragma GCC push_options
+#pragma GCC optimize("-O0")
+#pragma GCC pop_options
+
+inline int q(void);             /* { dg-warning "body not available" } */
+inline int t(void)
+{
+       return q();              /* { dg-message "called from here" } */
+}
index 21a45255051aca4f5acafc022190d5490790c566..58c6739eb7e334335fdef1ce1837e1798c578107 100644 (file)
@@ -4009,7 +4009,7 @@ tree_inlinable_function_p (tree fn)
     return false;
 
   /* We only warn for functions declared `inline' by the user.  */
-  do_warning = (warn_inline
+  do_warning = (opt_for_fn (fn, warn_inline)
                && DECL_DECLARED_INLINE_P (fn)
                && !DECL_NO_INLINE_WARNING_P (fn)
                && !DECL_IN_SYSTEM_HEADER (fn));
@@ -4714,7 +4714,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
            inform (DECL_SOURCE_LOCATION (cfun->decl),
                    "called from this function");
        }
-      else if (warn_inline
+      else if (opt_for_fn (fn, warn_inline)
               && DECL_DECLARED_INLINE_P (fn)
               && !DECL_NO_INLINE_WARNING_P (fn)
               && !DECL_IN_SYSTEM_HEADER (fn)