[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] clang: sizeof(type) must not have __attribute__(aligned)



---
 tools/include/xen-foreign/mkheader.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/include/xen-foreign/mkheader.py 
b/tools/include/xen-foreign/mkheader.py
index 0504cb8..1e1e55f 100644
--- a/tools/include/xen-foreign/mkheader.py
+++ b/tools/include/xen-foreign/mkheader.py
@@ -13,6 +13,7 @@ infiles = sys.argv[3:];
 # configuration #2: architecture information
 
 inttypes = {};
+typesizes = {}; # types used for sizeof(type) only
 header = {};
 footer = {};
 
@@ -24,6 +25,13 @@ inttypes["arm32"] = {
     "xen_ulong_t"   : "__align8__ uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
+typesizes["arm32"] = {
+    "unsigned long" : "__danger_unsigned_long_on_arm32",
+    "long"          : "__danger_long_on_arm32",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
+    "uint64_t"      : "uint64_t",
+};
 header["arm32"] = """
 #define __arm___ARM32 1
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
@@ -45,6 +53,13 @@ inttypes["arm64"] = {
     "xen_ulong_t"   : "__align8__ uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
+typesizes["arm64"] = {
+    "unsigned long" : "__danger_unsigned_long_on_arm64",
+    "long"          : "__danger_long_on_arm64",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
+    "uint64_t"      : "uint64_t",
+};
 header["arm64"] = """
 #define __aarch64___ARM64 1
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
@@ -66,6 +81,7 @@ inttypes["x86_32"] = {
     "xen_pfn_t"     : "uint32_t",
     "xen_ulong_t"   : "uint32_t",
 };
+typesizes["x86_32"] = inttypes["x86_32"]
 header["x86_32"] = """
 #define __i386___X86_32 1
 #pragma pack(4)
@@ -81,6 +97,12 @@ inttypes["x86_64"] = {
     "xen_pfn_t"     : "__align8__ uint64_t",
     "xen_ulong_t"   : "__align8__ uint64_t",
 };
+typesizes["x86_64"] = {
+    "unsigned long" : "uint64_t",
+    "long"          : "uint64_t",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
+};
 header["x86_64"] = """
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 # define __DECL_REG(name) union { uint64_t r ## name, e ## name; }
@@ -196,7 +218,8 @@ for struct in structs:
 integers = inttypes[arch].keys();
 integers.sort(lambda a, b: cmp(len(b),len(a)));
 for type in integers:
-    output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output);
+    output = re.sub("\\b(?<=sizeof\()%s\\b" % type, typesizes[arch][type], 
output);
+    output = re.sub("\\b(?<!sizeof\()%s\\b" % type, inttypes[arch][type], 
output);
 
 # print results
 f = open(outfile, "w");
-- 
2.0.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.