* [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate
@ 2016-03-09 19:03 Andrew Cooper
2016-03-09 19:03 ` [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat Andrew Cooper
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Andrew Cooper @ 2016-03-09 19:03 UTC (permalink / raw)
To: Xen-devel
Cc: Wei Liu, Andrew Cooper, Ian Jackson, Julien Grall,
Stefano Stabellini, Jan Beulich
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>
---
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>
CC: Julien Grall <julien.grall@arm.com>
CC: Jan Beulich <JBeulich@suse.com>
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(-)
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)
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat
2016-03-09 19:03 [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Andrew Cooper
@ 2016-03-09 19:03 ` Andrew Cooper
2016-03-09 19:56 ` Wei Liu
2016-03-09 19:56 ` [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Wei Liu
2016-03-10 8:31 ` Jan Beulich
2 siblings, 1 reply; 7+ messages in thread
From: Andrew Cooper @ 2016-03-09 19:03 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Wei Liu
Fixes a build failure with Clang.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
New in v2
---
tools/misc/gtracestat.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tools/misc/gtracestat.c b/tools/misc/gtracestat.c
index 3c2bd2c..67cb003 100644
--- a/tools/misc/gtracestat.c
+++ b/tools/misc/gtracestat.c
@@ -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;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate
2016-03-09 19:03 [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Andrew Cooper
2016-03-09 19:03 ` [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat Andrew Cooper
@ 2016-03-09 19:56 ` Wei Liu
2016-03-10 8:33 ` Jan Beulich
2016-03-10 8:31 ` Jan Beulich
2 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2016-03-09 19:56 UTC (permalink / raw)
To: Andrew Cooper
Cc: Wei Liu, Ian Jackson, Xen-devel, Julien Grall,
Stefano Stabellini, Jan Beulich
On Wed, Mar 09, 2016 at 07:03:15PM +0000, Andrew Cooper 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 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>
Acked-by: Wei Liu <wei.liu2@citrix.com>
> ---
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Stefano Stabellini <stefano.stabellini@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
> CC: Jan Beulich <JBeulich@suse.com>
>
> 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(-)
>
> 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)
> --
> 2.1.4
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat
2016-03-09 19:03 ` [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat Andrew Cooper
@ 2016-03-09 19:56 ` Wei Liu
0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-03-09 19:56 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Wei Liu, Ian Jackson, Xen-devel
On Wed, Mar 09, 2016 at 07:03:16PM +0000, Andrew Cooper wrote:
> Fixes a build failure with Clang.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
> ---
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
>
> New in v2
> ---
> tools/misc/gtracestat.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/tools/misc/gtracestat.c b/tools/misc/gtracestat.c
> index 3c2bd2c..67cb003 100644
> --- a/tools/misc/gtracestat.c
> +++ b/tools/misc/gtracestat.c
> @@ -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;
>
> --
> 2.1.4
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate
2016-03-09 19:03 [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Andrew Cooper
2016-03-09 19:03 ` [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat Andrew Cooper
2016-03-09 19:56 ` [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Wei Liu
@ 2016-03-10 8:31 ` Jan Beulich
2 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2016-03-10 8:31 UTC (permalink / raw)
To: Andrew Cooper
Cc: Wei Liu, Julien Grall, StefanoStabellini, Ian Jackson, Xen-devel
>>> On 09.03.16 at 20:03, <andrew.cooper3@citrix.com> 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 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>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate
2016-03-09 19:56 ` [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Wei Liu
@ 2016-03-10 8:33 ` Jan Beulich
2016-03-10 10:52 ` Wei Liu
0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2016-03-10 8:33 UTC (permalink / raw)
To: Andrew Cooper, Wei Liu
Cc: Ian Jackson, Julien Grall, StefanoStabellini, Xen-devel
>>> On 09.03.16 at 20:56, <wei.liu2@citrix.com> wrote:
> On Wed, Mar 09, 2016 at 07:03:15PM +0000, Andrew Cooper 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 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>
>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
Should I apply this and the 2nd patch, or can/should this wait
for Ian to be back?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate
2016-03-10 8:33 ` Jan Beulich
@ 2016-03-10 10:52 ` Wei Liu
0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-03-10 10:52 UTC (permalink / raw)
To: Jan Beulich
Cc: Wei Liu, Andrew Cooper, Ian Jackson, Xen-devel, Julien Grall,
StefanoStabellini
On Thu, Mar 10, 2016 at 01:33:16AM -0700, Jan Beulich wrote:
> >>> On 09.03.16 at 20:56, <wei.liu2@citrix.com> wrote:
> > On Wed, Mar 09, 2016 at 07:03:15PM +0000, Andrew Cooper 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 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>
> >
> > Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> 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.
> Jan
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-03-10 10:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 19:03 [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Andrew Cooper
2016-03-09 19:03 ` [PATCH v2 2/2] tools/misc: Drop unused function from gtracestat Andrew Cooper
2016-03-09 19:56 ` Wei Liu
2016-03-09 19:56 ` [PATCH v2 1/2] tools/foreign: Avoid using alignment directives when not appropriate Wei Liu
2016-03-10 8:33 ` Jan Beulich
2016-03-10 10:52 ` Wei Liu
2016-03-10 8:31 ` Jan Beulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).