public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Set C++ standard earlier
@ 2015-09-04 11:10 Marek Polacek
  2015-09-04 13:58 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2015-09-04 11:10 UTC (permalink / raw)
  To: GCC Patches, Jason Merrill

I noticed that -Wshift-overflow isn't on by default even though now we're
defaulting to C++14.  The reason is that at the time we set warn_shift_overflow
the cxx_dialect is still cxx_unset.  So let's set the default C++ standard
earlier in that function, before be enable/disable the warnings.

(A two other patches are prerequisite before this may go in.)

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2015-09-04  Marek Polacek  <polacek@redhat.com>

	* c-opts.c (c_common_post_options): Set C++ standard earlier, before
	setting various warnings.

diff --git gcc/c-family/c-opts.c gcc/c-family/c-opts.c
index 3239a85..f358b62 100644
--- gcc/c-family/c-opts.c
+++ gcc/c-family/c-opts.c
@@ -800,6 +800,10 @@ c_common_post_options (const char **pfilename)
       && flag_no_builtin)
     flag_tree_loop_distribute_patterns = 0;
 
+  /* Set C++ standard to C++14 if not specified on the command line.  */
+  if (c_dialect_cxx () && cxx_dialect == cxx_unset)
+    set_std_cxx14 (/*ISO*/false);
+
   /* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
      It is never enabled in C++, as the minimum limit is not normative
      in that standard.  */
@@ -887,10 +891,6 @@ c_common_post_options (const char **pfilename)
   if (flag_abi_version == 0)
     flag_abi_version = 10;
 
-  /* Set C++ standard to C++14 if not specified on the command line.  */
-  if (c_dialect_cxx () && cxx_dialect == cxx_unset)
-    set_std_cxx14 (/*ISO*/false);
-
   if (cxx_dialect >= cxx11)
     {
       /* If we're allowing C++0x constructs, don't warn about C++98

	Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ PATCH] Set C++ standard earlier
  2015-09-04 11:10 [C++ PATCH] Set C++ standard earlier Marek Polacek
@ 2015-09-04 13:58 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-09-04 13:58 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-04 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 11:10 [C++ PATCH] Set C++ standard earlier Marek Polacek
2015-09-04 13:58 ` Jason Merrill

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).