diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 7f73cbd83..6b14929b1 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -917,22 +917,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define FTE_ALIGN(a) #endif +//fte_inline must only be used in headers, and requires one and ONLY one fte_inlinebody elsewhere. +//fte_inlinebody must be used on a prototype OUTSIDE of a header. +//fte_inlinestatic must not be used inside any headers at all. #if __STDC_VERSION__ >= 199901L //C99 specifies that an inline function is used as a hint. there should be an actual body/copy somewhere (extern inline foo). #define fte_inline inline //must have non-line 'int foo();' somewhere #define fte_inlinebody extern inline + #define fte_inlinestatic static inline #elif defined(_MSC_VER) //msvc will inline like C++. and that's fine. #define fte_inline __inline //c++ style #define fte_inlinebody + #define fte_inlinestatic static __inline #elif (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) //gcc will generally inline where it can - so long as its static. but that doesn't stop it warning #define fte_inline __attribute__((unused)) static #define fte_inlinebody static + #define fte_inlinestatic static #else //make it static so we at least don't get errors (might still get warnings. see above) #define fte_inline static #define fte_inlinebody static + #define fte_inlinestatic static #endif diff --git a/engine/common/cmd.c b/engine/common/cmd.c index f6fb7deb0..653c3b22d 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -2195,7 +2195,7 @@ struct cmdargcompletion_ctx_s cmd_completion_t *res; const char *desc; }; -static fte_inline int Q_tolower(char c) +fte_inlinestatic int Q_tolower(char c) { if (c >= 'a' && c <= 'z') c -= ('a' - 'A'); diff --git a/engine/common/common.c b/engine/common/common.c index 566a7ee76..998db3887 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -480,7 +480,7 @@ char *Q_strlwr(char *s) return ret; } -static char fte_inline Q_tolower(char c) +fte_inlinestatic char Q_tolower(char c) { if (c >= 'A' && c <= 'Z') return c-'A'+'a';