diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96c4fcad84350b688a291f6a9d3fbfbd00bc996f..bbdadd7effc13fc9fefe8b92a93aa4358f5c1466 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-21  Richard Henderson  <rth@redhat.com>
+
+	PR target/5996
+	* fixinc/inclhack.def (solaris_stdio_tag): New.
+	* fixinc/fixincl.x: Regenerate.
+
 2002-03-21  Eric Botcazou <ebotcazou@multimania.com>
 
 	PR c/5597
diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x
index 280948df5588aa6697c3ac80d4429eb30b6b8fe9..a128a399860db808a4aad0f1674e2def1bce1aac 100644
--- a/gcc/fixinc/fixincl.x
+++ b/gcc/fixinc/fixincl.x
@@ -5,7 +5,7 @@
  * files which are fixed to work correctly with ANSI C and placed in a
  * directory that GNU C will search.
  *
- * This file contains 139 fixup descriptions.
+ * This file contains 140 fixup descriptions.
  *
  * See README for more information.
  *
@@ -3660,6 +3660,40 @@ static const char* apzSolaris_Mutex_InitPatch[] = {
     "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+{.*),[ \t]*0}(|[ \t].*)$",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Solaris_Stdio_Tag fix
+ */
+tSCC zSolaris_Stdio_TagName[] =
+     "solaris_stdio_tag";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zSolaris_Stdio_TagList[] =
+  "|stdio_tag.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzSolaris_Stdio_TagMachs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Stdio_TagSelect0[] =
+       "__cplusplus < 54321L";
+
+#define    SOLARIS_STDIO_TAG_TEST_CT  1
+static tTestDesc aSolaris_Stdio_TagTests[] = {
+  { TT_EGREP,    zSolaris_Stdio_TagSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Solaris_Stdio_Tag
+ */
+static const char* apzSolaris_Stdio_TagPatch[] = { "sed",
+    "-e", "s/defined(__cplusplus) && (__cplusplus < 54321L)/0/",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Statsswtch fix
@@ -5470,9 +5504,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          148
+#define REGEX_COUNT          149
 #define MACH_LIST_SIZE_LIMIT 279
-#define FIX_COUNT            139
+#define FIX_COUNT            140
 
 /*
  *  Enumerate the fixes
@@ -5570,6 +5604,7 @@ typedef enum {
     SCO_STATIC_FUNC_FIXIDX,
     SCO_UTIME_FIXIDX,
     SOLARIS_MUTEX_INIT_FIXIDX,
+    SOLARIS_STDIO_TAG_FIXIDX,
     STATSSWTCH_FIXIDX,
     STDIO_STDARG_H_FIXIDX,
     STDIO_VA_LIST_FIXIDX,
@@ -6080,6 +6115,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      SOLARIS_MUTEX_INIT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aSolaris_Mutex_InitTests,   apzSolaris_Mutex_InitPatch, 0 },
 
+  {  zSolaris_Stdio_TagName,    zSolaris_Stdio_TagList,
+     apzSolaris_Stdio_TagMachs,
+     SOLARIS_STDIO_TAG_TEST_CT, FD_MACH_ONLY,
+     aSolaris_Stdio_TagTests,   apzSolaris_Stdio_TagPatch, 0 },
+
   {  zStatsswtchName,    zStatsswtchList,
      apzStatsswtchMachs,
      STATSSWTCH_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index 874f58495d079dde15dc2971e6d4e05152a5a633..6faca9ae314563f507824537eeb3b18196f1f792 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -2060,6 +2060,22 @@ fix = {
 };
 
 
+/*
+ * Solaris 2.8 has what appears to be some gross workaround for 
+ * some old version of their c++ compiler.  G++ doesn't want it
+ * either, but doesn't want to be tied to SunPRO version numbers.
+ */
+fix = {
+    hackname = solaris_stdio_tag;
+    files    = stdio_tag.h;
+
+    select   = '__cplusplus < 54321L';
+    sed      = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
+
+    test_text = '#if\tdefined(__cplusplus) && (__cplusplus < 54321L)';
+};
+
+
 /*
  *  Sony NEWSOS 5.0 does not support the complete ANSI C standard.
  */