re PR c++/89105 (-Wabi warns for functions with internal linkage)
authorJakub Jelinek <jakub@redhat.com>
Wed, 30 Jan 2019 07:51:24 +0000 (08:51 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 30 Jan 2019 07:51:24 +0000 (08:51 +0100)
PR c++/89105
* config/i386/i386.c (ix86_warn_parameter_passing_abi): Don't warn
for arguments to functions that are TU-local and shouldn't be
referenced by assembly.

* g++.target/i386/pr89105.C: New test.

From-SVN: r268382

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/i386/pr89105.C [new file with mode: 0644]

index 1b9c8e4976f3df2c68778e2d7360e1179c682bf3..2e6f49e92ff32df48d68670e68bd4bd231e518fa 100644 (file)
@@ -1,3 +1,10 @@
+2019-01-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/89105
+       * config/i386/i386.c (ix86_warn_parameter_passing_abi): Don't warn
+       for arguments to functions that are TU-local and shouldn't be
+       referenced by assembly.
+
 2019-01-30  Ulrich Drepper  <drepper@redhat.com>
 
        * dumpfile.c (opt_info_switch_p_1): Ignore '-' if it appears
index 2b5bd682639a7ec4f5ea92f07316741ca60a8ac2..4e67abe87646358e6cc97f0262ae6696de3c6b8c 100644 (file)
@@ -29562,6 +29562,10 @@ ix86_warn_parameter_passing_abi (cumulative_args_t cum_v, tree type)
   if (!TYPE_EMPTY_P (type))
     return;
 
+  /* Don't warn if the function isn't visible outside of the TU.  */
+  if (cum->decl && !TREE_PUBLIC (cum->decl))
+    return;
+
   const_tree ctx = get_ultimate_context (cum->decl);
   if (ctx != NULL_TREE
       && !TRANSLATION_UNIT_WARN_EMPTY_P (ctx))
index d60389f4c4f1092419fe6d2e2ae7d28576a5a989..e9846c7710df40c7188d34d88260659fe29605a9 100644 (file)
@@ -1,5 +1,8 @@
 2019-01-30  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/89105
+       * g++.target/i386/pr89105.C: New test.
+
        PR c/89061
        * gcc.dg/pr89061.c: New test.
 
diff --git a/gcc/testsuite/g++.target/i386/pr89105.C b/gcc/testsuite/g++.target/i386/pr89105.C
new file mode 100644 (file)
index 0000000..689e5ee
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/89105
+// { dg-do compile { target c++11 } }
+// { dg-options "-fabi-version=12 -Wabi=11" }
+
+namespace {
+  template<typename F>
+    void run(F f, int i)       // { dg-bogus "parameter passing ABI changes in -fabi-version=12" }
+    {
+      f(i);
+    }
+}
+
+void f()
+{
+  run([](int) { }, 1);         // { dg-bogus "parameter passing ABI changes in -fabi-version=12" }
+}