C++ PATCH to ENABLE_NEW_GXX_ABI

Jason Merrill jason@redhat.com
Fri Jan 19 07:10:00 GMT 2001


Handling the ABI default in g++spec.c is completely broken; it means we get
a different result depending on whether we use the gcc or g++ driver.  This
patch fixes things to be uniform.

2001-01-19  Jason Merrill  <jason@redhat.com>

	* decl2.c (flag_new_abi): Depend on ENABLE_NEW_GXX_ABI.
	* lang-specs.h: Default ABI depends on ENABLE_NEW_GXX_ABI.
	* g++spec.c: Don't look at ENABLE_NEW_GXX_ABI.

*** decl2.c.~1~	Fri Jan 19 14:22:40 2001
--- decl2.c	Fri Jan 19 14:22:49 2001
*************** int flag_weak = 1;
*** 417,423 ****
--- 417,427 ----
  
  /* Nonzero to enable experimental ABI changes.  */
  
+ #if ENABLE_NEW_GXX_ABI
+ int flag_new_abi = 1;
+ #else
  int flag_new_abi;
+ #endif
  
  /* Nonzero to use __cxa_atexit, rather than atexit, to register
     destructors for local statics and global objects.  */
*** lang-specs.h.~1~	Fri Jan 19 14:22:41 2001
--- lang-specs.h	Fri Jan 19 14:22:49 2001
*************** Boston, MA 02111-1307, USA.  */
*** 31,36 ****
--- 31,55 ----
    {"@c++",
     /* cc1plus has an integrated ISO C preprocessor.  We should invoke
        the external preprocessor if -save-temps is given.  */
+ #if ENABLE_NEW_GXX_ABI
+     "%{E|M|MM:cpp0 -lang-c++ -D_GNU_SOURCE %{!no-gcc:-D__GNUG__=%v1}\
+        %{!fno-new-abi:-D__GXX_ABI_VERSION=100}\
+        %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp_options)}\
+      %{!E:%{!M:%{!MM:\
+        %{save-temps:cpp0 -lang-c++ -D_GNU_SOURCE \
+ 		    %{!no-gcc:-D__GNUG__=%v1}\
+ 		    %{!fno-new-abi:-D__GXX_ABI_VERSION=100}\
+ 		    %{ansi:-D__STRICT_ANSI__ -trigraphs -$}\
+ 		    %(cpp_options) %b.ii \n}\
+       cc1plus %{save-temps:-fpreprocessed %b.ii}\
+               %{!save-temps:%(cpp_options)\
+ 			    %{!no-gcc:-D__GNUG__=%v1} -D_GNU_SOURCE \
+ 			    %{!fno-new-abi:-D__GXX_ABI_VERSION=100}\
+ 			    %{ansi:-D__STRICT_ANSI__}}\
+        %{ansi:-trigraphs -$}\
+        %(cc1_options) %2 %{+e1*}\
+        %{!fsyntax-only:%(invoke_as)}}}}"
+ #else
      "%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{fnew-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp_options)}\
*************** Boston, MA 02111-1307, USA.  */
*** 47,53 ****
  			    %{ansi:-D__STRICT_ANSI__}}\
         %{ansi:-trigraphs -$}\
         %(cc1_options) %2 %{+e*}\
!        %{!fsyntax-only:%(invoke_as)}}}}"},
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
     "%{!M:%{!MM:%{!E:\
--- 66,74 ----
  			    %{ansi:-D__STRICT_ANSI__}}\
         %{ansi:-trigraphs -$}\
         %(cc1_options) %2 %{+e*}\
!        %{!fsyntax-only:%(invoke_as)}}}}"
! #endif
!      },
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
     "%{!M:%{!MM:%{!E:\
*** g++spec.c.~1~	Fri Jan 19 14:22:40 2001
--- g++spec.c	Fri Jan 19 14:22:49 2001
*************** lang_specific_driver (in_argc, in_argv, 
*** 94,103 ****
    /* The total number of arguments with the new stuff.  */
    int num_args = 1;
  
- #if ENABLE_NEW_GXX_ABI
-   added++;
- #endif
- 
    argc = *in_argc;
    argv = *in_argv;
    added_libraries = *in_added_libraries;
--- 94,99 ----
*************** lang_specific_driver (in_argc, in_argv, 
*** 210,222 ****
    
    /* Copy the 0th argument, i.e., the name of the program itself.  */
    arglist[i++] = argv[j++];
- 
- #if ENABLE_NEW_GXX_ABI
-   /* If we should use the new ABI by default, add the appropriate flag
-      to cc1plus here.  We put this first so that it can be overridden
-      by other command-line options.  */
-   arglist[j++] = "-fnew-abi";
- #endif
  
    /* NOTE: We start at 1 now, not 0.  */
    while (i < argc)
--- 206,211 ----


More information about the Gcc-patches mailing list