Index: configure =================================================================== --- configure (revision 116768) +++ configure (working copy) @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 115341 . +# From configure.ac Revision: 115579 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.4. # @@ -14891,7 +14891,73 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking for inlining variadic functions" >&5 +echo $ECHO_N "checking for inlining variadic functions... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +static int foo(int fd, ...); +static inline int foo(int fd, ...) +{ + int res; int foo; int bar; + va_list ap; + va_start(ap, fd); + foo = va_arg(ap, int); + bar = va_arg(ap, int); + res = foo + bar; + va_end(ap); + return res; +} +int +main () +{ +return foo(0, 0, 0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +cat >>confdefs.h <<\_ACEOF +#define HAVE_INLINED_VARIADIC_FUNCTIONS 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for compiler 'attribute pure' support" >&5 echo $ECHO_N "checking for compiler 'attribute pure' support... $ECHO_C" >&6; } saved_CFLAGS="$CFLAGS" Index: configure.ac =================================================================== --- configure.ac (revision 116768) +++ configure.ac (working copy) @@ -313,6 +313,26 @@ AC_MSG_RESULT(no) ) +AC_MSG_CHECKING(for inlining variadic functions) +AC_LINK_IFELSE( + AC_LANG_PROGRAM([#include +static int foo(int fd, ...); +static inline int foo(int fd, ...) +{ + int res; int foo; int bar; + va_list ap; + va_start(ap, fd); + foo = va_arg(ap, int); + bar = va_arg(ap, int); + res = foo + bar; + va_end(ap); + return res; +}], [return foo(0, 0, 0)]), + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_INLINED_VARIADIC_FUNCTIONS], 1, [Define to 1 if your system allows inlining variadic functions.]), + AC_MSG_RESULT(no) +) + AST_GCC_ATTRIBUTE(pure) AST_GCC_ATTRIBUTE(malloc) AST_GCC_ATTRIBUTE(const) Index: include/asterisk/utils.h =================================================================== --- include/asterisk/utils.h (revision 116768) +++ include/asterisk/utils.h (working copy) @@ -473,7 +473,7 @@ #define ast_asprintf(ret, fmt, ...) \ _ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__) -AST_INLINE_API( +AST_INLINE_VARAPI( int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...), { int res; Index: include/asterisk/autoconfig.h.in =================================================================== --- include/asterisk/autoconfig.h.in (revision 116768) +++ include/asterisk/autoconfig.h.in (working copy) @@ -169,6 +169,9 @@ /* Define to 1 if you have the `inet_ntoa' function. */ #undef HAVE_INET_NTOA +/* Define to 1 if your system allows inlining variadic functions. */ +#undef HAVE_INLINED_VARIADIC_FUNCTIONS + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H Index: include/asterisk/inline_api.h =================================================================== --- include/asterisk/inline_api.h (revision 116768) +++ include/asterisk/inline_api.h (working copy) @@ -47,7 +47,7 @@ #if !defined(AST_API_MODULE) #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body -#else +#else #define AST_INLINE_API(hdr, body) hdr; hdr body #endif @@ -61,6 +61,15 @@ #endif +/* Some compilers support inlining variadic functions */ +#if (defined(HAVE_INLINED_VARIADIC_FUNCTIONS) && !defined(LOW_MEMORY) && !defined(AST_API_MODULE)) +#define AST_INLINE_VARAPI(hdr, body) hdr; extern inline hdr body +#elif ((!defined(HAVE_INLINED_VARIADIC_FUNCTIONS) || defined(LOW_MEMORY)) && !defined(AST_API_MODULE)) +#define AST_INLINE_VARAPI(hdr, body) hdr; +#else +#define AST_INLINE_VARAPI(hdr, body) hdr; hdr body +#endif + #undef AST_API_MODULE #endif /* __ASTERISK_INLINEAPI_H */