* C++ PATCH to change default dialect to C++14 @ 2015-07-01 18:27 Jason Merrill 2015-07-01 18:39 ` Marek Polacek ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Jason Merrill @ 2015-07-01 18:27 UTC (permalink / raw) To: gcc-patches List [-- Attachment #1: Type: text/plain, Size: 227 bytes --] I've been threatening to do this for a couple of months, and now that the regressions are under control I think it's time. This patch changes the default C++ dialect to C++14. Tested x86_64-pc-linux-gnu, applying to trunk. [-- Attachment #2: cxx14.patch --] [-- Type: text/x-patch, Size: 1426 bytes --] commit 6f2b3941ffb3734cecc05507dd8ed46f6a6d4f2d Author: Jason Merrill <jason@redhat.com> Date: Fri May 8 17:02:05 2015 -0500 gcc/c-family/ * c-opts.c (c_common_post_options): Default to C++14. gcc/testsuite/ * lib/target-supports.exp (cxx_default): Set to C++14. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 195045e..80481c3 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -889,9 +889,9 @@ c_common_post_options (const char **pfilename) if (flag_abi_version == 0) flag_abi_version = 10; - /* Set C++ standard to C++98 if not specified on the command line. */ + /* Set C++ standard to C++14 if not specified on the command line. */ if (c_dialect_cxx () && cxx_dialect == cxx_unset) - set_std_cxx98 (/*ISO*/false); + set_std_cxx14 (/*ISO*/false); if (cxx_dialect >= cxx11) { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index fc05e84..bf512e9 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5935,7 +5935,7 @@ proc check_effective_target_c++ { } { return 0 } -set cxx_default "c++98" +set cxx_default "c++14" # Check whether the current active language standard supports the features # of C++11/C++14 by checking for the presence of one of the -std flags. # This assumes that the default for the compiler is $cxx_default, and that ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-01 18:27 C++ PATCH to change default dialect to C++14 Jason Merrill @ 2015-07-01 18:39 ` Marek Polacek 2015-07-02 4:10 ` Jim Wilson 2015-07-10 11:27 ` H.J. Lu 2 siblings, 0 replies; 13+ messages in thread From: Marek Polacek @ 2015-07-01 18:39 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List On Wed, Jul 01, 2015 at 02:26:59PM -0400, Jason Merrill wrote: > I've been threatening to do this for a couple of months, and now that the > regressions are under control I think it's time. This patch changes the > default C++ dialect to C++14. Great! It seems that our cppopts.texi is very outdated wrt C++ standards... Marek ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-01 18:27 C++ PATCH to change default dialect to C++14 Jason Merrill 2015-07-01 18:39 ` Marek Polacek @ 2015-07-02 4:10 ` Jim Wilson 2015-07-02 5:21 ` Jason Merrill 2015-07-10 11:27 ` H.J. Lu 2 siblings, 1 reply; 13+ messages in thread From: Jim Wilson @ 2015-07-02 4:10 UTC (permalink / raw) To: Jason Merrill, gcc-patches List On 07/01/2015 11:26 AM, Jason Merrill wrote: > I've been threatening to do this for a couple of months, and now that > the regressions are under control I think it's time. This patch changes > the default C++ dialect to C++14. > > Tested x86_64-pc-linux-gnu, applying to trunk. This causes a build failure on Ubuntu 14.04 LTS (Trusty) for x86_64 and armhf and probably others. All of the graphite*.c files fail with /home/wilson/FOSS/GCC/X-palantir/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/cstddef:51:11: error: â::max_align_tâ has not been declared using ::max_align_t; This is a known gmp problem, documented in PR56019 and in https://gcc.gnu.org/gcc-4.9/porting_to.html near the bottom where it discusses cstddef.h changes. Except the cstddef.h changes didn't matter until C++11 or later became the default. This is apparently fixed in gmp 6.0.0. I haven't had a chance to try that yet. The prereqs section on doc/install.texi says we need gmp 4.3.2 or later, so it appears that this needs to change too. This is maybe only a problem if you have the isl libraries installed. Jim ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 4:10 ` Jim Wilson @ 2015-07-02 5:21 ` Jason Merrill 2015-07-02 6:17 ` Jim Wilson 2015-07-02 6:18 ` Marc Glisse 0 siblings, 2 replies; 13+ messages in thread From: Jason Merrill @ 2015-07-02 5:21 UTC (permalink / raw) To: Jim Wilson, gcc-patches List On 07/02/2015 12:10 AM, Jim Wilson wrote: > This is a known gmp problem, documented in PR56019 and in > https://gcc.gnu.org/gcc-4.9/porting_to.html > near the bottom where it discusses cstddef.h changes. This document also says that "A workaround until libraries get updated is to include <cstddef> or <stddef.h> before any headers from that library." Can you try modifying the graphite* files accordingly? Thanks, Jason ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 5:21 ` Jason Merrill @ 2015-07-02 6:17 ` Jim Wilson 2015-07-02 23:41 ` Jim Wilson 2015-07-02 6:18 ` Marc Glisse 1 sibling, 1 reply; 13+ messages in thread From: Jim Wilson @ 2015-07-02 6:17 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List [-- Attachment #1: Type: text/plain, Size: 514 bytes --] On Wed, Jul 1, 2015 at 10:21 PM, Jason Merrill <jason@redhat.com> wrote: > This document also says that "A workaround until libraries get updated is to > include <cstddef> or <stddef.h> before any headers from that library." > Can you try modifying the graphite* files accordingly? Right. I forgot to try that. Trying it now, I see that my build gets past the point that it failed, so this does appear to work. I won't be able to finish a proper test until tomorrow, but for now this patch seems to work. Jim [-- Attachment #2: gmp-513-cxx11.patch --] [-- Type: text/x-patch, Size: 4117 bytes --] 2015-07-01 Jim Wilson <jim.wilson@linaro.org> * graphite-blocking.c (HAVE_isl): Include <stddef.h>. * graphite-dependencies.c, graphite-interchange.c, graphite-isl-ast-to-gimple.c, graphite-optimize-isl.c, graphite-poly.c, graphite-scop-detection.c, graphite-sese-to-poly.c, graphite.c: Likewise. Index: graphite-blocking.c =================================================================== --- graphite-blocking.c (revision 225286) +++ graphite-blocking.c (working copy) @@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite-dependences.c =================================================================== --- graphite-dependences.c (revision 225286) +++ graphite-dependences.c (working copy) @@ -22,6 +22,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite-interchange.c =================================================================== --- graphite-interchange.c (revision 225286) +++ graphite-interchange.c (working copy) @@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/aff.h> #include <isl/set.h> #include <isl/map.h> Index: graphite-isl-ast-to-gimple.c =================================================================== --- graphite-isl-ast-to-gimple.c (revision 225286) +++ graphite-isl-ast-to-gimple.c (working copy) @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite-optimize-isl.c =================================================================== --- graphite-optimize-isl.c (revision 225286) +++ graphite-optimize-isl.c (working copy) @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite-poly.c =================================================================== --- graphite-poly.c (revision 225286) +++ graphite-poly.c (working copy) @@ -22,6 +22,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite-scop-detection.c =================================================================== --- graphite-scop-detection.c (revision 225286) +++ graphite-scop-detection.c (working copy) @@ -22,6 +22,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite-sese-to-poly.c =================================================================== --- graphite-sese-to-poly.c (revision 225286) +++ graphite-sese-to-poly.c (working copy) @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/union_map.h> Index: graphite.c =================================================================== --- graphite.c (revision 225286) +++ graphite.c (working copy) @@ -35,6 +35,9 @@ along with GCC; see the file COPYING3. #include "config.h" #ifdef HAVE_isl +/* Workaround for GMP 5.1.3 bug, see PR56019. */ +#include <stddef.h> + #include <isl/set.h> #include <isl/map.h> #include <isl/options.h> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 6:17 ` Jim Wilson @ 2015-07-02 23:41 ` Jim Wilson 2015-07-03 8:43 ` Richard Biener 2015-07-03 14:43 ` Jason Merrill 0 siblings, 2 replies; 13+ messages in thread From: Jim Wilson @ 2015-07-02 23:41 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List On 07/01/2015 11:17 PM, Jim Wilson wrote: > On Wed, Jul 1, 2015 at 10:21 PM, Jason Merrill <jason@redhat.com> wrote: >> This document also says that "A workaround until libraries get updated is to >> include <cstddef> or <stddef.h> before any headers from that library." >> Can you try modifying the graphite* files accordingly? > > Right. I forgot to try that. Trying it now, I see that my build gets > past the point that it failed, so this does appear to work. I won't > be able to finish a proper test until tomorrow, but for now this patch > seems to work. Since the patch to include system.h before the isl header did not work, I went ahead and tested this patch to add stddef.h includes before the isl headers. I tested it with an x86_64 bootstrap and make check. There were no problems caused by my patch. Though as a side effect of doing this, I discovered another minor problem with the C++ version change. This caused one additional testsuite failure. It also caused a bunch of tests to start working, which is nice, but the new failure needs to be addressed. /home/wilson/FOSS/GCC/gcc-svn/gcc/testsuite/gcc.dg/plugin/wide-int_plugin. c: In function 'void test_double_int_round_udiv()': /home/wilson/FOSS/GCC/gcc-svn/gcc/testsuite/gcc.dg/plugin/wide-int_plugin. c:13:45: error: narrowing conversion of '-1' from ' int' to 'long unsigned int' inside { } [-Wnarrowing] double_int dmax = { -1, HOST_WIDE_INT_MAX }; ^ /home/wilson/FOSS/GCC/gcc-svn/gcc/testsuite/gcc.dg/plugin/wide-int_plugin. c:14:33: error: narrowing conversion of '-1' from ' int' to 'long unsigned int' inside { } [-Wnarrowing] double_int dnegone = { -1, -1 }; ^ ... FAIL: gcc.dg/plugin/wide-int_plugin.c compilation The code compiles with -std=c++98. It does not compile with -std=c++14. So this testcase should be fixed to work with c++14. Or the c++14 support should be fixed if it is broken. Jim ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 23:41 ` Jim Wilson @ 2015-07-03 8:43 ` Richard Biener 2015-07-03 14:43 ` Jason Merrill 1 sibling, 0 replies; 13+ messages in thread From: Richard Biener @ 2015-07-03 8:43 UTC (permalink / raw) To: Jim Wilson; +Cc: Jason Merrill, gcc-patches List On Fri, Jul 3, 2015 at 1:41 AM, Jim Wilson <jim.wilson@linaro.org> wrote: > On 07/01/2015 11:17 PM, Jim Wilson wrote: >> On Wed, Jul 1, 2015 at 10:21 PM, Jason Merrill <jason@redhat.com> wrote: >>> This document also says that "A workaround until libraries get updated is to >>> include <cstddef> or <stddef.h> before any headers from that library." >>> Can you try modifying the graphite* files accordingly? >> >> Right. I forgot to try that. Trying it now, I see that my build gets >> past the point that it failed, so this does appear to work. I won't >> be able to finish a proper test until tomorrow, but for now this patch >> seems to work. > > Since the patch to include system.h before the isl header did not work, > I went ahead and tested this patch to add stddef.h includes before the > isl headers. I tested it with an x86_64 bootstrap and make check. > There were no problems caused by my patch. Ok then. I presume it might still cause issues on some hosts in the end. At some point we talked about doing sth like #define WANT_ISL_HEADERS #include "system.h" and include isl headers from system.h at the appropriate location if WANT_ISL_HEADERS Richard. > Though as a side effect of doing this, I discovered another minor > problem with the C++ version change. This caused one additional > testsuite failure. It also caused a bunch of tests to start working, > which is nice, but the new failure needs to be addressed. > > /home/wilson/FOSS/GCC/gcc-svn/gcc/testsuite/gcc.dg/plugin/wide-int_plugin. > c: In function 'void test_double_int_round_udiv()': > /home/wilson/FOSS/GCC/gcc-svn/gcc/testsuite/gcc.dg/plugin/wide-int_plugin. > c:13:45: error: narrowing conversion of '-1' from ' > int' to 'long unsigned int' inside { } [-Wnarrowing] > double_int dmax = { -1, HOST_WIDE_INT_MAX }; > ^ > /home/wilson/FOSS/GCC/gcc-svn/gcc/testsuite/gcc.dg/plugin/wide-int_plugin. > c:14:33: error: narrowing conversion of '-1' from ' > int' to 'long unsigned int' inside { } [-Wnarrowing] > double_int dnegone = { -1, -1 }; > ^ > ... > FAIL: gcc.dg/plugin/wide-int_plugin.c compilation > > The code compiles with -std=c++98. It does not compile with -std=c++14. > So this testcase should be fixed to work with c++14. Or the c++14 > support should be fixed if it is broken. > > Jim > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 23:41 ` Jim Wilson 2015-07-03 8:43 ` Richard Biener @ 2015-07-03 14:43 ` Jason Merrill 1 sibling, 0 replies; 13+ messages in thread From: Jason Merrill @ 2015-07-03 14:43 UTC (permalink / raw) To: Jim Wilson; +Cc: gcc-patches List On 07/02/2015 07:41 PM, Jim Wilson wrote: > The code compiles with -std=c++98. It does not compile with -std=c++14. > So this testcase should be fixed to work with c++14. Done. Jason ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 5:21 ` Jason Merrill 2015-07-02 6:17 ` Jim Wilson @ 2015-07-02 6:18 ` Marc Glisse 2015-07-02 13:05 ` Richard Biener 1 sibling, 1 reply; 13+ messages in thread From: Marc Glisse @ 2015-07-02 6:18 UTC (permalink / raw) To: Jason Merrill; +Cc: Jim Wilson, gcc-patches List On Thu, 2 Jul 2015, Jason Merrill wrote: > On 07/02/2015 12:10 AM, Jim Wilson wrote: >> This is a known gmp problem, documented in PR56019 and in >> https://gcc.gnu.org/gcc-4.9/porting_to.html >> near the bottom where it discusses cstddef.h changes. > > This document also says that "A workaround until libraries get updated is to > include <cstddef> or <stddef.h> before any headers from that library." > > Can you try modifying the graphite* files accordingly? See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65988#c1 system.h looks like the right way to include gmp.h in gcc, currently. -- Marc Glisse ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 6:18 ` Marc Glisse @ 2015-07-02 13:05 ` Richard Biener 2015-07-02 13:08 ` Richard Biener 0 siblings, 1 reply; 13+ messages in thread From: Richard Biener @ 2015-07-02 13:05 UTC (permalink / raw) To: GCC Patches; +Cc: Jason Merrill, Jim Wilson On Thu, Jul 2, 2015 at 8:18 AM, Marc Glisse <marc.glisse@inria.fr> wrote: > On Thu, 2 Jul 2015, Jason Merrill wrote: > >> On 07/02/2015 12:10 AM, Jim Wilson wrote: >>> >>> This is a known gmp problem, documented in PR56019 and in >>> https://gcc.gnu.org/gcc-4.9/porting_to.html >>> near the bottom where it discusses cstddef.h changes. >> >> >> This document also says that "A workaround until libraries get updated is >> to include <cstddef> or <stddef.h> before any headers from that library." >> >> Can you try modifying the graphite* files accordingly? > > > See also > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65988#c1 > > system.h looks like the right way to include gmp.h in gcc, currently. Yeah, I _think_ the fix is to move the isl includes below the system.h include. Richard. > -- > Marc Glisse ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 13:05 ` Richard Biener @ 2015-07-02 13:08 ` Richard Biener 2015-07-02 15:53 ` Jim Wilson 0 siblings, 1 reply; 13+ messages in thread From: Richard Biener @ 2015-07-02 13:08 UTC (permalink / raw) To: GCC Patches; +Cc: Jason Merrill, Jim Wilson On Thu, Jul 2, 2015 at 3:05 PM, Richard Biener <richard.guenther@gmail.com> wrote: > On Thu, Jul 2, 2015 at 8:18 AM, Marc Glisse <marc.glisse@inria.fr> wrote: >> On Thu, 2 Jul 2015, Jason Merrill wrote: >> >>> On 07/02/2015 12:10 AM, Jim Wilson wrote: >>>> >>>> This is a known gmp problem, documented in PR56019 and in >>>> https://gcc.gnu.org/gcc-4.9/porting_to.html >>>> near the bottom where it discusses cstddef.h changes. >>> >>> >>> This document also says that "A workaround until libraries get updated is >>> to include <cstddef> or <stddef.h> before any headers from that library." >>> >>> Can you try modifying the graphite* files accordingly? >> >> >> See also >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65988#c1 >> >> system.h looks like the right way to include gmp.h in gcc, currently. > > Yeah, I _think_ the fix is to move the isl includes below the system.h > include. And it should only affect the files including isl/val_gmp.h which includes gmp.h. > Richard. > >> -- >> Marc Glisse ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-02 13:08 ` Richard Biener @ 2015-07-02 15:53 ` Jim Wilson 0 siblings, 0 replies; 13+ messages in thread From: Jim Wilson @ 2015-07-02 15:53 UTC (permalink / raw) To: Richard Biener; +Cc: GCC Patches, Jason Merrill On Thu, Jul 2, 2015 at 6:08 AM, Richard Biener <richard.guenther@gmail.com> wrote: > On Thu, Jul 2, 2015 at 3:05 PM, Richard Biener > <richard.guenther@gmail.com> wrote: >> Yeah, I _think_ the fix is to move the isl includes below the system.h >> include. I tried this, and got a conflict for pretty much every macro defined by ctype.h, e.g. /usr/include/c++/4.8/bits/locale_facets.h:240:53: error: macro "toupper" passed 2 arguments, but takes just 1 toupper(char_type *__lo, const char_type* __hi) const system.h includes safe-ctype.h which does #include <ctype.h> ... #undef toupper #define toupper(c) do_not_use_toupper_with_safe_ctype isl/int.h includes iostream which includes other header files that want to define ctype like functions and we get a conflict. I see that <ctype.h> doesn't define any macros when __cplusplus is defined, but if we disable the macro redefines in safe-ctype.h, it isn't very safe anymore. This is probably why the isl headers were deliberately included before system.h when the ISL support was first added. Jim ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: C++ PATCH to change default dialect to C++14 2015-07-01 18:27 C++ PATCH to change default dialect to C++14 Jason Merrill 2015-07-01 18:39 ` Marek Polacek 2015-07-02 4:10 ` Jim Wilson @ 2015-07-10 11:27 ` H.J. Lu 2 siblings, 0 replies; 13+ messages in thread From: H.J. Lu @ 2015-07-10 11:27 UTC (permalink / raw) To: Jason Merrill; +Cc: gcc-patches List On Wed, Jul 1, 2015 at 11:26 AM, Jason Merrill <jason@redhat.com> wrote: > I've been threatening to do this for a couple of months, and now that the > regressions are under control I think it's time. This patch changes the > default C++ dialect to C++14. > > Tested x86_64-pc-linux-gnu, applying to trunk. This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66829 -- H.J. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-07-10 11:27 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-07-01 18:27 C++ PATCH to change default dialect to C++14 Jason Merrill 2015-07-01 18:39 ` Marek Polacek 2015-07-02 4:10 ` Jim Wilson 2015-07-02 5:21 ` Jason Merrill 2015-07-02 6:17 ` Jim Wilson 2015-07-02 23:41 ` Jim Wilson 2015-07-03 8:43 ` Richard Biener 2015-07-03 14:43 ` Jason Merrill 2015-07-02 6:18 ` Marc Glisse 2015-07-02 13:05 ` Richard Biener 2015-07-02 13:08 ` Richard Biener 2015-07-02 15:53 ` Jim Wilson 2015-07-10 11:27 ` H.J. Lu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).