changeset 710:20a5180f2e80

Make align(n), n != 1 an error.
author Christian Kamm <kamm incasoftware de>
date Sat, 18 Oct 2008 14:33:11 +0200
parents b972fb129d37
children eed2de0c67a0
files dmd/attrib.c dmd/attrib.h dmd/parse.c
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/attrib.c	Thu Oct 16 22:36:26 2008 +0200
+++ b/dmd/attrib.c	Sat Oct 18 14:33:11 2008 +0200
@@ -492,10 +492,14 @@
 
 /********************************* AlignDeclaration ****************************/
 
-AlignDeclaration::AlignDeclaration(unsigned sa, Array *decl)
+AlignDeclaration::AlignDeclaration(Loc loc, unsigned sa, Array *decl)
 	: AttribDeclaration(decl)
 {
+    this->loc = loc;
     salign = sa;
+
+    if (salign != 1)
+	error("align(%d) is not implemented and specified to be unportable anyway, use align(1) and manual fillers instead", salign);
 }
 
 Dsymbol *AlignDeclaration::syntaxCopy(Dsymbol *s)
@@ -503,7 +507,7 @@
     AlignDeclaration *ad;
 
     assert(!s);
-    ad = new AlignDeclaration(salign, Dsymbol::arraySyntaxCopy(decl));
+    ad = new AlignDeclaration(loc, salign, Dsymbol::arraySyntaxCopy(decl));
     return ad;
 }
 
--- a/dmd/attrib.h	Thu Oct 16 22:36:26 2008 +0200
+++ b/dmd/attrib.h	Sat Oct 18 14:33:11 2008 +0200
@@ -90,7 +90,7 @@
 {
     unsigned salign;
 
-    AlignDeclaration(unsigned sa, Array *decl);
+    AlignDeclaration(Loc loc, unsigned sa, Array *decl);
     Dsymbol *syntaxCopy(Dsymbol *s);
     void semantic(Scope *sc);
     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
--- a/dmd/parse.c	Thu Oct 16 22:36:26 2008 +0200
+++ b/dmd/parse.c	Sat Oct 18 14:33:11 2008 +0200
@@ -367,7 +367,7 @@
 		    n = global.structalign;		// default
 
 		a = parseBlock();
-		s = new AlignDeclaration(n, a);
+		s = new AlignDeclaration(loc, n, a);
 		break;
 	    }