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

[Xen-changelog] [xen master] tools/foreign: avoid using alignment directives when not appropriate



commit a306f8107af7960259dda1a756224d71a338bba9
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Mar 10 16:45:55 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Mar 10 16:45:55 2016 +0100

    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@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/include/xen-foreign/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/include/xen-foreign/Makefile 
b/tools/include/xen-foreign/Makefile
index 80a446a..bb09c93 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -34,7 +34,10 @@ x86_32.h: mkheader.py structs.py 
$(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/
        $(PYTHON) $< $* $@ $(filter %.h,$^)
 
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h 
$(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
-       $(PYTHON) $< $* $@ $(filter %.h,$^)
+       $(PYTHON) $< $* $@.tmp $(filter %.h,$^)
+       #Avoid mixing an alignment directive with a uint64_t cast or sizeof 
expression
+       sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' -i $@.tmp
+       $(call move-if-changed,$@.tmp,$@)
 
 checker.c: mkchecker.py structs.py
        $(PYTHON) $< $@ $(architectures)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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