diff dmd/expression.c @ 1372:229e02867307

Fix format-string bugs by adding __attribute__((__format__)) in all applicable places and fixing all warnings my gcc produced. Among other things, this should fix several segfaults (including one I just ran into).
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 17 May 2009 00:15:25 +0200
parents 8026319762be
children df11cdec45a2
line wrap: on
line diff
--- a/dmd/expression.c	Sat May 16 23:44:27 2009 +0200
+++ b/dmd/expression.c	Sun May 17 00:15:25 2009 +0200
@@ -1466,7 +1466,7 @@
 	    case Tdchar:	// BUG: need to cast(dchar)
 		if ((uinteger_t)v > 0xFF)
 		{
-		     buf->printf("'\\U%08x'", v);
+		     buf->printf("'\\U%08x'", (unsigned)v);
 		     break;
 		}
 	    case Tchar:
@@ -2934,7 +2934,7 @@
 void ArrayLiteralExp::toMangleBuffer(OutBuffer *buf)
 {
     size_t dim = elements ? elements->dim : 0;
-    buf->printf("A%u", dim);
+    buf->printf("A%zu", dim);
     for (size_t i = 0; i < dim; i++)
     {	Expression *e = (Expression *)elements->data[i];
 	e->toMangleBuffer(buf);
@@ -3068,7 +3068,7 @@
 void AssocArrayLiteralExp::toMangleBuffer(OutBuffer *buf)
 {
     size_t dim = keys->dim;
-    buf->printf("A%u", dim);
+    buf->printf("A%zu", dim);
     for (size_t i = 0; i < dim; i++)
     {	Expression *key = (Expression *)keys->data[i];
 	Expression *value = (Expression *)values->data[i];
@@ -3284,7 +3284,7 @@
 void StructLiteralExp::toMangleBuffer(OutBuffer *buf)
 {
     size_t dim = elements ? elements->dim : 0;
-    buf->printf("S%u", dim);
+    buf->printf("S%zu", dim);
     for (size_t i = 0; i < dim; i++)
     {	Expression *e = (Expression *)elements->data[i];
 	if (e)