public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Does GCC really recognize __attribute__ ((bitwise))?
@ 2008-03-27 12:17 Eus
  2008-03-27 17:40 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Eus @ 2008-03-27 12:17 UTC (permalink / raw)
  To: gcc-help

Hi Ho!

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.

Is it a custom defined attribute? If it is, is the way to do such thing
documented in GCC texinfo? If it is not, why does it not described in GCC texinfo
file?

Thank you very much.

Best regards,
Eus (FSF member #4445)

In this digital era, where computing technology is pervasive, your freedom depends on the software controlling those computing devices.

Join free software movement today!
It is free as in freedom, _NOT_ as in free beer!
Use the following link to join:
http://www.fsf.org/register_form?referrer=4445

For more information, visit the following links:
- Free Software, Free Society
http://www.gnu.org/philosophy/fsfs/rms-essays.pdf
- The GNU Project
http://gnu.org
- The Free Software Foundation
http://fsf.org


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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

* Re: Does GCC really recognize __attribute__ ((bitwise))?
  2008-03-27 12:17 Does GCC really recognize __attribute__ ((bitwise))? Eus
@ 2008-03-27 17:40 ` Ian Lance Taylor
  2008-03-27 19:46   ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2008-03-27 17:40 UTC (permalink / raw)
  To: eus; +Cc: gcc-help

Eus <eus@member.fsf.org> 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.

Ian

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

* Re: Does GCC really recognize __attribute__ ((bitwise))?
  2008-03-27 17:40 ` Ian Lance Taylor
@ 2008-03-27 19:46   ` Sam Ravnborg
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2008-03-27 19:46 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: eus, gcc-help

On Thu, Mar 27, 2008 at 10:39:22AM -0700, Ian Lance Taylor wrote:
> Eus <eus@member.fsf.org> 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

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

end of thread, other threads:[~2008-03-27 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-27 12:17 Does GCC really recognize __attribute__ ((bitwise))? Eus
2008-03-27 17:40 ` Ian Lance Taylor
2008-03-27 19:46   ` Sam Ravnborg

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 read-only IMAP folder(s) and NNTP newsgroup(s).