This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[GOOGLE] Prevent x_flag_complex_method to be set to 2 for C++.
- From: Cong Hou <congh at google dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: David Li <davidxl at google dot com>
- Date: Tue, 11 Feb 2014 17:30:45 -0800
- Subject: [GOOGLE] Prevent x_flag_complex_method to be set to 2 for C++.
- Authentication-results: sourceware.org; auth=none
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. */