diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 755323ed29b1f5b787f7a9dd4cc2754b5639ff7f..a6fffce694de25e846659bbdf15963c538d3e2ea 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2002-05-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* mips/iris6.h (CPLUSPLUS_CPP_SPEC): Define.
+
 2002-05-12  Tom Tromey  <tromey@redhat.com>
 
 	* tree.h (copy_node): Don't mention TREE_PERMANENT.
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
index 776434a8d59b430a41f4bd7567c14e4c97fcbe16..56ea80753b7773a9ae27fa0c2200c4ac68e5b82c 100644
--- a/gcc/config/mips/iris6.h
+++ b/gcc/config/mips/iris6.h
@@ -124,6 +124,18 @@ Boston, MA 02111-1307, USA.  */
 %{mabi=64: -D__mips64} \
 %{!mabi*: -D__mips64}"
 
+/* The GNU C++ standard library requires that __EXTENSIONS__ and
+   _SGI_SOURCE be defined on at least irix6.2 and probably all irix6
+   prior to 6.5.  They normally get defined in SUBTARGET_CPP_SPEC if
+   !ansi, for g++ we want them regardless.  We don't need this on
+   irix6.5 itself, but it shouldn't hurt other than the namespace
+   polution.  */
+#undef CPLUSPLUS_CPP_SPEC
+#define CPLUSPLUS_CPP_SPEC "\
+-D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS \
+%{ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} %(cpp) \
+"
+
 /* Irix 6 uses DWARF-2.  */
 #define DWARF2_DEBUGGING_INFO
 #define MIPS_DEBUGGING_INFO
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 368b6137ec584b1aab1fab819f2bc1c6c20cab23..6f09d63878f65aca36aba7e7919cdb6b5fb1c38f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* config/os/irix/irix5.2/bits/os_defines.h: Revert 2002-05-06
+	change.
+
 2002-05-11  John David Anglin  <dave@hiauly1.hia.nrc.ca>
 
 	* config/os/gnu-linux/bits/os_defines.h (__glibcpp_long_bits): Define
diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h b/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h
index be2d2fbbf30877f1e38915126d5c5a7ae1c46fdc..32055ec6d674bfcfa032eeac612892de884b1e43 100644
--- a/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h
+++ b/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h
@@ -44,27 +44,11 @@
 // the command-line.
 #undef _POSIX_SOURCE
 
-/* On at least irix6.2 (which uses this file,) the header files are
-   very fragile and depend heavily on _SGI_SOURCE and __EXTENSIONS__
-   being defined.  If they're not, then features disappear that
-   configure was relying on which then breaks the libstdc++ headers.
-   These macros are normally implicitly defined by the command-line,
-   however they are not defined when -ansi is used, and -ansi is
-   passed to the testsuite.  The g++ test results (where it uses
-   libstdc++ headers) get dozens of extra failures without these
-   macros, so ensure they always are defined here.  */
-#ifndef _SGI_SOURCE
-# define _SGI_SOURCE
-#endif
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__
-#endif
-
 #define __off_t off_t
 #define __off64_t off64_t
 #define __ssize_t ssize_t
 
-// GCC does not use thunks on IRIX.
+// GCC does not use thunks on IRIX. 
 #define _G_USING_THUNKS 0
 
 #define __glibcpp_long_double_bits 64
@@ -74,3 +58,4 @@
 #endif
 
 #endif
+