- 追加された行はこの色です。
- 削除された行はこの色です。
*参照元 [#j005f63b]
#backlinks
*説明 [#bddbfc26]
-パス: [[linux-2.6.33/include/linux/compiler.h]]
--gcc3 版: [[linux-2.6.33/include/linux/compiler-gcc3.h]]
--gcc4 版: [[linux-2.6.33/include/linux/compiler-gcc4.h]]
-FIXME: これは何?
--説明
-関数や変数に対して出る警告 'defined but not used'
(定義されているが使用されていない)を抑制するための属性の宣言
--恐らく GCC 専用
**参考 [#he6e3bae]
*実装 [#l6f7dad2]
** include/linux/compiler.h [#f0f5159c]
/*
* Allow us to avoid 'defined but not used' warnings on functions and data,
* as well as force them to be emitted to the assembly file.
*
* As of gcc 3.4, static functions that are not marked with attribute((used))
* may be elided from the assembly file. As of gcc 3.4, static data not so
* marked will not be elided, but this may change in a future gcc version.
*
* NOTE: Because distributions shipped with a backported unit-at-a-time
* compiler in gcc 3.3, we must define __used to be __attribute__((used))
* for gcc >=3.3 instead of 3.4.
*
* In prior versions of gcc, such functions and data would be emitted, but
* would be warned about except with attribute((unused)).
*
* Mark functions that are referenced only in inline assembly as __used so
* the code is emitted even though it appears to be unreferenced.
*/
#ifndef __used
-gcc 以外のコンパイラで、__used に特別な意味を定めて居ない場合
# define __used /* unimplemented */
-__used には特に効力なし
#endif
** include/linux/compiler-gcc3.h [#c4d08228]
#if __GNUC_MINOR__ >= 3
-新しい gcc(3.3 以上)の場合
# define __used __attribute__((__used__))
-変数に対して、__attribute__( (used) ) を宣言できる。
#else
-古い gcc(3.3 未満)の場合
# define __used __attribute__((__unused__))
-unused でも used でも効力は同じらしい。
変数に対して、__attribute__( (used) ) を宣言できないため、
unused を使うらしい。
--この辺りの理屈はよくわかりません。正直どうでもいい…。
#endif
** include/linux/compiler-gcc4.h [#e1250e81]
#define __used __attribute__((__used__))
*コメント [#t5e5509c]