From 787e2debb8cb88138626ad7802c485f8b2c0694b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 30 Jan 2019 08:51:24 +0100 Subject: [PATCH] re PR c++/89105 (-Wabi warns for functions with internal linkage) 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 | 7 +++++++ gcc/config/i386/i386.c | 4 ++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.target/i386/pr89105.C | 16 ++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/pr89105.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b9c8e4976f..2e6f49e92ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-01-30 Jakub Jelinek + + 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 * dumpfile.c (opt_info_switch_p_1): Ignore '-' if it appears diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 2b5bd682639..4e67abe8764 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d60389f4c4f..e9846c7710d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-01-30 Jakub Jelinek + 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 index 00000000000..689e5ee5b6b --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr89105.C @@ -0,0 +1,16 @@ +// PR c++/89105 +// { dg-do compile { target c++11 } } +// { dg-options "-fabi-version=12 -Wabi=11" } + +namespace { + template + 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" } +} -- 2.30.2