diff options
-rw-r--r-- | src/arch/i386/include/relocate.h | 2 | ||||
-rw-r--r-- | src/include/compiler.h | 15 | ||||
-rw-r--r-- | src/include/console.h | 3 | ||||
-rw-r--r-- | src/include/dev.h | 7 | ||||
-rw-r--r-- | src/include/init.h | 2 | ||||
-rw-r--r-- | src/include/osdep.h | 4 | ||||
-rw-r--r-- | src/include/tables.h | 9 |
7 files changed, 24 insertions, 18 deletions
diff --git a/src/arch/i386/include/relocate.h b/src/arch/i386/include/relocate.h index fdc807f02..5e482bd61 100644 --- a/src/arch/i386/include/relocate.h +++ b/src/arch/i386/include/relocate.h @@ -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, \ }; diff --git a/src/include/compiler.h b/src/include/compiler.h index 4912b4242..4a7c48a1c 100644 --- a/src/include/compiler.h +++ b/src/include/compiler.h @@ -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 diff --git a/src/include/console.h b/src/include/console.h index 146fd9c3e..1decb9c3b 100644 --- a/src/include/console.h +++ b/src/include/console.h @@ -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 */ diff --git a/src/include/dev.h b/src/include/dev.h index 0d0d4d8ef..d6e31dabb 100644 --- a/src/include/dev.h +++ b/src/include/dev.h @@ -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) \ diff --git a/src/include/init.h b/src/include/init.h index e28a4349c..0b341b8dc 100644 --- a/src/include/init.h +++ b/src/include/init.h @@ -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, \ diff --git a/src/include/osdep.h b/src/include/osdep.h index 121eacae3..262c2d96d 100644 --- a/src/include/osdep.h +++ b/src/include/osdep.h @@ -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") diff --git a/src/include/tables.h b/src/include/tables.h index 48514464e..26ad61db7 100644 --- a/src/include/tables.h +++ b/src/include/tables.h @@ -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 */ |