aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-09-22 11:18:26 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-09-22 11:18:26 -0400
commita75f15742ab04d48fb599c9b6523ffbe8f5d837c (patch)
tree44c7e77abec314f6ccab830cf576cb24d797c18e /gcc/c-family
parent8013b816cc8b2de17db1a5115f4df482f0acbc6d (diff)
downloadgcc-a75f15742ab04d48fb599c9b6523ffbe8f5d837c.zip
gcc-a75f15742ab04d48fb599c9b6523ffbe8f5d837c.tar.gz
gcc-a75f15742ab04d48fb599c9b6523ffbe8f5d837c.tar.bz2
Disconnect -Wabi=<n> from -fabi-compat-version=<n>.
gcc/c-family/ * c-common.h (abi_compat_version_crosses): New. (warn_abi_version): Declare. * c-common.c: Define it. * c-opts.c (c_common_post_options): Handle it. flag_abi_compat_version defaults to 8. gcc/cp/ * mangle.c (abi_warn_or_compat_version_crosses): New. Use it instead of abi_version_crosses. (mangle_decl): Deal with -fabi-compat-version and -Wabi separately. From-SVN: r228017
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-common.c3
-rw-r--r--gcc/c-family/c-common.h14
-rw-r--r--gcc/c-family/c-opts.c22
4 files changed, 37 insertions, 10 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 5fa1a72..bccbbfa 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,11 @@
+2015-09-22 Jason Merrill <jason@redhat.com>
+
+ * c-common.h (abi_compat_version_crosses): New.
+ (warn_abi_version): Declare.
+ * c-common.c: Define it.
+ * c-opts.c (c_common_post_options): Handle it.
+ flag_abi_compat_version defaults to 8.
+
2015-09-21 Ville Voutilainen <ville.voutilainen@gmail.com>
Complete the implementation of N4230, Nested namespace definition.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 4b922bf..879f4db 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -239,6 +239,9 @@ const char *constant_string_class_name;
/* C++ language option variables. */
+/* The reference version of the ABI for -Wabi. */
+
+int warn_abi_version = -1;
/* Nonzero means generate separate instantiation control files and
juggle them at link time. */
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 74d1bc1..0b4d993 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -648,14 +648,24 @@ extern const char *constant_string_class_name;
/* C++ language option variables. */
+/* The reference version of the ABI for -Wabi. */
+
+extern int warn_abi_version;
/* Return TRUE if one of {flag_abi_version,flag_abi_compat_version} is
- less than N and the other is at least N, for use by -Wabi. */
-#define abi_version_crosses(N) \
+ less than N and the other is at least N. */
+#define abi_compat_version_crosses(N) \
(abi_version_at_least(N) \
!= (flag_abi_compat_version == 0 \
|| flag_abi_compat_version >= (N)))
+/* Return TRUE if one of {flag_abi_version,warn_abi_version} is
+ less than N and the other is at least N, for use by -Wabi. */
+#define abi_version_crosses(N) \
+ (abi_version_at_least(N) \
+ != (warn_abi_version == 0 \
+ || warn_abi_version >= (N)))
+
/* Nonzero means generate separate instantiation control files and
juggle them at link time. */
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index f358b62..bf2e6b0 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -397,7 +397,9 @@ c_common_handle_option (size_t scode, const char *arg, int value,
warning (0, "%<-Wabi=1%> is not supported, using =2");
value = 2;
}
- flag_abi_compat_version = value;
+ warn_abi_version = value;
+ if (flag_abi_compat_version == -1)
+ flag_abi_compat_version = value;
break;
case OPT_fcanonical_system_headers:
@@ -870,6 +872,14 @@ 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");
@@ -877,13 +887,9 @@ c_common_post_options (const char **pfilename)
}
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;
+ /* Generate compatibility aliases for ABI v8 (5.1) by default. */
+ flag_abi_compat_version
+ = (flag_abi_version == 0 ? 8 : 0);
}
/* Change flag_abi_version to be the actual current ABI level for the