This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GOOGLE] Prevent x_flag_complex_method to be set to 2 for C++.


With this patch x_flag_complex_method won't be set to 2 for C++ so
that multiply/divide between std::complex objects won't be replaced by
expensive builtin function calls.

Bootstrapped and passed regression test.

OK for Google branch?


thanks,
Cong



Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c (revision 207701)
+++ gcc/c-family/c-opts.c (working copy)
@@ -204,8 +204,10 @@ c_common_init_options_struct (struct gcc
   opts->x_warn_write_strings = c_dialect_cxx ();
   opts->x_flag_warn_unused_result = true;

-  /* By default, C99-like requirements for complex multiply and divide.  */
-  opts->x_flag_complex_method = 2;
+  /* By default, C99-like requirements for complex multiply and divide.
+     But for C++ this should not be required.  */
+  if (c_language != clk_cxx)
+    opts->x_flag_complex_method = 2;
 }

 /* Common initialization before calling option handlers.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]