mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-01-04 07:53:34 +01:00
35 lines
1.3 KiB
C
35 lines
1.3 KiB
C
//---
|
|
// gint:defs:attributes - Macros for compiler-specific attributes
|
|
//---
|
|
|
|
#ifndef GINT_DEFS_ATTRIBUTES
|
|
#define GINT_DEFS_ATTRIBUTES
|
|
|
|
/* Generic attribute element */
|
|
#define ATTR(...) __attribute__((__VA_ARGS__))
|
|
|
|
/* Objects from specific sections */
|
|
#define SECTION(x) __attribute__((section(x)))
|
|
/* Objects from the .gint.data and .gint.bss sections */
|
|
#define GDATA __attribute__((section(".gint.data")))
|
|
#define GBSS __attribute__((section(".gint.bss")))
|
|
/* Initialization functions */
|
|
#define PRETEXT __attribute__((section(".pretext")))
|
|
|
|
/* Unused parameters or variables */
|
|
#define UNUSED __attribute__((unused))
|
|
/* Functions that *must* be inlined */
|
|
#define INLINE __attribute__((always_inline)) inline
|
|
/* Short static functions defined in header files */
|
|
#define HDRFUNC __attribute__((always_inline)) static inline
|
|
|
|
/* Constructors and destructors */
|
|
#define CTOR(x) __attribute__((constructor ((x) + 101))) PRETEXT
|
|
#define DTOR(x) __attribute__((destructor ((x) + 101)))
|
|
|
|
/* Packed structures. I require explicit alignment because if it's unspecified,
|
|
GCC cannot optimize access size, and reads to memory-mapped I/O with invalid
|
|
access sizes silently fail - honestly you don't want this to happen */
|
|
#define PACKED(x) __attribute__((packed, aligned(x)))
|
|
|
|
#endif /* GINT_DEFS_ATTRIBUTES */
|