GCC按位属性 [英] GCC Bitwise Attribute

查看:407
本文介绍了GCC按位属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是GCC的 __ __属性(按位)是什么意思?该属性没有在GCC-4.6的信息页面提及。我在文件中后,它stubled 开放式iSCSI的2.0.871 /包括/ iscsi_proto.h 源项目打开的iSCSI 它在哪里作为

What does GCC's __attribute__(bitwise) mean? The attribute isn't mentioned in the info pages of GCC-4.6. I stubled 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.

推荐答案

这显然是不使用GCC而是由稀疏,由Linux内核使用对C语义解析器。它是在<一个记录href=\"https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=Documentation/sparse.txt\">Documentation/sparse.txt.

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/sparse.txt.

这篇关于GCC按位属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆