瀏覽代碼

gcc is rather over-aggressive about optimising out static data structures

even when __atribute__ (( unused )) is correctly set...
tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
832e86246b

+ 2
- 2
src/arch/i386/core/video_subr.c 查看文件

@@ -12,7 +12,7 @@
12 12
 #include "init.h"
13 13
 #include "vga.h"
14 14
 
15
-static struct console_driver vga_console;
15
+struct console_driver vga_console;
16 16
 
17 17
 static char *vidmem;		/* The video buffer */
18 18
 static int video_line, video_col;
@@ -94,7 +94,7 @@ static void vga_putc(int byte)
94 94
 	write_crtc((video_col + (video_line *COLS)) & 0x0ff, CRTC_CURSOR_LO);
95 95
 }
96 96
 
97
-static struct console_driver vga_console __console_driver = {
97
+struct console_driver vga_console __console_driver = {
98 98
 	.putchar = vga_putc,
99 99
 	.disabled = 1,
100 100
 };

+ 1
- 1
src/arch/i386/firmware/pcbios/bios_console.c 查看文件

@@ -68,7 +68,7 @@ static int bios_iskey ( void ) {
68 68
 	return ( ( flags & ZF ) == 0 );
69 69
 }
70 70
 
71
-static struct console_driver bios_console __console_driver = {
71
+struct console_driver bios_console __console_driver = {
72 72
 	.putchar = bios_putchar,
73 73
 	.getchar = bios_getchar,
74 74
 	.iskey = bios_iskey,

+ 1
- 1
src/arch/i386/image/nbi.c 查看文件

@@ -404,7 +404,7 @@ static int nbi_boot ( void *context ) {
404 404
 }
405 405
 
406 406
 /** Declaration of the NBI image format */
407
-static struct image nbi_image __image = {
407
+struct image nbi_image __image = {
408 408
 	.name	= "NBI",
409 409
 	.probe	= nbi_probe,
410 410
 	.load	= nbi_load,

+ 4
- 4
src/arch/i386/include/relocate.h 查看文件

@@ -15,10 +15,10 @@ struct post_reloc_fn {
15 15
 #define POST_RELOC_LIBRM	00
16 16
 
17 17
 /* Macro for creating a post-relocation function table entry */
18
-#define POST_RELOC_FN( order, post_reloc_func )				      \
19
-	static struct post_reloc_fn PREFIX_OBJECT(post_reloc_fn__)	      \
20
-	    __table ( post_reloc_fn, order ) = {			      \
21
-		.post_reloc = post_reloc_func,				      \
18
+#define POST_RELOC_FN( order, post_reloc_func )			\
19
+	struct post_reloc_fn PREFIX_OBJECT(post_reloc_fn__)	\
20
+	    __table ( post_reloc_fn, order ) = {		\
21
+		.post_reloc = post_reloc_func,			\
22 22
 	};
23 23
 
24 24
 #endif

+ 1
- 1
src/core/btext.c 查看文件

@@ -434,7 +434,7 @@ static void btext_putc(int c)
434 434
         btext_drawchar((unsigned char)c);
435 435
 }
436 436
 
437
-static struct console_driver btext_console __console_driver = {
437
+struct console_driver btext_console __console_driver = {
438 438
 	.putchar = btext_putc,
439 439
 	.disabled = 1,
440 440
 };

+ 1
- 1
src/core/pc_kbd.c 查看文件

@@ -107,6 +107,6 @@ static int kbd_getc(void)
107 107
     return c;
108 108
 }
109 109
 
110
-static struct console_driver pc_kbd_console __console_driver = {
110
+struct console_driver pc_kbd_console __console_driver = {
111 111
 	.getchar = kbd_getc,
112 112
 };

+ 2
- 2
src/core/serial.c 查看文件

@@ -91,7 +91,7 @@
91 91
 #define uart_writeb(val,addr) outb((val),(addr))
92 92
 #endif
93 93
 
94
-static struct console_driver serial_console;
94
+struct console_driver serial_console;
95 95
 
96 96
 /*
97 97
  * void serial_putc(int ch);
@@ -229,7 +229,7 @@ static void serial_fini ( void ) {
229 229
 	/* Don't mark it as disabled; it's still usable */
230 230
 }
231 231
 
232
-static struct console_driver serial_console __console_driver = {
232
+struct console_driver serial_console __console_driver = {
233 233
 	.putchar = serial_putc,
234 234
 	.getchar = serial_getc,
235 235
 	.iskey = serial_ischar,

+ 2
- 2
src/drivers/net/3c509.c 查看文件

@@ -311,7 +311,7 @@ static const char * t509_name_device ( struct bus_dev *bus_dev __unused ) {
311 311
  * T509 bus operations table
312 312
  *
313 313
  */
314
-static struct bus_driver t509_driver __bus_driver = {
314
+struct bus_driver t509_driver __bus_driver = {
315 315
 	.name			= "T509",
316 316
 	.next_location		= t509_next_location,
317 317
 	.fill_device		= t509_fill_device,
@@ -392,7 +392,7 @@ static void el3_t509_disable ( struct nic *nic, struct t509_device *t509 ) {
392 392
 	deactivate_t509_device ( t509 );
393 393
 }
394 394
 
395
-static struct {} el3_t509_driver;
395
+struct {} el3_t509_driver;
396 396
 
397 397
 DRIVER ( "3c509", nic_driver, t509_driver, el3_t509_driver,
398 398
 	 el3_t509_probe, el3_t509_disable );

+ 1
- 1
src/drivers/net/mlx_ipoib/mt23108.c 查看文件

@@ -235,7 +235,7 @@ static struct pci_id tavor_nics[] = {
235 235
 	PCI_ROM(0x15b3, 0x6278, "MT25208", "MT25208 HCA driver"),
236 236
 };
237 237
 
238
-static struct pci_driver tavor_driver __pci_driver = {
238
+struct pci_driver tavor_driver __pci_driver = {
239 239
 	.type = NIC_DRIVER,
240 240
 	.name = "MT23108/MT25208",
241 241
 	.probe = tavor_probe,

+ 1
- 1
src/drivers/net/mlx_ipoib/mt25218.c 查看文件

@@ -235,7 +235,7 @@ static struct pci_id mt25218_nics[] = {
235 235
 	PCI_ROM(0x15b3, 0x6274, "MT25204", "MT25204 HCA driver"),
236 236
 };
237 237
 
238
-static struct pci_driver mt25218_driver __pci_driver = {
238
+struct pci_driver mt25218_driver __pci_driver = {
239 239
 	.type = NIC_DRIVER,
240 240
 	.name = "MT25218",
241 241
 	.probe = mt25218_probe,

+ 3
- 3
src/drivers/net/ns8390.c 查看文件

@@ -961,7 +961,7 @@ static struct nic_operations ns8390_operations = {
961 961
 }
962 962
 
963 963
 #ifdef	INCLUDE_WD
964
-static struct isa_driver wd_driver __isa_driver = {
964
+struct isa_driver wd_driver __isa_driver = {
965 965
 	.type    = NIC_DRIVER,
966 966
 	.name    = "WD",
967 967
 	.probe   = wd_probe,
@@ -971,7 +971,7 @@ ISA_ROM("wd","WD8003/8013, SMC8216/8416, SMC 83c790 (EtherEZ)");
971 971
 #endif
972 972
 
973 973
 #ifdef	INCLUDE_3C503
974
-static struct isa_driver t503_driver __isa_driver = {
974
+struct isa_driver t503_driver __isa_driver = {
975 975
 	.type    = NIC_DRIVER,
976 976
 	.name    = "3C503",
977 977
 	.probe   = t503_probe,
@@ -981,7 +981,7 @@ ISA_ROM("3c503","3Com503, Etherlink II[/16]");
981 981
 #endif
982 982
 
983 983
 #ifdef	INCLUDE_NE
984
-static struct isa_driver ne_driver __isa_driver = {
984
+struct isa_driver ne_driver __isa_driver = {
985 985
 	.type    = NIC_DRIVER,
986 986
 	.name    = "NE*000",
987 987
 	.probe   = ne_probe,

+ 2
- 2
src/include/gpxe/tables.h 查看文件

@@ -131,7 +131,7 @@
131 131
  *	...
132 132
  *   }
133 133
  *
134
- *   static struct frob my_frobnicator __frobnicator = {
134
+ *   struct frob my_frobnicator __frobnicator = {
135 135
  *	.name = "my_frob",
136 136
  *	.frob = my_frob,
137 137
  *   };
@@ -184,7 +184,7 @@
184 184
  *
185 185
  * @code
186 186
  *
187
- *   static struct my_foo __table ( foo, 01 ) = {
187
+ *   struct my_foo __table ( foo, 01 ) = {
188 188
  *      ...
189 189
  *   };
190 190
  *

+ 6
- 6
src/include/init.h 查看文件

@@ -49,12 +49,12 @@ struct init_fn {
49 49
 #define	INIT_RPC	11
50 50
 
51 51
 /* Macro for creating an initialisation function table entry */
52
-#define INIT_FN( init_order, init_func, reset_func, exit_func )		      \
53
-	static struct init_fn PREFIX_OBJECT(init_fn__)			      \
54
-	    __table ( init_fn, init_order ) = {				      \
55
-		.init = init_func,					      \
56
-		.reset = reset_func,					      \
57
-		.exit = exit_func,					      \
52
+#define INIT_FN( init_order, init_func, reset_func, exit_func )	\
53
+	struct init_fn PREFIX_OBJECT(init_fn__)			\
54
+	    __table ( init_fn, init_order ) = {			\
55
+		.init = init_func,				\
56
+		.reset = reset_func,				\
57
+		.exit = exit_func,				\
58 58
 	};
59 59
 
60 60
 /* Function prototypes */

+ 1
- 1
src/include/isa.h 查看文件

@@ -54,7 +54,7 @@ struct isa_driver {
54 54
  *
55 55
  */
56 56
 #define ISA_DRIVER( _name, _probe_addrs, _probe_addr, _mfg_id, _prod_id )   \
57
-static struct isa_driver _name __table(isa_driver,01 ) = {		    \
57
+struct isa_driver _name __table(isa_driver,01 ) = {			    \
58 58
 	.probe_addrs = _probe_addrs,					    \
59 59
 	.addr_count = sizeof ( _probe_addrs ) / sizeof ( _probe_addrs[0] ), \
60 60
 	.probe_addr = _probe_addr,					    \

+ 1
- 1
src/interface/pxe/pxe_errors.c 查看文件

@@ -13,7 +13,7 @@
13 13
  * followed by a little manual tweaking.
14 14
  *
15 15
  */
16
-static struct errortab pxe_errortab[] __errortab = {
16
+struct errortab pxe_errortab[] __errortab = {
17 17
 	{ PXENV_STATUS_SUCCESS, "Success" },
18 18
 	{ PXENV_STATUS_FAILURE, "Failure" },
19 19
 	{ PXENV_STATUS_BAD_FUNC, "Bad function" },

+ 1
- 1
src/proto/dns.c 查看文件

@@ -355,7 +355,7 @@ static int dns_resolv ( struct in_addr *addr, const char *name ) {
355 355
 	}
356 356
 }
357 357
 
358
-static struct resolver dns_resolver __resolver = {
358
+struct resolver dns_resolver __resolver = {
359 359
 	.name = "DNS",
360 360
 	.resolv = dns_resolv,
361 361
 };

+ 1
- 1
src/proto/http.c 查看文件

@@ -166,7 +166,7 @@ static int http ( char *url, struct sockaddr_in *server __unused,
166 166
 	return 1;
167 167
 }
168 168
 
169
-static struct protocol http_protocol __protocol = {
169
+struct protocol http_protocol __protocol = {
170 170
 	.name = "http",
171 171
 	.default_port = 80,
172 172
 	.load = http,

+ 1
- 1
src/proto/igmp.c 查看文件

@@ -112,7 +112,7 @@ static void process_igmp ( unsigned long now, unsigned short ptype __unused,
112 112
 	}
113 113
 }
114 114
 
115
-static struct background igmp_background __background = {
115
+struct background igmp_background __background = {
116 116
 	.send = send_igmp_reports,
117 117
 	.process = process_igmp,
118 118
 };

+ 1
- 1
src/proto/nfs.c 查看文件

@@ -610,7 +610,7 @@ nfssymlink:
610 610
 
611 611
 INIT_FN ( INIT_RPC, rpc_init, nfs_reset, nfs_reset );
612 612
 
613
-static struct protocol nfs_protocol __protocol = {
613
+struct protocol nfs_protocol __protocol = {
614 614
 	.name = "nfs",
615 615
 	.default_port = SUNRPC_PORT,
616 616
 	.load = nfs,

+ 1
- 1
src/proto/nmb.c 查看文件

@@ -100,7 +100,7 @@ static int nmb_resolv ( struct in_addr *addr, const char *name ) {
100 100
 	return 1;
101 101
 }
102 102
 
103
-static struct resolver nmb_resolver __resolver = {
103
+struct resolver nmb_resolver __resolver = {
104 104
 	.name = "NMB",
105 105
 	.resolv = nmb_resolv,
106 106
 };

+ 1
- 1
src/proto/slam.c 查看文件

@@ -534,7 +534,7 @@ static int url_slam ( char *url __unused, struct sockaddr_in *server,
534 534
 	return proto_slam(&info);
535 535
 }
536 536
 
537
-static struct protocol slam_protocol __protocol = {
537
+struct protocol slam_protocol __protocol = {
538 538
 	.name = "x-slam",
539 539
 	.default_port = SLAM_PORT,
540 540
 	.load = url_slam,

Loading…
取消
儲存