aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-opts.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-06-12 16:47:21 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-06-12 16:47:21 -0400
commit62984918665f0c82b187293ba762bc2edb32ab92 (patch)
treec0d0389e8a30820854148e9a086d0b15f452ac9f /gcc/c-family/c-opts.c
parentca0e51a0e5983a68e47b5195b99a8805938ecc26 (diff)
downloadgcc-62984918665f0c82b187293ba762bc2edb32ab92.zip
gcc-62984918665f0c82b187293ba762bc2edb32ab92.tar.gz
gcc-62984918665f0c82b187293ba762bc2edb32ab92.tar.bz2
Support -Wabi warning about backward compatibility.
gcc/c-family/ * c.opt (Wabi=, fabi-compat-version): New. * c-opts.c (c_common_handle_option): Handle -Wabi=. (c_common_post_options): Handle flag_abi_compat_version default. Disallow -fabi-compat-version=1. * c-common.h (abi_version_crosses): New. gcc/cp/ * call.c (convert_arg_to_ellipsis): Use abi_version_crosses. * cvt.c (type_promotes_to): Likewise. * mangle.c (write_type, write_expression): Likewise. (write_name, write_template_arg): Likewise. (mangle_decl): Make alias based on flag_abi_compat_version. Emit -Wabi warning here. (finish_mangling_internal): Not here. Drop warn parm. (finish_mangling_get_identifier, finish_mangling): Adjust. (mangle_type_string, mangle_special_for_type): Adjust. (mangle_ctor_vtbl_for_type, mangle_thunk): Adjust. (mangle_guard_variable, mangle_tls_init_fn): Adjust. (mangle_tls_wrapper_fn, mangle_ref_init_variable): Adjust. From-SVN: r211594
Diffstat (limited to 'gcc/c-family/c-opts.c')
-rw-r--r--gcc/c-family/c-opts.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 29e9a35..fbbc80e 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -456,6 +456,16 @@ c_common_handle_option (size_t scode, const char *arg, int value,
handle_OPT_d (arg);
break;
+ case OPT_Wabi_:
+ warn_abi = true;
+ if (value == 1)
+ {
+ warning (0, "%<-Wabi=1%> is not supported, using =2");
+ value = 2;
+ }
+ flag_abi_compat_version = value;
+ break;
+
case OPT_fcanonical_system_headers:
cpp_opts->canonical_system_headers = value;
break;
@@ -910,6 +920,22 @@ c_common_post_options (const char **pfilename)
if (flag_declone_ctor_dtor == -1)
flag_declone_ctor_dtor = optimize_size;
+ 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)
+ {
+ /* Generate compatibility aliases for ABI v2 (3.4-4.9) by default. */
+ flag_abi_compat_version = (flag_abi_version == 0 ? 2 : 0);
+
+ /* But don't warn about backward compatibility unless explicitly
+ requested with -Wabi=n. */
+ if (flag_abi_version == 0)
+ warn_abi = false;
+ }
+
if (cxx_dialect >= cxx11)
{
/* If we're allowing C++0x constructs, don't warn about C++98