git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5243 fc73d0e0-1445-4013-8a0c-d673dee63da5

This commit is contained in:
Spoike 2018-04-15 14:31:44 +00:00
parent e1e3336eaa
commit 08ca60d1bf
3 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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');

View File

@ -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';