tools/foreign: Avoid using alignment directives when not appropriate
PATCH v2 1/2 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.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Jan Beulich <[email protected]>
v2: Use .tmp file. Make sedary able to deal with int64_t
--- tools/include/xen-foreign/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/include/xen-foreign/Makefile +4 -1
@@ -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) $< $* [email protected] $(filter %.h,$^) + #Avoid mixing an alignment directive with a uint64_t cast or sizeof expression + sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' -i [email protected] + $(call move-if-changed,[email protected],$@) checker.c: mkchecker.py structs.py $(PYTHON) $< $@ $(architectures)
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 2/2 tools/misc: Drop unused function from gtracestat
Fixes a build failure with Clang.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
New in v2
--- tools/misc/gtracestat.c | 4 ---- 1 file changed, 4 deletions(-)
tools/misc/gtracestat.c +0 -4
@@ -89,10 +89,6 @@ static inline uint64_t min(uint64_t a, uint64_t b) {return a < b ? a : b; } -static inline uint64_t max (uint64_t a,uint64_t b) -{ -return a > b ? a : b; -}static int is_px =0 ;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat
Quoted 3 lines · Andrew Cooper
Fixes a build failure with Clang.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 27 lines
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>New in v2
--- tools/misc/gtracestat.c | 4 ---- 1 file changed, 4 deletions(-)tools/misc/gtracestat.c +0
-4@@ -89,10 +89,6 @@ static inline uint64_t min(uint64_t a, uint64_t b) {return a < b ? a : b; } -static inline uint64_t max (uint64_t a,uint64_t b) -{ -return a > b ? a : b; -}static int is_px =0 ;Signature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines · Andrew Cooper
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 typecastAn 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__' ^~~~~~~~~~~
Quoted 5 lines
This sedary is sufficient to fix all the bad examples without touching any of the legitimate uses, and is more simple than teaching
mkheader.pyhow to parse C.Signed-off-by Andrew Cooper <[email protected]>
Quoted 31 lines
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Jan Beulich <[email protected]>v2: Use .tmp file. Make sedary able to deal with
int64_t--- tools/include/xen-foreign/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/include/xen-foreign/Makefile +4
-1@@ -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) $< $* [email protected] $(filter %.h,$^) + #Avoid mixing an alignment directive with a uint64_t cast or sizeof expression + sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' -i [email protected] + $(call move-if-changed,[email protected],$@) checker.c: mkchecker.py structs.py $(PYTHON) $< $@ $(architectures)Signature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 09.03.16 at 20:56, <[email protected]> wrote:
Quoted 11 lines · Andrew Cooper
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 typecastAn 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]
Quoted 7 lines
__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
Quoted 8 lines
of
Quoted 1 line
the legitimate uses, and is more simple than teaching
mkheader.pyhow toparse
Quoted 3 lines
C.
Signed-off-by Andrew Cooper <[email protected]>Acked-by Wei Liu <[email protected]>
Should I apply this and the 2nd patch, or can/should this wait for Ian to be back?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 24 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 09.03.16 at 20:56, <[email protected]> wrote:
Quoted 11 lines · Andrew Cooper
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 typecastAn 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]
Quoted 7 lines
__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
Quoted 1 line
the legitimate uses, and is more simple than teaching
mkheader.pyhow toparse
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
C.
Signed-off-by Andrew Cooper <[email protected]>Acked-by Wei Liu <[email protected]>Should I apply this and the 2nd patch, or can/should this wait for Ian to be back?
You can go ahead if convenient.
Wei.
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 09.03.16 at 20:03, <[email protected]> wrote:
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 typecastAn 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__' ^~~~~~~~~~~
Quoted 7 lines
This sedary is sufficient to fix all the bad examples without touching any of
the legitimate uses, and is more simple than teachingmkheader.pyhow to parse
C.Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel