Parcourir la source

Use __unused instead of __used for static data structures.

Remove compiler.h defines from osdep.h
tags/v0.9.3
Michael Brown il y a 19 ans
Parent
révision
3bbf5f28a3

+ 1
- 1
src/arch/i386/include/relocate.h Voir le fichier

@@ -17,7 +17,7 @@ struct post_reloc_fn {
17 17
 /* Macro for creating a post-relocation function table entry */
18 18
 #define POST_RELOC_FN( order, post_reloc_func )				      \
19 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 21
 		.post_reloc = post_reloc_func,				      \
22 22
 	};
23 23
 

+ 12
- 3
src/include/compiler.h Voir le fichier

@@ -84,9 +84,18 @@ __asm__ ( ".equ\tDEBUG_LEVEL, " DEBUG_SYMBOL_STR );
84 84
 	} while (0)
85 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 101
  * To save space in the binary when multiple-driver images are

+ 1
- 2
src/include/console.h Voir le fichier

@@ -18,8 +18,7 @@ struct console_driver {
18 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 23
 /* Function prototypes */
25 24
 

+ 3
- 4
src/include/dev.h Voir le fichier

@@ -160,7 +160,7 @@ struct bus_driver {
160 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 166
  * A structure fully describing the bus-independent parts of a
@@ -186,7 +186,7 @@ struct type_driver {
186 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 192
  * A driver for a device.
@@ -203,8 +203,7 @@ struct device_driver {
203 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 208
 #define DRIVER(_name,_type_driver,_bus_driver,_bus_info,	 	      \
210 209
 	       _probe,_disable) 		 			      \

+ 1
- 1
src/include/init.h Voir le fichier

@@ -51,7 +51,7 @@ struct init_fn {
51 51
 /* Macro for creating an initialisation function table entry */
52 52
 #define INIT_FN( init_order, init_func, reset_func, exit_func )		      \
53 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 55
 		.init = init_func,					      \
56 56
 		.reset = reset_func,					      \
57 57
 		.exit = exit_func,					      \

+ 0
- 4
src/include/osdep.h Voir le fichier

@@ -1,10 +1,6 @@
1 1
 #ifndef	ETHERBOOT_OSDEP_H
2 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 4
 /* Optimization barrier */
9 5
 /* The "volatile" is due to gcc bugs */
10 6
 #define barrier() __asm__ __volatile__("": : :"memory")

+ 6
- 3
src/include/tables.h Voir le fichier

@@ -49,8 +49,11 @@
49 49
 #define __table_section_start(table) __table_section(table,00)
50 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 59
 #endif /* TABLES_H */

Chargement…
Annuler
Enregistrer