ソースを参照

Use __unused instead of __used for static data structures.

Remove compiler.h defines from osdep.h
tags/v0.9.3
Michael Brown 19年前
コミット
3bbf5f28a3

+ 1
- 1
src/arch/i386/include/relocate.h ファイルの表示

17
 /* Macro for creating a post-relocation function table entry */
17
 /* Macro for creating a post-relocation function table entry */
18
 #define POST_RELOC_FN( order, post_reloc_func )				      \
18
 #define POST_RELOC_FN( order, post_reloc_func )				      \
19
 	static struct post_reloc_fn PREFIX_OBJECT(post_reloc_fn__)	      \
19
 	static struct post_reloc_fn PREFIX_OBJECT(post_reloc_fn__)	      \
20
-	    __attribute__ (( used, __table_section(post_reloc_fn,order) )) = {\
20
+	    __table ( post_reloc_fn, order ) = {			      \
21
 		.post_reloc = post_reloc_func,				      \
21
 		.post_reloc = post_reloc_func,				      \
22
 	};
22
 	};
23
 
23
 

+ 12
- 3
src/include/compiler.h ファイルの表示

84
 	} while (0)
84
 	} while (0)
85
 #endif
85
 #endif
86
 
86
 
87
-#define PACKED __attribute__((packed))
88
-#define __unused __attribute__((unused))
89
-#define __used __attribute__((used))
87
+/*
88
+ * Commonly-used attributes.
89
+ *
90
+ * Note that __used can be used only for functions.  If you have a
91
+ * static variable declaration that you want to force to be included,
92
+ * use __unused.
93
+ *
94
+ */
95
+#define PACKED __attribute__ (( packed ))
96
+#define __unused __attribute__ (( unused ))
97
+#define __used __attribute__ (( used ))
98
+#define __aligned __attribute__ (( aligned ( 16 ) ))
90
 
99
 
91
 /*
100
 /*
92
  * To save space in the binary when multiple-driver images are
101
  * To save space in the binary when multiple-driver images are

+ 1
- 2
src/include/console.h ファイルの表示

18
 	int ( *iskey ) ( void );
18
 	int ( *iskey ) ( void );
19
 };
19
 };
20
 
20
 
21
-#define __console_driver \
22
-	__attribute__ (( used, __table_section ( console, 01 ) ))
21
+#define __console_driver __table ( console, 01 )
23
 
22
 
24
 /* Function prototypes */
23
 /* Function prototypes */
25
 
24
 

+ 3
- 4
src/include/dev.h ファイルの表示

160
 	const char * ( *name_device ) ( struct bus_dev *bus_dev );
160
 	const char * ( *name_device ) ( struct bus_dev *bus_dev );
161
 };
161
 };
162
 
162
 
163
-#define __bus_driver __attribute__ (( used, __table_section(bus_driver,01) ))
163
+#define __bus_driver __table ( bus_driver, 01 )
164
 
164
 
165
 /*
165
 /*
166
  * A structure fully describing the bus-independent parts of a
166
  * A structure fully describing the bus-independent parts of a
186
 	int ( * load ) ( struct type_dev *type_dev, struct buffer *buffer );
186
 	int ( * load ) ( struct type_dev *type_dev, struct buffer *buffer );
187
 };
187
 };
188
 
188
 
189
-#define __type_driver __attribute__ (( used, __table_section(type_driver,01) ))
189
+#define __type_driver __table ( type_driver, 01 )
190
 
190
 
191
 /*
191
 /*
192
  * A driver for a device.
192
  * A driver for a device.
203
 			     struct bus_dev *bus_dev );
203
 			     struct bus_dev *bus_dev );
204
 };
204
 };
205
 
205
 
206
-#define __device_driver \
207
-	__attribute__ (( used, __table_section(device_driver,01) ))
206
+#define __device_driver __table ( device_driver, 01 )
208
 
207
 
209
 #define DRIVER(_name,_type_driver,_bus_driver,_bus_info,	 	      \
208
 #define DRIVER(_name,_type_driver,_bus_driver,_bus_info,	 	      \
210
 	       _probe,_disable) 		 			      \
209
 	       _probe,_disable) 		 			      \

+ 1
- 1
src/include/init.h ファイルの表示

51
 /* Macro for creating an initialisation function table entry */
51
 /* Macro for creating an initialisation function table entry */
52
 #define INIT_FN( init_order, init_func, reset_func, exit_func )		      \
52
 #define INIT_FN( init_order, init_func, reset_func, exit_func )		      \
53
 	static struct init_fn PREFIX_OBJECT(init_fn__)			      \
53
 	static struct init_fn PREFIX_OBJECT(init_fn__)			      \
54
-	    __attribute__ (( used, __table_section(init_fn,init_order) )) = { \
54
+	    __table ( init_fn, init_order ) = {				      \
55
 		.init = init_func,					      \
55
 		.init = init_func,					      \
56
 		.reset = reset_func,					      \
56
 		.reset = reset_func,					      \
57
 		.exit = exit_func,					      \
57
 		.exit = exit_func,					      \

+ 0
- 4
src/include/osdep.h ファイルの表示

1
 #ifndef	ETHERBOOT_OSDEP_H
1
 #ifndef	ETHERBOOT_OSDEP_H
2
 #define ETHERBOOT_OSDEP_H
2
 #define ETHERBOOT_OSDEP_H
3
 
3
 
4
-#define __unused __attribute__((unused))
5
-#define __aligned __attribute__((aligned(16)))
6
-#define PACKED __attribute__((packed))
7
-
8
 /* Optimization barrier */
4
 /* Optimization barrier */
9
 /* The "volatile" is due to gcc bugs */
5
 /* The "volatile" is due to gcc bugs */
10
 #define barrier() __asm__ __volatile__("": : :"memory")
6
 #define barrier() __asm__ __volatile__("": : :"memory")

+ 6
- 3
src/include/tables.h ファイルの表示

49
 #define __table_section_start(table) __table_section(table,00)
49
 #define __table_section_start(table) __table_section(table,00)
50
 #define __table_section_end(table) __table_section(table,99)
50
 #define __table_section_end(table) __table_section(table,99)
51
 
51
 
52
-#define __table(table,idx) __attribute__ (( __table_section(table,idx) ))
53
-#define __table_start(table) __attribute__ (( __table_section_start(table) ))
54
-#define __table_end(table) __attribute__ (( __table_section_end(table) ))
52
+#define __table(table,idx) \
53
+	__attribute__ (( unused, __table_section(table,idx) ))
54
+#define __table_start(table) \
55
+	__attribute__ (( unused, __table_section_start(table) ))
56
+#define __table_end(table) \
57
+	__attribute__ (( unused, __table_section_end(table) ))
55
 
58
 
56
 #endif /* TABLES_H */
59
 #endif /* TABLES_H */

読み込み中…
キャンセル
保存