From 832e86246b37c78466a5a30159bed48ed59eb811 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 24 Apr 2006 18:31:37 +0000 Subject: [PATCH] gcc is rather over-aggressive about optimising out static data structures even when __atribute__ (( unused )) is correctly set... --- src/arch/i386/core/video_subr.c | 4 ++-- src/arch/i386/firmware/pcbios/bios_console.c | 2 +- src/arch/i386/image/nbi.c | 2 +- src/arch/i386/include/relocate.h | 8 ++++---- src/core/btext.c | 2 +- src/core/pc_kbd.c | 2 +- src/core/serial.c | 4 ++-- src/drivers/net/3c509.c | 4 ++-- src/drivers/net/mlx_ipoib/mt23108.c | 2 +- src/drivers/net/mlx_ipoib/mt25218.c | 2 +- src/drivers/net/ns8390.c | 6 +++--- src/include/gpxe/tables.h | 4 ++-- src/include/init.h | 12 ++++++------ src/include/isa.h | 2 +- src/interface/pxe/pxe_errors.c | 2 +- src/proto/dns.c | 2 +- src/proto/http.c | 2 +- src/proto/igmp.c | 2 +- src/proto/nfs.c | 2 +- src/proto/nmb.c | 2 +- src/proto/slam.c | 2 +- 21 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/arch/i386/core/video_subr.c b/src/arch/i386/core/video_subr.c index dbcfc73d..66aee114 100644 --- a/src/arch/i386/core/video_subr.c +++ b/src/arch/i386/core/video_subr.c @@ -12,7 +12,7 @@ #include "init.h" #include "vga.h" -static struct console_driver vga_console; +struct console_driver vga_console; static char *vidmem; /* The video buffer */ static int video_line, video_col; @@ -94,7 +94,7 @@ static void vga_putc(int byte) write_crtc((video_col + (video_line *COLS)) & 0x0ff, CRTC_CURSOR_LO); } -static struct console_driver vga_console __console_driver = { +struct console_driver vga_console __console_driver = { .putchar = vga_putc, .disabled = 1, }; diff --git a/src/arch/i386/firmware/pcbios/bios_console.c b/src/arch/i386/firmware/pcbios/bios_console.c index f6ea952f..c1c8273c 100644 --- a/src/arch/i386/firmware/pcbios/bios_console.c +++ b/src/arch/i386/firmware/pcbios/bios_console.c @@ -68,7 +68,7 @@ static int bios_iskey ( void ) { return ( ( flags & ZF ) == 0 ); } -static struct console_driver bios_console __console_driver = { +struct console_driver bios_console __console_driver = { .putchar = bios_putchar, .getchar = bios_getchar, .iskey = bios_iskey, diff --git a/src/arch/i386/image/nbi.c b/src/arch/i386/image/nbi.c index f5d9e382..7a2db255 100644 --- a/src/arch/i386/image/nbi.c +++ b/src/arch/i386/image/nbi.c @@ -404,7 +404,7 @@ static int nbi_boot ( void *context ) { } /** Declaration of the NBI image format */ -static struct image nbi_image __image = { +struct image nbi_image __image = { .name = "NBI", .probe = nbi_probe, .load = nbi_load, diff --git a/src/arch/i386/include/relocate.h b/src/arch/i386/include/relocate.h index 5e87c693..d8002185 100644 --- a/src/arch/i386/include/relocate.h +++ b/src/arch/i386/include/relocate.h @@ -15,10 +15,10 @@ struct post_reloc_fn { #define POST_RELOC_LIBRM 00 /* Macro for creating a post-relocation function table entry */ -#define POST_RELOC_FN( order, post_reloc_func ) \ - static struct post_reloc_fn PREFIX_OBJECT(post_reloc_fn__) \ - __table ( post_reloc_fn, order ) = { \ - .post_reloc = post_reloc_func, \ +#define POST_RELOC_FN( order, post_reloc_func ) \ + struct post_reloc_fn PREFIX_OBJECT(post_reloc_fn__) \ + __table ( post_reloc_fn, order ) = { \ + .post_reloc = post_reloc_func, \ }; #endif diff --git a/src/core/btext.c b/src/core/btext.c index da6c029b..43accc47 100644 --- a/src/core/btext.c +++ b/src/core/btext.c @@ -434,7 +434,7 @@ static void btext_putc(int c) btext_drawchar((unsigned char)c); } -static struct console_driver btext_console __console_driver = { +struct console_driver btext_console __console_driver = { .putchar = btext_putc, .disabled = 1, }; diff --git a/src/core/pc_kbd.c b/src/core/pc_kbd.c index 84a3c640..d43357fe 100644 --- a/src/core/pc_kbd.c +++ b/src/core/pc_kbd.c @@ -107,6 +107,6 @@ static int kbd_getc(void) return c; } -static struct console_driver pc_kbd_console __console_driver = { +struct console_driver pc_kbd_console __console_driver = { .getchar = kbd_getc, }; diff --git a/src/core/serial.c b/src/core/serial.c index 29be2216..802b32a7 100644 --- a/src/core/serial.c +++ b/src/core/serial.c @@ -91,7 +91,7 @@ #define uart_writeb(val,addr) outb((val),(addr)) #endif -static struct console_driver serial_console; +struct console_driver serial_console; /* * void serial_putc(int ch); @@ -229,7 +229,7 @@ static void serial_fini ( void ) { /* Don't mark it as disabled; it's still usable */ } -static struct console_driver serial_console __console_driver = { +struct console_driver serial_console __console_driver = { .putchar = serial_putc, .getchar = serial_getc, .iskey = serial_ischar, diff --git a/src/drivers/net/3c509.c b/src/drivers/net/3c509.c index 095fb392..b27ee1f6 100644 --- a/src/drivers/net/3c509.c +++ b/src/drivers/net/3c509.c @@ -311,7 +311,7 @@ static const char * t509_name_device ( struct bus_dev *bus_dev __unused ) { * T509 bus operations table * */ -static struct bus_driver t509_driver __bus_driver = { +struct bus_driver t509_driver __bus_driver = { .name = "T509", .next_location = t509_next_location, .fill_device = t509_fill_device, @@ -392,7 +392,7 @@ static void el3_t509_disable ( struct nic *nic, struct t509_device *t509 ) { deactivate_t509_device ( t509 ); } -static struct {} el3_t509_driver; +struct {} el3_t509_driver; DRIVER ( "3c509", nic_driver, t509_driver, el3_t509_driver, el3_t509_probe, el3_t509_disable ); diff --git a/src/drivers/net/mlx_ipoib/mt23108.c b/src/drivers/net/mlx_ipoib/mt23108.c index 06d63f39..d07d8384 100644 --- a/src/drivers/net/mlx_ipoib/mt23108.c +++ b/src/drivers/net/mlx_ipoib/mt23108.c @@ -235,7 +235,7 @@ static struct pci_id tavor_nics[] = { PCI_ROM(0x15b3, 0x6278, "MT25208", "MT25208 HCA driver"), }; -static struct pci_driver tavor_driver __pci_driver = { +struct pci_driver tavor_driver __pci_driver = { .type = NIC_DRIVER, .name = "MT23108/MT25208", .probe = tavor_probe, diff --git a/src/drivers/net/mlx_ipoib/mt25218.c b/src/drivers/net/mlx_ipoib/mt25218.c index 38b32dc5..22c8480f 100644 --- a/src/drivers/net/mlx_ipoib/mt25218.c +++ b/src/drivers/net/mlx_ipoib/mt25218.c @@ -235,7 +235,7 @@ static struct pci_id mt25218_nics[] = { PCI_ROM(0x15b3, 0x6274, "MT25204", "MT25204 HCA driver"), }; -static struct pci_driver mt25218_driver __pci_driver = { +struct pci_driver mt25218_driver __pci_driver = { .type = NIC_DRIVER, .name = "MT25218", .probe = mt25218_probe, diff --git a/src/drivers/net/ns8390.c b/src/drivers/net/ns8390.c index 134e52ab..9c091216 100644 --- a/src/drivers/net/ns8390.c +++ b/src/drivers/net/ns8390.c @@ -961,7 +961,7 @@ static struct nic_operations ns8390_operations = { } #ifdef INCLUDE_WD -static struct isa_driver wd_driver __isa_driver = { +struct isa_driver wd_driver __isa_driver = { .type = NIC_DRIVER, .name = "WD", .probe = wd_probe, @@ -971,7 +971,7 @@ ISA_ROM("wd","WD8003/8013, SMC8216/8416, SMC 83c790 (EtherEZ)"); #endif #ifdef INCLUDE_3C503 -static struct isa_driver t503_driver __isa_driver = { +struct isa_driver t503_driver __isa_driver = { .type = NIC_DRIVER, .name = "3C503", .probe = t503_probe, @@ -981,7 +981,7 @@ ISA_ROM("3c503","3Com503, Etherlink II[/16]"); #endif #ifdef INCLUDE_NE -static struct isa_driver ne_driver __isa_driver = { +struct isa_driver ne_driver __isa_driver = { .type = NIC_DRIVER, .name = "NE*000", .probe = ne_probe, diff --git a/src/include/gpxe/tables.h b/src/include/gpxe/tables.h index a565eba7..1fdbbfd7 100644 --- a/src/include/gpxe/tables.h +++ b/src/include/gpxe/tables.h @@ -131,7 +131,7 @@ * ... * } * - * static struct frob my_frobnicator __frobnicator = { + * struct frob my_frobnicator __frobnicator = { * .name = "my_frob", * .frob = my_frob, * }; @@ -184,7 +184,7 @@ * * @code * - * static struct my_foo __table ( foo, 01 ) = { + * struct my_foo __table ( foo, 01 ) = { * ... * }; * diff --git a/src/include/init.h b/src/include/init.h index 71311bfb..3708d923 100644 --- a/src/include/init.h +++ b/src/include/init.h @@ -49,12 +49,12 @@ struct init_fn { #define INIT_RPC 11 /* Macro for creating an initialisation function table entry */ -#define INIT_FN( init_order, init_func, reset_func, exit_func ) \ - static struct init_fn PREFIX_OBJECT(init_fn__) \ - __table ( init_fn, init_order ) = { \ - .init = init_func, \ - .reset = reset_func, \ - .exit = exit_func, \ +#define INIT_FN( init_order, init_func, reset_func, exit_func ) \ + struct init_fn PREFIX_OBJECT(init_fn__) \ + __table ( init_fn, init_order ) = { \ + .init = init_func, \ + .reset = reset_func, \ + .exit = exit_func, \ }; /* Function prototypes */ diff --git a/src/include/isa.h b/src/include/isa.h index 9e1dcadf..eacbb8ef 100644 --- a/src/include/isa.h +++ b/src/include/isa.h @@ -54,7 +54,7 @@ struct isa_driver { * */ #define ISA_DRIVER( _name, _probe_addrs, _probe_addr, _mfg_id, _prod_id ) \ -static struct isa_driver _name __table(isa_driver,01 ) = { \ +struct isa_driver _name __table(isa_driver,01 ) = { \ .probe_addrs = _probe_addrs, \ .addr_count = sizeof ( _probe_addrs ) / sizeof ( _probe_addrs[0] ), \ .probe_addr = _probe_addr, \ diff --git a/src/interface/pxe/pxe_errors.c b/src/interface/pxe/pxe_errors.c index 581393e8..dce50d77 100644 --- a/src/interface/pxe/pxe_errors.c +++ b/src/interface/pxe/pxe_errors.c @@ -13,7 +13,7 @@ * followed by a little manual tweaking. * */ -static struct errortab pxe_errortab[] __errortab = { +struct errortab pxe_errortab[] __errortab = { { PXENV_STATUS_SUCCESS, "Success" }, { PXENV_STATUS_FAILURE, "Failure" }, { PXENV_STATUS_BAD_FUNC, "Bad function" }, diff --git a/src/proto/dns.c b/src/proto/dns.c index d74b29a9..60ea04a3 100644 --- a/src/proto/dns.c +++ b/src/proto/dns.c @@ -355,7 +355,7 @@ static int dns_resolv ( struct in_addr *addr, const char *name ) { } } -static struct resolver dns_resolver __resolver = { +struct resolver dns_resolver __resolver = { .name = "DNS", .resolv = dns_resolv, }; diff --git a/src/proto/http.c b/src/proto/http.c index 3264f2ad..07a16921 100644 --- a/src/proto/http.c +++ b/src/proto/http.c @@ -166,7 +166,7 @@ static int http ( char *url, struct sockaddr_in *server __unused, return 1; } -static struct protocol http_protocol __protocol = { +struct protocol http_protocol __protocol = { .name = "http", .default_port = 80, .load = http, diff --git a/src/proto/igmp.c b/src/proto/igmp.c index aad530f7..4d4df900 100644 --- a/src/proto/igmp.c +++ b/src/proto/igmp.c @@ -112,7 +112,7 @@ static void process_igmp ( unsigned long now, unsigned short ptype __unused, } } -static struct background igmp_background __background = { +struct background igmp_background __background = { .send = send_igmp_reports, .process = process_igmp, }; diff --git a/src/proto/nfs.c b/src/proto/nfs.c index 828aa871..ebcca737 100644 --- a/src/proto/nfs.c +++ b/src/proto/nfs.c @@ -610,7 +610,7 @@ nfssymlink: INIT_FN ( INIT_RPC, rpc_init, nfs_reset, nfs_reset ); -static struct protocol nfs_protocol __protocol = { +struct protocol nfs_protocol __protocol = { .name = "nfs", .default_port = SUNRPC_PORT, .load = nfs, diff --git a/src/proto/nmb.c b/src/proto/nmb.c index ee805b17..d2944031 100644 --- a/src/proto/nmb.c +++ b/src/proto/nmb.c @@ -100,7 +100,7 @@ static int nmb_resolv ( struct in_addr *addr, const char *name ) { return 1; } -static struct resolver nmb_resolver __resolver = { +struct resolver nmb_resolver __resolver = { .name = "NMB", .resolv = nmb_resolv, }; diff --git a/src/proto/slam.c b/src/proto/slam.c index 50745aec..c55bf307 100644 --- a/src/proto/slam.c +++ b/src/proto/slam.c @@ -534,7 +534,7 @@ static int url_slam ( char *url __unused, struct sockaddr_in *server, return proto_slam(&info); } -static struct protocol slam_protocol __protocol = { +struct protocol slam_protocol __protocol = { .name = "x-slam", .default_port = SLAM_PORT, .load = url_slam,