Index: trunk/src/gcc/gcc/config/i386/emx.c
===================================================================
--- trunk/src/gcc/gcc/config/i386/emx.c	(revision 671)
+++ trunk/src/gcc/gcc/config/i386/emx.c	(revision 674)
@@ -31,5 +31,4 @@
 #include "flags.h"
 #include "i386-protos.h"
-#include "diagnostic.h"
 
 /* The size of the target's pointer type.  */
@@ -422,22 +421,2 @@
   }
 }
-
-/* Adds calling convention to a function dump. (diagnostic) */
-void emx_print_callingconvention (tree type, struct output_buffer *scratch_buffer)
-{
-  const char *conv = NULL;
-
-  if (lookup_attribute ("system", TYPE_ATTRIBUTES (type)))
-    conv = "_System ";
-  else if (lookup_attribute ("optlink", TYPE_ATTRIBUTES (type)))
-    conv = "_Optlink ";
-  else if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (type)))
-    conv = "__stdcall ";
-  else if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type)))
-    conv = "__cdecl ";
-
-  if (conv)
-    output_add_string(scratch_buffer, conv);
-
-}
-
Index: trunk/src/gcc/gcc/config/i386/emx.h
===================================================================
--- trunk/src/gcc/gcc/config/i386/emx.h	(revision 671)
+++ trunk/src/gcc/gcc/config/i386/emx.h	(revision 674)
@@ -108,8 +108,4 @@
 #define TARGET_CXX_SET_DECL_ASSEMBLER_NAME(decl) \
   (emx_c_set_decl_assembler_name (decl, DECL_LANG_SPECIFIC(decl) && DECL_FUNCTION_MEMBER_P (decl)))
-
-/* pretty warnings and errors in C++ */
-struct output_buffer;
-extern void emx_print_callingconvention PARAMS ((tree type, struct output_buffer *scratch_buffer));
 
 /* This macros will stick a label to exception table for current file,
Index: trunk/src/gcc/gcc/config/i386/i386-protos.h
===================================================================
--- trunk/src/gcc/gcc/config/i386/i386-protos.h	(revision 671)
+++ trunk/src/gcc/gcc/config/i386/i386-protos.h	(revision 674)
@@ -200,2 +200,8 @@
 extern int x86_field_alignment PARAMS ((tree, int));
 #endif
+
+#ifdef GCC_DIAGNOSTIC_H
+#define TARGET_PRINT_TYPE_ATTRS(t, scratch_buffer) \
+  ix86_print_attributes (t, scratch_buffer)
+extern void ix86_print_attributes PARAMS ((tree type, struct output_buffer *scratch_buffer));
+#endif
Index: trunk/src/gcc/gcc/config/i386/i386.c
===================================================================
--- trunk/src/gcc/gcc/config/i386/i386.c	(revision 671)
+++ trunk/src/gcc/gcc/config/i386/i386.c	(revision 674)
@@ -41,4 +41,5 @@
 #include "basic-block.h"
 #include "ggc.h"
+#include "diagnostic.h"
 #include "target.h"
 #include "target-def.h"
@@ -1465,4 +1466,30 @@
 
   return NULL_TREE;
+}
+
+/* Adds calling convention to a function dump. (diagnostic) */
+void ix86_print_attributes (tree type, struct output_buffer *scratch_buffer)
+{
+  tree attr;
+
+  if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type)))
+    output_add_string(scratch_buffer, "__attribute__((cdecl)) ");
+  if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (type)))
+    output_add_string(scratch_buffer, "__attribute__((stdcall)) ");
+  if ((attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type))))
+  {
+    char temp [32];
+    int nregs = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
+    sprintf (temp, "__attribute__((regparm(%d))) ", nregs);
+    output_add_string(scratch_buffer, temp);
+  }
+#ifdef TARGET_SYSTEM_DECL_ATTRIBUTES
+  if (lookup_attribute ("system", TYPE_ATTRIBUTES (type)))
+    output_add_string(scratch_buffer, "__attribute__((system)) ");
+#endif
+#ifdef TARGET_OPTLINK_DECL_ATTRIBUTES
+  if (lookup_attribute ("optlink", TYPE_ATTRIBUTES (type)))
+    output_add_string(scratch_buffer, "__attribute__((optlink)) ");
+#endif
 }
 
Index: trunk/src/gcc/gcc/cp/error.c
===================================================================
--- trunk/src/gcc/gcc/cp/error.c	(revision 671)
+++ trunk/src/gcc/gcc/cp/error.c	(revision 674)
@@ -29,4 +29,5 @@
 #include "flags.h"
 #include "diagnostic.h"
+#include "tm_p.h"
 
 enum pad { none, before, after };
@@ -658,6 +659,6 @@
         output_add_space (scratch_buffer);
       print_left_paren (scratch_buffer);
-#ifdef EMX
-      emx_print_callingconvention(t, scratch_buffer);
+#ifdef TARGET_PRINT_TYPE_ATTRS
+      TARGET_PRINT_TYPE_ATTRS (t, scratch_buffer);
 #endif
       padding = none;
@@ -669,6 +670,6 @@
         output_add_space (scratch_buffer);
       print_left_paren (scratch_buffer);
-#ifdef EMX
-      emx_print_callingconvention(t, scratch_buffer);
+#ifdef TARGET_PRINT_TYPE_ATTRS
+      TARGET_PRINT_TYPE_ATTRS (t, scratch_buffer);
 #endif
       padding = none;
