Skip to content

Commit

Permalink
gcc is rather over-aggressive about optimising out static data struct…
Browse files Browse the repository at this point in the history
…ures

even when __atribute__ (( unused )) is correctly set...
  • Loading branch information
Michael Brown committed Apr 24, 2006
1 parent 4c4e4de commit 832e862
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/arch/i386/core/video_subr.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion src/arch/i386/firmware/pcbios/bios_console.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/arch/i386/image/nbi.c
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/arch/i386/include/relocate.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/btext.c
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/pc_kbd.c
Expand Up @@ -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,
};
4 changes: 2 additions & 2 deletions src/core/serial.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/net/3c509.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/mlx_ipoib/mt23108.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/mlx_ipoib/mt25218.c
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/net/ns8390.c
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/include/gpxe/tables.h
Expand Up @@ -131,7 +131,7 @@
* ...
* }
*
* static struct frob my_frobnicator __frobnicator = {
* struct frob my_frobnicator __frobnicator = {
* .name = "my_frob",
* .frob = my_frob,
* };
Expand Down Expand Up @@ -184,7 +184,7 @@
*
* @code
*
* static struct my_foo __table ( foo, 01 ) = {
* struct my_foo __table ( foo, 01 ) = {
* ...
* };
*
Expand Down
12 changes: 6 additions & 6 deletions src/include/init.h
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/include/isa.h
Expand Up @@ -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, \
Expand Down
2 changes: 1 addition & 1 deletion src/interface/pxe/pxe_errors.c
Expand Up @@ -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" },
Expand Down
2 changes: 1 addition & 1 deletion src/proto/dns.c
Expand Up @@ -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,
};
2 changes: 1 addition & 1 deletion src/proto/http.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/proto/igmp.c
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion src/proto/nfs.c
Expand Up @@ -610,7 +610,7 @@ static int nfs ( char *url __unused, struct sockaddr_in *server,

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,
Expand Down
2 changes: 1 addition & 1 deletion src/proto/nmb.c
Expand Up @@ -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,
};
2 changes: 1 addition & 1 deletion src/proto/slam.c
Expand Up @@ -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,
Expand Down

0 comments on commit 832e862

Please sign in to comment.