compiler.h: Check if __aligned and __section macros are already defined

Don't define these macros if they are already - doing so causes
compiler warnings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-06-08 19:20:03 -04:00
parent 4dd3478fc1
commit 220a1e4197
1 changed files with 4 additions and 0 deletions

View File

@ -15,8 +15,12 @@
#define __noreturn __attribute__((noreturn)) #define __noreturn __attribute__((noreturn))
#define PACKED __attribute__((packed)) #define PACKED __attribute__((packed))
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x))) #define __aligned(x) __attribute__((aligned(x)))
#endif
#ifndef __section
#define __section(S) __attribute__((section(S))) #define __section(S) __attribute__((section(S)))
#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)