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]

Patch committed: Don't use designated initializers with C++


This patch changes system.h to not define HAVE_DESIGNATED_INITIALIZERS
when compiling with C++.  It then changes optabs.c to only use
designated initializers when HAVE_DESIGNATED_INITIALIZERS is defined.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed.

Ian


2009-06-09  Ian Lance Taylor  <iant@google.com>

	* system.h (HAVE_DESIGNATED_INITIALIZERS): Don't define if
	compiling with C++.
	* optabs.c (optab_table): Only use designated initializers if
	HAVE_DESIGNATED_INITIALIZERS is defined.
	(convert_optab_table): Likewise.
	(init_optabs): Always call init_insn_codes if
	HAVE_DESIGNATED_INITIALIZERS is not defined.


Index: system.h
===================================================================
--- system.h	(revision 148327)
+++ system.h	(working copy)
@@ -452,7 +452,8 @@
 /* 1 if we have C99 designated initializers.  */
 #if !defined(HAVE_DESIGNATED_INITIALIZERS)
 #define HAVE_DESIGNATED_INITIALIZERS \
-  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
+  (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) \
+   && !defined(__cplusplus))
 #endif
 
 #if HAVE_SYS_STAT_H
Index: optabs.c
===================================================================
--- optabs.c	(revision 148327)
+++ optabs.c	(working copy)
@@ -54,7 +54,7 @@
 
    See expr.h for documentation of these optabs.  */
 
-#if GCC_VERSION >= 4000
+#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
 __extension__ struct optab_d optab_table[OTI_MAX]
   = { [0 ... OTI_MAX - 1].handlers[0 ... NUM_MACHINE_MODES - 1].insn_code
       = CODE_FOR_nothing };
@@ -66,7 +66,7 @@
 rtx libfunc_table[LTI_MAX];
 
 /* Tables of patterns for converting one mode to another.  */
-#if GCC_VERSION >= 4000
+#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
 __extension__ struct convert_optab_d convert_optab_table[COI_MAX]
   = { [0 ... COI_MAX - 1].handlers[0 ... NUM_MACHINE_MODES - 1]
 	[0 ... NUM_MACHINE_MODES - 1].insn_code
@@ -6153,7 +6153,7 @@
       vcondu_gen_code[i] = CODE_FOR_nothing;
     }
 
-#if GCC_VERSION >= 4000
+#if GCC_VERSION >= 4000 && HAVE_DESIGNATED_INITIALIZERS
   /* We statically initialize the insn_codes with CODE_FOR_nothing.  */
   if (reinit)
     init_insn_codes ();

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