tools/foreign: avoid using alignment directives when not appropriate
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 10 Mar 2016 15:45:55 +0000 (16:45 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 10 Mar 2016 15:45:55 +0000 (16:45 +0100)
commita306f8107af7960259dda1a756224d71a338bba9
tree748ebde43c6b29b6783edfc57777b40c422f6444
parentb91c845deb490dc008cbc328cbe35c3060aa6b6c
tools/foreign: avoid using alignment directives when not appropriate

The foreign header generation blindly replaces 'uint64_t' with '__align8__
uint64_t', to get correct alignment when built as 32bit.  This is correct in
most circumstances, but Clang objects to two specific uses.

 * Inside a sizeof() expression
 * As part of a typecast

An example error looks like:

/local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:204:44:
error: 'aligned' attribute ignored when parsing type [-Werror,-Wignored-attributes]
    __align8__ uint64_t evtchn_mask[sizeof(__align8__ uint64_t) * 8];
                                           ^~~~~~~~~~
/local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:13:36:
note: expanded from macro '__align8__'
                                   ^~~~~~~~~~~

This sedary is sufficient to fix all the bad examples without touching any of
the legitimate uses, and is more simple than teaching mkheader.py how to parse
C.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/include/xen-foreign/Makefile