xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Clang tools build
@ 2016-02-12 15:25 Andrew Cooper
  2016-02-12 16:04 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2016-02-12 15:25 UTC (permalink / raw)
  To: Xen-devel List, Jan Beulich, Ian Campbell, Ian Jackson, Wei Liu

Hello,

Now that Clang 3.5 can build the hypervisor, I was just preparing a
patch to README, and encountered this:

In file included from xc_altp2m.c:23:
In file included from ./xc_private.h:35:
In file included from ./include/xenctrl.h:53:
/local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:203:47:
error: 'aligned' attribute ignored when parsing type
[-Werror,-Wignored-attributes]
    __align8__ uint64_t evtchn_pending[sizeof(__align8__ uint64_t) * 8];
                                              ^~~~~~~~~~
/local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:13:36:
note: expanded from macro '__align8__'
# define __align8__ __attribute__((aligned (8)))
                                   ^~~~~~~~~~~
/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__'
# define __align8__ __attribute__((aligned (8)))
                                   ^~~~~~~~~~~
2 errors generated.

In this case, Clang is complaining that the alignment attribute is wrong
for uint64_t.  This is correct for 64bit compilations, but wrong for
32bit.  On the other hand, I am not sure whether it is sensible to do a
blanket disable of -Wignored-attributes.

Thoughts?

~Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Clang tools build
  2016-02-12 15:25 Clang tools build Andrew Cooper
@ 2016-02-12 16:04 ` Jan Beulich
  2016-02-12 16:20   ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2016-02-12 16:04 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ian Jackson, Wei Liu, Ian Campbell, Xen-devel List

>>> On 12.02.16 at 16:25, <andrew.cooper3@citrix.com> wrote:
> Hello,
> 
> Now that Clang 3.5 can build the hypervisor, I was just preparing a
> patch to README, and encountered this:
> 
> In file included from xc_altp2m.c:23:
> In file included from ./xc_private.h:35:
> In file included from ./include/xenctrl.h:53:
> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:203:47:
> error: 'aligned' attribute ignored when parsing type
> [-Werror,-Wignored-attributes]
>     __align8__ uint64_t evtchn_pending[sizeof(__align8__ uint64_t) * 8];
>                                               ^~~~~~~~~~
> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:13:36:
> note: expanded from macro '__align8__'
> # define __align8__ __attribute__((aligned (8)))
>                                    ^~~~~~~~~~~
> /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__'
> # define __align8__ __attribute__((aligned (8)))
>                                    ^~~~~~~~~~~
> 2 errors generated.
> 
> In this case, Clang is complaining that the alignment attribute is wrong
> for uint64_t.  This is correct for 64bit compilations, but wrong for
> 32bit.

If it only complains about it when used as operand to sizeof() I
think it's correctly saying so.

>  On the other hand, I am not sure whether it is sensible to do a
> blanket disable of -Wignored-attributes.

I agree it's not ideal, but I see no alternative, and I'm not sure
there are many cases where a legitimately ignored attribute
would be a problem (leaving as a potential issue only cases
where the compiler wrongly ignores one).

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Clang tools build
  2016-02-12 16:04 ` Jan Beulich
@ 2016-02-12 16:20   ` Andrew Cooper
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2016-02-12 16:20 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Ian Jackson, Wei Liu, Ian Campbell, Xen-devel List

On 12/02/16 16:04, Jan Beulich wrote:
>>>> On 12.02.16 at 16:25, <andrew.cooper3@citrix.com> wrote:
>> Hello,
>>
>> Now that Clang 3.5 can build the hypervisor, I was just preparing a
>> patch to README, and encountered this:
>>
>> In file included from xc_altp2m.c:23:
>> In file included from ./xc_private.h:35:
>> In file included from ./include/xenctrl.h:53:
>> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:203:47:
>> error: 'aligned' attribute ignored when parsing type
>> [-Werror,-Wignored-attributes]
>>     __align8__ uint64_t evtchn_pending[sizeof(__align8__ uint64_t) * 8];
>>                                               ^~~~~~~~~~
>> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:13:36:
>> note: expanded from macro '__align8__'
>> # define __align8__ __attribute__((aligned (8)))
>>                                    ^~~~~~~~~~~
>> /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__'
>> # define __align8__ __attribute__((aligned (8)))
>>                                    ^~~~~~~~~~~
>> 2 errors generated.
>>
>> In this case, Clang is complaining that the alignment attribute is wrong
>> for uint64_t.  This is correct for 64bit compilations, but wrong for
>> 32bit.
> If it only complains about it when used as operand to sizeof() I
> think it's correctly saying so.

Turns out that a fix^W gross hack of

diff --git a/tools/include/xen-foreign/Makefile
b/tools/include/xen-foreign/Makefile
index 80a446a..d9f68cd 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -35,6 +35,7 @@ x86_32.h: mkheader.py structs.py
$(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/
 
 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,$^)
+       sed 's/(__align8__ uint64_t)/(uint64_t)/g' -i $@
 
 checker.c: mkchecker.py structs.py
        $(PYTHON) $< $@ $(architectures)

Does indeed fix the build.  There are problems with sizeof(), and later,
an explicit (__align8__ uint64_t) cast.

Unfortunately, mkheader is doing dumb translation, and I don't fancy
teaching it how to parse C.  I will see if there is something neater I
can do as a solution.

Also, further real issues have surfaces, so I will have to submit a
series cleaning up the tools/ compile with Clang.

~Andrew

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-12 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12 15:25 Clang tools build Andrew Cooper
2016-02-12 16:04 ` Jan Beulich
2016-02-12 16:20   ` Andrew Cooper

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).