aboutsummaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1026499
blob: 39861e995d6b0df99a52746da75dc11bda06fc44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
commit 8d0efe4
Author: Martin Husemann <martin@NetBSD.org>
Date:   Wed Jun 18 18:12:22 2014 +0200

    Bug 1026499 - Use MOZ_ALIGNED_DECL to declare union members in ipdl value declarations. r=bsmedberg
---
 ipc/ipdl/ipdl/cxx/ast.py  | 7 ++++---
 ipc/ipdl/ipdl/cxx/cgen.py | 5 ++++-
 ipc/ipdl/ipdl/lower.py    | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git ipc/ipdl/ipdl/cxx/ast.py ipc/ipdl/ipdl/cxx/ast.py
index 3180a65..c2d945b 100644
--- ipc/ipdl/ipdl/cxx/ast.py
+++ ipc/ipdl/ipdl/cxx/ast.py
@@ -336,12 +336,13 @@ Type.VOID = Type('void')
 Type.VOIDPTR = Type('void', ptr=1)
 
 class TypeArray(Node):
-    def __init__(self, basetype, nmemb):
-        '''the type |basetype DECLNAME[nmemb]|.  |nmemb| is an Expr'''
+    def __init__(self, basetype, nmemb, alignType):
+        '''the type |basetype DECLNAME[nmemb]|.  |nmemb| is an Expr, |alignType| is a type'''
         self.basetype = basetype
         self.nmemb = nmemb
+        self.alignType = alignType
     def __deepcopy__(self, memo):
-        return TypeArray(deepcopy(self.basetype, memo), nmemb)
+        return TypeArray(deepcopy(self.basetype, memo), nmemb, alignType)
 
 class TypeEnum(Node):
     def __init__(self, name=None):
diff --git ipc/ipdl/ipdl/cxx/cgen.py ipc/ipdl/ipdl/cxx/cgen.py
index 48b0988..bc914cf 100644
--- ipc/ipdl/ipdl/cxx/cgen.py
+++ ipc/ipdl/ipdl/cxx/cgen.py
@@ -101,6 +101,7 @@ class CxxCodeGen(CodePrinter, Visitor):
     def visitDecl(self, d):
         # C-syntax arrays make code generation much more annoying
         if isinstance(d.type, TypeArray):
+            self.write('MOZ_ALIGNED_DECL(')
             d.type.basetype.accept(self)
         else:
             d.type.accept(self)
@@ -111,7 +112,9 @@ class CxxCodeGen(CodePrinter, Visitor):
         if isinstance(d.type, TypeArray):
             self.write('[')
             d.type.nmemb.accept(self)
-            self.write(']')
+            self.write('], MOZ_ALIGNOF(')
+            d.type.alignType.accept(self)
+            self.write('))')
 
     def visitParam(self, p):
         self.visitDecl(p)