diff dmd/mangle.c @ 1103:b30fe7e1dbb9

- Updated to DMD frontend 1.041. - Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 12 Mar 2009 20:37:27 +0100
parents 55f6c2e454d7
children eeb8b95ea92e
line wrap: on
line diff
--- a/dmd/mangle.c	Thu Mar 12 14:08:57 2009 +0100
+++ b/dmd/mangle.c	Thu Mar 12 20:37:27 2009 +0100
@@ -24,6 +24,10 @@
 #include "id.h"
 #include "module.h"
 
+#if TARGET_LINUX || TARGET_OSX
+char *cpp_mangle(Dsymbol *s);
+#endif
+
 char *mangle(Declaration *sthis)
 {
     OutBuffer buf;
@@ -110,8 +114,15 @@
 		case LINKc:
 		case LINKwindows:
 		case LINKpascal:
+		    return ident->toChars();
+
 		case LINKcpp:
+#if V2 && (TARGET_LINUX || TARGET_OSX)
+		    return cpp_mangle(this);
+#else
+		    // Windows C++ mangling is done by C++ back end
 		    return ident->toChars();
+#endif
 
 		case LINKdefault:
 		    error("forward declaration");
@@ -142,7 +153,7 @@
 #endif
     {
 	if (isMain())
-	    return "_Dmain";
+	    return (char *)"_Dmain";
 
     if (isWinMain() || isDllMain())
         return ident->toChars();
@@ -216,7 +227,7 @@
 	    p += 2;
 	buf.writestring(p);
     }
-    buf.printf("%"PRIuSIZE"%s", strlen(id), id);
+    buf.printf("%zu%s", strlen(id), id);
     id = buf.toChars();
     buf.data = NULL;
     //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id);
@@ -243,7 +254,7 @@
 	    p += 2;
 	buf.writestring(p);
     }
-    buf.printf("%"PRIuSIZE"%s", strlen(id), id);
+    buf.printf("%zu%s", strlen(id), id);
     id = buf.toChars();
     buf.data = NULL;
     //printf("TemplateMixin::mangle() %s = %s\n", toChars(), id);
@@ -269,7 +280,7 @@
 	    p += 2;
 	buf.writestring(p);
     }
-    buf.printf("%"PRIuSIZE"%s", strlen(id), id);
+    buf.printf("%zu%s", strlen(id), id);
     id = buf.toChars();
     buf.data = NULL;
     //printf("Dsymbol::mangle() %s = %s\n", toChars(), id);