Re: Does GCC really recognize __attribute__ ((bitwise))?

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

 



On Thu, Mar 27, 2008 at 10:39:22AM -0700, Ian Lance Taylor wrote:
> Eus <eus@xxxxxxxxxxxxxx> writes:
> 
> > When browsing the Linux kernel 2.6.21.5's source code, I noticed a variable
> > definition like:
> >
> > typedef __u64 __bitwise __be64;
> >
> > Being curious about __bitwise, I found it out to be:
> >
> > #define __bitwise __bitwise__
> >
> > that finally turned out to be:
> >
> > #define __bitwise__ __attribute__((bitwise))
> >
> > Since it was __attribute__, I tried to find its documentation in GCC texinfo
> > file. But, I couldn't find one. Even I have tried to find it out in the Internet.
> > But, I still couldn't find one.
> 
> There is no "bitwise" attribute in standard gcc.
> 
> Looking at the Linux 2.6.24 sources, I see that it is defined as an
> attribute only when __CHECKER__ is defined.  This has something to do
> with sparse--see Documentation/sparse.txt.  I don't know the details.

Correct.
We have in the kernel a number of sparse specific extensions.
bitwise, __iomem and __user is the ones most widely used.
sparse uses this to do additional checks that gcc not has context to do.

The __user annotation is used to annotate pointers to data in userspace
which may not be mixed up with pointers in kernel space.

	Sam

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux