From: Marcin Cieslak Subject: [PATCH] clang: sizeof(type) must not have __attribute__(aligned) Date: Sat, 13 Sep 2014 18:42:52 +0000 Message-ID: <1410633772-23044-1-git-send-email-saper@saper.info> References: <533464AA.8080807@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XSsHr-0002lj-Vf for xen-devel@lists.xenproject.org; Sat, 13 Sep 2014 18:43:08 +0000 In-Reply-To: <533464AA.8080807@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: julien.grall@linaro.org, Ian.Campbell@citrix.com, Marcin Cieslak List-Id: xen-devel@lists.xenproject.org --- 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(?