From 1282f420a181dfe12b3a7655cf29766018bd4bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Mon, 23 Jun 2014 02:24:27 +0200 Subject: [PATCH] Get rid of clang warnings for UC_INLINE --- include/ucore/mbuf.h | 10 ++++++++-- include/ucore/pack.h | 11 +++++++++-- include/ucore/tailq.h | 10 ++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/include/ucore/mbuf.h b/include/ucore/mbuf.h index 73dc17e..3972798 100644 --- a/include/ucore/mbuf.h +++ b/include/ucore/mbuf.h @@ -4,10 +4,16 @@ #include #include "tailq.h" +#ifndef UC_INLINE #ifdef __GNUC__ -# define UC_INLINE inline __attribute__((always_inline)) +# ifdef __clang__ +# define UC_INLINE inline __attribute__((always_inline)) +# else +# define UC_INLINE inline __attribute__((always_inline,flatten)) +# endif #else -# define UC_INLINE inline +# define UC_INLINE inline +#endif #endif enum UC_MBUF_FLAGS { diff --git a/include/ucore/pack.h b/include/ucore/pack.h index 658ed44..9160e01 100644 --- a/include/ucore/pack.h +++ b/include/ucore/pack.h @@ -2,10 +2,17 @@ #define UC_PACK_H_ #include + +#ifndef UC_INLINE #ifdef __GNUC__ -# define UC_INLINE inline __attribute__((always_inline)) +# ifdef __clang__ +# define UC_INLINE inline __attribute__((always_inline)) +# else +# define UC_INLINE inline __attribute__((always_inline,flatten)) +# endif #else -# define UC_INLINE inline +# define UC_INLINE inline +#endif #endif /** Functions for serializing/de-serializing integers to and from diff --git a/include/ucore/tailq.h b/include/ucore/tailq.h index 010fb8a..a4ebd6f 100644 --- a/include/ucore/tailq.h +++ b/include/ucore/tailq.h @@ -1,10 +1,16 @@ #ifndef UC_TAILQ_H_ #define UC_TAILQ_H_ +#ifndef UC_INLINE #ifdef __GNUC__ -#define UC_INLINE inline __attribute__((always_inline,flatten)) +# ifdef __clang__ +# define UC_INLINE inline __attribute__((always_inline)) +# else +# define UC_INLINE inline __attribute__((always_inline,flatten)) +# endif #else -#define UC_INLINE inline +# define UC_INLINE inline +#endif #endif /** * Doubly Linked List.