Bitwidth attribute

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Bitwidth attribute

adamhusar
Hello,

   I would like to ask, whether there are any plan to support the bitwidth attribute.

In llvm-test-2.8 in SingleSource/UnitTests/Integer/bits.h, there is the attribute used:

typedef unsigned int __attribute__((bitwidth(1))) uint1;
...

However, when I try to compile it with clang 2.8, I get this message:

test.c:2:37: warning: unknown attribute 'bitwidth' ignored [-Wunknown-attributes]


   I did not try the latest llvm-gcc, but last time i tried, it did not work either.
So, I would like to ask, whether you plan to include support for the bitwidth attribute in the close future, or if
you would be willing to accept a patch that implements this support.

   We need this to describe hardware using C and I think that we are not the only ones that
would find this useful.


Thank you
   Adam Husar
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Bitwidth attribute

Douglas Gregor

On Jan 12, 2011, at 3:13 AM, ihusar wrote:

> Hello,
>
>   I would like to ask, whether there are any plan to support the bitwidth attribute.
>
> In llvm-test-2.8 in SingleSource/UnitTests/Integer/bits.h, there is the attribute used:
>
> typedef unsigned int __attribute__((bitwidth(1))) uint1;
> ...
>
> However, when I try to compile it with clang 2.8, I get this message:
>
> test.c:2:37: warning: unknown attribute 'bitwidth' ignored [-Wunknown-attributes]
>
>
>   I did not try the latest llvm-gcc, but last time i tried, it did not work either.
> So, I would like to ask, whether you plan to include support for the bitwidth attribute in the close future, or if
> you would be willing to accept a patch that implements this support.
>
>   We need this to describe hardware using C and I think that we are not the only ones that
> would find this useful.


Where does this attribute come from? I don't see it in GCC's list of attributes, nor do I recall seeing it in other compilers.

We try to add attributes when we need to for compatibility or when there's a strong benefit and a solid implementation for that attribute.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Bitwidth attribute

İsmail Dönmez
Hi;

On Fri, Jan 14, 2011 at 5:49 PM, Douglas Gregor <[hidden email]> wrote:

On Jan 12, 2011, at 3:13 AM, ihusar wrote:

> Hello,
>
>   I would like to ask, whether there are any plan to support the bitwidth attribute.
>
> In llvm-test-2.8 in SingleSource/UnitTests/Integer/bits.h, there is the attribute used:
>
> typedef unsigned int __attribute__((bitwidth(1))) uint1;
> ...
>
> However, when I try to compile it with clang 2.8, I get this message:
>
> test.c:2:37: warning: unknown attribute 'bitwidth' ignored [-Wunknown-attributes]
>
>
>   I did not try the latest llvm-gcc, but last time i tried, it did not work either.
> So, I would like to ask, whether you plan to include support for the bitwidth attribute in the close future, or if
> you would be willing to accept a patch that implements this support.
>
>   We need this to describe hardware using C and I think that we are not the only ones that
> would find this useful.


Where does this attribute come from? I don't see it in GCC's list of attributes, nor do I recall seeing it in other compilers.

We try to add attributes when we need to for compatibility or when there's a strong benefit and a solid implementation for that attribute.

This is already reported & rejected, see http://llvm.org/bugs/show_bug.cgi?id=1284

Regards,
ismail
 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Bitwidth attribute

Anton Korobeynikov
In reply to this post by Douglas Gregor
> Where does this attribute come from? I don't see it in GCC's list of attributes, nor do I recall seeing it in other compilers.
This was the custom attribute added to llvm-gcc during the arbitrary
width integer project. Though even in llvm-gcc is was not
working always properly and right now noone is interested in it.

--
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev