summaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-06-13 15:39:36 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-06-13 15:39:36 -0400
commit34a7a2308da1effd628f9f7959e1f5cabec918be (patch)
tree7e4dadbab05c5400b398730714c7858cd3f9950a /gcc/c-family
parent010b9a3ec010d3cf5c76ba98e9a6438ad5bf7a76 (diff)
downloadgcc-34a7a2308da1effd628f9f7959e1f5cabec918be.tar.gz
PR c++/86094 - wrong code with defaulted move ctor.
gcc/c-family/ * c-opts.c (c_common_post_options): Bump the current ABI version to 13. Set warn_abi_version and flag_abi_compat_version to the current version rather than 0. Fix defaulting flag_abi_compat_version from warn_abi_version. gcc/cp/ * class.c (classtype_has_non_deleted_move_ctor): New. * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init): Handle v12 breakage. From-SVN: r261562
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-opts.c41
2 files changed, 32 insertions, 17 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f63af26624c..72f24fdb772 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/86094 - wrong code with defaulted move ctor.
+ * c-opts.c (c_common_post_options): Bump the current ABI version to
+ 13. Set warn_abi_version and flag_abi_compat_version to the current
+ version rather than 0. Fix defaulting flag_abi_compat_version from
+ warn_abi_version.
+
2018-06-12 Martin Sebor <msebor@redhat.com>
PR c/85931
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index ddaaef37e1d..107359ec20d 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -915,31 +915,38 @@ c_common_post_options (const char **pfilename)
if (flag_declone_ctor_dtor == -1)
flag_declone_ctor_dtor = optimize_size;
- if (warn_abi_version == -1)
- {
- if (flag_abi_compat_version != -1)
- warn_abi_version = flag_abi_compat_version;
- else
- warn_abi_version = 0;
- }
-
if (flag_abi_compat_version == 1)
{
warning (0, "%<-fabi-compat-version=1%> is not supported, using =2");
flag_abi_compat_version = 2;
}
- else if (flag_abi_compat_version == -1)
+
+ /* Change flag_abi_version to be the actual current ABI level, for the
+ benefit of c_cpp_builtins, and to make comparison simpler. */
+ const int latest_abi_version = 13;
+ /* Generate compatibility aliases for ABI v11 (7.1) by default. */
+ const int abi_compat_default = 11;
+
+#define clamp(X) if (X == 0 || X > latest_abi_version) X = latest_abi_version
+ clamp (flag_abi_version);
+ clamp (warn_abi_version);
+ clamp (flag_abi_compat_version);
+#undef clamp
+
+ /* Default -Wabi= or -fabi-compat-version= from each other. */
+ if (warn_abi_version == -1 && flag_abi_compat_version != -1)
+ warn_abi_version = flag_abi_compat_version;
+ else if (flag_abi_compat_version == -1 && warn_abi_version != -1)
+ flag_abi_compat_version = warn_abi_version;
+ else if (warn_abi_version == -1 && flag_abi_compat_version == -1)
{
- /* Generate compatibility aliases for ABI v11 (7.1) by default. */
- flag_abi_compat_version
- = (flag_abi_version == 0 ? 11 : 0);
+ warn_abi_version = latest_abi_version;
+ if (flag_abi_version == latest_abi_version)
+ flag_abi_compat_version = abi_compat_default;
+ else
+ flag_abi_compat_version = latest_abi_version;
}
- /* Change flag_abi_version to be the actual current ABI level for the
- benefit of c_cpp_builtins. */
- if (flag_abi_version == 0)
- flag_abi_version = 12;
-
/* By default, enable the new inheriting constructor semantics along with ABI
11. New and old should coexist fine, but it is a change in what
artificial symbols are generated. */