david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Use __unused instead of __used for static data structures.

Remove compiler.h defines from osdep.h
This commit is contained in:
Michael Brown 2005-05-17 12:16:28 +00:00
parent 301b2d40f0
commit 3bbf5f28a3
7 changed files with 24 additions and 18 deletions

View File

@ -17,7 +17,7 @@ struct post_reloc_fn {
/* 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__) \
__attribute__ (( used, __table_section(post_reloc_fn,order) )) = {\
__table ( post_reloc_fn, order ) = { \
.post_reloc = post_reloc_func, \
};

View File

@ -84,9 +84,18 @@ __asm__ ( ".equ\tDEBUG_LEVEL, " DEBUG_SYMBOL_STR );
} while (0)
#endif
#define PACKED __attribute__((packed))
#define __unused __attribute__((unused))
#define __used __attribute__((used))
/*
* Commonly-used attributes.
*
* Note that __used can be used only for functions. If you have a
* static variable declaration that you want to force to be included,
* use __unused.
*
*/
#define PACKED __attribute__ (( packed ))
#define __unused __attribute__ (( unused ))
#define __used __attribute__ (( used ))
#define __aligned __attribute__ (( aligned ( 16 ) ))
/*
* To save space in the binary when multiple-driver images are

View File

@ -18,8 +18,7 @@ struct console_driver {
int ( *iskey ) ( void );
};
#define __console_driver \
__attribute__ (( used, __table_section ( console, 01 ) ))
#define __console_driver __table ( console, 01 )
/* Function prototypes */

View File

@ -160,7 +160,7 @@ struct bus_driver {
const char * ( *name_device ) ( struct bus_dev *bus_dev );
};
#define __bus_driver __attribute__ (( used, __table_section(bus_driver,01) ))
#define __bus_driver __table ( bus_driver, 01 )
/*
* A structure fully describing the bus-independent parts of a
@ -186,7 +186,7 @@ struct type_driver {
int ( * load ) ( struct type_dev *type_dev, struct buffer *buffer );
};
#define __type_driver __attribute__ (( used, __table_section(type_driver,01) ))
#define __type_driver __table ( type_driver, 01 )
/*
* A driver for a device.
@ -203,8 +203,7 @@ struct device_driver {
struct bus_dev *bus_dev );
};
#define __device_driver \
__attribute__ (( used, __table_section(device_driver,01) ))
#define __device_driver __table ( device_driver, 01 )
#define DRIVER(_name,_type_driver,_bus_driver,_bus_info, \
_probe,_disable) \

View File

@ -51,7 +51,7 @@ struct init_fn {
/* 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__) \
__attribute__ (( used, __table_section(init_fn,init_order) )) = { \
__table ( init_fn, init_order ) = { \
.init = init_func, \
.reset = reset_func, \
.exit = exit_func, \

View File

@ -1,10 +1,6 @@
#ifndef ETHERBOOT_OSDEP_H
#define ETHERBOOT_OSDEP_H
#define __unused __attribute__((unused))
#define __aligned __attribute__((aligned(16)))
#define PACKED __attribute__((packed))
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")

View File

@ -49,8 +49,11 @@
#define __table_section_start(table) __table_section(table,00)
#define __table_section_end(table) __table_section(table,99)
#define __table(table,idx) __attribute__ (( __table_section(table,idx) ))
#define __table_start(table) __attribute__ (( __table_section_start(table) ))
#define __table_end(table) __attribute__ (( __table_section_end(table) ))
#define __table(table,idx) \
__attribute__ (( unused, __table_section(table,idx) ))
#define __table_start(table) \
__attribute__ (( unused, __table_section_start(table) ))
#define __table_end(table) \
__attribute__ (( unused, __table_section_end(table) ))
#endif /* TABLES_H */