From 785f21af82139f512eb12f3318899c9f967409e6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 13 Feb 2015 00:26:37 -0500 Subject: [PATCH] re PR c++/64956 (__GXX_ABI_VERSION needs a proper definition for the 5.x releases) PR c++/64956 * c-opts.c (c_common_post_options): Change flag_abi_version from 0 to the current highest version. * c-cppbuiltin.c (c_cpp_builtins): Assert that it isn't 0. From-SVN: r220675 --- gcc/c-family/ChangeLog | 7 +++++++ gcc/c-family/c-cppbuiltin.c | 10 ++-------- gcc/c-family/c-opts.c | 5 +++++ gcc/common.opt | 6 ++++-- gcc/testsuite/g++.dg/abi/macro0.C | 3 ++- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 6e4553af921..c63384be947 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2015-02-12 Jason Merrill + + PR c++/64956 + * c-opts.c (c_common_post_options): Change flag_abi_version from 0 + to the current highest version. + * c-cppbuiltin.c (c_cpp_builtins): Assert that it isn't 0. + 2015-02-04 Jakub Jelinek PR c/64824 diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 19365920a86..60c2d7f3862 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -891,14 +891,8 @@ c_cpp_builtins (cpp_reader *pfile) /* Represents the C++ ABI version, always defined so it can be used while preprocessing C and assembler. */ if (flag_abi_version == 0) - /* Use a very large value so that: - - #if __GXX_ABI_VERSION >= - - will work whether the user explicitly says "-fabi-version=x" or - "-fabi-version=0". Do not use INT_MAX because that will be - different from system to system. */ - builtin_define_with_int_value ("__GXX_ABI_VERSION", 999999); + /* We should have set this to something real in c_common_post_options. */ + gcc_unreachable (); else if (flag_abi_version == 1) /* Due to a historical accident, this version had the value "102". */ diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index d10e5bd8daa..1a67b5a766d 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -886,6 +886,11 @@ c_common_post_options (const char **pfilename) warn_abi = false; } + /* 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 = 8; + if (cxx_dialect >= cxx11) { /* If we're allowing C++0x constructs, don't warn about C++98 diff --git a/gcc/common.opt b/gcc/common.opt index 87f2e1f920c..0c60e84797a 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -806,7 +806,8 @@ Driver Undocumented ; ; 1: The version of the ABI first used in G++ 3.2. No longer selectable. ; -; 2: The version of the ABI first used in G++ 3.4 (and current default). +; 2: The version of the ABI first used in G++ 3.4, and the default +; until GCC 4.9. ; ; 3: The version of the ABI that fixes the missing underscore ; in template non-type arguments of pointer type. @@ -831,7 +832,8 @@ Driver Undocumented ; ; 8: The version of the ABI that corrects the substitution behavior of ; function types with function-cv-qualifiers. -; First selectable in G++ 4.9. +; First selectable in G++ 4.9 and default in G++ 5 +; (set in c_common_post_options). ; ; Additional positive integers will be assigned as new versions of ; the ABI become the default version of the ABI. diff --git a/gcc/testsuite/g++.dg/abi/macro0.C b/gcc/testsuite/g++.dg/abi/macro0.C index 6c391e6891b..fbcbb2cdc96 100644 --- a/gcc/testsuite/g++.dg/abi/macro0.C +++ b/gcc/testsuite/g++.dg/abi/macro0.C @@ -1,5 +1,6 @@ +// This testcase will need to be kept in sync with c_common_post_options. // { dg-options "-fabi-version=0" } -#if __GXX_ABI_VERSION != 999999 +#if __GXX_ABI_VERSION != 1008 #error "Incorrect value of __GXX_ABI_VERSION" #endif -- 2.30.2