From 54aef8e02d798f55700af4cd97974183a694e769 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 11 Aug 2011 11:10:35 +0100 Subject: [PATCH] Instead of using DBUS_INLINE, define "inline" to have its C99 meaning In commit b0b5f9b, Ralf added a workaround for compilers that don't understand the C99 inline keyword, but in fact this was never necessary for the Autoconf build system, because we use AC_C_INLINE. That macro causes config.h to #define "inline" to "__inline" or "__inline__" if the compiler understands one of those but not "inline", or to the empty string as a last resort (resulting in "static inline" functions becoming merely "static"), which means we can use "static inline" functions uniformly on any compiler. If CMake can't do that check, the next best thing is to check for MSVC++ specifically, resulting in: * Autoconf build system works with any C compiler * CMake build system works with MSVC++, or with any compiler that understands the inline keyword (in practice everyone is probably using MSVC++ or gcc) --- bus/bus.c | 7 +------ cmake/config.h.cmake | 4 +--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/bus/bus.c b/bus/bus.c index f805e3f..6b0dc08 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -1320,12 +1320,7 @@ out: va_end (args); } -/* TODO: move to autotools generated config.h like done in cmake */ -#ifndef DBUS_INLINE -#define DBUS_INLINE inline -#endif - -static DBUS_INLINE const char * +static inline const char * nonnull (const char *maybe_null, const char *if_null) { diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index aa2343c..0a1e9e4 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -254,9 +254,7 @@ #endif #ifdef _MSC_VER -#define DBUS_INLINE __inline -#else -#define DBUS_INLINE inline +#define inline __inline #endif #endif // _DBUS_CONFIG_H -- 1.7.5.4