[PATCH] specs changes for libstdc++ debug mode

Doug Gregor dgregor@apple.com
Tue Jul 15 00:02:00 GMT 2003


Here's the patch that enables linking against libstdc++-debug (the 
libstdc++ debug mode library).

Tested on i686-pc-linux-gnu and powerpc-apple-darwin; no regressions. 
ChangeLog follows.

Okay to commit?

	Doug

2003-07-14  Doug Gregor  <dgregor@apple.com>

	* g++spec.c (lang_specific_driver): Link against -lstdc++-debug
	when we've seen -D_GLIBCXX_DEBUG.

Index: gcc/cp/g++spec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/g++spec.c,v
retrieving revision 1.38
diff -c -3 -p -r1.38 g++spec.c
*** gcc/cp/g++spec.c	7 Jul 2003 19:11:59 -0000	1.38
--- gcc/cp/g++spec.c	14 Jul 2003 20:49:35 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 45,50 ****
--- 45,53 ----
   #ifndef LIBSTDCXX_PROFILE
   #define LIBSTDCXX_PROFILE "-lstdc++"
   #endif
+ #ifndef LIBSTDCXX_DEBUG
+ #define LIBSTDCXX_DEBUG "-lstdc++-debug"
+ #endif

   void
   lang_specific_driver (int *in_argc, const char *const **in_argv,
*************** lang_specific_driver (int *in_argc, cons
*** 55,60 ****
--- 58,66 ----
     /* If nonzero, the user gave us the `-p' or `-pg' flag.  */
     int saw_profile_flag = 0;

+   /* If nonzero, the user gave us the `-D_GLIBCXX_DEBUG' flag.  */
+   int saw_debug_flag = 0;
+
     /* If nonzero, the user gave us the `-v' flag.  */
     int saw_verbose_flag = 0;

*************** lang_specific_driver (int *in_argc, cons
*** 144,149 ****
--- 150,167 ----
   	      args[i] |= MATHLIB;
   	      need_math = 0;
   	    }
+ 	  else if (strcmp (argv[i], LIBSTDCXX_DEBUG) == 0)
+ 	    {
+ 	      library = -1;
+ 	    }
+ 	  else if (strcmp (argv[i], "-D_GLIBCXX_DEBUG") == 0)
+ 	    {
+ 	      saw_debug_flag = 1;
+ 	    }
+ 	  else if (strcmp (argv[i], "-U_GLIBCXX_DEBUG") == 0)
+ 	    {
+ 	      saw_debug_flag = 0;
+ 	    }
   	  else if (strcmp (argv[i], "-lc") == 0)
   	    args[i] |= WITHLIBC;
   	  else if (strcmp (argv[i], "-pg") == 0 || strcmp (argv[i], "-p") == 
0)
*************** lang_specific_driver (int *in_argc, cons
*** 300,306 ****
     /* Add `-lstdc++' if we haven't already done so.  */
     if (library > 0)
       {
!       arglist[j++] = saw_profile_flag ? LIBSTDCXX_PROFILE : LIBSTDCXX;
         added_libraries++;
   #ifdef USE_LIBUNWIND_EXCEPTIONS
   # ifndef LIBUNWIND
--- 318,325 ----
     /* Add `-lstdc++' if we haven't already done so.  */
     if (library > 0)
       {
!       arglist[j++] = saw_debug_flag? LIBSTDCXX_DEBUG
! 	            :saw_profile_flag ? LIBSTDCXX_PROFILE : LIBSTDCXX;
         added_libraries++;
   #ifdef USE_LIBUNWIND_EXCEPTIONS
   # ifndef LIBUNWIND



More information about the Libstdc++ mailing list