Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC Bitwise Attribute

Tags:

c

gcc

attributes

What does GCC's __attribute__(bitwise) mean? The attribute isn't mentioned in the info pages of GCC-4.6. I stumbled upon it in the file open-iscsi-2.0.871/include/iscsi_proto.h in source the project Open-ISCSI where it is used as

...
/*
 * If running svn modules we may need to define these.
 * This should not go upstream since this is already properly defined there
 */
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif

/*! initiator tags; opaque for target */
typedef uint32_t __bitwise__ itt_t;
/*! below makes sense only for initiator that created this tag */
#define build_itt(itt, age) ((__force itt_t)\
    ((itt) | ((age) << ISCSI_AGE_SHIFT)))
#define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK)
#define RESERVED_ITT ((__force itt_t)0xffffffff)
...

I'm suspecting something involving byte-order but I can't make any sense of the snippet given above.

like image 899
Nordlöw Avatar asked Oct 28 '11 15:10

Nordlöw


2 Answers

This is apparently not used by GCC but by Sparse, a semantic parser for C used by the Linux kernel. It is documented in Documentation/dev-tools/sparse.txt.

like image 74
Schnouki Avatar answered Nov 06 '22 14:11

Schnouki


Google says here that bitwise don't mean much anymore.

like image 28
Basile Starynkevitch Avatar answered Nov 06 '22 15:11

Basile Starynkevitch